Compare commits

..

No commits in common. "62e7a4b22ef1d88311ef54180bbeff208e5b6f84" and "8ea0e124a3708dc2f2ab275633eb15fbfdd82597" have entirely different histories.

23 changed files with 540 additions and 671 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

View File

@ -295,19 +295,13 @@ function checkSpam(array $extra_salt = array()) {
#print_err("checkSpam start");
$extra_salt_orig = $extra_salt;
/*
if (!isset($_POST['hash'])) {
print_err("checkSpam: _POST array doesn't have key 'hash', check failed.");
dumpVars($extra_salt_orig);
return true;
}
*/
if (isset($_POST['hash'])) {
$hash = $_POST['hash'];
} else {
$hash = "";
}
$hash = $_POST['hash'];
if (!empty($extra_salt)) {
// create a salted hash of the "extra salt"
@ -342,12 +336,7 @@ function checkSpam(array $extra_salt = array()) {
// Use SHA1 for the hash
$_hash = sha1($_hash . $extra_salt);
if (empty($hash)) {
print_err("checkSpam: hash is either empty or was never present, check failed. Not flagging as spam however.");
dumpVars($extra_salt_orig);
// Ignore missing hash, because it was missing for some legitimate posters and bots tend to fill in any field.
return false;
} else if ($hash != $_hash) {
if ($hash != $_hash) {
print_err("checkSpam: Hash values do not match! submitted hash value from POST data: $hash ; Computed hash value: $_hash");
dumpVars($extra_salt_orig);
return true;

View File

@ -24,42 +24,6 @@ register_shutdown_function('fatal_error_handler');
$error_recursion=false;
/*
* Global anything is always a bad idea, but since all of this website's error handling comes
* down to calling this error function and quitting, we have no way of catching exceptions, for example
* during thumbnail creation.
*
* So push things to run in case of a crash into a list, and then run all of them in error.
*
* This will be exclusive to callbacks for posting a post callflow, not mod actions or anything else.
*/
function global_post_cleanup() {
global $post_cleanup_list;
foreach ($post_cleanup_list as $f) {
$f();
}
unset($post_cleanup_list);
}
function push_global_post_cleanup($f) {
global $post_cleanup_list;
if (!isset($post_cleanup_list)) {
$post_cleanup_list = array($f);
} else {
array_push($post_cleanup_list, $f);
}
}
function init_global_post_cleanup() {
global $post_cleanup_list;
$post_cleanup_list = array();
}
function error($message, $priority = true, $debug_stuff = false) {
global $board, $mod, $config, $db_error, $error_recursion;
@ -111,14 +75,11 @@ function error($message, $priority = true, $debug_stuff = false) {
$data['debug']=$debug_stuff;
}
print json_encode($data);
global_post_cleanup();
exit();
}
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error');
global_post_cleanup();
die(Element('page.html', array(
'config' => $config,
'title' => _('Error'),

View File

@ -8,98 +8,98 @@ defined('TINYBOARD') or exit;
require_once 'inc/polyfill.php';
class Image {
public $src, $format, $image, $size;
public $src, $format, $image, $size;
public function __construct($src, $format = false, $size = false) {
global $config;
public function __construct($src, $format = false, $size = false) {
global $config;
$this->src = $src;
$this->format = $format;
$this->src = $src;
$this->format = $format;
if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif (in_array($config['thumb_method'], array('convert', 'convert+gifsicle', 'gm', 'gm+gifsicle'))) {
$classname = 'ImageConvert';
} else {
$classname = 'Image' . strtoupper($this->format);
if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $this->format);
}
}
if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif (in_array($config['thumb_method'], array('convert', 'convert+gifsicle', 'gm', 'gm+gifsicle'))) {
$classname = 'ImageConvert';
} else {
$classname = 'Image' . strtoupper($this->format);
if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $this->format);
}
}
$this->image = new $classname($this, $size);
$this->image = new $classname($this, $size);
if (!$this->image->valid()) {
$this->delete();
error($config['error']['invalidimg4']);
}
if (!$this->image->valid()) {
$this->delete();
error($config['error']['invalidimg4']);
}
$this->size = (object)array('width' => $this->image->_width(), 'height' => $this->image->_height());
if ($this->size->width < 1 || $this->size->height < 1) {
$this->delete();
error($config['error']['invalidimg5']);
}
}
$this->size = (object)array('width' => $this->image->_width(), 'height' => $this->image->_height());
if ($this->size->width < 1 || $this->size->height < 1) {
$this->delete();
error($config['error']['invalidimg5']);
}
}
public function resize($extension, $max_width, $max_height) {
global $config;
public function resize($extension, $max_width, $max_height) {
global $config;
if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif ($config['thumb_method'] == 'convert') {
$classname = 'ImageConvert';
} elseif ($config['thumb_method'] == 'convert+gifsicle') {
$classname = 'ImageConvert';
$gifsicle = true;
} elseif ($config['thumb_method'] == 'gm') {
$classname = 'ImageConvert';
$gm = true;
} elseif ($config['thumb_method'] == 'gm+gifsicle') {
$classname = 'ImageConvert';
$gm = true;
$gifsicle = true;
} else {
$classname = 'Image' . strtoupper($extension);
if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $extension);
}
}
if ($config['thumb_method'] == 'imagick') {
$classname = 'ImageImagick';
} elseif ($config['thumb_method'] == 'convert') {
$classname = 'ImageConvert';
} elseif ($config['thumb_method'] == 'convert+gifsicle') {
$classname = 'ImageConvert';
$gifsicle = true;
} elseif ($config['thumb_method'] == 'gm') {
$classname = 'ImageConvert';
$gm = true;
} elseif ($config['thumb_method'] == 'gm+gifsicle') {
$classname = 'ImageConvert';
$gm = true;
$gifsicle = true;
} else {
$classname = 'Image' . strtoupper($extension);
if (!class_exists($classname)) {
error(_('Unsupported file format: ') . $extension);
}
}
$thumb = new $classname(false);
$thumb->src = $this->src;
$thumb->format = $this->format;
$thumb->original_width = $this->size->width;
$thumb->original_height = $this->size->height;
$thumb = new $classname(false);
$thumb->src = $this->src;
$thumb->format = $this->format;
$thumb->original_width = $this->size->width;
$thumb->original_height = $this->size->height;
$x_ratio = $max_width / $this->size->width;
$y_ratio = $max_height / $this->size->height;
$x_ratio = $max_width / $this->size->width;
$y_ratio = $max_height / $this->size->height;
if (($this->size->width <= $max_width) && ($this->size->height <= $max_height)) {
$width = $this->size->width;
$height = $this->size->height;
} elseif (($x_ratio * $this->size->height) < $max_height) {
$height = ceil($x_ratio * $this->size->height);
$width = $max_width;
} else {
$width = ceil($y_ratio * $this->size->width);
$height = $max_height;
}
if (($this->size->width <= $max_width) && ($this->size->height <= $max_height)) {
$width = $this->size->width;
$height = $this->size->height;
} elseif (($x_ratio * $this->size->height) < $max_height) {
$height = ceil($x_ratio * $this->size->height);
$width = $max_width;
} else {
$width = ceil($y_ratio * $this->size->width);
$height = $max_height;
}
$thumb->_resize($this->image->image, $width, $height);
$thumb->_resize($this->image->image, $width, $height);
return $thumb;
}
return $thumb;
}
public function to($dst) {
$this->image->to($dst);
}
public function to($dst) {
$this->image->to($dst);
}
public function delete() {
file_unlink($this->src);
}
public function destroy() {
$this->image->_destroy();
}
public function delete() {
file_unlink($this->src);
}
public function destroy() {
$this->image->_destroy();
}
}
class ImageGD {
@ -111,446 +111,422 @@ class ImageGD {
public $original_height;
public $format;
public function GD_create() {
$this->image = imagecreatetruecolor($this->width, $this->height);
}
public function GD_copyresampled() {
imagecopyresampled($this->image, $this->original, 0, 0, 0, 0, $this->width, $this->height, $this->original_width, $this->original_height);
}
public function GD_resize() {
$this->GD_create();
$this->GD_copyresampled();
}
public function GD_create() {
$this->image = imagecreatetruecolor($this->width, $this->height);
}
public function GD_copyresampled() {
imagecopyresampled($this->image, $this->original, 0, 0, 0, 0, $this->width, $this->height, $this->original_width, $this->original_height);
}
public function GD_resize() {
$this->GD_create();
$this->GD_copyresampled();
}
}
class ImageBase extends ImageGD {
public $image, $src, $original, $original_width, $original_height, $width, $height;
public $image, $src, $original, $original_width, $original_height, $width, $height;
public function __construct($img, $size = false) {
if (method_exists($this, 'init'))
$this->init();
public function __construct($img, $size = false) {
if (method_exists($this, 'init'))
$this->init();
if ($size && $size[0] > 0 && $size[1] > 0) {
$this->width = $size[0];
$this->height = $size[1];
}
if ($size && $size[0] > 0 && $size[1] > 0) {
$this->width = $size[0];
$this->height = $size[1];
}
if ($img !== false) {
$this->src = $img->src;
$this->from();
}
}
if ($img !== false) {
$this->src = $img->src;
$this->from();
}
}
public function valid() {
return (bool)$this->image;
}
public function valid() {
return (bool)$this->image;
}
public function _width() {
if (method_exists($this, 'width'))
return $this->width();
// use default GD functions
return imagesx($this->image);
}
public function _width() {
if (method_exists($this, 'width'))
return $this->width();
// use default GD functions
return imagesx($this->image);
}
public function _height() {
if (method_exists($this, 'height'))
return $this->height();
// use default GD functions
return imagesy($this->image);
}
public function _height() {
if (method_exists($this, 'height'))
return $this->height();
// use default GD functions
return imagesy($this->image);
}
public function _destroy() {
if (method_exists($this, 'destroy'))
return $this->destroy();
// use default GD functions
return imagedestroy($this->image);
}
public function _destroy() {
if (method_exists($this, 'destroy'))
return $this->destroy();
// use default GD functions
return imagedestroy($this->image);
}
public function _resize($original, $width, $height) {
$this->original = &$original;
$this->width = $width;
$this->height = $height;
public function _resize($original, $width, $height) {
$this->original = &$original;
$this->width = $width;
$this->height = $height;
if (method_exists($this, 'resize')) {
$this->resize();
} else {
// use default GD functions
$this->GD_resize();
}
}
if (method_exists($this, 'resize'))
$this->resize();
else
// use default GD functions
$this->GD_resize();
}
}
class ImageImagick extends ImageBase {
public function init() {
$this->image = new Imagick();
$this->image->setBackgroundColor(new ImagickPixel('transparent'));
}
public function init() {
$this->image = new Imagick();
$this->image->setBackgroundColor(new ImagickPixel('transparent'));
}
public function from() {
try {
$this->image->readImage($this->src);
} catch(ImagickException $e) {
// invalid image
$this->image = false;
}
}
public function from() {
try {
$this->image->readImage($this->src);
} catch(ImagickException $e) {
// invalid image
$this->image = false;
}
}
public function to($src) {
global $config;
public function to($src) {
global $config;
if ($config['strip_exif']) {
$this->image->stripImage();
}
if ($config['strip_exif']) {
$this->image->stripImage();
}
if (preg_match('/\.gif$/i', $src)) {
if (preg_match('/\.gif$/i', $src)) {
$this->image->writeImages($src, true);
}
else {
else {
$this->image->writeImage($src);
}
}
}
public function width() {
return $this->image->getImageWidth();
}
public function width() {
return $this->image->getImageWidth();
}
public function height() {
return $this->image->getImageHeight();
}
public function height() {
return $this->image->getImageHeight();
}
public function destroy() {
return $this->image->destroy();
}
public function destroy() {
return $this->image->destroy();
}
public function resize() {
global $config;
public function resize() {
global $config;
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '')) {
$this->image = new Imagick();
$this->image->setFormat('gif');
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '')) {
$this->image = new Imagick();
$this->image->setFormat('gif');
$keep_frames = array();
$keep_frames = array();
for ($i = 0; $i < $this->original->getNumberImages(); $i += floor($this->original->getNumberImages() / $config['thumb_keep_animation_frames'])) {
$keep_frames[] = $i;
for ($i = 0; $i < $this->original->getNumberImages(); $i += floor($this->original->getNumberImages() / $config['thumb_keep_animation_frames'])) {
$keep_frames[] = $i;
}
$i = 0;
$delay = 0;
$i = 0;
$delay = 0;
foreach ($this->original as $frame) {
$delay += $frame->getImageDelay();
foreach ($this->original as $frame) {
$delay += $frame->getImageDelay();
if (in_array($i, $keep_frames)) {
// $frame->scaleImage($this->width, $this->height, false);
$frame->sampleImage($this->width, $this->height);
$frame->setImagePage($this->width, $this->height, 0, 0);
$frame->setImageDelay($delay);
$delay = 0;
if (in_array($i, $keep_frames)) {
// $frame->scaleImage($this->width, $this->height, false);
$frame->sampleImage($this->width, $this->height);
$frame->setImagePage($this->width, $this->height, 0, 0);
$frame->setImageDelay($delay);
$delay = 0;
$this->image->addImage($frame->getImage());
}
$i++;
}
} else {
$this->image = clone $this->original;
$this->image->scaleImage($this->width, $this->height, false);
}
}
$this->image->addImage($frame->getImage());
}
$i++;
}
} else {
$this->image = clone $this->original;
$this->image->scaleImage($this->width, $this->height, false);
}
}
}
class ImageConvert extends ImageBase {
public $width, $height, $temp, $gm = false, $gifsicle = false;
public $width, $height, $temp, $gm = false, $gifsicle = false;
public function init() {
global $config;
public function init() {
global $config;
if ($config['thumb_method'] == 'gm' || $config['thumb_method'] == 'gm+gifsicle')
$this->gm = true;
if ($config['thumb_method'] == 'convert+gifsicle' || $config['thumb_method'] == 'gm+gifsicle')
$this->gifsicle = true;
if ($config['thumb_method'] == 'gm' || $config['thumb_method'] == 'gm+gifsicle')
$this->gm = true;
if ($config['thumb_method'] == 'convert+gifsicle' || $config['thumb_method'] == 'gm+gifsicle')
$this->gifsicle = true;
$this->temp = false;
}
$this->temp = false;
}
public function get_size($src, $try_gd_first = true) {
if ($try_gd_first) {
if ($size = @getimagesize($src))
return $size;
}
$size = shell_exec_error(($this->gm ? 'gm ' : '') . 'identify -format "%w %h" ' . escapeshellarg($src . '[0]'));
if (preg_match('/^(\d+) (\d+)$/', $size, $m))
return array($m[1], $m[2]);
return false;
}
public function get_size($src, $try_gd_first = true) {
if ($try_gd_first) {
if ($size = @getimagesize($src))
return $size;
}
$size = shell_exec_error(($this->gm ? 'gm ' : '') . 'identify -format "%w %h" ' . escapeshellarg($src . '[0]'));
if (preg_match('/^(\d+) (\d+)$/', $size, $m))
return array($m[1], $m[2]);
return false;
}
public function from() {
if ($this->width > 0 && $this->height > 0) {
$this->image = true;
return;
}
public function from() {
if ($this->width > 0 && $this->height > 0) {
$this->image = true;
return;
}
$size = $this->get_size($this->src, false);
$size = $this->get_size($this->src, false);
if ($size) {
$this->width = $size[0];
$this->height = $size[1];
if ($size) {
$this->width = $size[0];
$this->height = $size[1];
$this->image = true;
} else {
// mark as invalid
$this->image = false;
}
}
$this->image = true;
} else {
// mark as invalid
$this->image = false;
}
}
public function to($src) {
global $config;
public function to($src) {
global $config;
if (!$this->temp) {
if ($config['strip_exif']) {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient -strip ' . escapeshellarg($src))) {
$this->destroy();
error(_('Failed to redraw image!'), null, $error);
}
} else {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient ' . escapeshellarg($src))) {
$this->destroy();
error(_('Failed to redraw image!'), null, $error);
}
}
} else {
rename($this->temp, $src);
chmod($src, 0664);
}
}
if (!$this->temp) {
if ($config['strip_exif']) {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient -strip ' . escapeshellarg($src))) {
$this->destroy();
error(_('Failed to redraw image!'), null, $error);
}
} else {
if($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
escapeshellarg($this->src) . ' -auto-orient ' . escapeshellarg($src))) {
$this->destroy();
error(_('Failed to redraw image!'), null, $error);
}
}
} else {
rename($this->temp, $src);
chmod($src, 0664);
}
}
public function width() {
return $this->width;
}
public function width() {
return $this->width;
}
public function height() {
return $this->height;
}
public function height() {
return $this->height;
}
public function destroy() {
@unlink($this->temp);
$this->temp = false;
}
public function destroy() {
@unlink($this->temp);
$this->temp = false;
}
// Returns true if there is a real error and false if it's just a warning
// (appilcable to the return text of the `gm convert` command only)
public static function actualErrorOrJustWarning($message_string) {
$warnings = array(
"known incorrect sRGB profile",
"iCCP: Not recognizing known sRGB profile that has been edited",
"sRGB: cHRM chunk does not match sRGB"
);
public function resize() {
global $config;
foreach ($warnings as $w) {
if (strpos($message_string, $w) !== False) {
return False;
}
}
if ($this->temp) {
// remove old
$this->destroy();
}
return True;
}
$this->temp = tempnam($config['tmp'], 'convert') . ($config['thumb_ext'] == '' ? '' : '.' . $config['thumb_ext']);
public function resize() {
global $config;
$config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
if ($this->temp) {
// remove old
$this->destroy();
}
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
if ($this->gifsicle) {
if (($error = shell_exec("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " .
escapeshellarg($this->temp))) || !file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
} else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else
$convert_args = &$config['convert_args'];
$this->temp = tempnam($config['tmp'], 'convert') . ($config['thumb_ext'] == '' ? '' : '.' . $config['thumb_ext']);
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
sprintf($convert_args,
$this->width,
$this->height,
escapeshellarg($this->src),
$this->width,
$this->height,
escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
if ($size = $this->get_size($this->temp)) {
$this->width = $size[0];
$this->height = $size[1];
}
}
} else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else
$convert_args = &$config['convert_args'];
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
sprintf($convert_args,
$this->width,
$this->height,
escapeshellarg($this->src . '[0]'),
$this->width,
$this->height,
escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
$config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames'];
if (strpos($error, "known incorrect sRGB profile") === false &&
strpos($error, "iCCP: Not recognizing known sRGB profile that has been edited") === false) {
$this->destroy();
error(_('Failed to resize image!')." "._('Details: ').nl2br(htmlspecialchars($error)), null, array('convert_error' => $error));
}
if (!file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
}
if ($size = $this->get_size($this->temp)) {
$this->width = $size[0];
$this->height = $size[1];
}
}
}
if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) {
if ($this->gifsicle) {
if (($error = shell_exec("gifsicle -w --unoptimize -O2 --resize {$this->width}x{$this->height} < " .
escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" -o " .
escapeshellarg($this->temp))) || !file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
} else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else
$convert_args = &$config['convert_args'];
// For when -auto-orient doesn't exist (older versions)
static public function jpeg_exif_orientation($src, $exif = false) {
if (!$exif) {
$exif = @exif_read_data($src);
if (!isset($exif['Orientation']))
return false;
}
switch($exif['Orientation']) {
case 1:
// Normal
return false;
case 2:
// 888888
// 88
// 8888
// 88
// 88
if (($error = shell_exec_error(($this->gm ? 'gm ' : '') . 'convert ' .
sprintf($convert_args,
$this->width,
$this->height,
escapeshellarg($this->src),
$this->width,
$this->height,
escapeshellarg($this->temp)))) || !file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
if ($size = $this->get_size($this->temp)) {
$this->width = $size[0];
$this->height = $size[1];
}
}
} else {
if ($config['convert_manual_orient'] && ($this->format == 'jpg' || $this->format == 'jpeg'))
$convert_args = str_replace('-auto-orient', ImageConvert::jpeg_exif_orientation($this->src), $config['convert_args']);
elseif ($config['convert_manual_orient'])
$convert_args = str_replace('-auto-orient', '', $config['convert_args']);
else
$convert_args = &$config['convert_args'];
return '-flop';
case 3:
$full_convert_cmd =
($this->gm ? 'gm ' : '') . 'convert ' .
sprintf(
$convert_args,
$this->width,
$this->height,
escapeshellarg($this->src . '[0]'),
$this->width,
$this->height,
escapeshellarg($this->temp)
);
// 88
// 88
// 8888
// 88
// 888888
if (($error = shell_exec_error($full_convert_cmd)) || !file_exists($this->temp)) {
if (ImageConvert::actualErrorOrJustWarning($error)) {
$this->destroy();
error(_('Failed to resize image!')." "._('Details: ').nl2br(htmlspecialchars($error)), null, array('convert_error' => $error));
}
return '-flip -flop';
case 4:
// 88
// 88
// 8888
// 88
// 888888
if (!file_exists($this->temp)) {
$this->destroy();
error(_('Failed to resize image!'), null, $error);
}
}
if ($size = $this->get_size($this->temp)) {
$this->width = $size[0];
$this->height = $size[1];
}
}
}
return '-flip';
case 5:
// 8888888888
// 88 88
// 88
// For when -auto-orient doesn't exist (older versions)
static public function jpeg_exif_orientation($src, $exif = false) {
if (!$exif) {
$exif = @exif_read_data($src);
if (!isset($exif['Orientation']))
return false;
}
switch($exif['Orientation']) {
case 1:
// Normal
return false;
case 2:
// 888888
// 88
// 8888
// 88
// 88
return '-rotate 90 -flop';
case 6:
// 88
// 88 88
// 8888888888
return '-flop';
case 3:
return '-rotate 90';
case 7:
// 88
// 88 88
// 8888888888
// 88
// 88
// 8888
// 88
// 888888
return '-rotate "-90" -flop';
case 8:
// 8888888888
// 88 88
// 88
return '-flip -flop';
case 4:
// 88
// 88
// 8888
// 88
// 888888
return '-flip';
case 5:
// 8888888888
// 88 88
// 88
return '-rotate 90 -flop';
case 6:
// 88
// 88 88
// 8888888888
return '-rotate 90';
case 7:
// 88
// 88 88
// 8888888888
return '-rotate "-90" -flop';
case 8:
// 8888888888
// 88 88
// 88
return '-rotate "-90"';
}
}
return '-rotate "-90"';
}
}
}
class ImagePNG extends ImageBase {
public function from() {
$this->image = @imagecreatefrompng($this->src);
}
public function from() {
$this->image = @imagecreatefrompng($this->src);
}
public function to($src) {
global $config;
imagepng($this->image, $src);
}
public function to($src) {
global $config;
imagepng($this->image, $src);
}
public function resize() {
$this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true);
imagealphablending($this->image, false);
$this->GD_copyresampled();
}
public function resize() {
$this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true);
imagealphablending($this->image, false);
$this->GD_copyresampled();
}
}
class ImageGIF extends ImageBase {
public function from() {
$this->image = @imagecreatefromgif($this->src);
}
public function from() {
$this->image = @imagecreatefromgif($this->src);
}
public function to($src) {
imagegif ($this->image, $src);
}
public function to($src) {
imagegif ($this->image, $src);
}
public function resize() {
$this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true);
$this->GD_copyresampled();
}
public function resize() {
$this->GD_create();
imagecolortransparent($this->image, imagecolorallocatealpha($this->image, 0, 0, 0, 0));
imagesavealpha($this->image, true);
$this->GD_copyresampled();
}
}
class ImageJPG extends ImageBase {
public function from() {
$this->image = @imagecreatefromjpeg($this->src);
}
public function from() {
$this->image = @imagecreatefromjpeg($this->src);
}
public function to($src) {
imagejpeg($this->image, $src);
}
public function to($src) {
imagejpeg($this->image, $src);
}
}
class ImageJPEG extends ImageJPG {
@ -558,11 +534,11 @@ class ImageJPEG extends ImageJPG {
class ImageBMP extends ImageBase {
public function from() {
$this->image = @imagecreatefrombmp($this->src);
}
public function from() {
$this->image = @imagecreatefrombmp($this->src);
}
public function to($src) {
imagebmp($this->image, $src);
}
public function to($src) {
imagebmp($this->image, $src);
}
}

View File

@ -22,7 +22,6 @@ $config['boards'] = array(
'edu',
'ga',
'ent',
'music',
'777',
'posad',
'i',
@ -51,7 +50,6 @@ $config['categories'] = array(
'edu',
'ga',
'ent',
'music',
'777',
'posad',
'i',
@ -69,8 +67,7 @@ $config['custom_categories'] = array(
'New Multitude' => 'https://newmultitude.org',
'Booru image repository' => 'https://lefty.pictures',
'Official chat room' => 'https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net',
'Nukechan' => 'https://nukechan.net',
#'Gitea instance' => 'https://git.leftychan.net',
'Gitea instance' => 'https://git.leftychan.net',
'Rules' => 'rules.html',
'Search' => 'search.php',
),
@ -262,7 +259,6 @@ $config['user_flags'] = array (
'egalitarianism' => 'Egalitarianism',
'egoism' => 'Egoism',
'eristocracy' => 'Έριστοκρατία',
'Eurasianism' => 'Eurasianism',
'eureka' => 'Eureka',
'eurocommunism' => 'Eurocommunism',
'farc' => 'Las FARC',
@ -289,7 +285,7 @@ $config['user_flags'] = array (
'marxism_blackpilism' => 'Marxism Blackpillism',
'mutualism' => 'Mutualism',
'naxalite' => 'Naxalite',
'nazbol' => 'National Bolshevik',
'nazbol' => 'Nazbol',
'nazi' => 'Nazi',
'ndfp' => 'NDFP',
'palestine' => 'Palestine',
@ -316,14 +312,12 @@ $config['user_flags'] = array (
'syndicalism' => 'Syndicalism',
'tankie' => 'Tankie',
'technocracy' => 'Technocracy',
'The_Other_Russia' => 'The Other Russia',
'think' => 'Think',
'transhumanism' => 'Transhumanism',
'united_farm_workers' => 'United Farm Workers',
'viet_cong' => 'Viet Cong',
'ypg' => 'YPG',
'yugoslavia' => 'Yugoslavia',
'zgang' => 'Z Gang'
'yugoslavia' => 'Yugoslavia'
);
@ -597,5 +591,5 @@ $config['filters'][] = array(
'message' => 'New threads are being created too quickly. Wait [at most] 10 minutes'
);
$config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://t.me/+RegtyzzrE0M1NDMx">Telegram</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span>';
$config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://t.me/+RegtyzzrE0M1NDMx">Telegram</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span><br/><br/><span>We will be performing scheduled maintenance from 2-3am UTC, May 30th. The board will be read only during this time.</span>';
$config['debug'] = false;

View File

@ -1501,7 +1501,7 @@ function mod_move($originBoard, $postID) {
} else {
deletePost($postID);
buildIndex();
rebuildThemes('post', $originBoard);
rebuildThemes('post', $targetBoard);
openBoard($targetBoard);
header('Location: ?/' . sprintf($config['board_path'], $newboard['uri']) . $config['dir']['res'] . link_for($op, false, $newboard), true, $config['redirect_http']);

View File

@ -32,13 +32,11 @@ $(document).ready(function(){
thread.find('div.hidden').remove();
var post_in_doc = thread.find('#' + $(this).attr('id'));
if(post_in_doc.length == 0) {
/*
if(last_expanded) {
$(this).addClass('expanded').insertAfter(last_expanded).before('<br class="expanded">');
} else {
$(this).addClass('expanded').insertAfter(thread.find('div.post:first')).after('<br class="expanded">');
}
*/
last_expanded = $(this);
$(document).trigger('new_post', this);
} else {

View File

@ -1,6 +1,6 @@
<?php
require_once 'inc/functions.php';
require_once 'inc/mod/pages.php';
include 'inc/functions.php';
include 'inc/mod/pages.php';
if (!isset($_GET['board']) || !preg_match("/{$config['board_regex']}/u", $_GET['board'])) {
http_response_code(400);

View File

@ -457,8 +457,6 @@ function validate_images(array $post_array) {
function handle_post(){
global $config,$dropped_post,$board, $mod,$pdo;
init_global_post_cleanup();
if (!isset($_POST['body'], $_POST['board']) && !$dropped_post) {
error($config['error']['bot']);
}
@ -1038,17 +1036,6 @@ function handle_post(){
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
/*
* If we have an error with posting this later, send back the
* delete token to spamnoticer to remove the post from the recent
* posts table. (see error.php for the error cleanup function)
*/
$f_spamnoticer_cleanup_on_err = function() use ($config, $delete_token) {
removeRecentPostFromSpamnoticer($config, array($delete_token));
};
push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 327 B

View File

@ -3,220 +3,184 @@ div.sidearrows {
}
body {
background: #1D1F21;
color: #ACACAC;
font-family: Courier, monospace;
font-size: 15px;
}
.theme-catalog .replies {
font-family: serif;
}
div.post div.body {
font-family: serif;
}
span.heading {
font-size: 15px;
}
.theme-catalog .replies .meta,
.theme-catalog .replies .intro,
div.post div.body a,
div.post div.body .toolong {
font-family: Courier, monospace;
background: #1D1F21;
color: #ACACAC;
font-family: Courier, monospace;
font-size: 13px;
}
/* LINKS */
a, a:link, a:visited, .intro a.email span.name {
color: #FFB300;
text-decoration: none;
color: #FFB300;
text-decoration: none;
}
a:link:hover, a:visited:hover {
color: #FFB300;
text-shadow: 0px 0px 5px #117743;
color: #FFB300;
text-shadow: 0px 0px 5px #117743;
}
div.pages a.selected {
color: #FFB300;
color: #FFB300;
}
/* INTRO */
h1, div.title, header div.subtitle {
color: #FFB300;
font-family: Courier, monospace;
color: #663E11;
font-family: Courier, monospace;
}
h1 {
font-size: 18pt;
font-weight: bold;
letter-spacing: 0px;
font-size: 24pt;
font-weight: normal;
letter-spacing: 0px;
}
header div.subtitle {
font-size: 10pt;
font-size: 12pt;
}
/* FORMS AND BUTTONS */
div.banner {
background-color: inherit;
color: #ACACAC;
background-color: inherit;
color: #ACACAC;
}
form table {
border: 1px dashed #117743;
padding-right: 1px;
border-radius: 3px;
border: 1px dashed #117743;
padding-right: 1px;
}
form table tr th {
background: #282A2E;
border: 1px solid #117743;
border-radius: 2px;
padding: 3px;
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
}
input[type="text"], input[type="password"], textarea, select {
border: 1px double #07371F;
border-radius: 2px;
background: #282A2E;
color: #ACACAC;
font-family: Courier, monospace;
margin: 0 1px;
padding: 3px !important;
box-sizing: border-box;
border: 1px double #07371F;
border-radius: 5px;
background: #282A2E;
color: #ACACAC;
font-family: Courier, monospace;
}
input[type="text"]:focus, input[type="password"]:focus, textarea:focus {
box-shadow: 0px 0px 5px 2px #117743;
box-shadow: 0px 0px 5px 2px #117743;
}
input[type="submit"] {
border: 3px double #07371F;
border-radius: 2px;
background-color: #07371F;
color: #ACACAC;
font-family: Courier, monospace;
font-weight: bold;
font-size: 16px;
border: 3px double #07371F;
border-radius: 5px;
background: #16171A;
color: #ACACAC;
font-family: Courier, monospace;
font-weight: bold;
}
input[type="submit"]:hover {
border-color: #117743;
background-color: #117743;
}
.dropzone {
background: #16171A;
border: 1px solid #07371F;
color: #ACACAC;
border-radius: 2px;
margin: 0 2px;
background: #16171A;
border: 3px double #07371F;
color: #ACACAC;
}
.dropzone .file-hint {
color: #ACACAC;
font-weight: bold;
color: #ACACAC;
font-weight: bold;
}
#quick-reply table {
background: #1D1F21 !important;
background: #1D1F21 !important;
}
fieldset {
border: 1px dashed #117743;
border: 1px dashed #117743;
}
/* POST IDENTIFIERS */
.intro span.subject {
color: #34ED3A;
color: #34ED3A;
}
.intro span.name {
color: #117743;
color: #117743;
}
.intro span.trip {
color: #117743;
color: #117743;
}
.intro a.capcode, p.intro a.nametag {
color: #FF0000;
font-weight: bold;
color: #FF0000;
font-weight: bold;
}
.intro a.email, p.intro a.email span.name, p.intro a.email:hover, p.intro a.email:hover span.name {
color: #34ED97;
color: #34ED97;
}
.intro time {
font-weight: bold;
font-weight: bold;
}
.intro a.post_no {
color: #ACACAC;
font-weight: bold;
color: #ACACAC;
font-weight: bold;
}
/* POST BOXES */
div.post.reply {
background: #282A2E;
border: 1px solid #117743;
border-radius: 2px;
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
}
div.post.reply.highlighted {
background: rgba(59, 22, 43, 0.4);
border: 1px solid #117743;
border-radius: 2px;
background: rgba(59, 22, 43, 0.4);
border: 1px solid #117743;
border-radius: 5px;
}
/* POST CONTENT */
div.post.reply div.body a {
color: #FFB300;
color: #FFB300;
}
.quote {
color: #789922;
color: #789922;
}
/* BARS */
.bar {
background-color: #151515;
background-color: #151515;
}
.bar.top {
border-bottom: 1px solid #B0790A;
border-bottom: 1px solid #B0790A;
}
.bar.bottom {
border-top: 1px solid #B0790A;
border-top: 1px solid #B0790A;
}
div.boardlist {
color: #ACACAC;
color: #ACACAC;
}
hr {
border: none;
border-top: 1pt solid #117743;
border: none;
border-top: 1pt solid #117743;
}
/* CATALOG */
.theme-catalog h1 {
color: #ACACAC;
font-size: 18pt;
font-weight: bold;
color: #ACACAC;
font-size: 18pt;
font-weight: bold;
}
.theme-catalog h1 a {
font-weight: normal;
font-weight: normal;
}
.theme-catalog div.thread, .theme-catalog div.thread:hover {
background: #282A2E;
border: 1px solid #117743;
border-radius: 2px;
font-size: 11pt;
background: #282A2E;
border: 1px solid #117743;
border-radius: 5px;
font-size: 10pt;
}
/* OPTIONS */
#options_div, #alert_div {
background: #1D1F21;
border: 1px dashed #117743;
background: #1D1F21;
border: 1px dashed #117743;
}
#options_tablist {
border-right: 1px dashed #117743;
border-right: 1px dashed #117743;
}
.options_tab_icon {
color: #ACACAC;
color: #ACACAC;
}
.options_tab_icon.active {
color: #FFB300;
color: #FFB300;
}
/* FIXES */
div.ban {
background: #1D1F21;
background: #1D1F21;
border: 1px dashed #117743;
}
@ -261,7 +225,7 @@ table thead th {
}
.theme-catalog .thread .meta {
font-size: 13px;
font-size: 10pt;
}
.theme-catalog .thread.grid-size-small .replies {