2010-11-02 06:57:33 -04:00
< ? php
2011-04-13 08:21:07 -04:00
if ( $_SERVER [ 'SCRIPT_FILENAME' ] == str_replace ( '\\' , '/' , __FILE__ )) {
// You cannot request this file directly.
header ( 'Location: ../' , true , 302 );
exit ;
}
2010-11-02 06:57:33 -04:00
/*
2010-11-04 01:58:43 -04:00
Stuff to help with the display .
2010-11-02 06:57:33 -04:00
*/
/*
joaoptm78 @ gmail . com
http :// www . php . net / manual / en / function . filesize . php #100097
*/
function format_bytes ( $size ) {
$units = array ( ' B' , ' KB' , ' MB' , ' GB' , ' TB' );
for ( $i = 0 ; $size >= 1024 && $i < 4 ; $i ++ ) $size /= 1024 ;
return round ( $size , 2 ) . $units [ $i ];
}
2010-11-04 07:41:52 -04:00
function commaize ( $n ) {
$n = strval ( $n );
return ( intval ( $n ) < 1000 ) ? $n : commaize ( substr ( $n , 0 , - 3 )) . ',' . substr ( $n , - 3 );
}
2011-02-19 04:16:13 -05:00
function doBoardListPart ( $list , $root ) {
global $config ;
$body = '' ;
foreach ( $list as $board ) {
if ( is_array ( $board ))
$body .= ' [' . doBoardListPart ( $board , $root ) . '] ' ;
else {
2011-03-17 08:49:28 -04:00
if (( $key = array_search ( $board , $list )) && gettype ( $key ) == 'string' ) {
$body .= ' <a href="' . $board . '">' . $key . '</a> /' ;
} else {
$body .= ' <a href="' . $root . $board . '/' . $config [ 'file_index' ] . '">' . $board . '</a> /' ;
}
2011-02-19 04:16:13 -05:00
}
}
$body = preg_replace ( '/\/$/' , '' , $body );
return $body ;
}
function createBoardlist ( $mod = false ) {
global $config ;
2011-02-20 02:46:38 -05:00
if ( ! isset ( $config [ 'boards' ])) return Array ( 'top' => '' , 'bottom' => '' );
2011-02-19 04:16:13 -05:00
$body = doBoardListPart ( $config [ 'boards' ], $mod ? '?/' : $config [ 'root' ]);
2011-03-17 08:53:27 -04:00
if ( ! preg_match ( '/\] $/' , $body ))
2011-03-17 08:45:14 -04:00
$body = '[' . $body . ']' ;
2011-02-19 04:16:13 -05:00
2011-03-17 08:53:27 -04:00
$body = trim ( $body );
2011-02-19 20:39:56 -05:00
return Array (
'top' => '<div class="boardlist">' . $body . '</div>' ,
'bottom' => '<div class="boardlist bottom">' . $body . '</div>'
);
2011-02-19 04:16:13 -05:00
}
2010-11-04 07:41:52 -04:00
2010-11-02 06:57:33 -04:00
function error ( $message ) {
2011-02-12 01:25:15 -05:00
global $board , $mod , $config ;
2010-11-30 07:15:05 -05:00
if ( function_exists ( 'sql_close' )) sql_close ();
2010-11-04 07:41:52 -04:00
die ( Element ( 'page.html' , Array (
2011-03-26 03:23:15 -04:00
'config' => $config ,
2010-11-04 07:41:52 -04:00
'title' => 'Error' ,
'subtitle' => 'An error has occured.' ,
'body' => " <center> " .
" <h2> $message </h2> " .
2011-01-02 23:10:21 -05:00
( isset ( $board ) ?
2011-02-12 01:25:15 -05:00
" <p><a href= \" " . $config [ 'root' ] .
( $mod ? $config [ 'file_mod' ] . '?/' : '' ) .
$board [ 'dir' ] . $config [ 'file_index' ] . " \" >Go back</a>.</p> " : '' ) .
2010-11-04 07:41:52 -04:00
" </center> "
)));
2010-11-02 06:57:33 -04:00
}
2011-02-16 03:59:13 -05:00
function loginForm ( $error = false , $username = false , $redirect = false ) {
2011-02-12 01:25:15 -05:00
global $config ;
2010-12-01 05:24:14 -05:00
if ( function_exists ( 'sql_close' )) sql_close ();
die ( Element ( 'page.html' , Array (
2011-02-12 01:25:15 -05:00
'index' => $config [ 'root' ],
2010-12-01 05:24:14 -05:00
'title' => 'Login' ,
2011-03-26 04:11:48 -04:00
'config' => $config ,
2010-12-01 05:24:14 -05:00
'body' => Element ( 'login.html' , Array (
2011-03-26 03:23:15 -04:00
'config' => $config ,
2010-12-01 05:24:14 -05:00
'error' => $error ,
2011-02-16 03:59:13 -05:00
'username' => $username ,
'redirect' => $redirect
2010-12-01 05:24:14 -05:00
)
)
)));
}
2011-04-12 04:02:20 -04:00
function pm_snippet ( $body ) {
global $config ;
// Replace line breaks with some whitespace
$body = str_replace ( '<br/>' , ' ' , $body );
// Strip tags
$body = strip_tags ( $body );
// Unescape HTML characters, to avoid splitting them in half
$body = html_entity_decode_utf8 ( $body );
$body = substr ( $body , 0 , $config [ 'mod' ][ 'snippet_length' ]) . ( strlen ( $body ) > $config [ 'mod' ][ 'snippet_length' ] ? '…' : '' );
// Re-escape the characters.
return '<em>' . utf8tohtml ( $body ) . '</em>' ;
}
2011-04-12 07:08:54 -04:00
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 );
}
2011-04-06 04:31:26 -04:00
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>' ;
}
2010-11-02 06:57:33 -04:00
class Post {
2011-04-12 07:08:54 -04:00
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 ) {
2011-02-12 01:25:15 -05:00
global $config ;
if ( ! isset ( $root )) $root = $config [ 'root' ];
2010-11-02 06:57:33 -04:00
$this -> id = $id ;
$this -> thread = $thread ;
2010-11-03 08:02:15 -04:00
$this -> subject = utf8tohtml ( $subject );
2010-11-02 06:57:33 -04:00
$this -> email = $email ;
2010-11-03 08:02:15 -04:00
$this -> name = utf8tohtml ( $name );
2010-11-02 06:57:33 -04:00
$this -> trip = $trip ;
2011-04-12 07:08:54 -04:00
$this -> capcode = $capcode ;
2010-11-02 06:57:33 -04:00
$this -> body = $body ;
$this -> time = $time ;
$this -> thumb = $thumb ;
$this -> thumbx = $thumbx ;
$this -> thumby = $thumby ;
$this -> file = $file ;
$this -> filex = $filex ;
$this -> filey = $filey ;
$this -> filesize = $filesize ;
$this -> filename = $filename ;
2010-12-10 05:14:45 -05:00
$this -> ip = $ip ;
$this -> root = $root ;
2011-01-01 06:12:31 -05:00
$this -> mod = $mod ;
2011-02-06 08:37:26 -05:00
if ( $this -> mod )
// Fix internal links
// Very complicated regex
$this -> body = preg_replace (
2011-02-19 01:38:25 -05:00
'/<a((([a-zA-Z]+="[^"]+")|[a-zA-Z]+=[a-zA-Z]+|\s)*)href="' . preg_quote ( $config [ 'root' ], '/' ) . '(' . sprintf ( preg_quote ( $config [ 'board_path' ], '/' ), '\w+' ) . ')/' ,
'<a $1href="?/$4' ,
2011-02-06 08:37:26 -05:00
$this -> body
);
2010-11-02 06:57:33 -04:00
}
2010-12-16 10:20:16 -05:00
public function postControls () {
2011-02-12 01:25:15 -05:00
global $board , $config ;
2011-01-18 00:48:39 -05:00
2010-12-16 10:20:16 -05:00
$built = '' ;
2011-01-01 06:12:31 -05:00
if ( $this -> mod ) {
2010-12-16 10:20:16 -05:00
// Mod controls (on posts)
$built .= '<span class="controls">' ;
// Delete
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'delete' ])
2011-04-06 04:31:26 -04:00
$built .= ' ' . confirmLink ( $config [ 'mod' ][ 'link_delete' ], 'Delete' , 'Are you sure you want to delete this?' , $board [ 'uri' ] . '/delete/' . $this -> id );
2010-12-16 10:20:16 -05:00
// Delete all posts by IP
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'deletebyip' ])
2011-04-06 04:31:26 -04:00
$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 );
2010-12-16 10:20:16 -05:00
// Ban
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'ban' ])
$built .= ' <a title="Ban" href="?/' . $board [ 'uri' ] . '/ban/' . $this -> id . '">' . $config [ 'mod' ][ 'link_ban' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
// Ban & Delete
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'bandelete' ])
$built .= ' <a title="Ban & Delete" href="?/' . $board [ 'uri' ] . '/ban&delete/' . $this -> id . '">' . $config [ 'mod' ][ 'link_bandelete' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
// Delete file (keep post)
2011-02-12 01:25:15 -05:00
if ( ! empty ( $this -> file ) && $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'deletefile' ])
$built .= ' <a title="Remove file" href="?/' . $board [ 'uri' ] . '/deletefile/' . $this -> id . '">' . $config [ 'mod' ][ 'link_deletefile' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
$built .= '</span>' ;
}
return $built ;
}
2010-11-02 06:57:33 -04:00
public function build ( $index = false ) {
2011-02-12 01:25:15 -05:00
global $board , $config ;
2010-11-30 03:59:35 -05:00
2011-04-13 03:24:06 -04:00
$built = '<div class="post reply" id="reply_' . $this -> id . '">' .
2011-01-20 21:14:55 -05:00
'<p class="intro"' . ( ! $index ? ' id="' . $this -> id . '"' : '' ) . '>' .
// Delete
'<input type="checkbox" class="delete" name="delete_' . $this -> id . '" id="delete_' . $this -> id . '" /><label for="delete_' . $this -> id . '">' ;
2010-11-03 12:10:47 -04:00
// Subject
2010-11-05 13:47:12 -04:00
if ( ! empty ( $this -> subject ))
$built .= '<span class="subject">' . $this -> subject . '</span> ' ;
2010-11-03 12:10:47 -04:00
// Email
if ( ! empty ( $this -> email ))
$built .= '<a class="email" href="mailto:' . $this -> email . '">' ;
// Name
2011-04-12 07:08:54 -04:00
$built .= '<span class="name"' .
( ! empty ( $this -> capcode ) && isset ( $config [ 'custom_capcode' ][ $this -> capcode ][ 1 ]) ?
' style="' . $config [ 'custom_capcode' ][ $this -> capcode ][ 1 ] . '"'
: '' )
. '>' . $this -> name . '</span>'
2010-11-03 12:10:47 -04:00
// Trip
2011-04-12 07:08:54 -04:00
. ( ! 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 ) : '' );
2010-11-03 12:10:47 -04:00
2011-02-20 06:47:01 -05:00
// End email
if ( ! empty ( $this -> email ))
$built .= '</a>' ;
2010-12-10 05:14:45 -05:00
// IP Address
2011-02-12 01:25:15 -05:00
if ( $this -> mod && $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'show_ip' ]) {
2010-12-10 05:14:45 -05:00
$built .= ' [<a style="margin:0;" href="?/IP/' . $this -> ip . '">' . $this -> ip . '</a>]' ;
}
2010-11-03 12:10:47 -04:00
// Date/time
2011-02-12 01:25:15 -05:00
$built .= ' ' . date ( $config [ 'post_date' ], $this -> time );
2010-11-03 12:10:47 -04:00
2011-01-20 21:14:55 -05:00
// End delete
2011-04-13 06:02:58 -04:00
$built .= '</label>'
2011-01-20 21:14:55 -05:00
2011-04-13 06:02:58 -04:00
// Poster ID
. ( $config [ 'poster_ids' ] ?
' ID: ' . poster_id ( $this -> ip , $this -> thread )
: '' )
. ' <a class="post_no"' .
2010-11-03 12:10:47 -04:00
// JavaScript highlight
( $index ? '' : ' onclick="highlightReply(' . $this -> id . ');"' ) .
2011-02-12 01:25:15 -05:00
' href="' . $this -> root . $board [ 'dir' ] . $config [ 'dir' ][ 'res' ] . $this -> thread . '.html' . '#' . $this -> id . '">No.</a>' .
2010-11-03 12:10:47 -04:00
// JavaScript cite
2011-02-12 01:25:15 -05:00
'<a class="post_no"' . ( $index ? '' : ' onclick="citeReply(' . $this -> id . ');"' ) . ' href="' . ( $index ? $this -> root . $board [ 'dir' ] . $config [ 'dir' ][ 'res' ] . $this -> thread . '.html' . '#q' . $this -> id : 'javascript:void(0);' ) . '">' . $this -> id . '</a>' .
2010-11-03 12:10:47 -04:00
'</p>' ;
// File info
2011-01-01 06:12:31 -05:00
if ( ! empty ( $this -> file ) && $this -> file != 'deleted' ) {
2011-03-17 03:56:18 -04:00
$built .= '<p class="fileinfo">File: <a href="' . $config [ 'uri_img' ] . $this -> file . '">' . $this -> file . '</a> <span class="unimportant">(' .
2010-11-03 12:10:47 -04:00
// Filesize
2011-04-13 06:57:41 -04:00
format_bytes ( $this -> filesize ) .
2010-11-03 12:10:47 -04:00
// File dimensions
2011-04-13 06:57:41 -04:00
( $this -> filex && $this -> filey ?
', ' . $this -> filex . 'x' . $this -> filey
: '' );
2010-11-03 12:10:47 -04:00
// Aspect Ratio
2011-04-13 06:57:41 -04:00
if ( $config [ 'show_ratio' ] && $this -> filex && $this -> filey ) {
$fraction = fraction ( $this -> filex , $this -> filey , ':' );
$built .= ', ' . $fraction ;
}
2010-11-03 12:10:47 -04:00
// Filename
2010-12-12 10:44:43 -05:00
$built .= ', ' . $this -> filename . ')</span></p>' .
2010-11-03 12:10:47 -04:00
// Thumbnail
2011-03-17 03:56:18 -04:00
'<a href="' . $config [ 'uri_img' ] . $this -> file . '"><img src="' . $config [ 'uri_thumb' ] . $this -> thumb . '" style="width:' . $this -> thumbx . 'px;height:' . $this -> thumby . 'px;" /></a>' ;
2011-01-01 06:12:31 -05:00
} elseif ( $this -> file == 'deleted' ) {
2011-02-12 01:25:15 -05:00
$built .= '<img src="' . $config [ 'image_deleted' ] . '" />' ;
2010-12-12 10:44:43 -05:00
}
2010-12-16 10:20:16 -05:00
$built .= $this -> postControls ();
2010-11-03 12:10:47 -04:00
// Body
$built .= '<p class="body">' . $this -> body . '</p></div><br class="clear"/>' ;
2010-11-02 06:57:33 -04:00
return $built ;
}
};
class Thread {
2011-04-12 07:08:54 -04:00
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 ) {
2011-02-12 01:25:15 -05:00
global $config ;
if ( ! isset ( $root )) $root = $config [ 'root' ];
2010-11-02 06:57:33 -04:00
$this -> id = $id ;
2010-11-03 08:02:15 -04:00
$this -> subject = utf8tohtml ( $subject );
2010-11-02 06:57:33 -04:00
$this -> email = $email ;
2010-11-03 08:02:15 -04:00
$this -> name = utf8tohtml ( $name );
2010-11-02 06:57:33 -04:00
$this -> trip = $trip ;
2011-04-12 07:08:54 -04:00
$this -> capcode = $capcode ;
2010-11-02 06:57:33 -04:00
$this -> body = $body ;
$this -> time = $time ;
$this -> thumb = $thumb ;
$this -> thumbx = $thumbx ;
$this -> thumby = $thumby ;
$this -> file = $file ;
$this -> filex = $filex ;
$this -> filey = $filey ;
$this -> filesize = $filesize ;
$this -> filename = $filename ;
$this -> omitted = 0 ;
2011-02-17 01:07:36 -05:00
$this -> omitted_images = 0 ;
2010-11-02 06:57:33 -04:00
$this -> posts = Array ();
2010-12-10 05:14:45 -05:00
$this -> ip = $ip ;
2010-12-16 07:08:52 -05:00
$this -> sticky = $sticky ;
2011-01-02 06:30:30 -05:00
$this -> locked = $locked ;
2010-12-10 05:14:45 -05:00
$this -> root = $root ;
2011-01-01 06:12:31 -05:00
$this -> mod = $mod ;
2011-02-17 09:13:56 -05:00
$this -> hr = $hr ;
2011-02-06 08:37:26 -05:00
if ( $this -> mod )
// Fix internal links
// Very complicated regex
$this -> body = preg_replace (
2011-02-12 01:25:15 -05:00
'/<a(([a-zA-Z]+="[^"]+")|[a-zA-Z]+=[a-zA-Z]+|\s)*href="' . preg_quote ( $config [ 'root' ], '/' ) . '(' . sprintf ( preg_quote ( $config [ 'board_path' ], '/' ), '\w+' ) . ')/' ,
2011-02-06 08:37:26 -05:00
'<a href="?/$3' ,
$this -> body
);
2010-11-02 06:57:33 -04:00
}
public function add ( Post $post ) {
$this -> posts [] = $post ;
}
2011-01-18 00:48:39 -05:00
public function postControls () {
2011-02-12 01:25:15 -05:00
global $board , $config ;
2011-01-18 00:48:39 -05:00
2010-12-16 10:20:16 -05:00
$built = '' ;
2011-01-01 06:12:31 -05:00
if ( $this -> mod ) {
2010-12-16 10:20:16 -05:00
// Mod controls (on posts)
$built .= '<span class="controls op">' ;
// Delete
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'delete' ])
2011-04-06 04:31:26 -04:00
$built .= ' ' . confirmLink ( $config [ 'mod' ][ 'link_delete' ], 'Delete' , 'Are you sure you want to delete this?' , $board [ 'uri' ] . '/delete/' . $this -> id );
2010-12-16 10:20:16 -05:00
// Delete all posts by IP
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'deletebyip' ])
2011-04-06 04:31:26 -04:00
$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 );
2010-12-16 10:20:16 -05:00
// Ban
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'ban' ])
$built .= ' <a title="Ban" href="?/' . $board [ 'uri' ] . '/ban/' . $this -> id . '">' . $config [ 'mod' ][ 'link_ban' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
// Ban & Delete
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'bandelete' ])
$built .= ' <a title="Ban & Delete" href="?/' . $board [ 'uri' ] . '/ban&delete/' . $this -> id . '">' . $config [ 'mod' ][ 'link_bandelete' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
2011-01-02 09:57:24 -05:00
// Stickies
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'sticky' ])
2010-12-16 10:20:16 -05:00
if ( $this -> sticky )
2011-02-12 01:25:15 -05:00
$built .= ' <a title="Make thread not sticky" href="?/' . $board [ 'uri' ] . '/unsticky/' . $this -> id . '">' . $config [ 'mod' ][ 'link_desticky' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
else
2011-02-12 01:25:15 -05:00
$built .= ' <a title="Make thread sticky" href="?/' . $board [ 'uri' ] . '/sticky/' . $this -> id . '">' . $config [ 'mod' ][ 'link_sticky' ] . '</a>' ;
2010-12-16 10:20:16 -05:00
2011-01-02 09:58:38 -05:00
// Lock
2011-02-12 01:25:15 -05:00
if ( $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'lock' ])
2011-01-02 10:00:03 -05:00
if ( $this -> locked )
2011-02-12 01:25:15 -05:00
$built .= ' <a title="Lock thread" href="?/' . $board [ 'uri' ] . '/unlock/' . $this -> id . '">' . $config [ 'mod' ][ 'link_unlock' ] . '</a>' ;
2011-01-02 09:58:38 -05:00
else
2011-02-12 01:25:15 -05:00
$built .= ' <a title="Unlock thread" href="?/' . $board [ 'uri' ] . '/lock/' . $this -> id . '">' . $config [ 'mod' ][ 'link_lock' ] . '</a>' ;
2011-01-02 09:58:38 -05:00
2011-01-02 09:57:24 -05:00
2010-12-16 10:20:16 -05:00
$built .= '</span>' ;
}
return $built ;
}
2010-11-02 06:57:33 -04:00
public function build ( $index = false ) {
2011-02-12 01:25:15 -05:00
global $board , $config ;
2010-11-30 03:59:35 -05:00
2011-03-17 03:56:18 -04:00
$built = '<p class="fileinfo">File: <a href="' . $config [ 'uri_img' ] . $this -> file . '">' . $this -> file . '</a> <span class="unimportant">(' .
2010-11-04 02:16:47 -04:00
// Filesize
2011-04-13 06:57:41 -04:00
format_bytes ( $this -> filesize ) .
2010-11-04 02:16:47 -04:00
// File dimensions
2011-04-13 06:57:41 -04:00
( $this -> filex && $this -> filey ?
', ' . $this -> filex . 'x' . $this -> filey
: '' );
2010-11-04 02:16:47 -04:00
// Aspect Ratio
2011-04-13 06:57:41 -04:00
if ( $config [ 'show_ratio' ] && $this -> filex && $this -> filey ) {
2010-11-04 02:16:47 -04:00
$fraction = fraction ( $this -> filex , $this -> filey , ':' );
$built .= ', ' . $fraction ;
}
// Filename
$built .= ', ' . $this -> filename . ')</span></p>' .
// Thumbnail
2011-03-17 03:56:18 -04:00
'<a href="' . $config [ 'uri_img' ] . $this -> file . '"><img src="' . $config [ 'uri_thumb' ] . $this -> thumb . '" style="width:' . $this -> thumbx . 'px;height:' . $this -> thumby . 'px;" /></a>' ;
2010-11-04 02:16:47 -04:00
$built .= '<div class="post op"><p class="intro"' . ( ! $index ? ' id="' . $this -> id . '"' : '' ) . '>' ;
2011-01-20 21:14:55 -05:00
// Delete
$built .= '<input type="checkbox" class="delete" name="delete_' . $this -> id . '" id="delete_' . $this -> id . '" /><label for="delete_' . $this -> id . '">' ;
2010-11-04 02:16:47 -04:00
// Subject
2010-11-05 13:53:45 -04:00
if ( ! empty ( $this -> subject ))
$built .= '<span class="subject">' . $this -> subject . '</span> ' ;
2010-11-04 02:16:47 -04:00
// Email
if ( ! empty ( $this -> email ))
$built .= '<a class="email" href="mailto:' . $this -> email . '">' ;
// Name
$built .= '<span class="name">' . $this -> name . '</span>'
// Trip
2011-04-12 07:08:54 -04:00
. ( ! empty ( $this -> trip ) ? ' <span class="trip">' . $this -> trip . '</span>' : '' )
// Capcode
. ( ! empty ( $this -> capcode ) ? capcode ( $this -> capcode ) : '' );
2010-11-04 02:16:47 -04:00
2011-02-20 06:47:01 -05:00
// End email
if ( ! empty ( $this -> email ))
$built .= '</a>' ;
2010-12-10 05:14:45 -05:00
// IP Address
2011-02-12 01:25:15 -05:00
if ( $this -> mod && $this -> mod [ 'type' ] >= $config [ 'mod' ][ 'show_ip' ]) {
2010-12-10 05:14:45 -05:00
$built .= ' [<a style="margin:0;" href="?/IP/' . $this -> ip . '">' . $this -> ip . '</a>]' ;
}
2010-11-04 02:16:47 -04:00
// Date/time
2011-02-12 01:25:15 -05:00
$built .= ' ' . date ( $config [ 'post_date' ], $this -> time );
2010-11-04 02:16:47 -04:00
2011-01-20 21:14:55 -05:00
// End delete
2011-04-13 06:02:58 -04:00
$built .= '</label>'
// Poster ID
. ( $config [ 'poster_ids' ] ?
' ID: ' . poster_id ( $this -> ip , $this -> id )
: '' )
2011-01-20 21:14:55 -05:00
2011-04-13 06:02:58 -04:00
. ' <a class="post_no"' .
2010-11-04 02:16:47 -04:00
// JavaScript highlight
( $index ? '' : ' onclick="highlightReply(' . $this -> id . ');"' ) .
2011-02-12 01:25:15 -05:00
' href="' . $this -> root . $board [ 'dir' ] . $config [ 'dir' ][ 'res' ] . $this -> id . '.html' . '#' . $this -> id . '">No.</a>' .
2010-11-04 02:16:47 -04:00
// JavaScript cite
2011-02-12 01:25:15 -05:00
'<a class="post_no"' . ( $index ? '' : ' onclick="citeReply(' . $this -> id . ');"' ) . ' href="' . ( $index ? $this -> root . $board [ 'dir' ] . $config [ 'dir' ][ 'res' ] . $this -> id . '.html' . '#q' . $this -> id : 'javascript:void(0);' ) . '">' . $this -> id . '</a>' .
2010-12-16 07:08:52 -05:00
// Sticky
2011-02-12 01:25:15 -05:00
( $this -> sticky ? '<img class="icon" title="Sticky" src="' . $config [ 'image_sticky' ] . '" />' : '' ) .
2011-01-02 06:30:30 -05:00
// Locked
2011-02-12 01:25:15 -05:00
( $this -> locked ? '<img class="icon" title="Locked" src="' . $config [ 'image_locked' ] . '" />' : '' ) .
2010-11-04 02:16:47 -04:00
// [Reply]
2011-02-12 01:25:15 -05:00
( $index ? '<a href="' . $this -> root . $board [ 'dir' ] . $config [ 'dir' ][ 'res' ] . $this -> id . '.html">[Reply]</a>' : '' ) .
2010-12-16 07:08:52 -05:00
2010-12-16 01:04:10 -05:00
// Mod controls
2010-12-16 10:20:16 -05:00
$this -> postControls () .
2010-11-04 02:16:47 -04:00
'</p>' ;
2010-12-16 01:04:10 -05:00
2010-11-04 02:16:47 -04:00
// Body
2011-02-21 19:47:09 -05:00
$built .= '<p class="body">' . $this -> body . '</p>' .
2010-11-04 02:16:47 -04:00
// Omitted posts
2011-02-17 01:07:36 -05:00
( $this -> omitted || $this -> omitted_images ? '<span class="omitted">' .
( $this -> omitted ?
$this -> omitted . ' post' . ( $this -> omitted == 1 ? '' : 's' ) .
( $this -> omitted_images ? ' and ' : '' )
: '' ) .
( $this -> omitted_images ?
$this -> omitted_images . ' image repl' . ( $this -> omitted_images == 1 ? 'y' : 'ies' )
: '' ) .
' omitted. Click reply to view.</span>' : '' ) .
2010-11-04 02:16:47 -04:00
// End
'</div>' ;
// Replies
2010-11-02 06:57:33 -04:00
foreach ( $this -> posts as & $post ) {
$built .= $post -> build ( $index );
}
2010-11-04 02:16:47 -04:00
2011-02-17 09:13:56 -05:00
$built .= '<br class="clear"/>' . ( $this -> hr ? '<hr/>' : '' );
2010-11-02 06:57:33 -04:00
return $built ;
}
};
2010-11-15 08:36:48 -05:00
?>