Redirect to a working doc page when the target is not found

This commit is contained in:
Joas Schilling
2015-02-06 12:15:29 +01:00
parent 77e4891487
commit 7b0095dfa9

34
go.php
View File

@@ -4,21 +4,22 @@
############## Adjust when editing docs ##################
$mapping = array(
'admin-ldap' => '/admin_manual/configuration/user_auth_ldap.html',
'admin-dir_permissions' => '/admin_manual/installation/installation_wizard.html#setting-strong-directory-permissions',
'admin-source_install' => '/admin_manual/installation/source_installation.html',
'admin-install' => '/admin_manual/installation/index.html',
'admin-encryption' => '/admin_manual/configuration/encryption_configuration.html',
'admin-external-storage' => '/admin_manual/configuration/external_storage_configuration_gui.html',
'admin-install' => '/admin_manual/installation/index.html',
'admin-ldap' => '/admin_manual/configuration/user_auth_ldap.html',
'admin-provisioning-api' => '/admin_manual/configuration/user_provisioning_api.html',
'admin-source_install' => '/admin_manual/installation/source_installation.html',
'user-encryption' => '/user_manual/files/encryption.html',
'user-files' => '/user_manual/files/index.html',
'user-manual' => '/user_manual',
'user-webdav' => '/user_manual/files/files.html',
'user-sync-calendars' => '/user_manual/pim/calendar.html#synchronising-calendars-with-caldav',
'user-sync-contacts' => '/user_manual/pim/contacts.html#keeping-your-addressbook-in-sync',
'user-encryption' => '/user_manual/files/encryption.html',
'user-trashbin' => '/user_manual/files/deletedfiles.html',
'user-files' => '/user_manual/files/index.html',
'user-versions' => '/user_manual/files/versioncontrol.html'
'user-versions' => '/user_manual/files/versioncontrol.html',
'user-webdav' => '/user_manual/files/files.html',
);
############# Do not edit below this line #################
@@ -29,15 +30,16 @@ $port = $_SERVER['SERVER_PORT'];
$port = ($port !== '80' && $port !== '443') ? ":$port" : '';
$name = $_SERVER['SERVER_NAME'];
$path = dirname($_SERVER['REQUEST_URI']);
if (array_key_exists($from, $mapping)) {
$target = $mapping[$from];
} else {
$target = '';
}
$location = "$proto://$name$port$path$target";
$location = "$proto://$name$port$path";
header('HTTP/1.1 302 Moved Temporarily');
header('Location: '.$location);
if (array_key_exists($from, $mapping)) {
header('Location: ' . $location . $mapping[$from]);
} else {
if (strpos($from, 'admin-') === 0) {
header('Location: ' . $location . '/admin_manual');
} else {
header('Location: ' . $location . '/user_manual');
}
}