Browse Source

Don't ignore subdomains when trying to autolink "internal" urls

spaghetti 9 years ago
parent
commit
9b80fec2a3
1 changed files with 15 additions and 14 deletions
  1. 15
    14
      classes/text.class.php

+ 15
- 14
classes/text.class.php View File

282
     }
282
     }
283
     $Host = $URLInfo['host'];
283
     $Host = $URLInfo['host'];
284
     // If for some reason your site does not require subdomains or contains a directory in the SITE_DOMAIN, revert to the line below.
284
     // If for some reason your site does not require subdomains or contains a directory in the SITE_DOMAIN, revert to the line below.
285
-    //if ($Host == SITE_DOMAIN || $Host == 'www.'.SITE_DOMAIN) {
286
-    if (empty($URLInfo['port']) && preg_match('/(\S+\.)*'.SITE_DOMAIN.'/', $Host)) {
287
-      $URL = '';
288
-      if (!empty($URLInfo['path'])) {
289
-        $URL .= ltrim($URLInfo['path'], '/'); // Things break if the path starts with '//'
290
-      }
291
-      if (!empty($URLInfo['query'])) {
292
-        $URL .= "?$URLInfo[query]";
293
-      }
294
-      if (!empty($URLInfo['fragment'])) {
295
-        $URL .= "#$URLInfo[fragment]";
285
+    if ($Host == SITE_DOMAIN || $Host == 'www.'.SITE_DOMAIN) {
286
+      if (empty($URLInfo['port']) && preg_match('/(\S+\.)*'.SITE_DOMAIN.'/', $Host)) {
287
+        $URL = '';
288
+        if (!empty($URLInfo['path'])) {
289
+          $URL .= ltrim($URLInfo['path'], '/'); // Things break if the path starts with '//'
290
+        }
291
+        if (!empty($URLInfo['query'])) {
292
+          $URL .= "?$URLInfo[query]";
293
+        }
294
+        if (!empty($URLInfo['fragment'])) {
295
+          $URL .= "#$URLInfo[fragment]";
296
+        }
297
+        return $URL ? "/$URL" : false;
298
+      } else {
299
+        return false;
296
       }
300
       }
297
-      return $URL ? "/$URL" : false;
298
-    } else {
299
-      return false;
300
     }
301
     }
301
 
302
 
302
   }
303
   }

Loading…
Cancel
Save