Completed
Pull Request — master (#4569)
by Morris
15:24
created
settings/personal.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -74,72 +74,72 @@  discard block
 block discarded – undo
74 74
 
75 75
 // array of common languages
76 76
 $commonLangCodes = array(
77
-	'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
77
+    'en', 'es', 'fr', 'de', 'de_DE', 'ja', 'ar', 'ru', 'nl', 'it', 'pt_BR', 'pt_PT', 'da', 'fi_FI', 'nb_NO', 'sv', 'tr', 'zh_CN', 'ko'
78 78
 );
79 79
 
80 80
 $languages=array();
81 81
 $commonLanguages = array();
82 82
 foreach($languageCodes as $lang) {
83
-	$l = \OC::$server->getL10N('settings', $lang);
84
-	// TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
85
-	$potentialName = (string) $l->t('__language_name__');
86
-	if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
87
-		$ln = array('code' => $lang, 'name' => $potentialName);
88
-	} elseif ($lang === 'en') {
89
-		$ln = ['code' => $lang, 'name' => 'English (US)'];
90
-	}else{//fallback to language code
91
-		$ln=array('code'=>$lang, 'name'=>$lang);
92
-	}
93
-
94
-	// put appropriate languages into appropriate arrays, to print them sorted
95
-	// used language -> common languages -> divider -> other languages
96
-	if ($lang === $userLang) {
97
-		$userLang = $ln;
98
-	} elseif (in_array($lang, $commonLangCodes)) {
99
-		$commonLanguages[array_search($lang, $commonLangCodes)]=$ln;
100
-	} else {
101
-		$languages[]=$ln;
102
-	}
83
+    $l = \OC::$server->getL10N('settings', $lang);
84
+    // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version
85
+    $potentialName = (string) $l->t('__language_name__');
86
+    if($l->getLanguageCode() === $lang && substr($potentialName, 0, 1) !== '_') {//first check if the language name is in the translation file
87
+        $ln = array('code' => $lang, 'name' => $potentialName);
88
+    } elseif ($lang === 'en') {
89
+        $ln = ['code' => $lang, 'name' => 'English (US)'];
90
+    }else{//fallback to language code
91
+        $ln=array('code'=>$lang, 'name'=>$lang);
92
+    }
93
+
94
+    // put appropriate languages into appropriate arrays, to print them sorted
95
+    // used language -> common languages -> divider -> other languages
96
+    if ($lang === $userLang) {
97
+        $userLang = $ln;
98
+    } elseif (in_array($lang, $commonLangCodes)) {
99
+        $commonLanguages[array_search($lang, $commonLangCodes)]=$ln;
100
+    } else {
101
+        $languages[]=$ln;
102
+    }
103 103
 }
104 104
 
105 105
 // if user language is not available but set somehow: show the actual code as name
106 106
 if (!is_array($userLang)) {
107
-	$userLang = [
108
-		'code' => $userLang,
109
-		'name' => $userLang,
110
-	];
107
+    $userLang = [
108
+        'code' => $userLang,
109
+        'name' => $userLang,
110
+    ];
111 111
 }
112 112
 
113 113
 ksort($commonLanguages);
114 114
 
115 115
 // sort now by displayed language not the iso-code
116 116
 usort( $languages, function ($a, $b) {
117
-	if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
118
-		// If a doesn't have a name, but b does, list b before a
119
-		return 1;
120
-	}
121
-	if ($a['code'] !== $a['name'] && $b['code'] === $b['name']) {
122
-		// If a does have a name, but b doesn't, list a before b
123
-		return -1;
124
-	}
125
-	// Otherwise compare the names
126
-	return strcmp($a['name'], $b['name']);
117
+    if ($a['code'] === $a['name'] && $b['code'] !== $b['name']) {
118
+        // If a doesn't have a name, but b does, list b before a
119
+        return 1;
120
+    }
121
+    if ($a['code'] !== $a['name'] && $b['code'] === $b['name']) {
122
+        // If a does have a name, but b doesn't, list a before b
123
+        return -1;
124
+    }
125
+    // Otherwise compare the names
126
+    return strcmp($a['name'], $b['name']);
127 127
 });
128 128
 
129 129
 //links to clients
130 130
 $clients = array(
131
-	'desktop' => $config->getSystemValue('customclient_desktop', $defaults->getSyncClientUrl()),
132
-	'android' => $config->getSystemValue('customclient_android', $defaults->getAndroidClientUrl()),
133
-	'ios'     => $config->getSystemValue('customclient_ios', $defaults->getiOSClientUrl())
131
+    'desktop' => $config->getSystemValue('customclient_desktop', $defaults->getSyncClientUrl()),
132
+    'android' => $config->getSystemValue('customclient_android', $defaults->getAndroidClientUrl()),
133
+    'ios'     => $config->getSystemValue('customclient_ios', $defaults->getiOSClientUrl())
134 134
 );
135 135
 
136 136
 // only show root certificate import if external storages are enabled
137 137
 $enableCertImport = false;
138 138
 $externalStorageEnabled = \OC::$server->getAppManager()->isEnabledForUser('files_external');
139 139
 if ($externalStorageEnabled) {
140
-	/** @var \OCA\Files_External\Service\BackendService $backendService */
141
-	$backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
142
-	$enableCertImport = $backendService->isUserMountingAllowed();
140
+    /** @var \OCA\Files_External\Service\BackendService $backendService */
141
+    $backendService = \OC_Mount_Config::$app->getContainer()->query('\OCA\Files_External\Service\BackendService');
142
+    $enableCertImport = $backendService->isUserMountingAllowed();
143 143
 }
144 144
 
145 145
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 $tmpl = new OC_Template( 'settings', 'personal', 'user');
149 149
 $tmpl->assign('usage', OC_Helper::humanFileSize($storageInfo['used']));
150 150
 if ($storageInfo['quota'] === \OCP\Files\FileInfo::SPACE_UNLIMITED) {
151
-	$totalSpace = $l->t('Unlimited');
151
+    $totalSpace = $l->t('Unlimited');
152 152
 } else {
153
-	$totalSpace = OC_Helper::humanFileSize($storageInfo['total']);
153
+    $totalSpace = OC_Helper::humanFileSize($storageInfo['total']);
154 154
 }
155 155
 
156 156
 $uid = $user->getUID();
@@ -208,35 +208,35 @@  discard block
 block discarded – undo
208 208
 
209 209
 // add bottom hardcoded forms from the template
210 210
 if ($enableCertImport) {
211
-	$certificatesTemplate = new OC_Template('settings', 'certificates');
212
-	$certificatesTemplate->assign('type', 'personal');
213
-	$certificatesTemplate->assign('uploadRoute', 'settings.Certificate.addPersonalRootCertificate');
214
-	$certificatesTemplate->assign('certs', $certificateManager->listCertificates());
215
-	$certificatesTemplate->assign('urlGenerator', $urlGenerator);
216
-	$forms[] = $certificatesTemplate->fetchPage();
211
+    $certificatesTemplate = new OC_Template('settings', 'certificates');
212
+    $certificatesTemplate->assign('type', 'personal');
213
+    $certificatesTemplate->assign('uploadRoute', 'settings.Certificate.addPersonalRootCertificate');
214
+    $certificatesTemplate->assign('certs', $certificateManager->listCertificates());
215
+    $certificatesTemplate->assign('urlGenerator', $urlGenerator);
216
+    $forms[] = $certificatesTemplate->fetchPage();
217 217
 }
218 218
 
219 219
 $formsMap = array_map(function($form){
220
-	if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
221
-		$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
222
-		$sectionName = str_replace('</h2>', '', $sectionName);
223
-		if (strpos($regs['class'], 'data-anchor-name') !== false) {
224
-			preg_match('%.*data-anchor-name="(?P<anchor>[^"]*)"%i', $regs['class'], $matches);
225
-			$anchor = $matches['anchor'];
226
-		} else {
227
-			$anchor = strtolower($sectionName);
228
-			$anchor = str_replace(' ', '-', $anchor);
229
-		}
230
-
231
-		return array(
232
-			'anchor' => $anchor,
233
-			'section-name' => $sectionName,
234
-			'form' => $form
235
-		);
236
-	}
237
-	return array(
238
-		'form' => $form
239
-	);
220
+    if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
221
+        $sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
222
+        $sectionName = str_replace('</h2>', '', $sectionName);
223
+        if (strpos($regs['class'], 'data-anchor-name') !== false) {
224
+            preg_match('%.*data-anchor-name="(?P<anchor>[^"]*)"%i', $regs['class'], $matches);
225
+            $anchor = $matches['anchor'];
226
+        } else {
227
+            $anchor = strtolower($sectionName);
228
+            $anchor = str_replace(' ', '-', $anchor);
229
+        }
230
+
231
+        return array(
232
+            'anchor' => $anchor,
233
+            'section-name' => $sectionName,
234
+            'form' => $form
235
+        );
236
+    }
237
+    return array(
238
+        'form' => $form
239
+    );
240 240
 }, $forms);
241 241
 
242 242
 $formsAndMore = array_merge($formsAndMore, $formsMap);
Please login to merge, or discard this patch.
apps/files_external/templates/settings.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,9 +87,9 @@
 block discarded – undo
87 87
 	}
88 88
 ?>
89 89
 
90
-<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
90
+<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>">
91 91
 	<h2 data-anchor-name="external-storage"><?php p($l->t('External storage')); ?></h2>
92
-	<?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
92
+	<?php if (isset($_['dependencies']) and ($_['dependencies'] <> '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
93 93
 	<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
94 94
 		<thead>
95 95
 			<tr>
Please login to merge, or discard this patch.
Braces   +24 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,7 +89,10 @@  discard block
 block discarded – undo
89 89
 
90 90
 <form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
91 91
 	<h2 data-anchor-name="external-storage"><?php p($l->t('External storage')); ?></h2>
92
-	<?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
92
+	<?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) {
93
+    print_unescaped(''.$_['dependencies'].'');
94
+}
95
+?>
93 96
 	<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
94 97
 		<thead>
95 98
 			<tr>
@@ -98,7 +101,10 @@  discard block
 block discarded – undo
98 101
 				<th><?php p($l->t('External storage')); ?></th>
99 102
 				<th><?php p($l->t('Authentication')); ?></th>
100 103
 				<th><?php p($l->t('Configuration')); ?></th>
101
-				<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?>
104
+				<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) {
105
+    print_unescaped('<th>'.$l->t('Available for').'</th>');
106
+}
107
+?>
102 108
 				<th>&nbsp;</th>
103 109
 				<th>&nbsp;</th>
104 110
 			</tr>
@@ -130,7 +136,10 @@  discard block
 block discarded – undo
130 136
 							});
131 137
 						?>
132 138
 						<?php foreach ($sortedBackends as $backend): ?>
133
-							<?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?>
139
+							<?php if ($backend->getDeprecateTo()) {
140
+    continue;
141
+}
142
+// ignore deprecated backends ?>
134 143
 							<option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option>
135 144
 						<?php endforeach; ?>
136 145
 					</select>
@@ -169,7 +178,10 @@  discard block
 block discarded – undo
169 178
 
170 179
 	<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
171 180
 		<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
172
-			value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
181
+			value="1" <?php if ($_['allowUserMounting'] == 'yes') {
182
+    print_unescaped(' checked="checked"');
183
+}
184
+?> />
173 185
 		<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
174 186
 
175 187
 		<p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>>
@@ -182,8 +194,14 @@  discard block
 block discarded – undo
182 194
 			<?php $i = 0; foreach ($userBackends as $backend): ?>
183 195
 				<?php if ($deprecateTo = $backend->getDeprecateTo()): ?>
184 196
 					<input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" />
185
-				<?php else: ?>
186
-					<input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> />
197
+				<?php else {
198
+    : ?>
199
+					<input type="checkbox" id="allowUserMountingBackends<?php p($i);
200
+}
201
+?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) {
202
+    print_unescaped(' checked="checked"');
203
+}
204
+?> />
187 205
 					<label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br />
188 206
 				<?php endif; ?>
189 207
 				<?php $i++; ?>
Please login to merge, or discard this patch.
apps/encryption/templates/settings-personal.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,57 +7,57 @@  discard block
 block discarded – undo
7 7
 <form id="ocDefaultEncryptionModule" class="section">
8 8
 	<h2 data-anchor-name="basic-encryption-module"><?php p($l->t('Basic encryption module')); ?></h2>
9 9
 
10
-	<?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED ): ?>
10
+	<?php if ($_["initialized"] === \OCA\Encryption\Session::NOT_INITIALIZED): ?>
11 11
 
12 12
 	<?php p($l->t("Encryption App is enabled, but your keys are not initialized. Please log-out and log-in again.")); ?>
13 13
 
14
-	<?php elseif ( $_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED ): ?>
14
+	<?php elseif ($_["initialized"] === \OCA\Encryption\Session::INIT_EXECUTED): ?>
15 15
 		<p>
16 16
 			<a name="changePKPasswd" />
17 17
 			<label for="changePrivateKeyPasswd">
18
-				<em><?php p( $l->t( "Your private key password no longer matches your log-in password." ) ); ?></em>
18
+				<em><?php p($l->t("Your private key password no longer matches your log-in password.")); ?></em>
19 19
 			</label>
20 20
 			<br />
21
-			<?php p( $l->t( "Set your old private key password to your current log-in password:" ) ); ?>
22
-			<?php if (  $_["recoveryEnabledForUser"] ):
23
-					p( $l->t( " If you don't remember your old password you can ask your administrator to recover your files." ) );
21
+			<?php p($l->t("Set your old private key password to your current log-in password:")); ?>
22
+			<?php if ($_["recoveryEnabledForUser"]):
23
+					p($l->t(" If you don't remember your old password you can ask your administrator to recover your files."));
24 24
 			endif; ?>
25 25
 			<br />
26 26
 			<input
27 27
 				type="password"
28 28
 				name="changePrivateKeyPassword"
29 29
 				id="oldPrivateKeyPassword" />
30
-			<label for="oldPrivateKeyPassword"><?php p($l->t( "Old log-in password" )); ?></label>
30
+			<label for="oldPrivateKeyPassword"><?php p($l->t("Old log-in password")); ?></label>
31 31
 			<br />
32 32
 			<input
33 33
 				type="password"
34 34
 				name="changePrivateKeyPassword"
35 35
 				id="newPrivateKeyPassword" />
36
-			<label for="newRecoveryPassword"><?php p($l->t( "Current log-in password" )); ?></label>
36
+			<label for="newRecoveryPassword"><?php p($l->t("Current log-in password")); ?></label>
37 37
 			<br />
38 38
 			<button
39 39
 				type="button"
40 40
 				name="submitChangePrivateKeyPassword"
41
-				disabled><?php p($l->t( "Update Private Key Password" )); ?>
41
+				disabled><?php p($l->t("Update Private Key Password")); ?>
42 42
 			</button>
43 43
 			<span class="msg"></span>
44 44
 		</p>
45 45
 
46
-	<?php elseif ( $_["recoveryEnabled"] && $_["privateKeySet"] &&  $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL ): ?>
46
+	<?php elseif ($_["recoveryEnabled"] && $_["privateKeySet"] && $_["initialized"] === \OCA\Encryption\Session::INIT_SUCCESSFUL): ?>
47 47
 		<br />
48 48
 		<p id="userEnableRecovery">
49
-			<label for="userEnableRecovery"><?php p( $l->t( "Enable password recovery:" ) ); ?></label>
49
+			<label for="userEnableRecovery"><?php p($l->t("Enable password recovery:")); ?></label>
50 50
 			<span class="msg"></span>
51 51
 			<br />
52
-			<em><?php p( $l->t( "Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" ) ); ?></em>
52
+			<em><?php p($l->t("Enabling this option will allow you to reobtain access to your encrypted files in case of password loss")); ?></em>
53 53
 			<br />
54 54
 			<input
55 55
 			type='radio'
56 56
 			id='userEnableRecoveryCheckbox'
57 57
 			name='userEnableRecovery'
58 58
 			value='1'
59
-			<?php echo ( $_["recoveryEnabledForUser"] ? 'checked="checked"' : '' ); ?> />
60
-			<label for="userEnableRecoveryCheckbox"><?php p( $l->t( "Enabled" ) ); ?></label>
59
+			<?php echo ($_["recoveryEnabledForUser"] ? 'checked="checked"' : ''); ?> />
60
+			<label for="userEnableRecoveryCheckbox"><?php p($l->t("Enabled")); ?></label>
61 61
 			<br />
62 62
 
63 63
 			<input
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 			id='userDisableRecoveryCheckbox'
66 66
 			name='userEnableRecovery'
67 67
 			value='0'
68
-			<?php echo ( $_["recoveryEnabledForUser"] === false ? 'checked="checked"' : '' ); ?> />
69
-			<label for="userDisableRecoveryCheckbox"><?php p( $l->t( "Disabled" ) ); ?></label>
68
+			<?php echo ($_["recoveryEnabledForUser"] === false ? 'checked="checked"' : ''); ?> />
69
+			<label for="userDisableRecoveryCheckbox"><?php p($l->t("Disabled")); ?></label>
70 70
 		</p>
71 71
 	<?php endif; ?>
72 72
 </form>
Please login to merge, or discard this patch.