diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-02-07 00:37:26 +1100 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-02-07 00:37:26 +1100 |
| commit | 6994b6a2f5f84ead4beb87a9f2fd7cb846a2b52d (patch) | |
| tree | 1dc2c152e6838abc2cf77a9441994ebdda727e16 /inc/display.php | |
| parent | a3d22a79b7fc41f566f3ee07e1be4cc5b2108163 (diff) | |
Fix internal links for moderator interface
Diffstat (limited to 'inc/display.php')
| -rw-r--r-- | inc/display.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/inc/display.php b/inc/display.php index 0678cef7..8423da0f 100644 --- a/inc/display.php +++ b/inc/display.php @@ -72,6 +72,15 @@ $this->ip = $ip; $this->root = $root; $this->mod = $mod; + + if($this->mod) + // Fix internal links + // Very complicated regex + $this->body = preg_replace( + '/<a(([a-zA-Z]+="[^"]+")|[a-zA-Z]+=[a-zA-Z]+|\s)*href="' . preg_quote(ROOT, '/') . '(' . sprintf(preg_quote(BOARD_PATH, '/'), '\w+') . ')/', + '<a href="?/$3', + $this->body + ); } public function postControls() { global $board; @@ -203,6 +212,15 @@ $this->locked = $locked; $this->root = $root; $this->mod = $mod; + + if($this->mod) + // Fix internal links + // Very complicated regex + $this->body = preg_replace( + '/<a(([a-zA-Z]+="[^"]+")|[a-zA-Z]+=[a-zA-Z]+|\s)*href="' . preg_quote(ROOT, '/') . '(' . sprintf(preg_quote(BOARD_PATH, '/'), '\w+') . ')/', + '<a href="?/$3', + $this->body + ); } public function add(Post $post) { $this->posts[] = $post; |
