1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2025-01-31 12:23:48 +01:00
This commit is contained in:
8n-tech 2015-04-20 23:00:29 +10:00
commit 0f4591aa90
11 changed files with 58 additions and 125 deletions

View File

@ -81,7 +81,6 @@ $searchHTML = Element("8chan/boards-search.html", array(
"founding_date" => $founding_date,
"page_updated" => date('r'),
"uptime" => shell_exec('uptime -p'),
"html_boards" => $boardsHTML,
"html_tags" => $tagsHTML
@ -91,7 +90,8 @@ $searchHTML = Element("8chan/boards-search.html", array(
$pageHTML = Element("page.html", array(
"title" => _("Boardlist"),
"config" => $config,
"body" => $searchHTML
"body" => $searchHTML,
"title" => _("Boards on ∞chan")
)
);
@ -103,7 +103,15 @@ if (php_sapi_name() == 'cli') {
file_write("boards.html", $pageHTML);
file_write("boards.json", json_encode($nonAssociativeBoardList));
file_write("boards-top20.json", json_encode(array_splice($nonAssociativeBoardList, 0, 48)));
$topbar = array();
foreach ($boards as $i => $b) {
if (!in_array($b['uri'], $config['no_top_bar_boards'])) {
$topbar[] = $b;
}
}
file_write("boards-top20.json", json_encode(array_splice($topbar, 0, 48)));
}
echo $pageHTML;
echo $pageHTML;

View File

@ -417,10 +417,10 @@ class Post {
));
}
public function getClean( ) {
public function getClean($actually_do = false) {
global $board, $config;
if( !isset( $this->clean ) ) {
if( !isset( $this->clean ) && $actually_do ) {
if ($config['cache']['enabled'] && $this->clean = cache::get("post_clean_{$board['uri']}_{$this->id}")) {
return $this->clean;
}
@ -443,8 +443,10 @@ class Post {
if ($config['cache']['enabled'])
cache::set("post_clean_{$board['uri']}_{$this->id}", $this->clean);
}
} else {
$this->clean = array();
}
return $this->clean;
}
};

View File

@ -628,47 +628,41 @@ function purge($uri) {
function file_write($path, $data, $simple = false, $skip_purge = false) {
global $config, $debug;
if (preg_match('/^remote:\/\/(.+)\:(.+)$/', $path, $m)) {
if (isset($config['remote'][$m[1]])) {
require_once 'inc/remote.php';
$remote = new Remote($config['remote'][$m[1]]);
$remote->write($data, $m[2]);
return;
}
else {
} else {
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 | O_TRUNC, 0644)) {
if (!$fp = dio_open($path, O_WRONLY | O_CREAT, 0644))
error('Unable to open file for writing: ' . $path);
}
// File locking
if (function_exists("dio_fcntl") && dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) {
if (dio_fcntl($fp, F_SETLKW, array('type' => F_WRLCK)) === -1) {
error('Unable to lock file: ' . $path);
}
// Truncate file
if (!dio_truncate($fp, 0))
error('Unable to truncate file: ' . $path);
// Write data
if (($bytes = dio_write($fp, $data)) === false) {
if (($bytes = dio_write($fp, $data)) === false)
error('Unable to write to file: ' . $path);
}
// 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
dio_close($fp);
/**
* Create gzipped file.
*
@ -1265,6 +1259,8 @@ function deleteFile($id, $remove_entirely_if_already=true, $file=null) {
$files = json_decode($post['files']);
$file_to_delete = $file !== false ? $files[(int)$file] : (object)array('file' => false);
if (!$files[0]) error(_('That post has no files.'));
if ($files[0]->file == 'deleted' && $post['num_files'] == 1 && !$post['thread'])
return; // Can't delete OP's image completely.

View File

@ -197,7 +197,7 @@
'fr' => "Français",
'hu' => "Magyar",
'it' => "Italiano",
'jp' => "日本語",
'ja' => "日本語",
'jbo' => "Lojban",
'lt' => "Lietuvių Kalba",
'lv' => "Latviešu Valoda",
@ -233,7 +233,7 @@ $config['page_404'] = 'page_404';
// Flavor and design.
$config['site_name'] = "∞chan";
$config['site_logo'] = "/static/logo_33.svg";
#$config['site_logo'] = "/static/logo_33.svg";
// 8chan specific mod pages
require '8chan-mod-config.php';

View File

@ -2507,7 +2507,7 @@ function mod_reports() {
}
// Fetch clean status.
$po->getClean();
$po->getClean(true);
$clean = $po->clean;

View File

@ -11,7 +11,7 @@
if (active_page == 'thread' || active_page == 'index') {
$(document).ready(function(){
if ($('.delete #password').length) {
if ($('#delete-fields #password').length) {
Menu.add_item("delete_post_menu", _("Delete post"));
Menu.add_item("delete_file_menu", _("Delete file"));
Menu.onclick(function(e, $buf) {
@ -53,9 +53,8 @@ Menu.onclick(function(e, $buf) {
});
$(document).on('new_post', function(){
$('div.delete').hide();
$('input.delete').hide();
});
$('div.delete').hide();
$('input.delete').hide();
$('#post-moderation-fields').hide();
})}

View File

@ -14,83 +14,6 @@
*/
$(document).ready(function(){
var open_form = function() {
var thread = $(this).parent().parent().hasClass('op');
var id = $(this).attr('name').match(/^delete_(\d+)$/)[1];
var submitButton;
if(this.checked) {
var post_form = $('<form class="post-actions" method="post" style="margin:10px 0 0 0">' +
'<div style="text-align:right">' +
(!thread ? '<hr>' : '') +
'<input type="hidden" name="delete_' + id + '">' +
'<label for="password_' + id + '">'+_("Password")+'</label>: ' +
'<input id="password_' + id + '" type="password" name="password" size="11" maxlength="18">' +
'<input title="'+_('Delete file only')+'" type="checkbox" name="file" id="delete_file_' + id + '">' +
'<label for="delete_file_' + id + '">'+_('File')+'</label>' +
' <input type="submit" name="delete" value="'+_('Delete')+'">' +
'<br>' +
'[<input title="Global Report" type="checkbox" name="global" id="global_report" />' +
'<label for="global_report" title="Report rule violation (CP, etc) to global staff">Global</label>' +
']<input type="submit" name="report" value="Report" /> ' +
'<label for="reason_' + id + '">'+_('Reason')+'</label>: ' +
'<input id="reason_' + id + '" type="text" name="reason" size="20" maxlength="100">' +
' <input type="submit" name="report" value="'+_('Report')+'">' +
'</div>' +
'</form>');
post_form
.attr('action', $('form[name="post"]:first').attr('action'))
.append($('input[name=board]:first').clone())
.find('input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"])').keypress(function(e) {
if(e.which == 13) {
e.preventDefault();
if($(this).attr('name') == 'password') {
post_form.find('input[name=delete]').click();
} else if($(this).attr('name') == 'reason') {
post_form.find('input[name=report]').click();
}
return false;
}
return true;
});
post_form.find('input[type="password"]').val(localStorage.password);
if(thread) {
post_form.prependTo($(this).parent().parent().find('div.body'));
} else {
post_form.appendTo($(this).parent().parent());
//post_form.insertBefore($(this));
}
$(window).trigger('quick-post-controls', post_form);
} else {
var elm = $(this).parent().parent().find('form');
if(elm.attr('class') == 'post-actions')
elm.remove();
}
};
var init_qpc = function() {
$(this).change(open_form);
if(this.checked)
$(this).trigger('change');
};
$('div.post input[type=checkbox].delete').each(init_qpc);
$(document).on('new_post', function(e, post) {
$(post).find('input[type=checkbox].delete').each(init_qpc);
});
// Bottom of the page quick reply function
$("#thread-quick-reply").show();
$("#link-quick-reply").on( 'click', function(event) {
@ -98,4 +21,4 @@ $(document).ready(function(){
$(window).trigger('cite', ['']);
return false;
} );
} );
} );

View File

@ -14,9 +14,8 @@ $(document).ready(function(){
var thread_id = (document.location.pathname + document.location.search).split('/');
thread_id = thread_id[thread_id.length -1].split('+')[0].split('.')[0];
$('form[name="postcontrols"] > .delete')
.first()
.before('<div id="thread_stats"></div>');
$('#thread-links')
.after('<div id="thread_stats"></div>');
var el = $('#thread_stats');
el.prepend('Page <span id="thread_stats_page">?</span>');
if (IDsupport){

View File

@ -72,6 +72,9 @@ table.mod.config-editor input[type="text"] {
width: 98%;
}
.longtable p {
margin: 0;
}
/* Uncategorized */
#post-form-outer {
@ -367,7 +370,6 @@ p.intro a {
color: maroon;
}
p.body-line,
div.post p {
display: block;
margin: 0;
@ -378,12 +380,15 @@ div.post p {
}
div.post div.body {
margin-left: 1.8em;
margin-top: 0.8em;
padding-right: 3em;
padding-bottom: 0.3em;
}
div.post.reply div.body {
margin-left: 1.8em;
}
div.post.reply.highlighted {
background: #D6BAD0;
}
@ -392,10 +397,6 @@ div.post.reply div.body a {
color: #D00;
}
div.post {
padding-left: 20px;
}
div.post div.body {
word-wrap: break-word;
white-space: pre-wrap;
@ -1614,4 +1615,8 @@ td.board-tags a.tag-link {
font-size: 0;
width: 0;
}
}
}
#post-moderation-fields {
display: none;
}

View File

@ -2,6 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" media="screen" href="{{ config.url_stylesheet }}">
<title>∞chan</title>
<style type="text/css">
/* Main */

View File

@ -177,7 +177,7 @@ function highlightReply(id, event) {
post.className += ' highlighted';
if (history.pushState) {
history.pushState(null, null, window.document.location.origin + window.document.location.pathname + window.document.location.search + '#' + id);
history.pushState(null, null, window.document.location.protocol + "//" + window.document.location.host + window.document.location.pathname + window.document.location.search + '#' + id);
} else {
window.location.hash = id;
}