|
|
@ -241,6 +241,29 @@ function secure_link($href) { |
|
|
|
return $href . '/' . make_secure_link_token($href); |
|
|
|
} |
|
|
|
|
|
|
|
function embed_html($link) { |
|
|
|
global $config; |
|
|
|
|
|
|
|
foreach ($config['embedding'] as $embed) { |
|
|
|
if ($html = preg_replace($embed[0], $embed[1], $link)) { |
|
|
|
if ($html == $link) |
|
|
|
continue; // Nope |
|
|
|
|
|
|
|
$html = str_replace('%%tb_width%%', $config['embed_width'], $html); |
|
|
|
$html = str_replace('%%tb_height%%', $config['embed_height'], $html); |
|
|
|
|
|
|
|
return $html; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($link[0] == '<') { |
|
|
|
// Prior to v0.9.6-dev-8, HTML code for embedding was stored in the database instead of the link. |
|
|
|
return $link; |
|
|
|
} |
|
|
|
|
|
|
|
return 'Embedding error.'; |
|
|
|
} |
|
|
|
|
|
|
|
class Post { |
|
|
|
public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) { |
|
|
|
global $config; |
|
|
@ -269,6 +292,9 @@ class Post { |
|
|
|
$this->root = $root; |
|
|
|
$this->mod = $mod; |
|
|
|
|
|
|
|
if ($this->embed) |
|
|
|
$this->embed = embed_html($this->embed); |
|
|
|
|
|
|
|
if ($this->mod) |
|
|
|
// Fix internal links |
|
|
|
// Very complicated regex |
|
|
@ -365,6 +391,9 @@ class Thread { |
|
|
|
$this->mod = $mod; |
|
|
|
$this->hr = $hr; |
|
|
|
|
|
|
|
if ($this->embed) |
|
|
|
$this->embed = embed_html($this->embed); |
|
|
|
|
|
|
|
if ($this->mod) |
|
|
|
// Fix internal links |
|
|
|
// Very complicated regex |
|
|
|