@@ -41,17 +41,17 @@ discard block |
||
41 | 41 | */ |
42 | 42 | 'instanceid' => '', |
43 | 43 | |
44 | - /** |
|
45 | - * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | - * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | - * all your passwords. This example is for documentation only, and you should |
|
48 | - * never use it. |
|
49 | - * |
|
50 | - * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | - * developers should *NOT* use this value for anything nowadays. |
|
52 | - * |
|
53 | - * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | - */ |
|
44 | + /** |
|
45 | + * The salt used to hash all passwords, auto-generated by the Nextcloud |
|
46 | + * installer. (There are also per-user salts.) If you lose this salt you lose |
|
47 | + * all your passwords. This example is for documentation only, and you should |
|
48 | + * never use it. |
|
49 | + * |
|
50 | + * @deprecated This salt is deprecated and only used for legacy-compatibility, |
|
51 | + * developers should *NOT* use this value for anything nowadays. |
|
52 | + * |
|
53 | + * 'passwordsalt' => 'd3c944a9af095aa08f', |
|
54 | + */ |
|
55 | 55 | 'passwordsalt' => '', |
56 | 56 | |
57 | 57 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * ubos-raspberry-pi.local and ubos-raspberry-pi-2.local |
68 | 68 | */ |
69 | 69 | 'trusted_domains' => |
70 | - array ( |
|
70 | + array ( |
|
71 | 71 | 'demo.example.org', |
72 | 72 | 'otherdomain.example.org', |
73 | - ), |
|
73 | + ), |
|
74 | 74 | |
75 | 75 | |
76 | 76 | /** |
@@ -283,10 +283,10 @@ discard block |
||
283 | 283 | * IMAP (OC_User_IMAP), SMB (OC_User_SMB), and FTP (OC_User_FTP). |
284 | 284 | */ |
285 | 285 | 'user_backends' => array( |
286 | - array( |
|
287 | - 'class' => 'OC_User_IMAP', |
|
288 | - 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
289 | - ) |
|
286 | + array( |
|
287 | + 'class' => 'OC_User_IMAP', |
|
288 | + 'arguments' => array('{imap.gmail.com:993/imap/ssl}INBOX') |
|
289 | + ) |
|
290 | 290 | ), |
291 | 291 | |
292 | 292 | /** |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | * Defaults to an empty array. |
763 | 763 | */ |
764 | 764 | 'log.condition' => [ |
765 | - 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
766 | - 'users' => ['sample-user'], |
|
767 | - 'apps' => ['files'], |
|
765 | + 'shared_secret' => '57b58edb6637fe3059b3595cf9c41b9', |
|
766 | + 'users' => ['sample-user'], |
|
767 | + 'apps' => ['files'], |
|
768 | 768 | ], |
769 | 769 | |
770 | 770 | /** |
@@ -818,18 +818,18 @@ discard block |
||
818 | 818 | * - iOS client app id: ``1125420102`` |
819 | 819 | */ |
820 | 820 | 'customclient_desktop' => |
821 | - 'https://nextcloud.com/install/#install-clients', |
|
821 | + 'https://nextcloud.com/install/#install-clients', |
|
822 | 822 | 'customclient_android' => |
823 | - 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
823 | + 'https://play.google.com/store/apps/details?id=com.nextcloud.client', |
|
824 | 824 | 'customclient_ios' => |
825 | - 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
825 | + 'https://itunes.apple.com/us/app/nextcloud/id1125420102?mt=8', |
|
826 | 826 | 'customclient_ios_appid' => |
827 | - '1125420102', |
|
827 | + '1125420102', |
|
828 | 828 | /** |
829 | - * Apps |
|
830 | - * |
|
831 | - * Options for the Apps folder, Apps store, and App code checker. |
|
832 | - */ |
|
829 | + * Apps |
|
830 | + * |
|
831 | + * Options for the Apps folder, Apps store, and App code checker. |
|
832 | + */ |
|
833 | 833 | |
834 | 834 | /** |
835 | 835 | * When enabled, admins may install apps from the Nextcloud app store. |
@@ -847,11 +847,11 @@ discard block |
||
847 | 847 | * indicates if a Web server can write files to that folder. |
848 | 848 | */ |
849 | 849 | 'apps_paths' => array( |
850 | - array( |
|
851 | - 'path'=> '/var/www/nextcloud/apps', |
|
852 | - 'url' => '/apps', |
|
853 | - 'writable' => true, |
|
854 | - ), |
|
850 | + array( |
|
851 | + 'path'=> '/var/www/nextcloud/apps', |
|
852 | + 'url' => '/apps', |
|
853 | + 'writable' => true, |
|
854 | + ), |
|
855 | 855 | ), |
856 | 856 | |
857 | 857 | /** |
@@ -916,8 +916,8 @@ discard block |
||
916 | 916 | * Defaults to ``''`` (empty string) |
917 | 917 | */ |
918 | 918 | 'preview_office_cl_parameters' => |
919 | - ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
920 | - '--convert-to png --outdir ', |
|
919 | + ' --headless --nologo --nofirststartwizard --invisible --norestore '. |
|
920 | + '--convert-to png --outdir ', |
|
921 | 921 | |
922 | 922 | /** |
923 | 923 | * Only register providers that have been explicitly enabled |
@@ -960,14 +960,14 @@ discard block |
||
960 | 960 | * - OC\Preview\XBitmap |
961 | 961 | */ |
962 | 962 | 'enabledPreviewProviders' => array( |
963 | - 'OC\Preview\PNG', |
|
964 | - 'OC\Preview\JPEG', |
|
965 | - 'OC\Preview\GIF', |
|
966 | - 'OC\Preview\BMP', |
|
967 | - 'OC\Preview\XBitmap', |
|
968 | - 'OC\Preview\MP3', |
|
969 | - 'OC\Preview\TXT', |
|
970 | - 'OC\Preview\MarkDown' |
|
963 | + 'OC\Preview\PNG', |
|
964 | + 'OC\Preview\JPEG', |
|
965 | + 'OC\Preview\GIF', |
|
966 | + 'OC\Preview\BMP', |
|
967 | + 'OC\Preview\XBitmap', |
|
968 | + 'OC\Preview\MP3', |
|
969 | + 'OC\Preview\TXT', |
|
970 | + 'OC\Preview\MarkDown' |
|
971 | 971 | ), |
972 | 972 | |
973 | 973 | /** |
@@ -1043,11 +1043,11 @@ discard block |
||
1043 | 1043 | |
1044 | 1044 | /** |
1045 | 1045 | * Extra SSL options to be used for configuration. |
1046 | - * |
|
1046 | + * |
|
1047 | 1047 | * Defaults to an empty array. |
1048 | 1048 | */ |
1049 | 1049 | 'openssl' => array( |
1050 | - 'config' => '/absolute/location/of/openssl.cnf', |
|
1050 | + 'config' => '/absolute/location/of/openssl.cnf', |
|
1051 | 1051 | ), |
1052 | 1052 | |
1053 | 1053 | /** |
@@ -1095,11 +1095,11 @@ discard block |
||
1095 | 1095 | * for more information. |
1096 | 1096 | */ |
1097 | 1097 | 'redis' => [ |
1098 | - 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1099 | - 'port' => 6379, |
|
1100 | - 'timeout' => 0.0, |
|
1101 | - 'password' => '', // Optional, if not defined no password will be used. |
|
1102 | - 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1098 | + 'host' => 'localhost', // can also be a unix domain socket: '/tmp/redis.sock' |
|
1099 | + 'port' => 6379, |
|
1100 | + 'timeout' => 0.0, |
|
1101 | + 'password' => '', // Optional, if not defined no password will be used. |
|
1102 | + 'dbindex' => 0, // Optional, if undefined SELECT will not run and will use Redis Server's default DB Index. |
|
1103 | 1103 | ], |
1104 | 1104 | |
1105 | 1105 | /** |
@@ -1125,13 +1125,13 @@ discard block |
||
1125 | 1125 | * See https://redis.io/topics/cluster-spec for details about the Redis cluster |
1126 | 1126 | */ |
1127 | 1127 | 'redis.cluster' => [ |
1128 | - 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1129 | - 'localhost:7000', |
|
1130 | - 'localhost:7001' |
|
1131 | - ], |
|
1132 | - 'timeout' => 0.0, |
|
1133 | - 'read_timeout' => 0.0, |
|
1134 | - 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1128 | + 'seeds' => [ // provide some/all of the cluster servers to bootstrap discovery, port required |
|
1129 | + 'localhost:7000', |
|
1130 | + 'localhost:7001' |
|
1131 | + ], |
|
1132 | + 'timeout' => 0.0, |
|
1133 | + 'read_timeout' => 0.0, |
|
1134 | + 'failover_mode' => \RedisCluster::FAILOVER_ERROR |
|
1135 | 1135 | ], |
1136 | 1136 | |
1137 | 1137 | |
@@ -1139,35 +1139,35 @@ discard block |
||
1139 | 1139 | * Server details for one or more memcached servers to use for memory caching. |
1140 | 1140 | */ |
1141 | 1141 | 'memcached_servers' => array( |
1142 | - // hostname, port and optional weight. Also see: |
|
1143 | - // http://www.php.net/manual/en/memcached.addservers.php |
|
1144 | - // http://www.php.net/manual/en/memcached.addserver.php |
|
1145 | - array('localhost', 11211), |
|
1146 | - //array('other.host.local', 11211), |
|
1142 | + // hostname, port and optional weight. Also see: |
|
1143 | + // http://www.php.net/manual/en/memcached.addservers.php |
|
1144 | + // http://www.php.net/manual/en/memcached.addserver.php |
|
1145 | + array('localhost', 11211), |
|
1146 | + //array('other.host.local', 11211), |
|
1147 | 1147 | ), |
1148 | 1148 | |
1149 | 1149 | /** |
1150 | 1150 | * Connection options for memcached, see http://apprize.info/php/scaling/15.html |
1151 | 1151 | */ |
1152 | 1152 | 'memcached_options' => array( |
1153 | - // Set timeouts to 50ms |
|
1154 | - \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1155 | - \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1156 | - \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1157 | - \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1158 | - \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1153 | + // Set timeouts to 50ms |
|
1154 | + \Memcached::OPT_CONNECT_TIMEOUT => 50, |
|
1155 | + \Memcached::OPT_RETRY_TIMEOUT => 50, |
|
1156 | + \Memcached::OPT_SEND_TIMEOUT => 50, |
|
1157 | + \Memcached::OPT_RECV_TIMEOUT => 50, |
|
1158 | + \Memcached::OPT_POLL_TIMEOUT => 50, |
|
1159 | 1159 | |
1160 | - // Enable compression |
|
1161 | - \Memcached::OPT_COMPRESSION => true, |
|
1160 | + // Enable compression |
|
1161 | + \Memcached::OPT_COMPRESSION => true, |
|
1162 | 1162 | |
1163 | - // Turn on consistent hashing |
|
1164 | - \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1163 | + // Turn on consistent hashing |
|
1164 | + \Memcached::OPT_LIBKETAMA_COMPATIBLE => true, |
|
1165 | 1165 | |
1166 | - // Enable Binary Protocol |
|
1167 | - \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1166 | + // Enable Binary Protocol |
|
1167 | + \Memcached::OPT_BINARY_PROTOCOL => true, |
|
1168 | 1168 | |
1169 | - // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1170 | - //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1169 | + // Binary serializer vill be enabled if the igbinary PECL module is available |
|
1170 | + //\Memcached::OPT_SERIALIZER => \Memcached::SERIALIZER_IGBINARY, |
|
1171 | 1171 | ), |
1172 | 1172 | |
1173 | 1173 | |
@@ -1213,61 +1213,61 @@ discard block |
||
1213 | 1213 | * One way to test is applying for a trystack account at http://trystack.org/ |
1214 | 1214 | */ |
1215 | 1215 | 'objectstore' => [ |
1216 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1217 | - 'arguments' => [ |
|
1218 | - // trystack will use your facebook id as the user name |
|
1219 | - 'username' => 'facebook100000123456789', |
|
1220 | - // in the trystack dashboard go to user -> settings -> API Password to |
|
1221 | - // generate a password |
|
1222 | - 'password' => 'Secr3tPaSSWoRdt7', |
|
1223 | - // must already exist in the objectstore, name can be different |
|
1224 | - 'container' => 'nextcloud', |
|
1225 | - // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1226 | - 'objectPrefix' => 'oid:urn:', |
|
1227 | - // create the container if it does not exist. default is false |
|
1228 | - 'autocreate' => true, |
|
1229 | - // required, dev-/trystack defaults to 'RegionOne' |
|
1230 | - 'region' => 'RegionOne', |
|
1231 | - // The Identity / Keystone endpoint |
|
1232 | - 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1233 | - // required on dev-/trystack |
|
1234 | - 'tenantName' => 'facebook100000123456789', |
|
1235 | - // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1236 | - // if omitted |
|
1237 | - 'serviceName' => 'swift', |
|
1238 | - // The Interface / url Type, optional |
|
1239 | - 'urlType' => 'internal' |
|
1240 | - ], |
|
1216 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1217 | + 'arguments' => [ |
|
1218 | + // trystack will use your facebook id as the user name |
|
1219 | + 'username' => 'facebook100000123456789', |
|
1220 | + // in the trystack dashboard go to user -> settings -> API Password to |
|
1221 | + // generate a password |
|
1222 | + 'password' => 'Secr3tPaSSWoRdt7', |
|
1223 | + // must already exist in the objectstore, name can be different |
|
1224 | + 'container' => 'nextcloud', |
|
1225 | + // prefix to prepend to the fileid, default is 'oid:urn:' |
|
1226 | + 'objectPrefix' => 'oid:urn:', |
|
1227 | + // create the container if it does not exist. default is false |
|
1228 | + 'autocreate' => true, |
|
1229 | + // required, dev-/trystack defaults to 'RegionOne' |
|
1230 | + 'region' => 'RegionOne', |
|
1231 | + // The Identity / Keystone endpoint |
|
1232 | + 'url' => 'http://8.21.28.222:5000/v2.0', |
|
1233 | + // required on dev-/trystack |
|
1234 | + 'tenantName' => 'facebook100000123456789', |
|
1235 | + // dev-/trystack uses swift by default, the lib defaults to 'cloudFiles' |
|
1236 | + // if omitted |
|
1237 | + 'serviceName' => 'swift', |
|
1238 | + // The Interface / url Type, optional |
|
1239 | + 'urlType' => 'internal' |
|
1240 | + ], |
|
1241 | 1241 | ], |
1242 | 1242 | |
1243 | 1243 | /** |
1244 | 1244 | * To use swift V3 |
1245 | 1245 | */ |
1246 | 1246 | 'objectstore' => [ |
1247 | - 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1248 | - 'arguments' => [ |
|
1249 | - 'autocreate' => true, |
|
1250 | - 'user' => [ |
|
1251 | - 'name' => 'swift', |
|
1252 | - 'password' => 'swift', |
|
1253 | - 'domain' => [ |
|
1254 | - 'name' => 'default', |
|
1255 | - ], |
|
1256 | - ], |
|
1257 | - 'scope' => [ |
|
1258 | - 'project' => [ |
|
1259 | - 'name' => 'service', |
|
1260 | - 'domain' => [ |
|
1261 | - 'name' => 'default', |
|
1262 | - ], |
|
1263 | - ], |
|
1264 | - ], |
|
1265 | - 'tenantName' => 'service', |
|
1266 | - 'serviceName' => 'swift', |
|
1267 | - 'region' => 'regionOne', |
|
1268 | - 'url' => 'http://yourswifthost:5000/v3', |
|
1269 | - 'bucket' => 'nextcloud', |
|
1270 | - ], |
|
1247 | + 'class' => 'OC\\Files\\ObjectStore\\Swift', |
|
1248 | + 'arguments' => [ |
|
1249 | + 'autocreate' => true, |
|
1250 | + 'user' => [ |
|
1251 | + 'name' => 'swift', |
|
1252 | + 'password' => 'swift', |
|
1253 | + 'domain' => [ |
|
1254 | + 'name' => 'default', |
|
1255 | + ], |
|
1256 | + ], |
|
1257 | + 'scope' => [ |
|
1258 | + 'project' => [ |
|
1259 | + 'name' => 'service', |
|
1260 | + 'domain' => [ |
|
1261 | + 'name' => 'default', |
|
1262 | + ], |
|
1263 | + ], |
|
1264 | + ], |
|
1265 | + 'tenantName' => 'service', |
|
1266 | + 'serviceName' => 'swift', |
|
1267 | + 'region' => 'regionOne', |
|
1268 | + 'url' => 'http://yourswifthost:5000/v3', |
|
1269 | + 'bucket' => 'nextcloud', |
|
1270 | + ], |
|
1271 | 1271 | ], |
1272 | 1272 | |
1273 | 1273 | |
@@ -1307,8 +1307,8 @@ discard block |
||
1307 | 1307 | * encryption in MySQL or specify a custom wait timeout on a cheap hoster. |
1308 | 1308 | */ |
1309 | 1309 | 'dbdriveroptions' => array( |
1310 | - PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1311 | - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1310 | + PDO::MYSQL_ATTR_SSL_CA => '/file/path/to/ca_cert.pem', |
|
1311 | + PDO::MYSQL_ATTR_INIT_COMMAND => 'SET wait_timeout = 28800' |
|
1312 | 1312 | ), |
1313 | 1313 | |
1314 | 1314 | /** |
@@ -1365,10 +1365,10 @@ discard block |
||
1365 | 1365 | * - pgsql (PostgreSQL) |
1366 | 1366 | */ |
1367 | 1367 | 'supportedDatabases' => array( |
1368 | - 'sqlite', |
|
1369 | - 'mysql', |
|
1370 | - 'pgsql', |
|
1371 | - 'oci', |
|
1368 | + 'sqlite', |
|
1369 | + 'mysql', |
|
1370 | + 'pgsql', |
|
1371 | + 'oci', |
|
1372 | 1372 | ), |
1373 | 1373 | |
1374 | 1374 | /** |
@@ -1628,8 +1628,8 @@ discard block |
||
1628 | 1628 | * WARNING: only use this if you know what you are doing |
1629 | 1629 | */ |
1630 | 1630 | 'csrf.optout' => array( |
1631 | - '/^WebDAVFS/', // OS X Finder |
|
1632 | - '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1631 | + '/^WebDAVFS/', // OS X Finder |
|
1632 | + '/^Microsoft-WebDAV-MiniRedir/', // Windows webdav drive |
|
1633 | 1633 | ), |
1634 | 1634 | |
1635 | 1635 | /** |
@@ -4,9 +4,9 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | - p($theme->getTitle()); |
|
9 | - ?> |
|
7 | + p(!empty($_['application'])?$_['application'].' - ':''); |
|
8 | + p($theme->getTitle()); |
|
9 | + ?> |
|
10 | 10 | </title> |
11 | 11 | <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
12 | 12 | <meta name="referrer" content="never"> |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | |
46 | 46 | <?php |
47 | - /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
48 | - if(isset($template) && $template->getActionCount() !== 0) { |
|
49 | - $primary = $template->getPrimaryAction(); |
|
50 | - $others = $template->getOtherActions(); |
|
51 | - ?> |
|
47 | + /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
|
48 | + if(isset($template) && $template->getActionCount() !== 0) { |
|
49 | + $primary = $template->getPrimaryAction(); |
|
50 | + $others = $template->getOtherActions(); |
|
51 | + ?> |
|
52 | 52 | <div class="header-right"> |
53 | 53 | <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
54 | 54 | <a href="<?php p($primary->getLink()); ?>"> |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | <div id="header-actions-menu" class="popovermenu menu"> |
62 | 62 | <ul> |
63 | 63 | <?php |
64 | - /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
65 | - foreach($template->getOtherActions() as $action) { |
|
66 | - print_unescaped($action->render()); |
|
67 | - } |
|
68 | - ?> |
|
64 | + /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
|
65 | + foreach($template->getOtherActions() as $action) { |
|
66 | + print_unescaped($action->render()); |
|
67 | + } |
|
68 | + ?> |
|
69 | 69 | </ul> |
70 | 70 | </div> |
71 | 71 | </div> |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | <footer> |
81 | 81 | <p><?php print_unescaped($theme->getLongFooter()); ?></p> |
82 | 82 | <?php |
83 | - if ($_['showSimpleSignUpLink']) { |
|
84 | - ?> |
|
83 | + if ($_['showSimpleSignUpLink']) { |
|
84 | + ?> |
|
85 | 85 | <p> |
86 | 86 | <a href="https://nextcloud.com/signup/" target="_blank" rel="noreferrer noopener">Get your own free account</a> |
87 | 87 | </p> |
88 | 88 | <?php |
89 | - } |
|
90 | - ?> |
|
89 | + } |
|
90 | + ?> |
|
91 | 91 | </footer> |
92 | 92 | <?php } ?> |
93 | 93 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | <meta charset="utf-8"> |
5 | 5 | <title> |
6 | 6 | <?php |
7 | - p(!empty($_['application'])?$_['application'].' - ':''); |
|
7 | + p(!empty($_['application']) ? $_['application'].' - ' : ''); |
|
8 | 8 | p($theme->getTitle()); |
9 | 9 | ?> |
10 | 10 | </title> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | <meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>"> |
15 | 15 | <meta name="apple-mobile-web-app-capable" content="yes"> |
16 | 16 | <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
17 | - <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!=='files')? $_['application']:$theme->getTitle()); ?>"> |
|
17 | + <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid'] !== 'files') ? $_['application'] : $theme->getTitle()); ?>"> |
|
18 | 18 | <meta name="mobile-web-app-capable" content="yes"> |
19 | 19 | <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>"> |
20 | 20 | <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | <?php emit_script_loading_tags($_); ?> |
26 | 26 | <?php print_unescaped($_['headers']); ?> |
27 | 27 | </head> |
28 | -<body id="<?php p($_['bodyid']);?>"> |
|
28 | +<body id="<?php p($_['bodyid']); ?>"> |
|
29 | 29 | <?php include('layout.noscript.warning.php'); ?> |
30 | 30 | <div id="notification-container"> |
31 | 31 | <div id="notification"></div> |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | <span id="nextcloud"> |
36 | 36 | <div class="logo logo-icon svg"></div> |
37 | 37 | <h1 class="header-appname"> |
38 | - <?php if (isset($template)) { p($template->getHeaderTitle()); } else { p($theme->getName());} ?> |
|
38 | + <?php if (isset($template)) { p($template->getHeaderTitle()); } else { p($theme->getName()); } ?> |
|
39 | 39 | </h1> |
40 | 40 | <div class="header-shared-by"> |
41 | 41 | <?php if (isset($template)) { p($template->getHeaderDetails()); } ?> |
@@ -45,24 +45,24 @@ discard block |
||
45 | 45 | |
46 | 46 | <?php |
47 | 47 | /** @var \OCP\AppFramework\Http\Template\PublicTemplateResponse $template */ |
48 | - if(isset($template) && $template->getActionCount() !== 0) { |
|
48 | + if (isset($template) && $template->getActionCount() !== 0) { |
|
49 | 49 | $primary = $template->getPrimaryAction(); |
50 | 50 | $others = $template->getOtherActions(); |
51 | 51 | ?> |
52 | 52 | <div class="header-right"> |
53 | - <span id="header-primary-action" class="<?php if($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
|
53 | + <span id="header-primary-action" class="<?php if ($template->getActionCount() === 1) { p($primary->getIcon()); } ?>"> |
|
54 | 54 | <a href="<?php p($primary->getLink()); ?>"> |
55 | 55 | <span><?php p($primary->getLabel()) ?></span> |
56 | 56 | </a> |
57 | 57 | </span> |
58 | - <?php if($template->getActionCount()>1) { ?> |
|
58 | + <?php if ($template->getActionCount() > 1) { ?> |
|
59 | 59 | <div id="header-secondary-action"> |
60 | 60 | <span id="header-actions-toggle" class="menutoggle icon-more-white"></span> |
61 | 61 | <div id="header-actions-menu" class="popovermenu menu"> |
62 | 62 | <ul> |
63 | 63 | <?php |
64 | 64 | /** @var \OCP\AppFramework\Http\Template\IMenuAction $action */ |
65 | - foreach($template->getOtherActions() as $action) { |
|
65 | + foreach ($template->getOtherActions() as $action) { |
|
66 | 66 | print_unescaped($action->render()); |
67 | 67 | } |
68 | 68 | ?> |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | <div id="content" class="app-<?php p($_['appid']) ?>" role="main"> |
77 | 77 | <?php print_unescaped($_['content']); ?> |
78 | 78 | </div> |
79 | - <?php if(isset($template) && $template->getFooterVisible()) { ?> |
|
79 | + <?php if (isset($template) && $template->getFooterVisible()) { ?> |
|
80 | 80 | <footer> |
81 | 81 | <p><?php print_unescaped($theme->getLongFooter()); ?></p> |
82 | 82 | <?php |
@@ -46,291 +46,291 @@ |
||
46 | 46 | |
47 | 47 | class TemplateLayout extends \OC_Template { |
48 | 48 | |
49 | - private static $versionHash = ''; |
|
50 | - |
|
51 | - /** |
|
52 | - * @var \OCP\IConfig |
|
53 | - */ |
|
54 | - private $config; |
|
55 | - |
|
56 | - /** |
|
57 | - * @param string $renderAs |
|
58 | - * @param string $appId application id |
|
59 | - */ |
|
60 | - public function __construct( $renderAs, $appId = '' ) { |
|
61 | - |
|
62 | - // yes - should be injected .... |
|
63 | - $this->config = \OC::$server->getConfig(); |
|
64 | - |
|
65 | - if(\OCP\Util::isIE()) { |
|
66 | - \OC_Util::addStyle('ie'); |
|
67 | - } |
|
68 | - |
|
69 | - // Decide which page we show |
|
70 | - if($renderAs == 'user') { |
|
71 | - parent::__construct( 'core', 'layout.user' ); |
|
72 | - if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
73 | - $this->assign('bodyid', 'body-settings'); |
|
74 | - }else{ |
|
75 | - $this->assign('bodyid', 'body-user'); |
|
76 | - } |
|
77 | - |
|
78 | - // Code integrity notification |
|
79 | - $integrityChecker = \OC::$server->getIntegrityCodeChecker(); |
|
80 | - if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
81 | - \OCP\Util::addScript('core', 'integritycheck-failed-notification'); |
|
82 | - } |
|
83 | - |
|
84 | - // Add navigation entry |
|
85 | - $this->assign( 'application', ''); |
|
86 | - $this->assign( 'appid', $appId ); |
|
87 | - $navigation = \OC::$server->getNavigationManager()->getAll(); |
|
88 | - $this->assign( 'navigation', $navigation); |
|
89 | - $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
|
90 | - $this->assign( 'settingsnavigation', $settingsNavigation); |
|
91 | - foreach($navigation as $entry) { |
|
92 | - if ($entry['active']) { |
|
93 | - $this->assign( 'application', $entry['name'] ); |
|
94 | - break; |
|
95 | - } |
|
96 | - } |
|
97 | - |
|
98 | - foreach($settingsNavigation as $entry) { |
|
99 | - if ($entry['active']) { |
|
100 | - $this->assign( 'application', $entry['name'] ); |
|
101 | - break; |
|
102 | - } |
|
103 | - } |
|
104 | - $userDisplayName = \OC_User::getDisplayName(); |
|
105 | - $this->assign('user_displayname', $userDisplayName); |
|
106 | - $this->assign('user_uid', \OC_User::getUser()); |
|
107 | - |
|
108 | - if (\OC_User::getUser() === false) { |
|
109 | - $this->assign('userAvatarSet', false); |
|
110 | - } else { |
|
111 | - $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists()); |
|
112 | - $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0)); |
|
113 | - } |
|
114 | - |
|
115 | - // check if app menu icons should be inverted |
|
116 | - try { |
|
117 | - /** @var \OCA\Theming\Util $util */ |
|
118 | - $util = \OC::$server->query(\OCA\Theming\Util::class); |
|
119 | - $this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary())); |
|
120 | - } catch (\OCP\AppFramework\QueryException $e) { |
|
121 | - $this->assign('themingInvertMenu', false); |
|
122 | - } |
|
123 | - |
|
124 | - } else if ($renderAs == 'error') { |
|
125 | - parent::__construct('core', 'layout.guest', '', false); |
|
126 | - $this->assign('bodyid', 'body-login'); |
|
127 | - } else if ($renderAs == 'guest') { |
|
128 | - parent::__construct('core', 'layout.guest'); |
|
129 | - \OC_Util::addStyle('guest'); |
|
130 | - $this->assign('bodyid', 'body-login'); |
|
131 | - } else if ($renderAs == 'public') { |
|
132 | - parent::__construct('core', 'layout.public'); |
|
133 | - $this->assign( 'appid', $appId ); |
|
134 | - $this->assign('bodyid', 'body-public'); |
|
135 | - $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
|
136 | - } else { |
|
137 | - parent::__construct('core', 'layout.base'); |
|
138 | - |
|
139 | - } |
|
140 | - // Send the language and the locale to our layouts |
|
141 | - $lang = \OC::$server->getL10NFactory()->findLanguage(); |
|
142 | - $lang = str_replace('_', '-', $lang); |
|
143 | - $this->assign('language', $lang); |
|
144 | - $this->assign('locale', \OC::$server->getL10NFactory()->findLocale($lang)); |
|
145 | - |
|
146 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
147 | - if (empty(self::$versionHash)) { |
|
148 | - $v = \OC_App::getAppVersions(); |
|
149 | - $v['core'] = implode('.', \OCP\Util::getVersion()); |
|
150 | - self::$versionHash = substr(md5(implode(',', $v)), 0, 8); |
|
151 | - } |
|
152 | - } else { |
|
153 | - self::$versionHash = md5('not installed'); |
|
154 | - } |
|
155 | - |
|
156 | - // Add the js files |
|
157 | - $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts); |
|
158 | - $this->assign('jsfiles', array()); |
|
159 | - if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') { |
|
160 | - if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) { |
|
161 | - $jsConfigHelper = new JSConfigHelper( |
|
162 | - \OC::$server->getL10N('lib'), |
|
163 | - \OC::$server->query(Defaults::class), |
|
164 | - \OC::$server->getAppManager(), |
|
165 | - \OC::$server->getSession(), |
|
166 | - \OC::$server->getUserSession()->getUser(), |
|
167 | - $this->config, |
|
168 | - \OC::$server->getGroupManager(), |
|
169 | - \OC::$server->getIniWrapper(), |
|
170 | - \OC::$server->getURLGenerator(), |
|
171 | - \OC::$server->getCapabilitiesManager() |
|
172 | - ); |
|
173 | - $this->assign('inline_ocjs', $jsConfigHelper->getConfig()); |
|
174 | - } else { |
|
175 | - $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
|
176 | - } |
|
177 | - } |
|
178 | - foreach($jsFiles as $info) { |
|
179 | - $web = $info[1]; |
|
180 | - $file = $info[2]; |
|
181 | - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
182 | - } |
|
183 | - |
|
184 | - try { |
|
185 | - $pathInfo = \OC::$server->getRequest()->getPathInfo(); |
|
186 | - } catch (\Exception $e) { |
|
187 | - $pathInfo = ''; |
|
188 | - } |
|
189 | - |
|
190 | - // Do not initialise scss appdata until we have a fully installed instance |
|
191 | - // Do not load scss for update, errors, installation or login page |
|
192 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
193 | - && !\OCP\Util::needUpgrade() |
|
194 | - && $pathInfo !== '' |
|
195 | - && !preg_match('/^\/login/', $pathInfo) |
|
196 | - && $renderAs !== 'error' |
|
197 | - ) { |
|
198 | - $cssFiles = self::findStylesheetFiles(\OC_Util::$styles); |
|
199 | - } else { |
|
200 | - // If we ignore the scss compiler, |
|
201 | - // we need to load the guest css fallback |
|
202 | - \OC_Util::addStyle('guest'); |
|
203 | - $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false); |
|
204 | - } |
|
205 | - |
|
206 | - $this->assign('cssfiles', array()); |
|
207 | - $this->assign('printcssfiles', []); |
|
208 | - $this->assign('versionHash', self::$versionHash); |
|
209 | - foreach($cssFiles as $info) { |
|
210 | - $web = $info[1]; |
|
211 | - $file = $info[2]; |
|
212 | - |
|
213 | - if (substr($file, -strlen('print.css')) === 'print.css') { |
|
214 | - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
215 | - } else { |
|
216 | - $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file) ); |
|
217 | - } |
|
218 | - } |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * @param string $path |
|
223 | - * @param string $file |
|
224 | - * @return string |
|
225 | - */ |
|
226 | - protected function getVersionHashSuffix($path = false, $file = false) { |
|
227 | - if ($this->config->getSystemValue('debug', false)) { |
|
228 | - // allows chrome workspace mapping in debug mode |
|
229 | - return ""; |
|
230 | - } |
|
231 | - $themingSuffix = ''; |
|
232 | - $v = []; |
|
233 | - |
|
234 | - if ($this->config->getSystemValue('installed', false)) { |
|
235 | - if (\OC::$server->getAppManager()->isInstalled('theming')) { |
|
236 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
237 | - } |
|
238 | - $v = \OC_App::getAppVersions(); |
|
239 | - } |
|
240 | - |
|
241 | - // Try the webroot path for a match |
|
242 | - if ($path !== false && $path !== '') { |
|
243 | - $appName = $this->getAppNamefromPath($path); |
|
244 | - if(array_key_exists($appName, $v)) { |
|
245 | - $appVersion = $v[$appName]; |
|
246 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
247 | - } |
|
248 | - } |
|
249 | - // fallback to the file path instead |
|
250 | - if ($file !== false && $file !== '') { |
|
251 | - $appName = $this->getAppNamefromPath($file); |
|
252 | - if(array_key_exists($appName, $v)) { |
|
253 | - $appVersion = $v[$appName]; |
|
254 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
255 | - } |
|
256 | - } |
|
257 | - |
|
258 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
259 | - } |
|
260 | - |
|
261 | - /** |
|
262 | - * @param array $styles |
|
263 | - * @return array |
|
264 | - */ |
|
265 | - static public function findStylesheetFiles($styles, $compileScss = true) { |
|
266 | - // Read the selected theme from the config file |
|
267 | - $theme = \OC_Util::getTheme(); |
|
268 | - |
|
269 | - if($compileScss) { |
|
270 | - $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
|
271 | - } else { |
|
272 | - $SCSSCacher = null; |
|
273 | - } |
|
274 | - |
|
275 | - $locator = new \OC\Template\CSSResourceLocator( |
|
276 | - \OC::$server->getLogger(), |
|
277 | - $theme, |
|
278 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
279 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
280 | - $SCSSCacher |
|
281 | - ); |
|
282 | - $locator->find($styles); |
|
283 | - return $locator->getResources(); |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * @param string $path |
|
288 | - * @return string|boolean |
|
289 | - */ |
|
290 | - public function getAppNamefromPath($path) { |
|
291 | - if ($path !== '' && is_string($path)) { |
|
292 | - $pathParts = explode('/', $path); |
|
293 | - if ($pathParts[0] === 'css') { |
|
294 | - // This is a scss request |
|
295 | - return $pathParts[1]; |
|
296 | - } |
|
297 | - return end($pathParts); |
|
298 | - } |
|
299 | - return false; |
|
300 | - |
|
301 | - } |
|
302 | - |
|
303 | - /** |
|
304 | - * @param array $scripts |
|
305 | - * @return array |
|
306 | - */ |
|
307 | - static public function findJavascriptFiles($scripts) { |
|
308 | - // Read the selected theme from the config file |
|
309 | - $theme = \OC_Util::getTheme(); |
|
310 | - |
|
311 | - $locator = new \OC\Template\JSResourceLocator( |
|
312 | - \OC::$server->getLogger(), |
|
313 | - $theme, |
|
314 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
315 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
316 | - \OC::$server->query(JSCombiner::class) |
|
317 | - ); |
|
318 | - $locator->find($scripts); |
|
319 | - return $locator->getResources(); |
|
320 | - } |
|
321 | - |
|
322 | - /** |
|
323 | - * Converts the absolute file path to a relative path from \OC::$SERVERROOT |
|
324 | - * @param string $filePath Absolute path |
|
325 | - * @return string Relative path |
|
326 | - * @throws \Exception If $filePath is not under \OC::$SERVERROOT |
|
327 | - */ |
|
328 | - public static function convertToRelativePath($filePath) { |
|
329 | - $relativePath = explode(\OC::$SERVERROOT, $filePath); |
|
330 | - if(count($relativePath) !== 2) { |
|
331 | - throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
|
332 | - } |
|
333 | - |
|
334 | - return $relativePath[1]; |
|
335 | - } |
|
49 | + private static $versionHash = ''; |
|
50 | + |
|
51 | + /** |
|
52 | + * @var \OCP\IConfig |
|
53 | + */ |
|
54 | + private $config; |
|
55 | + |
|
56 | + /** |
|
57 | + * @param string $renderAs |
|
58 | + * @param string $appId application id |
|
59 | + */ |
|
60 | + public function __construct( $renderAs, $appId = '' ) { |
|
61 | + |
|
62 | + // yes - should be injected .... |
|
63 | + $this->config = \OC::$server->getConfig(); |
|
64 | + |
|
65 | + if(\OCP\Util::isIE()) { |
|
66 | + \OC_Util::addStyle('ie'); |
|
67 | + } |
|
68 | + |
|
69 | + // Decide which page we show |
|
70 | + if($renderAs == 'user') { |
|
71 | + parent::__construct( 'core', 'layout.user' ); |
|
72 | + if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
73 | + $this->assign('bodyid', 'body-settings'); |
|
74 | + }else{ |
|
75 | + $this->assign('bodyid', 'body-user'); |
|
76 | + } |
|
77 | + |
|
78 | + // Code integrity notification |
|
79 | + $integrityChecker = \OC::$server->getIntegrityCodeChecker(); |
|
80 | + if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
81 | + \OCP\Util::addScript('core', 'integritycheck-failed-notification'); |
|
82 | + } |
|
83 | + |
|
84 | + // Add navigation entry |
|
85 | + $this->assign( 'application', ''); |
|
86 | + $this->assign( 'appid', $appId ); |
|
87 | + $navigation = \OC::$server->getNavigationManager()->getAll(); |
|
88 | + $this->assign( 'navigation', $navigation); |
|
89 | + $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
|
90 | + $this->assign( 'settingsnavigation', $settingsNavigation); |
|
91 | + foreach($navigation as $entry) { |
|
92 | + if ($entry['active']) { |
|
93 | + $this->assign( 'application', $entry['name'] ); |
|
94 | + break; |
|
95 | + } |
|
96 | + } |
|
97 | + |
|
98 | + foreach($settingsNavigation as $entry) { |
|
99 | + if ($entry['active']) { |
|
100 | + $this->assign( 'application', $entry['name'] ); |
|
101 | + break; |
|
102 | + } |
|
103 | + } |
|
104 | + $userDisplayName = \OC_User::getDisplayName(); |
|
105 | + $this->assign('user_displayname', $userDisplayName); |
|
106 | + $this->assign('user_uid', \OC_User::getUser()); |
|
107 | + |
|
108 | + if (\OC_User::getUser() === false) { |
|
109 | + $this->assign('userAvatarSet', false); |
|
110 | + } else { |
|
111 | + $this->assign('userAvatarSet', \OC::$server->getAvatarManager()->getAvatar(\OC_User::getUser())->exists()); |
|
112 | + $this->assign('userAvatarVersion', $this->config->getUserValue(\OC_User::getUser(), 'avatar', 'version', 0)); |
|
113 | + } |
|
114 | + |
|
115 | + // check if app menu icons should be inverted |
|
116 | + try { |
|
117 | + /** @var \OCA\Theming\Util $util */ |
|
118 | + $util = \OC::$server->query(\OCA\Theming\Util::class); |
|
119 | + $this->assign('themingInvertMenu', $util->invertTextColor(\OC::$server->getThemingDefaults()->getColorPrimary())); |
|
120 | + } catch (\OCP\AppFramework\QueryException $e) { |
|
121 | + $this->assign('themingInvertMenu', false); |
|
122 | + } |
|
123 | + |
|
124 | + } else if ($renderAs == 'error') { |
|
125 | + parent::__construct('core', 'layout.guest', '', false); |
|
126 | + $this->assign('bodyid', 'body-login'); |
|
127 | + } else if ($renderAs == 'guest') { |
|
128 | + parent::__construct('core', 'layout.guest'); |
|
129 | + \OC_Util::addStyle('guest'); |
|
130 | + $this->assign('bodyid', 'body-login'); |
|
131 | + } else if ($renderAs == 'public') { |
|
132 | + parent::__construct('core', 'layout.public'); |
|
133 | + $this->assign( 'appid', $appId ); |
|
134 | + $this->assign('bodyid', 'body-public'); |
|
135 | + $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
|
136 | + } else { |
|
137 | + parent::__construct('core', 'layout.base'); |
|
138 | + |
|
139 | + } |
|
140 | + // Send the language and the locale to our layouts |
|
141 | + $lang = \OC::$server->getL10NFactory()->findLanguage(); |
|
142 | + $lang = str_replace('_', '-', $lang); |
|
143 | + $this->assign('language', $lang); |
|
144 | + $this->assign('locale', \OC::$server->getL10NFactory()->findLocale($lang)); |
|
145 | + |
|
146 | + if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
147 | + if (empty(self::$versionHash)) { |
|
148 | + $v = \OC_App::getAppVersions(); |
|
149 | + $v['core'] = implode('.', \OCP\Util::getVersion()); |
|
150 | + self::$versionHash = substr(md5(implode(',', $v)), 0, 8); |
|
151 | + } |
|
152 | + } else { |
|
153 | + self::$versionHash = md5('not installed'); |
|
154 | + } |
|
155 | + |
|
156 | + // Add the js files |
|
157 | + $jsFiles = self::findJavascriptFiles(\OC_Util::$scripts); |
|
158 | + $this->assign('jsfiles', array()); |
|
159 | + if ($this->config->getSystemValue('installed', false) && $renderAs != 'error') { |
|
160 | + if (\OC::$server->getContentSecurityPolicyNonceManager()->browserSupportsCspV3()) { |
|
161 | + $jsConfigHelper = new JSConfigHelper( |
|
162 | + \OC::$server->getL10N('lib'), |
|
163 | + \OC::$server->query(Defaults::class), |
|
164 | + \OC::$server->getAppManager(), |
|
165 | + \OC::$server->getSession(), |
|
166 | + \OC::$server->getUserSession()->getUser(), |
|
167 | + $this->config, |
|
168 | + \OC::$server->getGroupManager(), |
|
169 | + \OC::$server->getIniWrapper(), |
|
170 | + \OC::$server->getURLGenerator(), |
|
171 | + \OC::$server->getCapabilitiesManager() |
|
172 | + ); |
|
173 | + $this->assign('inline_ocjs', $jsConfigHelper->getConfig()); |
|
174 | + } else { |
|
175 | + $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
|
176 | + } |
|
177 | + } |
|
178 | + foreach($jsFiles as $info) { |
|
179 | + $web = $info[1]; |
|
180 | + $file = $info[2]; |
|
181 | + $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
182 | + } |
|
183 | + |
|
184 | + try { |
|
185 | + $pathInfo = \OC::$server->getRequest()->getPathInfo(); |
|
186 | + } catch (\Exception $e) { |
|
187 | + $pathInfo = ''; |
|
188 | + } |
|
189 | + |
|
190 | + // Do not initialise scss appdata until we have a fully installed instance |
|
191 | + // Do not load scss for update, errors, installation or login page |
|
192 | + if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
193 | + && !\OCP\Util::needUpgrade() |
|
194 | + && $pathInfo !== '' |
|
195 | + && !preg_match('/^\/login/', $pathInfo) |
|
196 | + && $renderAs !== 'error' |
|
197 | + ) { |
|
198 | + $cssFiles = self::findStylesheetFiles(\OC_Util::$styles); |
|
199 | + } else { |
|
200 | + // If we ignore the scss compiler, |
|
201 | + // we need to load the guest css fallback |
|
202 | + \OC_Util::addStyle('guest'); |
|
203 | + $cssFiles = self::findStylesheetFiles(\OC_Util::$styles, false); |
|
204 | + } |
|
205 | + |
|
206 | + $this->assign('cssfiles', array()); |
|
207 | + $this->assign('printcssfiles', []); |
|
208 | + $this->assign('versionHash', self::$versionHash); |
|
209 | + foreach($cssFiles as $info) { |
|
210 | + $web = $info[1]; |
|
211 | + $file = $info[2]; |
|
212 | + |
|
213 | + if (substr($file, -strlen('print.css')) === 'print.css') { |
|
214 | + $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
215 | + } else { |
|
216 | + $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file) ); |
|
217 | + } |
|
218 | + } |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * @param string $path |
|
223 | + * @param string $file |
|
224 | + * @return string |
|
225 | + */ |
|
226 | + protected function getVersionHashSuffix($path = false, $file = false) { |
|
227 | + if ($this->config->getSystemValue('debug', false)) { |
|
228 | + // allows chrome workspace mapping in debug mode |
|
229 | + return ""; |
|
230 | + } |
|
231 | + $themingSuffix = ''; |
|
232 | + $v = []; |
|
233 | + |
|
234 | + if ($this->config->getSystemValue('installed', false)) { |
|
235 | + if (\OC::$server->getAppManager()->isInstalled('theming')) { |
|
236 | + $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
237 | + } |
|
238 | + $v = \OC_App::getAppVersions(); |
|
239 | + } |
|
240 | + |
|
241 | + // Try the webroot path for a match |
|
242 | + if ($path !== false && $path !== '') { |
|
243 | + $appName = $this->getAppNamefromPath($path); |
|
244 | + if(array_key_exists($appName, $v)) { |
|
245 | + $appVersion = $v[$appName]; |
|
246 | + return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
247 | + } |
|
248 | + } |
|
249 | + // fallback to the file path instead |
|
250 | + if ($file !== false && $file !== '') { |
|
251 | + $appName = $this->getAppNamefromPath($file); |
|
252 | + if(array_key_exists($appName, $v)) { |
|
253 | + $appVersion = $v[$appName]; |
|
254 | + return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
255 | + } |
|
256 | + } |
|
257 | + |
|
258 | + return '?v=' . self::$versionHash . $themingSuffix; |
|
259 | + } |
|
260 | + |
|
261 | + /** |
|
262 | + * @param array $styles |
|
263 | + * @return array |
|
264 | + */ |
|
265 | + static public function findStylesheetFiles($styles, $compileScss = true) { |
|
266 | + // Read the selected theme from the config file |
|
267 | + $theme = \OC_Util::getTheme(); |
|
268 | + |
|
269 | + if($compileScss) { |
|
270 | + $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
|
271 | + } else { |
|
272 | + $SCSSCacher = null; |
|
273 | + } |
|
274 | + |
|
275 | + $locator = new \OC\Template\CSSResourceLocator( |
|
276 | + \OC::$server->getLogger(), |
|
277 | + $theme, |
|
278 | + array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
279 | + array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
280 | + $SCSSCacher |
|
281 | + ); |
|
282 | + $locator->find($styles); |
|
283 | + return $locator->getResources(); |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * @param string $path |
|
288 | + * @return string|boolean |
|
289 | + */ |
|
290 | + public function getAppNamefromPath($path) { |
|
291 | + if ($path !== '' && is_string($path)) { |
|
292 | + $pathParts = explode('/', $path); |
|
293 | + if ($pathParts[0] === 'css') { |
|
294 | + // This is a scss request |
|
295 | + return $pathParts[1]; |
|
296 | + } |
|
297 | + return end($pathParts); |
|
298 | + } |
|
299 | + return false; |
|
300 | + |
|
301 | + } |
|
302 | + |
|
303 | + /** |
|
304 | + * @param array $scripts |
|
305 | + * @return array |
|
306 | + */ |
|
307 | + static public function findJavascriptFiles($scripts) { |
|
308 | + // Read the selected theme from the config file |
|
309 | + $theme = \OC_Util::getTheme(); |
|
310 | + |
|
311 | + $locator = new \OC\Template\JSResourceLocator( |
|
312 | + \OC::$server->getLogger(), |
|
313 | + $theme, |
|
314 | + array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
315 | + array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
316 | + \OC::$server->query(JSCombiner::class) |
|
317 | + ); |
|
318 | + $locator->find($scripts); |
|
319 | + return $locator->getResources(); |
|
320 | + } |
|
321 | + |
|
322 | + /** |
|
323 | + * Converts the absolute file path to a relative path from \OC::$SERVERROOT |
|
324 | + * @param string $filePath Absolute path |
|
325 | + * @return string Relative path |
|
326 | + * @throws \Exception If $filePath is not under \OC::$SERVERROOT |
|
327 | + */ |
|
328 | + public static function convertToRelativePath($filePath) { |
|
329 | + $relativePath = explode(\OC::$SERVERROOT, $filePath); |
|
330 | + if(count($relativePath) !== 2) { |
|
331 | + throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
|
332 | + } |
|
333 | + |
|
334 | + return $relativePath[1]; |
|
335 | + } |
|
336 | 336 | } |
@@ -57,47 +57,47 @@ discard block |
||
57 | 57 | * @param string $renderAs |
58 | 58 | * @param string $appId application id |
59 | 59 | */ |
60 | - public function __construct( $renderAs, $appId = '' ) { |
|
60 | + public function __construct($renderAs, $appId = '') { |
|
61 | 61 | |
62 | 62 | // yes - should be injected .... |
63 | 63 | $this->config = \OC::$server->getConfig(); |
64 | 64 | |
65 | - if(\OCP\Util::isIE()) { |
|
65 | + if (\OCP\Util::isIE()) { |
|
66 | 66 | \OC_Util::addStyle('ie'); |
67 | 67 | } |
68 | 68 | |
69 | 69 | // Decide which page we show |
70 | - if($renderAs == 'user') { |
|
71 | - parent::__construct( 'core', 'layout.user' ); |
|
72 | - if(in_array(\OC_App::getCurrentApp(), ['settings','admin', 'help']) !== false) { |
|
70 | + if ($renderAs == 'user') { |
|
71 | + parent::__construct('core', 'layout.user'); |
|
72 | + if (in_array(\OC_App::getCurrentApp(), ['settings', 'admin', 'help']) !== false) { |
|
73 | 73 | $this->assign('bodyid', 'body-settings'); |
74 | - }else{ |
|
74 | + } else { |
|
75 | 75 | $this->assign('bodyid', 'body-user'); |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Code integrity notification |
79 | 79 | $integrityChecker = \OC::$server->getIntegrityCodeChecker(); |
80 | - if(\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
80 | + if (\OC_User::isAdminUser(\OC_User::getUser()) && $integrityChecker->isCodeCheckEnforced() && !$integrityChecker->hasPassedCheck()) { |
|
81 | 81 | \OCP\Util::addScript('core', 'integritycheck-failed-notification'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | // Add navigation entry |
85 | - $this->assign( 'application', ''); |
|
86 | - $this->assign( 'appid', $appId ); |
|
85 | + $this->assign('application', ''); |
|
86 | + $this->assign('appid', $appId); |
|
87 | 87 | $navigation = \OC::$server->getNavigationManager()->getAll(); |
88 | - $this->assign( 'navigation', $navigation); |
|
88 | + $this->assign('navigation', $navigation); |
|
89 | 89 | $settingsNavigation = \OC::$server->getNavigationManager()->getAll('settings'); |
90 | - $this->assign( 'settingsnavigation', $settingsNavigation); |
|
91 | - foreach($navigation as $entry) { |
|
90 | + $this->assign('settingsnavigation', $settingsNavigation); |
|
91 | + foreach ($navigation as $entry) { |
|
92 | 92 | if ($entry['active']) { |
93 | - $this->assign( 'application', $entry['name'] ); |
|
93 | + $this->assign('application', $entry['name']); |
|
94 | 94 | break; |
95 | 95 | } |
96 | 96 | } |
97 | 97 | |
98 | - foreach($settingsNavigation as $entry) { |
|
98 | + foreach ($settingsNavigation as $entry) { |
|
99 | 99 | if ($entry['active']) { |
100 | - $this->assign( 'application', $entry['name'] ); |
|
100 | + $this->assign('application', $entry['name']); |
|
101 | 101 | break; |
102 | 102 | } |
103 | 103 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $this->assign('bodyid', 'body-login'); |
131 | 131 | } else if ($renderAs == 'public') { |
132 | 132 | parent::__construct('core', 'layout.public'); |
133 | - $this->assign( 'appid', $appId ); |
|
133 | + $this->assign('appid', $appId); |
|
134 | 134 | $this->assign('bodyid', 'body-public'); |
135 | 135 | $this->assign('showSimpleSignUpLink', $this->config->getSystemValue('simpleSignUpLink.shown', true) !== false); |
136 | 136 | } else { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | $this->assign('language', $lang); |
144 | 144 | $this->assign('locale', \OC::$server->getL10NFactory()->findLocale($lang)); |
145 | 145 | |
146 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
146 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
147 | 147 | if (empty(self::$versionHash)) { |
148 | 148 | $v = \OC_App::getAppVersions(); |
149 | 149 | $v['core'] = implode('.', \OCP\Util::getVersion()); |
@@ -175,10 +175,10 @@ discard block |
||
175 | 175 | $this->append('jsfiles', \OC::$server->getURLGenerator()->linkToRoute('core.OCJS.getConfig', ['v' => self::$versionHash])); |
176 | 176 | } |
177 | 177 | } |
178 | - foreach($jsFiles as $info) { |
|
178 | + foreach ($jsFiles as $info) { |
|
179 | 179 | $web = $info[1]; |
180 | 180 | $file = $info[2]; |
181 | - $this->append( 'jsfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
181 | + $this->append('jsfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | try { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | // Do not initialise scss appdata until we have a fully installed instance |
191 | 191 | // Do not load scss for update, errors, installation or login page |
192 | - if(\OC::$server->getSystemConfig()->getValue('installed', false) |
|
192 | + if (\OC::$server->getSystemConfig()->getValue('installed', false) |
|
193 | 193 | && !\OCP\Util::needUpgrade() |
194 | 194 | && $pathInfo !== '' |
195 | 195 | && !preg_match('/^\/login/', $pathInfo) |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | $this->assign('cssfiles', array()); |
207 | 207 | $this->assign('printcssfiles', []); |
208 | 208 | $this->assign('versionHash', self::$versionHash); |
209 | - foreach($cssFiles as $info) { |
|
209 | + foreach ($cssFiles as $info) { |
|
210 | 210 | $web = $info[1]; |
211 | 211 | $file = $info[2]; |
212 | 212 | |
213 | 213 | if (substr($file, -strlen('print.css')) === 'print.css') { |
214 | - $this->append( 'printcssfiles', $web.'/'.$file . $this->getVersionHashSuffix() ); |
|
214 | + $this->append('printcssfiles', $web.'/'.$file.$this->getVersionHashSuffix()); |
|
215 | 215 | } else { |
216 | - $this->append( 'cssfiles', $web.'/'.$file . $this->getVersionHashSuffix($web, $file) ); |
|
216 | + $this->append('cssfiles', $web.'/'.$file.$this->getVersionHashSuffix($web, $file)); |
|
217 | 217 | } |
218 | 218 | } |
219 | 219 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | |
234 | 234 | if ($this->config->getSystemValue('installed', false)) { |
235 | 235 | if (\OC::$server->getAppManager()->isInstalled('theming')) { |
236 | - $themingSuffix = '-' . $this->config->getAppValue('theming', 'cachebuster', '0'); |
|
236 | + $themingSuffix = '-'.$this->config->getAppValue('theming', 'cachebuster', '0'); |
|
237 | 237 | } |
238 | 238 | $v = \OC_App::getAppVersions(); |
239 | 239 | } |
@@ -241,21 +241,21 @@ discard block |
||
241 | 241 | // Try the webroot path for a match |
242 | 242 | if ($path !== false && $path !== '') { |
243 | 243 | $appName = $this->getAppNamefromPath($path); |
244 | - if(array_key_exists($appName, $v)) { |
|
244 | + if (array_key_exists($appName, $v)) { |
|
245 | 245 | $appVersion = $v[$appName]; |
246 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
246 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | // fallback to the file path instead |
250 | 250 | if ($file !== false && $file !== '') { |
251 | 251 | $appName = $this->getAppNamefromPath($file); |
252 | - if(array_key_exists($appName, $v)) { |
|
252 | + if (array_key_exists($appName, $v)) { |
|
253 | 253 | $appVersion = $v[$appName]; |
254 | - return '?v=' . substr(md5($appVersion), 0, 8) . $themingSuffix; |
|
254 | + return '?v='.substr(md5($appVersion), 0, 8).$themingSuffix; |
|
255 | 255 | } |
256 | 256 | } |
257 | 257 | |
258 | - return '?v=' . self::$versionHash . $themingSuffix; |
|
258 | + return '?v='.self::$versionHash.$themingSuffix; |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | // Read the selected theme from the config file |
267 | 267 | $theme = \OC_Util::getTheme(); |
268 | 268 | |
269 | - if($compileScss) { |
|
269 | + if ($compileScss) { |
|
270 | 270 | $SCSSCacher = \OC::$server->query(SCSSCacher::class); |
271 | 271 | } else { |
272 | 272 | $SCSSCacher = null; |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | $locator = new \OC\Template\CSSResourceLocator( |
276 | 276 | \OC::$server->getLogger(), |
277 | 277 | $theme, |
278 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
279 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
278 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
279 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
280 | 280 | $SCSSCacher |
281 | 281 | ); |
282 | 282 | $locator->find($styles); |
@@ -311,8 +311,8 @@ discard block |
||
311 | 311 | $locator = new \OC\Template\JSResourceLocator( |
312 | 312 | \OC::$server->getLogger(), |
313 | 313 | $theme, |
314 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
315 | - array( \OC::$SERVERROOT => \OC::$WEBROOT ), |
|
314 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
315 | + array(\OC::$SERVERROOT => \OC::$WEBROOT), |
|
316 | 316 | \OC::$server->query(JSCombiner::class) |
317 | 317 | ); |
318 | 318 | $locator->find($scripts); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | */ |
328 | 328 | public static function convertToRelativePath($filePath) { |
329 | 329 | $relativePath = explode(\OC::$SERVERROOT, $filePath); |
330 | - if(count($relativePath) !== 2) { |
|
330 | + if (count($relativePath) !== 2) { |
|
331 | 331 | throw new \Exception('$filePath is not under the \OC::$SERVERROOT'); |
332 | 332 | } |
333 | 333 |