';
if ($boardpage == 0) {
$output .= _gettext('Previous');
} else {
$output .= '';
}
$output .= ' | ';
for ($i=0;$i<=$pages;$i++) {
if ($boardpage == $i) {
$output .= '['.$i.']';
} else {
$output .= '[' . $i . ']';
}
$output .= ' ';
}
/* Remove the unwanted space */
$output = substr($output, 0, -1);
$output .= ' | ';
if ($boardpage == $pages) {
$output .= _gettext('Next');
} else {
$output .= '';
}
$output .= ' |
';
return $output;
}
/**
* Create a single row for a thread, which will be displayed in the upload imageboard board pages
*
* @param string $post Post data
* @param string $board Board directory
* @param integer $maxage Maximum thread age
* @param integer $replies Number of replies to the thread
* @return string Thread row
*/
function uploadImageboardPageRow($post, $board, $maxage, $replies) {
if ($post['tag'] == '') {
$post['tag'] = '*';
}
if ($post['filesize_formatted'] == '') {
$filesize = ConvertBytes($post['filesize']);
} else {
$filesize = $post['filesize_formatted'];
}
$output = '' . "\n" .
' ' . $post['id'] . "\n" .
' ' . "\n" .
' ' . "\n" .
' ' . formatNameAndTrip($post['name'], $post['email'], $post['tripcode']) .
' | ' . "\n" .
' ' . "\n" .
' [' . $post['filename'] . '.' . $post['filetype'] . ']' . "\n" .
' | ' . "\n" .
' ' . "\n" .
' [' . $post['tag'] . ']' . "\n" .
' | ' . "\n" .
' ' . "\n" .
' ' . $post['subject'] . "\n" .
' | ' . "\n" .
' ' . "\n" .
' ' . $filesize . "\n" .
' | ' . "\n" .
' ' . "\n" .
' ' . date("y/m/d(D)H:i", $post['postedat']) . '' . "\n" .
' | ' . "\n" .
' ' . "\n" .
' ' . $replies . "\n" .
' | ' . "\n" .
' ' . "\n" .
' [Reply]' . "\n" .
' | ' . "\n" .
'
' . "\n";
return $output;
}
/* <3 coda for this wonderful snippet
print $contents to $filename by using a temporary file and renaming it */
function print_page($filename, $contents, $board) {
global $tc_db;
$tempfile = tempnam(KU_BOARDSDIR . $board . '/res', 'tmp'); /* Create the temporary file */
$fp = fopen($tempfile, 'w');
fwrite($fp, $contents);
fclose($fp);
/* If we aren't able to use the rename function, try the alternate method */
if (!@rename($tempfile, $filename)) {
copy($tempfile, $filename);
unlink($tempfile);
}
chmod($filename, 0664); /* it was created 0600 */
}
/**
* Create thread links which are displayed at the top of thread pages, sometimes on the bottom as well, and also displayed in the thread info row
*
* @param integer $type Link type
* @param integer $threadid Thread ID
* @param string $board Board directory
* @param integer $type Board type
* @param boolean $modifier_last50 Last 50 modifier in effect
* @param boolean $modifier_first100 First 100 modifier in effect
* @param boolean $forcereplymodehide Force the Reply Mode to be hidden
* @return string Thread links
*/
function threadLinks($type, $threadid, $board, $boardtype, $modifier_last50, $modifier_first100, $forcereplymodehide = false, $forceentirethreadlink = false) {
if ($boardtype != 1) {
$leftbracket = '[';
$rightbracket = ']';
} else {
$leftbracket = '';
$rightbracket = '';
}
if ($type == 'return') {
$output = $leftbracket . '' . _gettext('Return') . '' . $rightbracket;
} elseif ($type == 'page' && $boardtype == 1) {
$output = '' . _gettext('The 5 newest replies are shown below.') . '
';
} elseif ($type == 'page' && $boardtype != 1) {
$output = $leftbracket . '' . _gettext('Reply') . '' . $rightbracket;
}
if ((KU_FIRSTLAST && $modifier_last50) || $boardtype == 1 || $forceentirethreadlink) {
if ($type == 'return') {
$output .= ' ' . $leftbracket;
}
if ($type == 'return' || ($type == 'page' && $boardtype == 1)) {
$output .= '';
if ($type == 'return') {
$output .= _gettext('Entire Thread');
} elseif ($type == 'page') {
$output .= _gettext('Read this thread from the beginning');
}
$output .= '';
}
if ($type == 'return') {
$output .= $rightbracket;
}
if ($modifier_first100) {
$output .= ' ' . $leftbracket . '' . _gettext('First 100 posts') . '' . $rightbracket;
}
if ($modifier_last50) {
$output .= ' ' . $leftbracket . '' . _gettext('Last 50 posts') . '' . $rightbracket;
}
}
if ($boardtype == 1 && $type == 'return') {
$output .= '
';
}elseif ($type == 'page' && $boardtype == 1) {
$output .= '
';
} elseif ($type != 'page' && $boardtype != 1 && !$forcereplymodehide) {
$output .= '' . _gettext('Posting mode: Reply') . '
';
}
return $output;
}
?>