Passed
Push — master ( 9b573c...c3361a )
by Blizzz
14:08 queued 10s
created
apps/files_sharing/lib/Capabilities.php 1 patch
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -36,92 +36,92 @@
 block discarded – undo
36 36
  */
37 37
 class Capabilities implements ICapability {
38 38
 
39
-	/** @var IConfig */
40
-	private $config;
41
-
42
-	public function __construct(IConfig $config) {
43
-		$this->config = $config;
44
-	}
45
-
46
-	/**
47
-	 * Return this classes capabilities
48
-	 *
49
-	 * @return array
50
-	 */
51
-	public function getCapabilities() {
52
-		$res = [];
53
-
54
-		if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
55
-			$res['api_enabled'] = false;
56
-			$res['public'] = ['enabled' => false];
57
-			$res['user'] = ['send_mail' => false];
58
-			$res['resharing'] = false;
59
-		} else {
60
-			$res['api_enabled'] = true;
61
-
62
-			$public = [];
63
-			$public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes';
64
-			if ($public['enabled']) {
65
-				$public['password'] = [];
66
-				$public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes');
67
-
68
-				if ($public['password']['enforced']) {
69
-					$public['password']['askForOptionalPassword'] = false;
70
-				} else {
71
-					$public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes');
72
-				}
73
-
74
-				$public['expire_date'] = [];
75
-				$public['multiple_links'] = true;
76
-				$public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
77
-				if ($public['expire_date']['enabled']) {
78
-					$public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
79
-					$public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
80
-				}
81
-
82
-				$public['expire_date_internal'] = [];
83
-				$public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes';
84
-				if ($public['expire_date_internal']['enabled']) {
85
-					$public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
86
-					$public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes';
87
-				}
88
-
89
-				$public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
90
-				$public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
91
-				$public['upload_files_drop'] = $public['upload'];
92
-			}
93
-			$res['public'] = $public;
94
-
95
-			$res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
96
-
97
-			$res['user']['send_mail'] = false;
98
-			$res['user']['expire_date']['enabled'] = true;
99
-
100
-			// deprecated in favour of 'group', but we need to keep it for now
101
-			// in order to stay compatible with older clients
102
-			$res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
103
-
104
-			$res['group'] = [];
105
-			$res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
106
-			$res['group']['expire_date']['enabled'] = true;
107
-			$res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
108
-		}
109
-
110
-		//Federated sharing
111
-		$res['federation'] = [
112
-			'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
113
-			'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
114
-			'expire_date' => ['enabled' => true]
115
-		];
116
-
117
-		// Sharee searches
118
-		$res['sharee'] = [
119
-			'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false),
120
-			'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes',
121
-		];
122
-
123
-		return [
124
-			'files_sharing' => $res,
125
-		];
126
-	}
39
+    /** @var IConfig */
40
+    private $config;
41
+
42
+    public function __construct(IConfig $config) {
43
+        $this->config = $config;
44
+    }
45
+
46
+    /**
47
+     * Return this classes capabilities
48
+     *
49
+     * @return array
50
+     */
51
+    public function getCapabilities() {
52
+        $res = [];
53
+
54
+        if ($this->config->getAppValue('core', 'shareapi_enabled', 'yes') !== 'yes') {
55
+            $res['api_enabled'] = false;
56
+            $res['public'] = ['enabled' => false];
57
+            $res['user'] = ['send_mail' => false];
58
+            $res['resharing'] = false;
59
+        } else {
60
+            $res['api_enabled'] = true;
61
+
62
+            $public = [];
63
+            $public['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_links', 'yes') === 'yes';
64
+            if ($public['enabled']) {
65
+                $public['password'] = [];
66
+                $public['password']['enforced'] = ($this->config->getAppValue('core', 'shareapi_enforce_links_password', 'no') === 'yes');
67
+
68
+                if ($public['password']['enforced']) {
69
+                    $public['password']['askForOptionalPassword'] = false;
70
+                } else {
71
+                    $public['password']['askForOptionalPassword'] = ($this->config->getAppValue('core', 'shareapi_enable_link_password_by_default', 'no') === 'yes');
72
+                }
73
+
74
+                $public['expire_date'] = [];
75
+                $public['multiple_links'] = true;
76
+                $public['expire_date']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no') === 'yes';
77
+                if ($public['expire_date']['enabled']) {
78
+                    $public['expire_date']['days'] = $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7');
79
+                    $public['expire_date']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no') === 'yes';
80
+                }
81
+
82
+                $public['expire_date_internal'] = [];
83
+                $public['expire_date_internal']['enabled'] = $this->config->getAppValue('core', 'shareapi_default_internal_expire_date', 'no') === 'yes';
84
+                if ($public['expire_date_internal']['enabled']) {
85
+                    $public['expire_date_internal']['days'] = $this->config->getAppValue('core', 'shareapi_internal_expire_after_n_days', '7');
86
+                    $public['expire_date_internal']['enforced'] = $this->config->getAppValue('core', 'shareapi_enforce_internal_expire_date', 'no') === 'yes';
87
+                }
88
+
89
+                $public['send_mail'] = $this->config->getAppValue('core', 'shareapi_allow_public_notification', 'no') === 'yes';
90
+                $public['upload'] = $this->config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === 'yes';
91
+                $public['upload_files_drop'] = $public['upload'];
92
+            }
93
+            $res['public'] = $public;
94
+
95
+            $res['resharing'] = $this->config->getAppValue('core', 'shareapi_allow_resharing', 'yes') === 'yes';
96
+
97
+            $res['user']['send_mail'] = false;
98
+            $res['user']['expire_date']['enabled'] = true;
99
+
100
+            // deprecated in favour of 'group', but we need to keep it for now
101
+            // in order to stay compatible with older clients
102
+            $res['group_sharing'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
103
+
104
+            $res['group'] = [];
105
+            $res['group']['enabled'] = $this->config->getAppValue('core', 'shareapi_allow_group_sharing', 'yes') === 'yes';
106
+            $res['group']['expire_date']['enabled'] = true;
107
+            $res['default_permissions'] = (int)$this->config->getAppValue('core', 'shareapi_default_permissions', Constants::PERMISSION_ALL);
108
+        }
109
+
110
+        //Federated sharing
111
+        $res['federation'] = [
112
+            'outgoing' => $this->config->getAppValue('files_sharing', 'outgoing_server2server_share_enabled', 'yes') === 'yes',
113
+            'incoming' => $this->config->getAppValue('files_sharing', 'incoming_server2server_share_enabled', 'yes') === 'yes',
114
+            'expire_date' => ['enabled' => true]
115
+        ];
116
+
117
+        // Sharee searches
118
+        $res['sharee'] = [
119
+            'query_lookup_default' => $this->config->getSystemValueBool('gs.enabled', false),
120
+            'always_show_unique' => $this->config->getAppValue('files_sharing', 'always_show_unique', 'yes') === 'yes',
121
+        ];
122
+
123
+        return [
124
+            'files_sharing' => $res,
125
+        ];
126
+    }
127 127
 }
Please login to merge, or discard this patch.