Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gapczynski <GapczynskiM@gmail.com>2012-04-25 19:51:18 +0400
committerMichael Gapczynski <GapczynskiM@gmail.com>2012-04-25 19:51:30 +0400
commitb369adbd9487496d799cf04f66fcc72a002ccda5 (patch)
treef77e57ba3b7e06019dd284e550abeba76092f360 /apps/files_sharing
parenta3dff248a1f4d34ccbf7bf0120109c0d910fc548 (diff)
Allow admin to disable resharing of files
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/ajax/toggleresharing.php16
-rw-r--r--apps/files_sharing/appinfo/app.php6
-rw-r--r--apps/files_sharing/js/settings.js9
-rw-r--r--apps/files_sharing/settings.php9
-rw-r--r--apps/files_sharing/templates/settings.php6
5 files changed, 45 insertions, 1 deletions
diff --git a/apps/files_sharing/ajax/toggleresharing.php b/apps/files_sharing/ajax/toggleresharing.php
new file mode 100644
index 00000000000..fd16b208be1
--- /dev/null
+++ b/apps/files_sharing/ajax/toggleresharing.php
@@ -0,0 +1,16 @@
+<?php
+
+require_once('../../../lib/base.php');
+
+OC_JSON::checkAppEnabled('files_sharing');
+OC_JSON::checkAdminUser();
+error_log($_POST['resharing']);
+if ($_POST['resharing'] == true) {
+ error_log("enabling");
+ OC_Appconfig::setValue('files_sharing', 'resharing', 'yes');
+} else {
+ error_log("disabling");
+ OC_Appconfig::setValue('files_sharing', 'resharing', 'no');
+}
+
+?>
diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php
index 8049e9b0ae3..117b65d754f 100644
--- a/apps/files_sharing/appinfo/app.php
+++ b/apps/files_sharing/appinfo/app.php
@@ -3,10 +3,14 @@
require_once('apps/files_sharing/sharedstorage.php');
OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php";
+OC_APP::registerAdmin('files_sharing', 'settings');
OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem");
OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem");
OC_Hook::connect("OC_Filesystem", "post_write", "OC_Share", "updateItem");
-OC_Util::addScript("files_sharing", "share");
+$dir = isset($_GET['dir']) ? $_GET['dir'] : '/';
+if ($dir != '/Shared' || OC_Appconfig::getValue('files_sharing', 'resharing', 'yes') == 'yes') {
+ OC_Util::addScript("files_sharing", "share");
+}
OC_Util::addScript("3rdparty", "chosen/chosen.jquery.min");
OC_Util::addStyle( 'files_sharing', 'sharing' );
OC_Util::addStyle("3rdparty", "chosen/chosen");
diff --git a/apps/files_sharing/js/settings.js b/apps/files_sharing/js/settings.js
new file mode 100644
index 00000000000..f1b1643e7d6
--- /dev/null
+++ b/apps/files_sharing/js/settings.js
@@ -0,0 +1,9 @@
+$(document).ready(function() {
+ $('#allowResharing').bind('change', function() {
+ var checked = 1;
+ if (!$('#allowResharing').attr('checked')) {
+ checked = 0;
+ }
+ $.post(OC.filePath('files_sharing','ajax','toggleresharing.php'), 'resharing='+checked);
+ });
+}); \ No newline at end of file
diff --git a/apps/files_sharing/settings.php b/apps/files_sharing/settings.php
new file mode 100644
index 00000000000..b30c4f45cde
--- /dev/null
+++ b/apps/files_sharing/settings.php
@@ -0,0 +1,9 @@
+<?php
+
+OC_Util::checkAdminUser();
+OC_Util::addScript('files_sharing', 'settings');
+$tmpl = new OC_Template('files_sharing', 'settings');
+$tmpl->assign('allowResharing', OC_Appconfig::getValue('files_sharing', 'resharing', 'yes'));
+return $tmpl->fetchPage();
+
+?> \ No newline at end of file
diff --git a/apps/files_sharing/templates/settings.php b/apps/files_sharing/templates/settings.php
new file mode 100644
index 00000000000..5b6ba5f33ee
--- /dev/null
+++ b/apps/files_sharing/templates/settings.php
@@ -0,0 +1,6 @@
+<form id="resharing">
+ <fieldset class="personalblock">
+ <input type="checkbox" name="allowResharing" id="allowResharing" value="1" <?php if ($_['allowResharing'] == 'yes') echo ' checked="checked"'; ?> /> <label for="allowResharing"><?php echo $l->t('Enable Resharing'); ?></label> <br/>
+ <em><?php echo $l->t('Allow users to reshare files they don\'t own');?></em>
+ </fieldset>
+</form> \ No newline at end of file