Michael Save
12 years ago
15 changed files with 6754 additions and 6668 deletions
@ -1,31 +1,25 @@ |
|||
<?php |
|||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { |
|||
// You cannot request this file directly. |
|||
header('Location: ../', true, 302); |
|||
exit; |
|||
} |
|||
|
|||
/* |
|||
Stuff to help with the display. |
|||
/* |
|||
* Copyright (c) 2010-2012 Tinyboard Development Group |
|||
*/ |
|||
|
|||
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) { |
|||
// You cannot request this file directly. |
|||
exit; |
|||
} |
|||
|
|||
/* |
|||
/* |
|||
[email protected] |
|||
http://www.php.net/manual/en/function.filesize.php#100097 |
|||
*/ |
|||
function format_bytes($size) { |
|||
*/ |
|||
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]; |
|||
} |
|||
|
|||
function commaize($n) { |
|||
$n = strval($n); |
|||
return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3); |
|||
} |
|||
} |
|||
|
|||
function doBoardListPart($list, $root) { |
|||
function doBoardListPart($list, $root) { |
|||
global $config; |
|||
|
|||
$body = ''; |
|||
@ -43,9 +37,9 @@ |
|||
$body = preg_replace('/\/$/', '', $body); |
|||
|
|||
return $body; |
|||
} |
|||
} |
|||
|
|||
function createBoardlist($mod=false) { |
|||
function createBoardlist($mod=false) { |
|||
global $config; |
|||
|
|||
if(!isset($config['boards'])) return Array('top'=>'','bottom'=>''); |
|||
@ -60,9 +54,9 @@ |
|||
'top' => '<div class="boardlist">' . $body . '</div>', |
|||
'bottom' => '<div class="boardlist bottom">' . $body . '</div>' |
|||
); |
|||
} |
|||
} |
|||
|
|||
function error($message, $priority = true) { |
|||
function error($message, $priority = true) { |
|||
global $board, $mod, $config; |
|||
|
|||
if($config['syslog'] && $priority !== false) { |
|||
@ -87,9 +81,9 @@ |
|||
$board['dir'] . $config['file_index'] . "\">Go back</a>.</p>" : '') . |
|||
'</center>' |
|||
))); |
|||
} |
|||
} |
|||
|
|||
function loginForm($error=false, $username=false, $redirect=false) { |
|||
function loginForm($error=false, $username=false, $redirect=false) { |
|||
global $config; |
|||
|
|||
die(Element('page.html', Array( |
|||
@ -104,9 +98,9 @@ |
|||
) |
|||
) |
|||
))); |
|||
} |
|||
} |
|||
|
|||
function pm_snippet($body, $len=null) { |
|||
function pm_snippet($body, $len=null) { |
|||
global $config; |
|||
|
|||
if(!isset($len)) |
|||
@ -128,9 +122,9 @@ |
|||
|
|||
// Re-escape the characters. |
|||
return '<em>' . utf8tohtml($body) . ($strlen > $len ? '…' : '') . '</em>'; |
|||
} |
|||
} |
|||
|
|||
function capcode($cap) { |
|||
function capcode($cap) { |
|||
global $config; |
|||
|
|||
if(!$cap) |
|||
@ -152,9 +146,9 @@ |
|||
} |
|||
|
|||
return $capcode; |
|||
} |
|||
} |
|||
|
|||
function truncate($body, $url, $max_lines = false, $max_chars = false) { |
|||
function truncate($body, $url, $max_lines = false, $max_chars = false) { |
|||
global $config; |
|||
|
|||
if($max_lines === false) |
|||
@ -209,20 +203,21 @@ |
|||
} |
|||
|
|||
return $body; |
|||
} |
|||
} |
|||
|
|||
function confirmLink($text, $title, $confirm, $href) { |
|||
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 { |
|||
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; |
|||
if(!isset($root)) $root = &$config['root']; |
|||
if(!isset($root)) |
|||
$root = &$config['root']; |
|||
|
|||
$this->id = $id; |
|||
$this->thread = $thread; |
|||
@ -306,12 +301,13 @@ |
|||
|
|||
return Element('post_reply.html', Array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); |
|||
} |
|||
}; |
|||
}; |
|||
|
|||
class Thread { |
|||
class Thread { |
|||
public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) { |
|||
global $config; |
|||
if(!isset($root)) $root = &$config['root']; |
|||
if(!isset($root)) |
|||
$root = &$config['root']; |
|||
|
|||
$this->id = $id; |
|||
$this->subject = utf8tohtml($subject); |
|||
@ -441,5 +437,5 @@ |
|||
|
|||
return 'thread_' . ($index ? 'index_' : '') . $board['uri'] . '_' . $this->id; |
|||
} |
|||
}; |
|||
?> |
|||
}; |
|||
|
|||
|
File diff suppressed because it is too large
@ -1,11 +1,15 @@ |
|||
<?php |
|||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { |
|||
|
|||
/* |
|||
* Copyright (c) 2010-2012 Tinyboard Development Group |
|||
*/ |
|||
|
|||
if(realpath($_SERVER['SCRIPT_FILENAME']) == str_replace('\\', '/', __FILE__)) { |
|||
// You cannot request this file directly. |
|||
header('Location: ../', true, 302); |
|||
exit; |
|||
} |
|||
} |
|||
|
|||
class Image { |
|||
class Image { |
|||
public $src, $format, $image, $size; |
|||
public function __construct($src, $format = false) { |
|||
global $config; |
|||
@ -84,9 +88,9 @@ |
|||
public function destroy() { |
|||
$this->image->_destroy(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImageGD { |
|||
class ImageGD { |
|||
public function GD_create() { |
|||
$this->image = imagecreatetruecolor($this->width, $this->height); |
|||
} |
|||
@ -97,9 +101,9 @@ |
|||
$this->GD_create(); |
|||
$this->GD_copyresampled(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImageBase extends ImageGD { |
|||
class ImageBase extends ImageGD { |
|||
public $image, $src, $original, $original_width, $original_height, $width, $height; |
|||
public function valid() { |
|||
return (bool)$this->image; |
|||
@ -144,9 +148,9 @@ |
|||
// use default GD functions |
|||
$this->GD_resize(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImageImagick extends ImageBase { |
|||
class ImageImagick extends ImageBase { |
|||
public function init() { |
|||
$this->image = new Imagick(); |
|||
$this->image->setBackgroundColor(new ImagickPixel('transparent')); |
|||
@ -207,10 +211,10 @@ |
|||
$this->image->scaleImage($this->width, $this->height, false); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
class ImageConvert extends ImageBase { |
|||
class ImageConvert extends ImageBase { |
|||
public $width, $height, $temp; |
|||
|
|||
public function init() { |
|||
@ -264,9 +268,9 @@ |
|||
if(shell_exec("convert -flatten -filter Point -scale {$this->width}x{$this->height} +antialias -quality {$quality} " . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) |
|||
error('Failed to resize image!'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImagePNG extends ImageBase { |
|||
class ImagePNG extends ImageBase { |
|||
public function from() { |
|||
$this->image = @imagecreatefrompng($this->src); |
|||
} |
|||
@ -281,9 +285,9 @@ |
|||
imagealphablending($this->image, false); |
|||
$this->GD_copyresampled(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImageGIF extends ImageBase { |
|||
class ImageGIF extends ImageBase { |
|||
public function from() { |
|||
$this->image = @imagecreatefromgif($this->src); |
|||
} |
|||
@ -296,38 +300,38 @@ |
|||
imagesavealpha($this->image, true); |
|||
$this->GD_copyresampled(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
class ImageJPG extends ImageBase { |
|||
class ImageJPG extends ImageBase { |
|||
public function from() { |
|||
$this->image = @imagecreatefromjpeg($this->src); |
|||
} |
|||
public function to($src) { |
|||
imagejpeg($this->image, $src); |
|||
} |
|||
} |
|||
class ImageJPEG extends ImageJPG { |
|||
} |
|||
} |
|||
class ImageJPEG extends ImageJPG { |
|||
} |
|||
|
|||
class ImageBMP extends ImageBase { |
|||
class ImageBMP extends ImageBase { |
|||
public function from() { |
|||
$this->image = @imagecreatefrombmp($this->src); |
|||
} |
|||
public function to($src) { |
|||
imagebmp($this->image, $src); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
/*********************************************/ |
|||
/* Fonction: imagecreatefrombmp */ |
|||
/* Author: DHKold */ |
|||
/* Contact: [email protected] */ |
|||
/* Date: The 15th of June 2005 */ |
|||
/* Version: 2.0B */ |
|||
/*********************************************/ |
|||
/*********************************************/ |
|||
/* Fonction: imagecreatefrombmp */ |
|||
/* Author: DHKold */ |
|||
/* Contact: [email protected] */ |
|||
/* Date: The 15th of June 2005 */ |
|||
/* Version: 2.0B */ |
|||
/*********************************************/ |
|||
|
|||
function imagecreatefrombmp($filename) { |
|||
function imagecreatefrombmp($filename) { |
|||
if (! $f1 = fopen($filename,"rb")) return FALSE; |
|||
$FILE = unpack("vfile_type/Vfile_size/Vreserved/Vbitmap_offset", fread($f1,14)); |
|||
if ($FILE['file_type'] != 19778) return FALSE; |
|||
@ -403,9 +407,9 @@ |
|||
fclose($f1); |
|||
|
|||
return $res; |
|||
} |
|||
} |
|||
|
|||
function imagebmp(&$img, $filename='') { |
|||
function imagebmp(&$img, $filename='') { |
|||
$widthOrig = imagesx($img); |
|||
$widthFloor = ((floor($widthOrig/16))*16); |
|||
$widthCeil = ((ceil($widthOrig/16))*16); |
|||
@ -476,13 +480,12 @@ |
|||
fwrite($file, $result); |
|||
fclose($file); |
|||
} |
|||
} |
|||
// imagebmp helpers |
|||
function int_to_dword($n) { |
|||
} |
|||
// imagebmp helpers |
|||
function int_to_dword($n) { |
|||
return chr($n & 255).chr(($n >> 8) & 255).chr(($n >> 16) & 255).chr(($n >> 24) & 255); |
|||
} |
|||
function int_to_word($n) { |
|||
} |
|||
function int_to_word($n) { |
|||
return chr($n & 255).chr(($n >> 8) & 255); |
|||
} |
|||
} |
|||
|
|||
?> |
|||
|
@ -1,10 +0,0 @@ |
|||
<?php |
|||
if($_SERVER['SCRIPT_FILENAME'] == str_replace('\\', '/', __FILE__)) { |
|||
// You cannot request this file directly. |
|||
header('Location: ../', true, 302); |
|||
exit; |
|||
} |
|||
|
|||
// 'false' means that the user is not logged in as a moderator |
|||
$mod = false; |
|||
|
Loading…
Reference in new issue