summaryrefslogtreecommitdiff
path: root/inc/display.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2011-04-12 21:08:54 +1000
committerSavetheinternet <savetheinternet@n0v4.com>2011-04-12 21:08:54 +1000
commitc596d457112bb3288c0d650884022f72a9d7f35c (patch)
treec26e9bcfa138b47641328460235a94b3c5fd035f /inc/display.php
parent614491880fb8b1efa7b6edd9a360af2e35e18af1 (diff)
New `capcode` field for posts and custom capcodes (run install.php to upgrade tables)
Diffstat (limited to 'inc/display.php')
-rw-r--r--inc/display.php36
1 files changed, 31 insertions, 5 deletions
diff --git a/inc/display.php b/inc/display.php
index c0d2dde1..f0bbc635 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -110,6 +110,18 @@
return '<em>' . utf8tohtml($body) . '</em>';
}
+ function capcode($cap) {
+ global $config;
+
+ if(isset($config['custom_capcode'][$cap])) {
+ if(is_array($config['custom_capcode'][$cap]))
+ return sprintf($config['custom_capcode'][$cap][0], $cap);
+ return sprintf($config['custom_capcode'][$cap], $cap);
+ }
+
+ return sprintf($config['capcode'], $cap);
+ }
+
function confirmLink($text, $title, $confirm, $href) {
global $config, $mod;
if($config['mod']['server-side_confirm'])
@@ -119,7 +131,7 @@
}
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) {
+ public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=null, $mod=false) {
global $config;
if(!isset($root)) $root = $config['root'];
@@ -129,6 +141,7 @@
$this->email = $email;
$this->name = utf8tohtml($name);
$this->trip = $trip;
+ $this->capcode = $capcode;
$this->body = $body;
$this->time = $time;
$this->thumb = $thumb;
@@ -200,9 +213,19 @@
if(!empty($this->email))
$built .= '<a class="email" href="mailto:' . $this->email . '">';
// Name
- $built .= '<span class="name">' . $this->name . '</span>'
+ $built .= '<span class="name"' .
+ (!empty($this->capcode) && isset($config['custom_capcode'][$this->capcode][1]) ?
+ ' style="' . $config['custom_capcode'][$this->capcode][1] . '"'
+ : '')
+ . '>' . $this->name . '</span>'
// Trip
- . (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'');
+ . (!empty($this->trip) ? ' <span class="trip"' .
+ (!empty($this->capcode) && isset($config['custom_capcode'][$this->capcode][2]) ?
+ ' style="' . $config['custom_capcode'][$this->capcode][2] . '"'
+ : '')
+ . '>'.$this->trip.'</span>':'')
+ // Capcode
+ . (!empty($this->capcode) ? capcode($this->capcode) : '');
// End email
if(!empty($this->email))
@@ -258,7 +281,7 @@
};
class Thread {
- public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $root=null, $mod=false, $hr=true) {
+ public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $root=null, $mod=false, $hr=true) {
global $config;
if(!isset($root)) $root = $config['root'];
@@ -267,6 +290,7 @@
$this->email = $email;
$this->name = utf8tohtml($name);
$this->trip = $trip;
+ $this->capcode = $capcode;
$this->body = $body;
$this->time = $time;
$this->thumb = $thumb;
@@ -375,7 +399,9 @@
// Name
$built .= '<span class="name">' . $this->name . '</span>'
// Trip
- . (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'');
+ . (!empty($this->trip) ? ' <span class="trip">'.$this->trip.'</span>':'')
+ // Capcode
+ . (!empty($this->capcode) ? capcode($this->capcode) : '');
// End email
if(!empty($this->email))