diff options
| author | Savetheinternet <savetheinternet@n0v4.com> | 2011-04-06 18:31:26 +1000 |
|---|---|---|
| committer | Savetheinternet <savetheinternet@n0v4.com> | 2011-04-06 18:31:26 +1000 |
| commit | 08bbd3f9127204aa4bc8be18fdc6ca6d68d88ff1 (patch) | |
| tree | 28c204c3907e70f0e49620658f8736d9258c4dce /inc/display.php | |
| parent | 10bd465ea366023769b047050d48b0e81d513b9b (diff) | |
Post saving/cache and Google Analytics integration
Diffstat (limited to 'inc/display.php')
| -rw-r--r-- | inc/display.php | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/inc/display.php b/inc/display.php index 88976457..72983a49 100644 --- a/inc/display.php +++ b/inc/display.php @@ -92,6 +92,14 @@ ))); } + function confirmLink($text, $title, $confirm, $href) { + global $config, $mod; + if($config['mod']['server-side_confirm']) + return '<a onclick="if(confirm(\'' . htmlentities(addslashes($confirm)) . '\')) document.location=\'?/' . htmlentities(addslashes($href)) . '\';return false;" title="' . htmlentities($title) . '" href="?/confirm/' . $href . '">' . $text . '</a>'; + else + return '<a onclick="return confirm(\'' . htmlentities(addslashes($confirm)) . '\')" title="' . htmlentities($title) . '" href="?/' . $href . '">' . $text . '</a>'; + } + class Post { public function __construct($id, $thread, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=null, $mod=false) { global $config; @@ -136,11 +144,11 @@ // Delete if($this->mod['type'] >= $config['mod']['delete']) - $built .= ' <a onclick="return confirm(\'Are you sure you want to delete this?\')" title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>'; + $built .= ' ' . confirmLink($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['uri'] . '/delete/' . $this->id); // Delete all posts by IP if($this->mod['type'] >= $config['mod']['deletebyip']) - $built .= ' <a onclick="return confirm(\'Are you sure you want to delete all posts by IP?\')" title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>'; + $built .= ' ' . confirmLink($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by IP?', $board['uri'] . '/deletebyip/' . $this->id); // Ban if($this->mod['type'] >= $config['mod']['ban']) @@ -283,11 +291,11 @@ // Delete if($this->mod['type'] >= $config['mod']['delete']) - $built .= ' <a onclick="return confirm(\'Are you sure you want to delete this?\')" title="Delete" href="?/' . $board['uri'] . '/delete/' . $this->id . '">' . $config['mod']['link_delete'] . '</a>'; + $built .= ' ' . confirmLink($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['uri'] . '/delete/' . $this->id); // Delete all posts by IP if($this->mod['type'] >= $config['mod']['deletebyip']) - $built .= ' <a onclick="return confirm(\'Are you sure you want to delete all posts by IP?\')" title="Delete all posts by IP" href="?/' . $board['uri'] . '/deletebyip/' . $this->id . '">' . $config['mod']['link_deletebyip'] . '</a>'; + $built .= ' ' . confirmLink($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by IP?', $board['uri'] . '/deletebyip/' . $this->id); // Ban if($this->mod['type'] >= $config['mod']['ban']) |
