Skip to content

Instantly share code, notes, and snippets.

@d00p
Created April 24, 2018 13:23
Show Gist options
  • Save d00p/2b5bb1cfafd3b1e8b6ad4b7d6c95d9d0 to your computer and use it in GitHub Desktop.
Save d00p/2b5bb1cfafd3b1e8b6ad4b7d6c95d9d0 to your computer and use it in GitHub Desktop.
diff --git a/lib/functions/output/function.RedirectCode.php b/lib/functions/output/function.RedirectCode.php
index 5783f133..e537fcdc 100644
--- a/lib/functions/output/function.RedirectCode.php
+++ b/lib/functions/output/function.RedirectCode.php
@@ -35,10 +35,12 @@ function getRedirectCodesArray() {
/**
* return an array of all enabled redirect-codes
* for the settings form
+ *
+ * @param bool $add_desc optional, default true, add the code-description
*
* @return array array of enabled redirect-codes
*/
-function getRedirectCodes() {
+function getRedirectCodes($add_desc = true) {
global $lng;
@@ -47,7 +49,10 @@ function getRedirectCodes() {
$codes = array();
while ($rc = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
- $codes[$rc['id']] = $rc['code']. ' ('.$lng['redirect_desc'][$rc['desc']].')';
+ $codes[$rc['id']] = $rc['code'];
+ if ($add_desc) {
+ $codes[$rc['id']] .= ' ('.$lng['redirect_desc'][$rc['desc']].')';
+ }
}
return $codes;
@@ -66,7 +71,7 @@ function getDomainRedirectCode($domainid = 0) {
// get system default
$default = '301';
if (Settings::Get('customredirect.enabled') == '1') {
- $all_codes = getRedirectCodes();
+ $all_codes = getRedirectCodes(false);
$default = $all_codes[Settings::Get('customredirect.default')];
}
$code = $default;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment