mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-24 15:40:12 +01:00
Signed-off-by: 8n-tech <8n-tech@users.noreply.github.com>
inc/functions.php - Fixed issues with dio on windows machines. inc/lib/Twig/Extensions/Extension/Tinyboard.php - Added strict (int) typecasting to avoid critical errors in timestamp formatting. index.php - Fixed issue where opening index.php would whitepage. static/nsfw.png static/swf.png - Added missing static files.
This commit is contained in:
parent
46cd77e813
commit
ee7c624517
@ -636,29 +636,35 @@ function file_write($path, $data, $simple = false, $skip_purge = false) {
|
|||||||
$remote = new Remote($config['remote'][$m[1]]);
|
$remote = new Remote($config['remote'][$m[1]]);
|
||||||
$remote->write($data, $m[2]);
|
$remote->write($data, $m[2]);
|
||||||
return;
|
return;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
error('Invalid remote server: ' . $m[1]);
|
error('Invalid remote server: ' . $m[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// This will convert a local, relative path like "b/index.html" to a full path.
|
||||||
|
// dio_open does not work with relative paths on Windows machines.
|
||||||
|
$path = realpath(dirname($path)) . DIRECTORY_SEPARATOR . basename($path);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$fp = dio_open($path, O_WRONLY | O_CREAT, 0644))
|
if (!$fp = dio_open( $path, O_WRONLY | O_CREAT | O_TRUNC, 0644)) {
|
||||||
error('Unable to open file for writing: ' . $path);
|
error('Unable to open file for writing: ' . $path);
|
||||||
|
}
|
||||||
|
|
||||||
// File locking
|
// File locking
|
||||||
if (dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) {
|
if (function_exists("dio_fcntl") && dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) {
|
||||||
error('Unable to lock file: ' . $path);
|
error('Unable to lock file: ' . $path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Truncate file
|
|
||||||
if (!dio_truncate($fp, 0))
|
|
||||||
error('Unable to truncate file: ' . $path);
|
|
||||||
|
|
||||||
// Write data
|
// Write data
|
||||||
if (($bytes = dio_write($fp, $data)) === false)
|
if (($bytes = dio_write($fp, $data)) === false) {
|
||||||
error('Unable to write to file: ' . $path);
|
error('Unable to write to file: ' . $path);
|
||||||
|
}
|
||||||
|
|
||||||
// Unlock
|
// Unlock
|
||||||
|
if (function_exists("dio_fcntl")) {
|
||||||
dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK));
|
dio_fcntl($fp, F_SETLK, array('type' => F_UNLCK));
|
||||||
|
}
|
||||||
|
|
||||||
// Close
|
// Close
|
||||||
dio_close($fp);
|
dio_close($fp);
|
||||||
|
@ -76,7 +76,7 @@ function twig_remove_whitespace_filter($data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function twig_date_filter($date, $format) {
|
function twig_date_filter($date, $format) {
|
||||||
return gmstrftime($format, $date);
|
return gmstrftime($format, (int) $date);
|
||||||
}
|
}
|
||||||
|
|
||||||
function twig_hasPermission_filter($mod, $permission, $board = null) {
|
function twig_hasPermission_filter($mod, $permission, $board = null) {
|
||||||
|
@ -9,3 +9,5 @@ if ($query) {
|
|||||||
|
|
||||||
$index = Element("8chan/index.html", array("config" => $config, "newsplus" => $newsplus));
|
$index = Element("8chan/index.html", array("config" => $config, "newsplus" => $newsplus));
|
||||||
file_write('index.html', $index);
|
file_write('index.html', $index);
|
||||||
|
|
||||||
|
echo $index;
|
BIN
static/nsfw.png
Normal file
BIN
static/nsfw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
static/sfw.png
Normal file
BIN
static/sfw.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Reference in New Issue
Block a user