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

github.com/nextcloud/nextcloud.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJos Poortvliet <jospoortvliet@gmail.com>2020-07-13 18:26:34 +0300
committerGitHub <noreply@github.com>2020-07-13 18:26:34 +0300
commit0b1609f17d541e3639fe2c8276ba00edaf731743 (patch)
tree649df4b615cf343985797b78967b95479c7678a6 /base.php
parent38fee1685cc4426c8086ccc40beb49f132084a35 (diff)
parent84334841ed48035368eb606d7eedeb012adb562d (diff)
Merge branch 'master' into CoC-update
Diffstat (limited to 'base.php')
-rw-r--r--base.php91
1 files changed, 18 insertions, 73 deletions
diff --git a/base.php b/base.php
index f2961c6f..2dc470f8 100644
--- a/base.php
+++ b/base.php
@@ -21,49 +21,7 @@ if(is_page('oc-news') || is_page('blogfeed')) {
* Pages that still use the old layout and haven't been migrated
*/
$oldPages = [
- '404',
- '5years',
// 'about',
- 'advisories',
- 'advisory',
- 'agreement',
- 'android',
- 'appform',
- 'appform-submit',
- 'apply',
- 'apply2',
- 'changelog',
-// 'code-of-conduct',
-// 'collaboraonline',
- 'community',
-// 'conf',
- 'conference-program',
- 'confinfo',
- 'confsubscribe',
- 'connect',
- 'consulting',
- 'contact',
-// 'contactform',
-// 'contactsubmit',
-// 'contribute',
-// 'contributors',
- 'design',
- 'desktop',
-// 'devices',
-// 'events',
- 'faq',
- 'federation',
- 'hackathon',
- 'history',
- 'impressum',
- 'install',
- 'install-backup',
- 'meetups',
- 'news',
- 'newsletter',
- 'nine',
- 'pidrive',
- 'policy',
'pr20160602',
'pr20160614',
'pr20160705',
@@ -85,31 +43,7 @@ if(is_page('oc-news') || is_page('blogfeed')) {
'pr20170824',
'pr20170927',
'pr20171018',
- 'press',
- 'privacy',
- 'promote',
- 'providers',
-// 'providersubmit',
-// 'release-channels',
-// 'salessubmit',
-// 'securesharesubmit',
-// 'securesharing',
- 'security',
-// 'sharing',
- 'speaking',
- 'spreedbox',
-// 'support',
-// 'team',
- 'thanks',
- 'thankyou',
-// 'ordersubmit',
- 'theming',
- 'threat-model',
- 'trademarks',
- 'translation',
'user',
-// 'webrtc',
-// 'workflow'
];
function is_blog()
@@ -121,7 +55,7 @@ if(is_page('oc-news') || is_page('blogfeed')) {
$currentPage = strtolower(get_post()->post_name);
$oldPage = true;
- if (in_array($currentPage, $oldPages) || is_blog()) {
+ if (in_array($currentPage, $oldPages)) {
// It's an old page, use the old template
ob_clean();
ob_start();
@@ -195,9 +129,14 @@ $echoed = false;
$hl = '';
$path = parse_url(site_url())['path'];
$language = explode('/', substr($_SERVER['REQUEST_URI'], strlen($path)));
-if(isset($language[1]) && $language[1] === 'de') {
- $hl = strtolower((string)$language[1]);
- if (ctype_alnum($hl) && strlen($hl) === 2) {
+if(isset($language[1])) { // check if language is set.
+ if (strlen($hl) == 2) {
+ $hl = strtolower((string)$language[1]); // lowercase two-character country codes
+ } else {
+ $hl = (string)$language[1];
+ }
+ // check if $hl is either a 2-character alphanumeric code or a regexp matched, 5-character xx_YY style code
+ if ( (ctype_alnum($hl) && strlen($hl) === 2) || (preg_match("/^[a-z]{2}_[A-Z]{2}/",$language[1]) && strlen($hl) == 5) ) {
$l10nFiles = [
get_post()->post_name,
'header-navbar',
@@ -217,9 +156,11 @@ if(isset($language[1]) && $language[1] === 'de') {
}
if(!is_array($translatedFile) || !is_array($originalFile)) {
$storeToCache = false;
- }
-
- if (array_keys($translatedFile) !== array_keys($originalFile)) {
+ } else if (
+ is_array($translatedFile)
+ && is_array($originalFile)
+ && array_keys($translatedFile) !== array_keys($originalFile)
+ ) {
$storeToCache = false;
}
}
@@ -229,6 +170,10 @@ if(isset($language[1]) && $language[1] === 'de') {
echo file_get_contents($cacheFile);
$echoed = true;
}
+ # do not store submit forms to the cache
+ if(strpos(get_post()->post_name, 'submit') !== false) {
+ $storeToCache = false;
+ }
if($storeToCache === true) {
file_put_contents($cacheFile, $html);
if(file_exists($cacheFile)) {