app.php 6.63 KB
Newer Older
1
2
3
<?php
/**
 * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
4
 * Copyright (c) 2014 Robin McCorkell <rmccorkell@karoshi.org.uk>
5
6
7
8
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
9
$l = \OC::$server->getL10N('files_external');
10

j-ed's avatar
j-ed committed
11
12
OC::$CLASSPATH['OC\Files\Storage\StreamWrapper'] = 'files_external/lib/streamwrapper.php';
OC::$CLASSPATH['OC\Files\Storage\FTP'] = 'files_external/lib/ftp.php';
13
OC::$CLASSPATH['OC\Files\Storage\OwnCloud'] = 'files_external/lib/owncloud.php';
j-ed's avatar
j-ed committed
14
OC::$CLASSPATH['OC\Files\Storage\Google'] = 'files_external/lib/google.php';
15
OC::$CLASSPATH['OC\Files\Storage\Swift'] = 'files_external/lib/swift.php';
j-ed's avatar
j-ed committed
16
OC::$CLASSPATH['OC\Files\Storage\SMB'] = 'files_external/lib/smb.php';
17
OC::$CLASSPATH['OC\Files\Storage\SMB_OC'] = 'files_external/lib/smb_oc.php';
j-ed's avatar
j-ed committed
18
19
20
21
OC::$CLASSPATH['OC\Files\Storage\AmazonS3'] = 'files_external/lib/amazons3.php';
OC::$CLASSPATH['OC\Files\Storage\Dropbox'] = 'files_external/lib/dropbox.php';
OC::$CLASSPATH['OC\Files\Storage\SFTP'] = 'files_external/lib/sftp.php';
OC::$CLASSPATH['OC_Mount_Config'] = 'files_external/lib/config.php';
22
OC::$CLASSPATH['OCA\Files\External\Api'] = 'files_external/lib/api.php';
Robin Appelman's avatar
Robin Appelman committed
23

24
25
OCP\Util::addTranslations('files_external');

26
OCP\App::registerAdmin('files_external', 'settings');
27
28
29
if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == 'yes') {
	OCP\App::registerPersonal('files_external', 'personal');
}
30

31
32
33
34
35
36
37
38
39
40
\OCA\Files\App::getNavigationManager()->add(
	array(
		"id" => 'extstoragemounts',
		"appname" => 'files_external',
		"script" => 'list.php',
		"order" => 30,
		"name" => $l->t('External storage')
	)
);

41
// connecting hooks
42
OCP\Util::connectHook('OC_Filesystem', 'post_initMountPoints', '\OC_Mount_Config', 'initMountPointsHook');
43
OCP\Util::connectHook('OC_User', 'post_login', 'OC\Files\Storage\SMB_OC', 'login');
44

45
OC_Mount_Config::registerBackend('\OC\Files\Storage\Local', array(
Volkan Gezer's avatar
Volkan Gezer committed
46
	'backend' => (string)$l->t('Local'),
Robin McCorkell's avatar
Robin McCorkell committed
47
	'priority' => 150,
48
	'configuration' => array(
Volkan Gezer's avatar
Volkan Gezer committed
49
		'datadir' => (string)$l->t('Location'))));
50
51

OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
Volkan Gezer's avatar
Volkan Gezer committed
52
	'backend' => (string)$l->t('Amazon S3'),
Robin McCorkell's avatar
Robin McCorkell committed
53
	'priority' => 100,
54
	'configuration' => array(
Volkan Gezer's avatar
Volkan Gezer committed
55
56
57
		'key' => (string)$l->t('Key'),
		'secret' => '*'.$l->t('Secret'),
		'bucket' => (string)$l->t('Bucket')),
58
	'has_dependencies' => true));
59

60
OC_Mount_Config::registerBackend('\OC\Files\Storage\AmazonS3', array(
Volkan Gezer's avatar
Volkan Gezer committed
61
	'backend' => (string)$l->t('Amazon S3 and compliant'),
Robin McCorkell's avatar
Robin McCorkell committed
62
	'priority' => 100,
63
	'configuration' => array(
Volkan Gezer's avatar
Volkan Gezer committed
64
65
66
		'key' => (string)$l->t('Access Key'),
		'secret' => '*'.$l->t('Secret Key'),
		'bucket' => (string)$l->t('Bucket'),
67
68
69
		'hostname' => '&'.$l->t('Hostname'),
		'port' => '&'.$l->t('Port'),
		'region' => '&'.$l->t('Region'),
Volkan Gezer's avatar
Volkan Gezer committed
70
71
		'use_ssl' => '!'.$l->t('Enable SSL'),
		'use_path_style' => '!'.$l->t('Enable Path Style')),
72
73
	'has_dependencies' => true));

74
75
OC_Mount_Config::registerBackend('\OC\Files\Storage\Dropbox', array(
	'backend' => 'Dropbox',
Robin McCorkell's avatar
Robin McCorkell committed
76
	'priority' => 100,
77
78
	'configuration' => array(
		'configured' => '#configured',
Volkan Gezer's avatar
Volkan Gezer committed
79
80
		'app_key' => (string)$l->t('App key'),
		'app_secret' => '*'.$l->t('App secret'),
81
82
		'token' => '#token',
		'token_secret' => '#token_secret'),
83
84
	'custom' => 'dropbox',
	'has_dependencies' => true));
85
86
87

OC_Mount_Config::registerBackend('\OC\Files\Storage\FTP', array(
	'backend' => 'FTP',
Robin McCorkell's avatar
Robin McCorkell committed
88
	'priority' => 100,
89
	'configuration' => array(
fibsifan's avatar
fibsifan committed
90
		'host' => (string)$l->t('Host'),
Volkan Gezer's avatar
Volkan Gezer committed
91
92
		'user' => (string)$l->t('Username'),
		'password' => '*'.$l->t('Password'),
93
		'root' => '&'.$l->t('Remote subfolder'),
Volkan Gezer's avatar
Volkan Gezer committed
94
		'secure' => '!'.$l->t('Secure ftps://')),
95
96
97
98
	'has_dependencies' => true));

OC_Mount_Config::registerBackend('\OC\Files\Storage\Google', array(
	'backend' => 'Google Drive',
Robin McCorkell's avatar
Robin McCorkell committed
99
	'priority' => 100,
100
101
	'configuration' => array(
		'configured' => '#configured',
Volkan Gezer's avatar
Volkan Gezer committed
102
103
		'client_id' => (string)$l->t('Client ID'),
		'client_secret' => '*'.$l->t('Client secret'),
104
		'token' => '#token'),
105
106
	'custom' => 'google',
	'has_dependencies' => true));
107

108
109

OC_Mount_Config::registerBackend('\OC\Files\Storage\Swift', array(
Volkan Gezer's avatar
Volkan Gezer committed
110
	'backend' => (string)$l->t('OpenStack Object Storage'),
Robin McCorkell's avatar
Robin McCorkell committed
111
	'priority' => 100,
112
	'configuration' => array(
113
114
		'user' => (string)$l->t('Username'),
		'bucket' => (string)$l->t('Bucket'),
Volkan Gezer's avatar
Volkan Gezer committed
115
		'region' => '&'.$l->t('Region (optional for OpenStack Object Storage)'),
116
		'key' => '&*'.$l->t('API Key (required for Rackspace Cloud Files)'),
Volkan Gezer's avatar
Volkan Gezer committed
117
		'tenant' => '&'.$l->t('Tenantname (required for OpenStack Object Storage)'),
118
		'password' => '&*'.$l->t('Password (required for OpenStack Object Storage)'),
Volkan Gezer's avatar
Volkan Gezer committed
119
120
		'service_name' => '&'.$l->t('Service Name (required for OpenStack Object Storage)'),
		'url' => '&'.$l->t('URL of identity endpoint (required for OpenStack Object Storage)'),
121
		'timeout' => '&'.$l->t('Timeout of HTTP requests in seconds'),
122
	),
123
	'has_dependencies' => true));
124

125
126
127
128

if (!OC_Util::runningOnWindows()) {
	OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB', array(
		'backend' => 'SMB / CIFS',
Robin McCorkell's avatar
Robin McCorkell committed
129
		'priority' => 100,
130
		'configuration' => array(
fibsifan's avatar
fibsifan committed
131
			'host' => (string)$l->t('Host'),
Volkan Gezer's avatar
Volkan Gezer committed
132
133
134
			'user' => (string)$l->t('Username'),
			'password' => '*'.$l->t('Password'),
			'share' => (string)$l->t('Share'),
135
			'root' => '&'.$l->t('Remote subfolder')),
136
137
138
		'has_dependencies' => true));

	OC_Mount_Config::registerBackend('\OC\Files\Storage\SMB_OC', array(
Volkan Gezer's avatar
Volkan Gezer committed
139
			'backend' => (string)$l->t('SMB / CIFS using OC login'),
Robin McCorkell's avatar
Robin McCorkell committed
140
			'priority' => 90,
141
			'configuration' => array(
fibsifan's avatar
fibsifan committed
142
				'host' => (string)$l->t('Host'),
Volkan Gezer's avatar
Volkan Gezer committed
143
144
				'username_as_share' => '!'.$l->t('Username as share'),
				'share' => '&'.$l->t('Share'),
145
				'root' => '&'.$l->t('Remote subfolder')),
146
147
148
149
150
		'has_dependencies' => true));
}

OC_Mount_Config::registerBackend('\OC\Files\Storage\DAV', array(
	'backend' => 'WebDAV',
Robin McCorkell's avatar
Robin McCorkell committed
151
	'priority' => 100,
152
	'configuration' => array(
Volkan Gezer's avatar
Volkan Gezer committed
153
154
155
		'host' => (string)$l->t('URL'),
		'user' => (string)$l->t('Username'),
		'password' => '*'.$l->t('Password'),
156
		'root' => '&'.$l->t('Remote subfolder'),
Volkan Gezer's avatar
Volkan Gezer committed
157
		'secure' => '!'.$l->t('Secure https://')),
158
159
	'has_dependencies' => true));

160
161
OC_Mount_Config::registerBackend('\OC\Files\Storage\OwnCloud', array(
	'backend' => 'ownCloud',
Robin McCorkell's avatar
Robin McCorkell committed
162
	'priority' => 100,
163
	'configuration' => array(
Volkan Gezer's avatar
Volkan Gezer committed
164
165
166
167
168
		'host' => (string)$l->t('URL'),
		'user' => (string)$l->t('Username'),
		'password' => '*'.$l->t('Password'),
		'root' => '&'.$l->t('Remote subfolder'),
		'secure' => '!'.$l->t('Secure https://'))));
169

170
171
172

OC_Mount_Config::registerBackend('\OC\Files\Storage\SFTP', array(
	'backend' => 'SFTP',
Robin McCorkell's avatar
Robin McCorkell committed
173
	'priority' => 100,
174
	'configuration' => array(
fibsifan's avatar
fibsifan committed
175
		'host' => (string)$l->t('Host'),
Volkan Gezer's avatar
Volkan Gezer committed
176
177
		'user' => (string)$l->t('Username'),
		'password' => '*'.$l->t('Password'),
178
		'root' => '&'.$l->t('Remote subfolder'))));
179

180
181
$mountProvider = new \OCA\Files_External\Config\ConfigAdapter();
\OC::$server->getMountProviderCollection()->registerProvider($mountProvider);