summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2016-04-25 10:19:46 +0200
committerBjörn Schießle <schiessle@owncloud.com>2016-04-25 10:19:46 +0200
commit74de72e75e68cb3aaffa2ab90fbd685e755b4262 (patch)
tree5d16bff52fb8e5f286d52e000382ba3949e9ebbd /apps/files_sharing
parenta4b1d9feee79218268abcb0c20ed16bec82c993c (diff)
parente10105474fbef8940fdfa96d5e2bf2f09b1f0649 (diff)
downloadnextcloud-server-74de72e75e68cb3aaffa2ab90fbd685e755b4262.tar.gz
nextcloud-server-74de72e75e68cb3aaffa2ab90fbd685e755b4262.zip
Merge pull request #24073 from owncloud/move_federated_sharing_settings_to_app
move federated sharing settings to the federatedfilesharing app
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/ajax/external.php5
-rw-r--r--apps/files_sharing/ajax/shareinfo.php5
-rw-r--r--apps/files_sharing/api/server2server.php18
-rw-r--r--apps/files_sharing/appinfo/app.php3
-rw-r--r--apps/files_sharing/appinfo/application.php4
-rw-r--r--apps/files_sharing/css/3rdparty/gs-share/style.css49
-rw-r--r--apps/files_sharing/css/settings-personal.css33
-rw-r--r--apps/files_sharing/img/social-diaspora.svg52
-rw-r--r--apps/files_sharing/img/social-facebook.svg43
-rw-r--r--apps/files_sharing/img/social-gnu.svg79
-rw-r--r--apps/files_sharing/img/social-googleplus.svg45
-rw-r--r--apps/files_sharing/img/social-twitter.svg53
-rw-r--r--apps/files_sharing/js/3rdparty/gs-share/gs-share.js206
-rw-r--r--apps/files_sharing/js/settings-admin.js12
-rw-r--r--apps/files_sharing/js/settings-personal.js19
-rw-r--r--apps/files_sharing/lib/controllers/sharecontroller.php10
-rw-r--r--apps/files_sharing/lib/helper.php20
-rw-r--r--apps/files_sharing/lib/share/file.php16
-rw-r--r--apps/files_sharing/settings-admin.php31
-rw-r--r--apps/files_sharing/settings-personal.php47
-rw-r--r--apps/files_sharing/templates/settings-admin.php26
-rw-r--r--apps/files_sharing/templates/settings-personal.php78
-rw-r--r--apps/files_sharing/tests/controller/sharecontroller.php12
-rw-r--r--apps/files_sharing/tests/server2server.php11
24 files changed, 71 insertions, 806 deletions
diff --git a/apps/files_sharing/ajax/external.php b/apps/files_sharing/ajax/external.php
index 76f9d5d7668..78e648618be 100644
--- a/apps/files_sharing/ajax/external.php
+++ b/apps/files_sharing/ajax/external.php
@@ -31,8 +31,11 @@ OCP\JSON::checkAppEnabled('files_sharing');
$l = \OC::$server->getL10N('files_sharing');
+$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
+$federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
+
// check if server admin allows to mount public links from other servers
-if (OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled() === false) {
+if ($federatedShareProvider->isIncomingServer2serverShareEnabled() === false) {
\OCP\JSON::error(array('data' => array('message' => $l->t('Server to server sharing is not enabled on this server'))));
exit();
}
diff --git a/apps/files_sharing/ajax/shareinfo.php b/apps/files_sharing/ajax/shareinfo.php
index 47bc061c136..d7f756b0039 100644
--- a/apps/files_sharing/ajax/shareinfo.php
+++ b/apps/files_sharing/ajax/shareinfo.php
@@ -29,7 +29,10 @@ if (!isset($_GET['t'])) {
exit;
}
-if (OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled() === false) {
+$federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
+$federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
+
+if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false) {
\OC_Response::setStatus(404); // 404 not found
exit;
}
diff --git a/apps/files_sharing/api/server2server.php b/apps/files_sharing/api/server2server.php
index 11b24d9148b..034ec5105e4 100644
--- a/apps/files_sharing/api/server2server.php
+++ b/apps/files_sharing/api/server2server.php
@@ -26,11 +26,25 @@
namespace OCA\Files_Sharing\API;
use OCA\FederatedFileSharing\DiscoveryManager;
+use OCA\FederatedFileSharing\FederatedShareProvider;
use OCA\Files_Sharing\Activity;
use OCP\Files\NotFoundException;
class Server2Server {
+ /** @var FederatedShareProvider */
+ private $federatedShareProvider;
+
+
+ /**
+ * Server2Server constructor.
+ *
+ * @param FederatedShareProvider $federatedShareProvider
+ */
+ public function __construct(FederatedShareProvider $federatedShareProvider) {
+ $this->federatedShareProvider = $federatedShareProvider;
+ }
+
/**
* create a new share
*
@@ -300,9 +314,9 @@ class Server2Server {
$result = \OCP\App::isEnabled('files_sharing');
if ($incoming) {
- $result = $result && \OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled();
+ $result = $result && $this->federatedShareProvider->isIncomingServer2serverShareEnabled();
} else {
- $result = $result && \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled();
+ $result = $result && $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
}
return $result;
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 29202c15b22..e0cbfd7f5ba 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -44,9 +44,6 @@ $l = \OC::$server->getL10N('files_sharing');
$application = new Application();
$application->registerMountProviders();
-\OCP\App::registerAdmin('files_sharing', 'settings-admin');
-\OCP\App::registerPersonal('files_sharing', 'settings-personal');
-
\OCA\Files_Sharing\Helper::registerHooks();
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
diff --git a/apps/files_sharing/appinfo/application.php b/apps/files_sharing/appinfo/application.php
index 5233b343830..b17e213e2e2 100644
--- a/apps/files_sharing/appinfo/application.php
+++ b/apps/files_sharing/appinfo/application.php
@@ -45,6 +45,7 @@ class Application extends App {
* Controllers
*/
$container->registerService('ShareController', function (SimpleContainer $c) use ($server) {
+ $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
return new ShareController(
$c->query('AppName'),
$c->query('Request'),
@@ -56,7 +57,8 @@ class Application extends App {
$server->getShareManager(),
$server->getSession(),
$server->getPreviewManager(),
- $server->getRootFolder()
+ $server->getRootFolder(),
+ $federatedSharingApp->getFederatedShareProvider()
);
});
$container->registerService('ExternalSharesController', function (SimpleContainer $c) {
diff --git a/apps/files_sharing/css/3rdparty/gs-share/style.css b/apps/files_sharing/css/3rdparty/gs-share/style.css
deleted file mode 100644
index c699ddb3db5..00000000000
--- a/apps/files_sharing/css/3rdparty/gs-share/style.css
+++ /dev/null
@@ -1,49 +0,0 @@
-.js-gs-share, .gs-share [aria-hidden="true"], .gs-share-form[aria-hidden="true"] {
- display: none;
-}
-
-.js-gs-share-enabled .js-gs-share {
- display: inline;
- float: left;
-}
-
-.gs-share .js-gs-share[href] {
- display: inline;
-}
-
-.gs-share [aria-hidden="false"], .gs-share-form[aria-hidden="false"] {
- display: block;
- margin-top: 40px;
-}
-
-.gs-share {
- position: relative;
-}
-
-.gs-share-form {
- background: #FFF;
- border: 1px solid #000;
- border-radius: 5px;
- padding: 5px;
- position: absolute;
- z-index: 1;
-}
-
-.gs-share [for="gs-account"], .gs-share [type="text"] {
- display: block;
- margin-bottom: 8px;
-}
-
-.gs-share [type="submit"] {
- display: block;
- margin-top: 8px;
-}
-
-.gs-share--icon {
- border: none;
- cursor: pointer;
- min-height: 32px;
- padding: 0;
- padding-left: 33px;
- background: transparent url('../../../img/gs-share.png') no-repeat left center;
-}
diff --git a/apps/files_sharing/css/settings-personal.css b/apps/files_sharing/css/settings-personal.css
deleted file mode 100644
index f53365c9371..00000000000
--- a/apps/files_sharing/css/settings-personal.css
+++ /dev/null
@@ -1,33 +0,0 @@
-#fileSharingSettings img {
- cursor: pointer;
-}
-
-#fileSharingSettings xmp {
- margin-top: 0;
- white-space: pre-wrap;
-}
-
-[class^="social-"], [class*=" social-"] {
- background-repeat: no-repeat;
- background-position: 2px;
- min-width: 16px;
- min-height: 16px;
- padding-left: 29px;
- background-size: 24px;
-}
-
-.social-gnu {
- background-image: url('../img/social-gnu.svg');
-}
-.social-diaspora {
- background-image: url('../img/social-diaspora.svg');
-}
-.social-twitter {
- background-image: url('../img/social-twitter.svg');
-}
-.social-facebook {
- background-image: url('../img/social-facebook.svg');
-}
-.social-googleplus {
- background-image: url('../img/social-googleplus.svg');
-}
diff --git a/apps/files_sharing/img/social-diaspora.svg b/apps/files_sharing/img/social-diaspora.svg
deleted file mode 100644
index 1d5131129a9..00000000000
--- a/apps/files_sharing/img/social-diaspora.svg
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- version="1.1"
- width="32"
- height="32"
- id="svg3937"
- inkscape:version="0.91 r13725"
- sodipodi:docname="social-diaspora.svg">
- <metadata
- id="metadata4166">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs4164" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="640"
- inkscape:window-height="480"
- id="namedview4162"
- showgrid="false"
- inkscape:zoom="13.549078"
- inkscape:cx="-5.9149036"
- inkscape:cy="9.8488708"
- inkscape:current-layer="svg3937" />
- <path
- d="m 15.956724,31 c -0.896548,4.3e-5 -1.344812,-0.448233 -1.344812,-1.344828 L 14.715361,19 5.612032,24.689655 C 4.9223812,25.172463 4.336189,25.034532 3.8534355,24.275862 L 3.3362024,23.448276 C 2.8534488,22.758671 2.991377,22.172465 3.7499869,21.689655 L 13.163651,16 3.6465383,10.310345 C 2.9568974,9.8966152 2.8189693,9.3104089 3.2327538,8.551724 L 3.8534355,7.517241 C 4.1982609,6.965584 4.7499735,6.896618 5.5085834,7.310345 L 14.715361,13 14.611912,2.344828 c 0,-0.89648 0.448264,-1.344756 1.344812,-1.344828 l 0.827569,0 c 0.896538,7.2e-5 1.344812,0.448348 1.344812,1.344828 L 18.025656,13 27.128985,7.206897 c 0.620651,-0.344761 1.206854,-0.206831 1.758596,0.413793 l 0.517233,0.827586 c 0.344796,0.7586846 0.206898,1.344891 -0.413784,1.758621 L 19.473917,16 l 9.620561,5.793103 c 0.689611,0.413845 0.827549,0.965568 0.413785,1.655173 L 28.99103,24.37931 c -0.482784,0.75867 -1.103465,0.896601 -1.862045,0.413793 L 18.025656,19 18.129105,29.655172 c 0,0.896595 -0.448274,1.344871 -1.344812,1.344828 l -0.827569,0"
- id="star"
- style="opacity:0.5;fill:#000000;fill-opacity:1"
- inkscape:connector-curvature="0" />
-</svg>
diff --git a/apps/files_sharing/img/social-facebook.svg b/apps/files_sharing/img/social-facebook.svg
deleted file mode 100644
index aad02bc3853..00000000000
--- a/apps/files_sharing/img/social-facebook.svg
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- enable-background="new 0 0 56.693 56.693"
- height="32"
- id="Layer_1"
- version="1.1"
- viewBox="0 0 32 32"
- width="32"
- xml:space="preserve"
- inkscape:version="0.91 r13725"
- sodipodi:docname="social-facebook.svg"><metadata
- id="metadata5818"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
- id="defs5816" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="640"
- inkscape:window-height="480"
- id="namedview5814"
- showgrid="false"
- inkscape:zoom="11.271233"
- inkscape:cx="5.0995367"
- inkscape:cy="28.322502"
- inkscape:current-layer="Layer_1" /><path
- d="m 22.396887,16.008872 -4.203409,0 0,14.991128 -6.230193,0 0,-14.991128 -2.963285,0 0,-5.292784 2.963285,0 0,-3.429613 C 11.963285,4.831822 13.128489,1 18.251639,1 l 4.613498,0.01774 0,5.140971 -3.349714,0 c -0.547114,0 -1.320959,0.273067 -1.320959,1.44026 l 0,3.118099 4.749536,0 z"
- id="path5812"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccccccscccssccc"
- style="fill:#000000;fill-opacity:1;opacity:0.5" /></svg> \ No newline at end of file
diff --git a/apps/files_sharing/img/social-gnu.svg b/apps/files_sharing/img/social-gnu.svg
deleted file mode 100644
index 24556aaa024..00000000000
--- a/apps/files_sharing/img/social-gnu.svg
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="32"
- height="32"
- id="svg2880"
- version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="social-gnu.svg"
- inkscape:export-filename="/home/robmyers/Desktop/social_logo_competition/gnu-social-logo.png"
- inkscape:export-xdpi="90"
- inkscape:export-ydpi="90">
- <defs
- id="defs2882">
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="0 : 526.18109 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_z="744.09448 : 526.18109 : 1"
- inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
- id="perspective2888" />
- <inkscape:perspective
- id="perspective2859"
- inkscape:persp3d-origin="0.5 : 0.33333333 : 1"
- inkscape:vp_z="1 : 0.5 : 1"
- inkscape:vp_y="0 : 1000 : 0"
- inkscape:vp_x="0 : 0.5 : 1"
- sodipodi:type="inkscape:persp3d" />
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="17.21204"
- inkscape:cx="13.854211"
- inkscape:cy="18.472465"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1022"
- inkscape:window-height="730"
- inkscape:window-x="0"
- inkscape:window-y="49"
- inkscape:window-maximized="0" />
- <metadata
- id="metadata2885">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-119.19595,-352.32438)">
- <path
- style="opacity:0.5;fill:#000000;fill-opacity:1;stroke:none"
- d="m 125.14074,354.32438 c -2.18531,0 -3.94479,1.75948 -3.94479,3.94479 l 0,15.76964 c 0,2.18531 1.75948,3.94419 3.94479,3.94419 l 11.72461,0 c -0.0131,4.46851 -6.05322,6.34138 -6.05322,6.34138 0,0 10.21217,-0.0335 11.65719,-6.34138 l 2.12751,0 c 2.18532,0 3.94479,-1.75888 3.94479,-3.94419 l 0,-15.76964 c 0,-2.18531 -1.75947,-3.94479 -3.94479,-3.94479 l -19.45609,0 z m 5.66602,3.16145 c 0.042,-0.007 0.0803,-0.007 0.11455,0 0.0366,0.007 0.0681,0.022 0.0943,0.0454 0.41895,0.37367 -0.69461,0.73954 -0.60497,2.57737 0.0394,0.80713 -0.2017,1.43484 1.34476,1.43484 1.03195,0 0.60505,-0.91938 1.90498,-0.91938 0.77317,0 1.0581,0.49786 1.16578,0.90268 0.10769,-0.40482 0.39265,-0.90268 1.16577,-0.90268 1.29994,0 0.87304,0.91938 1.90498,0.91938 1.54648,0 1.3054,-0.62771 1.34477,-1.43484 0.0896,-1.83783 -1.02452,-2.2037 -0.60556,-2.57737 0.41895,-0.37366 2.21932,1.81578 2.26414,2.66745 0.0469,0.89057 0.0697,2.29462 -1.25467,3.02244 1.47777,1.45682 1.67588,3.38756 1.67588,3.38756 l -2.55469,-0.0447 c 0,0 -0.58278,-2.64503 -3.67572,-2.51054 -3.09293,0.13447 -3.49614,0.67255 -3.49614,3.94479 0,3.27223 1.43378,4.39676 3.63037,4.48234 3.45154,0.13448 3.13818,-1.79282 3.13818,-1.79282 l -1.61383,0.0895 -0.89671,-2.42045 5.51329,0 c 0,2.64468 -1.12011,6.76843 -6.36465,6.49949 -5.24455,-0.26896 -6.41052,-4.39271 -6.45534,-7.17187 -0.0246,-1.52551 0.22386,-3.24602 1.47363,-4.46265 -1.31045,-0.72721 -1.2678,-2.13094 -1.2678,-3.02303 0,-1.10312 1.42517,-2.61621 2.05473,-2.71279 z"
- id="path4639"
- inkscape:connector-curvature="0" />
- </g>
-</svg>
diff --git a/apps/files_sharing/img/social-googleplus.svg b/apps/files_sharing/img/social-googleplus.svg
deleted file mode 100644
index 123273f2d38..00000000000
--- a/apps/files_sharing/img/social-googleplus.svg
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- height="32"
- id="Layer_1"
- version="1.1"
- viewBox="0 0 32 32"
- width="32"
- xml:space="preserve"
- inkscape:version="0.91 r13725"
- sodipodi:docname="social-googleplus.svg"><metadata
- id="metadata4721"><rdf:RDF><cc:Work
- rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
- id="defs4719" /><sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="640"
- inkscape:window-height="480"
- id="namedview4717"
- showgrid="false"
- inkscape:zoom="14.120039"
- inkscape:cx="16.803685"
- inkscape:cy="25.296916"
- inkscape:current-layer="Layer_1" /><style
- type="text/css"
- id="style4709"><![CDATA[
- .st0{fill-rule:evenodd;clip-rule:evenodd;}
-]]></style><path
- d="m 12.260365,1.00001 c -1.044403,0 -2.164648,0.121381 -3.360551,0.364723 C 7.692812,1.648864 6.529074,2.249513 5.409199,3.171551 3.776833,4.74759 2.962354,6.502187 2.962354,8.437552 c 0,1.600734 0.575619,3.003332 1.728237,4.209224 1.099897,1.293294 2.698442,1.953874 4.796683,1.980234 0.39512,0 0.817861,-0.0267 1.265423,-0.0775 -0.07353,0.20755 -0.154327,0.43048 -0.240621,0.67688 -0.0985,0.23057 -0.147948,0.52213 -0.147948,0.8698 0,0.57798 0.128855,1.07502 0.388569,1.48762 0.221977,0.42453 0.475109,0.82365 0.759795,1.19768 -0.920096,0.0244 -2.074179,0.14101 -3.465144,0.34467 -1.405117,0.24362 -2.74619,0.73028 -4.021172,1.45781 C 2.888819,21.26184 2.103483,22.04929 1.67146,22.94303 1.222511,23.83815 1,24.65257 1,25.38066 1,26.87734 1.688069,28.1616 3.060444,29.23708 4.421998,30.38637 6.482307,30.97531 9.242318,31 c 3.296919,-0.0505 5.820381,-0.83703 7.567065,-2.36284 1.686196,-1.47532 2.530304,-3.16622 2.530304,-5.07578 -0.02608,-1.34436 -0.332749,-2.43326 -0.922377,-3.26734 -0.625976,-0.82049 -1.354352,-1.56623 -2.184547,-2.24687 l -1.336959,-1.0958 c -0.192565,-0.19229 -0.392744,-0.41698 -0.59613,-0.67308 -0.241401,-0.26887 -0.361472,-0.60732 -0.361472,-1.02047 0,-0.42231 0.118073,-0.79294 0.352259,-1.11314 0.199779,-0.30855 0.415557,-0.58393 0.651408,-0.827 0.410103,-0.35849 0.796786,-0.711889 1.160829,-1.056231 0.329081,-0.34684 0.640495,-0.724448 0.932673,-1.134274 0.599894,-0.846566 0.912101,-1.973756 0.934299,-3.383312 0,-0.768597 -0.08672,-1.441865 -0.259587,-2.018173 C 17.498927,5.148549 17.257171,4.650391 16.984971,4.226692 16.700007,3.779685 16.410431,3.400399 16.113536,3.09296 15.80471,2.79773 15.527026,2.574136 15.278412,2.420417 l 2.429503,0 L 20.140669,1 12.260365,1 Z m 12.417942,0.168542 0,4.135521 -4.133895,0 0,2.002999 4.133895,0 0,4.133894 2.00354,0 0,-4.133894 4.133895,0 0,-2.002999 -4.133895,0 0,-4.135521 -2.00354,0 z M 9.822733,2.304994 c 0.806887,0.02581 1.520753,0.264821 2.141734,0.712105 0.608218,0.474477 1.099244,1.092424 1.472443,1.849089 0.794402,1.577704 1.192261,3.145874 1.192261,4.698051 0,0.360713 -0.02983,0.802452 -0.08671,1.329371 -0.0949,0.526364 -0.308925,1.039903 -0.643279,1.540185 -0.690627,0.706445 -1.554617,1.080265 -2.592084,1.118555 -0.821594,0 -1.551253,-0.25054 -2.188883,-0.752206 C 8.478088,12.299585 7.957919,11.690036 7.553643,10.971107 6.719841,9.429474 6.303937,7.947693 6.303937,6.523431 6.277017,5.444621 6.562813,4.468801 7.159655,3.59643 7.86804,2.76124 8.754744,2.330799 9.822733,2.304994 Z m 1.66754,17.540326 c 0.08939,-4e-5 0.159034,0.003 0.209187,0.009 0.337683,0 0.633039,0.0118 0.884983,0.0385 1.468658,1.02609 2.547169,1.89084 3.238073,2.59534 0.650949,0.74279 0.977113,1.61238 0.977113,2.61322 0,1.23142 -0.476766,2.23692 -1.430714,3.01967 -0.977255,0.7944 -2.395196,1.20356 -4.252037,1.2302 C 9.046107,29.32465 7.415497,28.8642 6.222646,27.96768 4.968474,27.07062 4.343209,25.92939 4.343209,24.54481 c 0,-0.70422 0.142508,-1.30655 0.432465,-1.80628 0.249447,-0.47503 0.556709,-0.87233 0.920751,-1.19226 0.377084,-0.30688 0.746941,-0.54508 1.110429,-0.71156 0.364043,-0.15344 0.645616,-0.26945 0.846505,-0.34576 0.853226,-0.25666 1.68826,-0.44222 2.503749,-0.55765 0.620565,-0.0574 1.064984,-0.0861 1.333165,-0.0862 z"
- id="path4713"
- style="opacity:0.5;fill:#000000;fill-opacity:1"
- inkscape:connector-curvature="0" /></svg> \ No newline at end of file
diff --git a/apps/files_sharing/img/social-twitter.svg b/apps/files_sharing/img/social-twitter.svg
deleted file mode 100644
index 00ce390de6b..00000000000
--- a/apps/files_sharing/img/social-twitter.svg
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- height="32"
- id="svg2"
- version="1.1"
- width="32"
- inkscape:version="0.91 r13725"
- sodipodi:docname="social-twitter.svg">
- <metadata
- id="metadata5269">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="640"
- inkscape:window-height="480"
- id="namedview5267"
- showgrid="false"
- inkscape:zoom="10.224"
- inkscape:cx="-7.2593811"
- inkscape:cy="16.128046"
- inkscape:current-layer="svg2" />
- <defs
- id="defs4" />
- <path
- sodipodi:nodetypes="sscccccsscsccscsccsccss"
- inkscape:connector-curvature="0"
- style="opacity:0.5;fill:#000000;fill-opacity:1;fill-rule:nonzero"
- id="rect2995"
- d="m 21.611501,4.61946 c 0.05279,-0.002 0.106021,0 0.159127,0 1.770342,0 3.36956,0.74756 4.491932,1.94362 C 27.665067,6.2866 28.983178,5.77311 30.172539,5.06729 29.712752,6.50573 28.736679,7.71137 27.465106,8.4726 28.710494,8.32462 29.897115,7.99445 31,7.50421 c -0.824575,1.23442 -1.869002,2.31882 -3.071153,3.18481 0.01156,0.26431 0.01819,0.53117 0.01819,0.79791 C 27.947037,19.62063 21.755733,29 10.433964,29 6.9584454,29 3.7246302,27.98066 1,26.23346 c 0.481711,0.0572 0.9721881,0.0864 1.4685161,0.0864 2.8841872,0 5.5361434,-0.98372 7.6426469,-2.63469 -2.6929626,-0.0493 -4.9652637,-1.83087 -5.7490348,-4.27598 0.375747,0.0725 0.7622921,0.11139 1.1593551,0.11139 0.561492,0 1.1043981,-0.0759 1.6208231,-0.21596 -2.8159792,-0.56635 -4.9374873,-3.05156 -4.9374873,-6.03318 0,-0.0262 -4.66e-4,-0.054 0,-0.0796 0.830058,0.46101 1.7807801,0.73835 2.7892712,0.77063 -1.6515871,-1.10349 -2.7392592,-2.98649 -2.7392592,-5.12162 0,-1.12907 0.304455,-2.18754 0.834281,-3.09616 3.0358242,3.72399 7.5714429,6.17402 12.6869759,6.43101 -0.105355,-0.45126 -0.159128,-0.92088 -0.159128,-1.4026 0,-3.34627 2.669159,-6.0694 5.994545,-6.15366 z" />
-</svg>
diff --git a/apps/files_sharing/js/3rdparty/gs-share/gs-share.js b/apps/files_sharing/js/3rdparty/gs-share/gs-share.js
deleted file mode 100644
index fd4442708a4..00000000000
--- a/apps/files_sharing/js/3rdparty/gs-share/gs-share.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// @license magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt MPL 2.0
-document.addEventListener('DOMContentLoaded', function () {
- 'use strict';
- /**
- * 'Share' widget for GNU social
- * http://code.chromic.org/project/view/2/
- *
- * We make a few assumptions about the target instance:
- * 1) The API root is in the default location
- * 2) Fancy URLs are enabled
- * 3) CORS is allowed
- * 4) The Bookmark plugin is enabled
- *
- * If 1), 3) or 4) are wrong, we fall back to a regular
- * notice (instead of a bookmark notice)
- *
- * If 2) is wrong the user will be directed to a 404 :(
- */
-
- // TODO: input sanitation [1], [2]
- // TODO: server-side fallback if JS is disabled
-
- var createForm,
- bindClicks,
- frm,
- shareAsNotice,
- shareAsBookmark,
- extractURLParams,
- shareURL,
- shareTitle,
- closest,
- i18n = window.i18n;
-
- /**
- * Internationalization
- */
- if (i18n === undefined) {
- i18n = {
- invalidId: 'The account id provided is invalid',
- yourAcctId: 'Your account ID:',
- idPlaceholder: 'user@example.org',
- shareAsBookmark: 'Share as a bookmark'
- };
- }
-
- shareAsNotice = function (title, url, domain) {
- window.open('http://' + domain + '/notice/new?status_textarea=' + title + ' ' + url); // [1]
- };
-
- shareAsBookmark = function (title, url, domain) {
- window.open('http://' + domain + '/main/bookmark/new?url=' + url + '&title=' + title); // [2]
- };
-
- /**
- * Extract parameters from query string
- *
- * ex:
- * ?foo=bar&baz=test
- * will return:
- * {foo: 'bar', baz: 'test'}
- */
- extractURLParams = function (queryStr) {
- var parts = queryStr.substr(1).split('&'),
- i, len, keyVal, params = {};
-
- for (i = 0, len = parts.length; i < len; i += 1) {
- keyVal = parts[i].split('=');
- params[keyVal[0]] = keyVal[1];
- }
-
- return params;
- };
-
- // Create the form that we'll re-use throughout the page
- createForm = function () {
- var err = document.createElement('div');
- err.setAttribute('class', 'gs-share-err');
- err.setAttribute('tabindex', '-1');
- err.setAttribute('aria-hidden', 'true');
- err.textContent = i18n.invalidId;
-
- frm = document.createElement('form');
-
- frm.setAttribute('class', 'gs-share-form');
- frm.setAttribute('tabindex', '-1');
- frm.setAttribute('aria-hidden', 'true');
-
- frm.innerHTML = '<label for="gs-account">' + i18n.yourAcctId + '</label>' +
- '<input type="text" id="gs-account" placeholder="' + i18n.idPlaceholder + '" />' +
- '<input type="checkbox" id="gs-bookmark" /> <label for="gs-bookmark">' + i18n.shareAsBookmark + '</label>' +
- '<input type="submit" value="Share"/>';
- frm.insertBefore(err, frm.firstChild);
-
- // Submit handler
- frm.addEventListener('submit', function (e) {
- e.preventDefault();
-
- var accountParts = document.getElementById('gs-account').value.split('@'),
- username, domain, xhr, bookmarkURL;
-
- if (accountParts.length === 2) {
- err.setAttribute('aria-hidden', 'true');
-
- username = accountParts[0];
- domain = accountParts[1];
- bookmarkURL = 'http://' + domain + '/api/bookmarks/' + username + '.json';
-
- // Try bookmark
- if (document.getElementById('gs-bookmark').checked) {
- xhr = new XMLHttpRequest();
-
- xhr.onreadystatechange = function () {
- if (xhr.readyState === 4) {
- if (xhr.status === 200) { // Success
- shareAsBookmark(shareTitle, shareURL, domain);
- } else { // Failure, fallback to regular notice
- shareAsNotice(shareTitle, shareURL, domain);
- }
- }
- };
-
- xhr.open('GET', bookmarkURL, true);
- xhr.send();
- } else { // Regular notice
- shareAsNotice(shareTitle, shareURL, domain);
- }
- } else { // Invalid account id
- err.setAttribute('aria-hidden', 'false');
- err.focus();
- }
- });
-
- // Keydown handler
- frm.addEventListener('keydown', function (e) {
- if (e.keyCode === 27) { // Escape key closes the dialog
- frm.parentElement.getElementsByClassName('js-gs-share')[0].focus();
- frm.setAttribute('aria-hidden', 'true');
- }
- });
-
- document.body.appendChild(frm);
- };
-
- /**
- * Something similar to jQuery.closest
- *
- * Given `elm`, return the closest parent with class `cls`
- * or false if there is no matching ancestor.
- */
- closest = function (elm, cls) {
- while (elm !== document) {
- if (elm.classList.contains(cls)) {
- return elm;
- }
-
- elm = elm.parentNode;
- }
-
- return false;
- };
-
- bindClicks = function () {
- document.addEventListener('click', function (e) {
- var target = e.target,
- urlParams,
- lnk = closest(target, 'js-gs-share');
-
- // Don't do anything on right/middle click or if ctrl or shift was pressed while left-clicking
- if (!e.button && !e.ctrlKey && !e.shiftKey && lnk) {
- e.preventDefault();
-
- // Check for submission information in href first
- if (lnk.search !== undefined) {
- urlParams = extractURLParams(lnk.search);
- shareURL = urlParams.url;
- shareTitle = urlParams.title;
- } else { // If it's not there, try data-* attributes. If not, use current document url and title
- shareURL = lnk.getAttribute('data-url') || window.location.href;
- shareTitle = lnk.getAttribute('data-title') || document.title;
- }
-
- // Move form after the clicked link
- lnk.parentNode.appendChild(frm);
-
- // Show form
- frm.setAttribute('aria-hidden', 'false');
-
- // Focus on form
- frm.focus();
- } else if (!frm.contains(target)) {
- frm.setAttribute('aria-hidden', 'true');
- }
- });
- };
-
- // Flag that js is enabled
- document.body.classList.add('js-gs-share-enabled');
-
- createForm();
- bindClicks();
-});
-// @license-end
diff --git a/apps/files_sharing/js/settings-admin.js b/apps/files_sharing/js/settings-admin.js
deleted file mode 100644
index 95578bff548..00000000000
--- a/apps/files_sharing/js/settings-admin.js
+++ /dev/null
@@ -1,12 +0,0 @@
-$(document).ready(function() {
-
- $('#fileSharingSettings input').change(function() {
- var value = 'no';
- if (this.checked) {
- value = 'yes';
- }
- OC.AppConfig.setValue('files_sharing', $(this).attr('name'), value);
- });
-
- $('.section .icon-info').tipsy({gravity: 'w'});
-});
diff --git a/apps/files_sharing/js/settings-personal.js b/apps/files_sharing/js/settings-personal.js
deleted file mode 100644
index 14a9b7bbfa7..00000000000
--- a/apps/files_sharing/js/settings-personal.js
+++ /dev/null
@@ -1,19 +0,0 @@
-$(document).ready(function() {
-
- $('#fileSharingSettings button.pop-up').click(function() {
- var url = $(this).data('url');
- if (url) {
- var width = 600;
- var height = 400;
- var left = (screen.width/2)-(width/2);
- var top = (screen.height/2)-(height/2);
-
- window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left);
- }
- });
-
- $('#oca-files-sharing-add-to-your-website').click(function() {
- $('#oca-files-sharing-add-to-your-website-expanded').slideDown();
- });
-
-});
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php
index ea024b6016a..72294f6b26f 100644
--- a/apps/files_sharing/lib/controllers/sharecontroller.php
+++ b/apps/files_sharing/lib/controllers/sharecontroller.php
@@ -33,6 +33,7 @@ namespace OCA\Files_Sharing\Controllers;
use OC;
use OC_Files;
use OC_Util;
+use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP;
use OCP\Template;
use OCP\Share;
@@ -79,6 +80,8 @@ class ShareController extends Controller {
protected $previewManager;
/** @var IRootFolder */
protected $rootFolder;
+ /** @var FederatedShareProvider */
+ protected $federatedShareProvider;
/**
* @param string $appName
@@ -92,6 +95,7 @@ class ShareController extends Controller {
* @param ISession $session
* @param IPreview $previewManager
* @param IRootFolder $rootFolder
+ * @param FederatedShareProvider $federatedShareProvider
*/
public function __construct($appName,
IRequest $request,
@@ -103,7 +107,8 @@ class ShareController extends Controller {
\OCP\Share\IManager $shareManager,
ISession $session,
IPreview $previewManager,
- IRootFolder $rootFolder) {
+ IRootFolder $rootFolder,
+ FederatedShareProvider $federatedShareProvider) {
parent::__construct($appName, $request);
$this->config = $config;
@@ -115,6 +120,7 @@ class ShareController extends Controller {
$this->session = $session;
$this->previewManager = $previewManager;
$this->rootFolder = $rootFolder;
+ $this->federatedShareProvider = $federatedShareProvider;
}
/**
@@ -300,7 +306,7 @@ class ShareController extends Controller {
$shareTmpl['previewSupported'] = $this->previewManager->isMimeSupported($share->getNode()->getMimetype());
$shareTmpl['dirToken'] = $token;
$shareTmpl['sharingToken'] = $token;
- $shareTmpl['server2serversharing'] = Helper::isOutgoingServer2serverShareEnabled();
+ $shareTmpl['server2serversharing'] = $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
$shareTmpl['protected'] = $share->getPassword() !== null ? 'true' : 'false';
$shareTmpl['dir'] = '';
$shareTmpl['nonHumanFileSize'] = $share->getNode()->getSize();
diff --git a/apps/files_sharing/lib/helper.php b/apps/files_sharing/lib/helper.php
index e857974ae74..c09694e9888 100644
--- a/apps/files_sharing/lib/helper.php
+++ b/apps/files_sharing/lib/helper.php
@@ -280,26 +280,6 @@ class Helper {
}
/**
- * allow users from other ownCloud instances to mount public links share by this instance
- * @return bool
- */
- public static function isOutgoingServer2serverShareEnabled() {
- $appConfig = \OC::$server->getAppConfig();
- $result = $appConfig->getValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes');
- return ($result === 'yes') ? true : false;
- }
-
- /**
- * allow user to mount public links from onther ownClouds
- * @return bool
- */
- public static function isIncomingServer2serverShareEnabled() {
- $appConfig = \OC::$server->getAppConfig();
- $result = $appConfig->getValue('files_sharing', 'incoming_server2server_share_enabled', 'yes');
- return ($result === 'yes') ? true : false;
- }
-
- /**
* get default share folder
*
* @return string
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 113675508fb..38605def73a 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -1,4 +1,6 @@
<?php
+use OCA\FederatedFileSharing\FederatedShareProvider;
+
/**
* @author Andreas Fischer <bantu@owncloud.com>
* @author Bart Visscher <bartv@thisnet.nl>
@@ -40,6 +42,18 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
private $path;
+ /** @var FederatedShareProvider */
+ private $federatedShareProvider;
+
+ public function __construct(FederatedShareProvider $federatedShareProvider = null) {
+ if ($federatedShareProvider) {
+ $this->federatedShareProvider = $federatedShareProvider;
+ } else {
+ $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application('federatedfilesharing');
+ $this->federatedShareProvider = $federatedSharingApp->getFederatedShareProvider();
+ }
+ }
+
public function isValidSource($itemSource, $uidOwner) {
try {
$path = \OC\Files\Filesystem::getPath($itemSource);
@@ -173,7 +187,7 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
*/
public function isShareTypeAllowed($shareType) {
if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
- return \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled();
+ return $this->federatedShareProvider->isOutgoingServer2serverShareEnabled();
}
return true;
diff --git a/apps/files_sharing/settings-admin.php b/apps/files_sharing/settings-admin.php
deleted file mode 100644
index b2a305ebcdb..00000000000
--- a/apps/files_sharing/settings-admin.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/**
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-\OC_Util::checkAdminUser();
-
-\OCP\Util::addScript('files_sharing', 'settings-admin');
-
-$tmpl = new OCP\Template('files_sharing', 'settings-admin');
-$tmpl->assign('outgoingServer2serverShareEnabled', OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled());
-$tmpl->assign('incomingServer2serverShareEnabled', OCA\Files_Sharing\Helper::isIncomingServer2serverShareEnabled());
-
-return $tmpl->fetchPage();
diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php
deleted file mode 100644
index 982a8b05c15..00000000000
--- a/apps/files_sharing/settings-personal.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-/**
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Jan-Christoph Borchardt <hey@jancborchardt.net>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-\OC_Util::checkLoggedIn();
-
-$l = \OC::$server->getL10N('files_sharing');
-
-$isIE8 = false;
-preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
-if (count($matches) > 0 && $matches[1] <= 9) {
- $isIE8 = true;
-}
-
-$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
-$url = 'https://owncloud.org/federation#' . $cloudID;
-$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
-
-$tmpl = new OCP\Template('files_sharing', 'settings-personal');
-$tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled());
-$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID, see %s', [$url]));
-$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID', [$cloudID]));
-$tmpl->assign('owncloud_logo_path', $ownCloudLogoPath);
-$tmpl->assign('reference', $url);
-$tmpl->assign('cloudId', $cloudID);
-$tmpl->assign('showShareIT', !$isIE8);
-
-return $tmpl->fetchPage();
diff --git a/apps/files_sharing/templates/settings-admin.php b/apps/files_sharing/templates/settings-admin.php
deleted file mode 100644
index 64b6b8e72a3..00000000000
--- a/apps/files_sharing/templates/settings-admin.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/** @var OC_L10N $l */
-/** @var array $_ */
-?>
-<div id="fileSharingSettings">
- <h3><?php p($l->t('Federated Cloud Sharing'));?></h3>
- <a target="_blank" rel="noreferrer" class="icon-info svg"
- title="<?php p($l->t('Open documentation'));?>"
- href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a>
-
- <p>
- <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox"
- value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> />
- <label for="outgoingServer2serverShareEnabled">
- <?php p($l->t('Allow users on this server to send shares to other servers'));?>
- </label>
- </p>
-
- <p>
- <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox"
- value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> />
- <label for="incomingServer2serverShareEnabled">
- <?php p($l->t('Allow users on this server to receive shares from other servers'));?>
- </label><br/>
- </p>
-</div>
diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php
deleted file mode 100644
index ea9aae038a7..00000000000
--- a/apps/files_sharing/templates/settings-personal.php
+++ /dev/null
@@ -1,78 +0,0 @@
-<?php
-/** @var OC_L10N $l */
-/** @var array $_ */
-script('files_sharing', 'settings-personal');
-style('files_sharing', 'settings-personal');
-if ($_['showShareIT']) {
- script('files_sharing', '3rdparty/gs-share/gs-share');
- style('files_sharing', '3rdparty/gs-share/style');
-}
-?>
-
-<?php if ($_['outgoingServer2serverShareEnabled']): ?>
- <div id="fileSharingSettings" class="section">
- <h2><?php p($l->t('Federated Cloud')); ?></h2>
-
- <p>
- <?php p($l->t('Your Federated Cloud ID:')); ?>
- <strong><?php p($_['cloudId']); ?></strong>
- </p>
-
- <br>
-
- <?php if ($_['showShareIT']) {?>
- <p>
- <?php p($l->t('Share it:')); ?>
- <div class="gs-share">
- <button data-url="<?php p(urlencode($_['reference'])); ?>"
- data-title='<?php p(urlencode($_['message_without_URL'])); ?>'
- class='js-gs-share social-gnu'>
- GNU Social
- </button>
- </div>
- <button class="social-diaspora pop-up"
- data-url='https://sharetodiaspora.github.io/?title=<?php p($_['message_without_URL']); ?>&url=<?php p(urlencode($_['reference'])); ?>'>
- Diaspora
- </button>
- <button class="social-twitter pop-up"
- data-url='https://twitter.com/intent/tweet?text=<?php p(urlencode($_['message_with_URL'])); ?>'>
- Twitter
- </button>
- <button class="social-facebook pop-up"
- data-url='https://www.facebook.com/sharer/sharer.php?u=<?php p(urlencode($_['reference'])); ?>'>
- Facebook
- </button>
- <button class="social-googleplus pop-up"
- data-url='https://plus.google.com/share?url=<?php p(urlencode($_['reference'])); ?>'/>
- Google+
- </button>
- <button id="oca-files-sharing-add-to-your-website">
- <?php p($l->t('Add to your website')) ?>
- </button>
- </p>
-
- <div class="hidden" id="oca-files-sharing-add-to-your-website-expanded">
- <p style="margin: 10px 0">
- <a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
- style="padding:10px;background-color:#1d2d44;color:#fff;border-radius:3px;padding-left:4px;">
- <img src="<?php p($_['owncloud_logo_path']); ?>"
- style="width:50px;position:relative;top:8px;">
- <?php p($l->t('Share with me via ownCloud')); ?>
- </a>
- </p>
-
- <p>
- <?php p($l->t('HTML Code:')); ?>
- <xmp><a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
- style="padding:10px;background-color:#1d2d44;color:#fff;border-radius:3px;padding-left:4px;">
- <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>"
- style="width:50px;position:relative;top:8px;">
- <?php p($l->t('Share with me via ownCloud')); ?>
-
-</a></xmp>
- </p>
- </div>
- <?php } ?>
-
- </div>
-<?php endif; ?>
diff --git a/apps/files_sharing/tests/controller/sharecontroller.php b/apps/files_sharing/tests/controller/sharecontroller.php
index db8c7fe553c..df3973099fb 100644
--- a/apps/files_sharing/tests/controller/sharecontroller.php
+++ b/apps/files_sharing/tests/controller/sharecontroller.php
@@ -29,6 +29,7 @@
namespace OCA\Files_Sharing\Controllers;
use OC\Files\Filesystem;
+use OCA\FederatedFileSharing\FederatedShareProvider;
use OCP\Share\Exceptions\ShareNotFound;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
@@ -66,6 +67,8 @@ class ShareControllerTest extends \Test\TestCase {
private $shareManager;
/** @var IUserManager | \PHPUnit_Framework_MockObject_MockObject */
private $userManager;
+ /** @var FederatedShareProvider | \PHPUnit_Framework_MockObject_MockObject */
+ private $federatedShareProvider;
protected function setUp() {
$this->appName = 'files_sharing';
@@ -76,6 +79,12 @@ class ShareControllerTest extends \Test\TestCase {
$this->previewManager = $this->getMock('\OCP\IPreview');
$this->config = $this->getMock('\OCP\IConfig');
$this->userManager = $this->getMock('\OCP\IUserManager');
+ $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
+ ->disableOriginalConstructor()->getMock();
+ $this->federatedShareProvider->expects($this->any())
+ ->method('isOutgoingServer2serverShareEnabled')->willReturn(true);
+ $this->federatedShareProvider->expects($this->any())
+ ->method('isIncomingServer2serverShareEnabled')->willReturn(true);
$this->shareController = new \OCA\Files_Sharing\Controllers\ShareController(
$this->appName,
@@ -88,7 +97,8 @@ class ShareControllerTest extends \Test\TestCase {
$this->shareManager,
$this->session,
$this->previewManager,
- $this->getMock('\OCP\Files\IRootFolder')
+ $this->getMock('\OCP\Files\IRootFolder'),
+ $this->federatedShareProvider
);
diff --git a/apps/files_sharing/tests/server2server.php b/apps/files_sharing/tests/server2server.php
index 7714f274c6d..1d047916ca9 100644
--- a/apps/files_sharing/tests/server2server.php
+++ b/apps/files_sharing/tests/server2server.php
@@ -44,6 +44,9 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase {
*/
private $s2s;
+ /** @var \OCA\FederatedFileSharing\FederatedShareProvider | PHPUnit_Framework_MockObject_MockObject */
+ private $federatedShareProvider;
+
protected function setUp() {
parent::setUp();
@@ -57,10 +60,16 @@ class Test_Files_Sharing_S2S_OCS_API extends TestCase {
->setConstructorArgs([$config, $clientService])
->getMock();
$httpHelperMock->expects($this->any())->method('post')->with($this->anything())->will($this->returnValue(true));
+ $this->federatedShareProvider = $this->getMockBuilder('OCA\FederatedFileSharing\FederatedShareProvider')
+ ->disableOriginalConstructor()->getMock();
+ $this->federatedShareProvider->expects($this->any())
+ ->method('isOutgoingServer2serverShareEnabled')->willReturn(true);
+ $this->federatedShareProvider->expects($this->any())
+ ->method('isIncomingServer2serverShareEnabled')->willReturn(true);
$this->registerHttpHelper($httpHelperMock);
- $this->s2s = new \OCA\Files_Sharing\API\Server2Server();
+ $this->s2s = new \OCA\Files_Sharing\API\Server2Server($this->federatedShareProvider);
$this->connection = \OC::$server->getDatabaseConnection();
}