Browse Source

Merge branch 'master' of https://github.com/savetheinternet/Tinyboard

Conflicts:
	stylesheets/dark_roach.css
	stylesheets/style.css
pull/40/head
czaks 11 years ago
parent
commit
de035f4a7e
  1. 2
      inc/config.php
  2. 45
      inc/display.php
  3. 11
      inc/mod/pages.php
  4. 18
      install.php
  5. 2
      post.php
  6. 1
      stylesheets/dark_roach.css
  7. 4
      stylesheets/style.css
  8. 3
      templates/main.js
  9. 4
      templates/post_reply.html
  10. 4
      templates/post_thread.html

2
inc/config.php

@ -357,6 +357,8 @@
// Allow "uploading" images via URL as well. Users can enter the URL of the image and then Tinyboard will
// download it. Not usually recommended.
$config['allow_upload_by_url'] = false;
// The timeout for the above, in seconds.
$config['upload_by_url_timeout'] = 15;
// A wordfilter (sometimes referred to as just a "filter" or "censor") automatically scans users’ posts
// as they are submitted and changes or censors particular words or phrases.

45
inc/display.php

@ -232,11 +232,50 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) {
return $body;
}
function bidi_cleanup($str) {
// Removes all embedded RTL and LTR unicode formatting blocks in a string so that
function bidi_cleanup($data) {
// Closes all embedded RTL and LTR unicode formatting blocks in a string so that
// it can be used inside another without controlling its direction.
return "<bdi>$str</bdi>";
$explicits = '\xE2\x80\xAA|\xE2\x80\xAB|\xE2\x80\xAD|\xE2\x80\xAE';
$pdf = '\xE2\x80\xAC';
preg_match_all("!$explicits!", $data, $m1, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
preg_match_all("!$pdf!", $data, $m2, PREG_OFFSET_CAPTURE | PREG_SET_ORDER);
if (count($m1) || count($m2)){
$p = array();
foreach ($m1 as $m){ $p[$m[0][1]] = 'push'; }
foreach ($m2 as $m){ $p[$m[0][1]] = 'pop'; }
ksort($p);
$offset = 0;
$stack = 0;
foreach ($p as $pos => $type){
if ($type == 'push'){
$stack++;
}else{
if ($stack){
$stack--;
}else{
# we have a pop without a push - remove it
$data = substr($data, 0, $pos-$offset)
.substr($data, $pos+3-$offset);
$offset += 3;
}
}
}
# now add some pops if your stack is bigger than 0
for ($i=0; $i<$stack; $i++){
$data .= "\xE2\x80\xAC";
}
return $data;
}
return $data;
}
function secure_link_confirm($text, $title, $confirm_message, $href) {

11
inc/mod/pages.php

@ -359,10 +359,12 @@ function mod_edit_board($boardName) {
$query->bindValue(':uri', $board['uri']);
$query->execute() or error(db_error($query));
modLog('Deleted board: ' . sprintf($config['board_abbreviation'], $board['uri']), false);
if ($config['cache']['enabled']) {
cache::delete('board_' . $board['uri']);
cache::delete('all_boards');
}
// Delete entire board directory
rrmdir($board['uri'] . '/');
modLog('Deleted board: ' . sprintf($config['board_abbreviation'], $board['uri']), false);
// Delete posting table
$query = query(sprintf('DROP TABLE IF EXISTS ``posts_%s``', $board['uri'])) or error(db_error());
@ -409,6 +411,9 @@ function mod_edit_board($boardName) {
$_query->execute() or error(db_error($_query));
}
}
// Delete entire board directory
rrmdir($board['uri'] . '/');
} else {
$query = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri');
$query->bindValue(':uri', $board['uri']);

18
install.php

@ -658,18 +658,18 @@ if ($step == 0) {
$sql_errors .= '<li>' . db_error() . '</li>';
}
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
$page['title'] = 'Installation complete';
$page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover. <a href="http://tinyboard.org/docs/?p=Config">How do I edit the config files?</a></p>';
if (!empty($sql_errors)) {
$page['body'] .= '<div class="ban"><h2>SQL errors</h2><p>SQL errors were encountered when trying to install the database. This may be the result of using a database which is already occupied with a Tinyboard installation; if so, you can probably ignore this.</p><p>The errors encountered were:</p><ul>' . $sql_errors . '</ul><p><a href="?step=5">Ignore errors and complete installation.</a></p></div>';
} else {
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
file_write($config['has_installed'], VERSION);
if (!file_unlink(__FILE__)) {
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';
@ -681,6 +681,12 @@ if ($step == 0) {
$page['title'] = 'Installation complete';
$page['body'] = '<p style="text-align:center">Thank you for using Tinyboard. Please remember to report any bugs you discover.</p>';
$boards = listBoards();
foreach ($boards as &$_board) {
setupBoard($_board);
buildIndex();
}
file_write($config['has_installed'], VERSION);
if (!file_unlink(__FILE__)) {
$page['body'] .= '<div class="ban"><h2>Delete install.php!</h2><p>I couldn\'t remove <strong>install.php</strong>. You will have to remove it manually.</p></div>';

2
post.php

@ -293,7 +293,7 @@ if (isset($_POST['delete'])) {
curl_setopt($curl, CURLOPT_FAILONERROR, true);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 15);
curl_setopt($curl, CURLOPT_TIMEOUT, $config['upload_by_url_timeout']);
curl_setopt($curl, CURLOPT_USERAGENT, 'Tinyboard');
curl_setopt($curl, CURLOPT_BINARYTRANSFER, true);
curl_setopt($curl, CURLOPT_FILE, $fp);

1
stylesheets/dark_roach.css

File diff suppressed because one or more lines are too long

4
stylesheets/style.css

@ -37,6 +37,10 @@ p.intro a.email:hover span.name {
p.intro label {
display: inline;
}
p.intro time, p.intro a.ip-link, p.intro a.capcode {
direction: ltr;
unicode-bidi: embed;
}
h2 {
color: #AF0A0F;
font-size: 11pt;

3
templates/main.js

@ -168,6 +168,9 @@ function dopost(form) {
if (form.elements['name']) {
localStorage.name = form.elements['name'].value.replace(/( |^)## .+$/, '');
}
if (form.elements['password']) {
localStorage.password = form.elements['password'].value;
}
if (form.elements['email'] && form.elements['email'].value != 'sage') {
localStorage.email = form.elements['email'].value;
}

4
templates/post_reply.html

@ -26,12 +26,12 @@
{{ capcode.cap }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
[<a class="ip-link" style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
{% if config.display_flags and post.modifiers.flag %}
<img class="flag" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"
style="{% if post.modifiers['flag style'] %}{{ post.modifiers['flag style'] }}{% else %}{{ config.flag_style }}{% endif %}"
{% if post.modifiers['flag alt'] %}title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% if post.modifiers['flag alt'] %}alt="{{ post.modifiers['flag alt'] | e('html_attr') }}" title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% endif %}
<time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time>
</label>

4
templates/post_thread.html

@ -80,12 +80,12 @@
{{ capcode.cap }}
{% endif %}
{% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %}
[<a style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
[<a class="ip-link" style="margin:0;" href="?/IP/{{ post.ip }}">{{ post.ip }}</a>]
{% endif %}
{% if config.display_flags and post.modifiers.flag %}
<img class="flag" src="{{ config.uri_flags|sprintf(post.modifiers.flag) }}"
style="{% if post.modifiers['flag style'] %}{{ post.modifiers['flag style'] }}{% else %}{{ config.flag_style }}{% endif %}"
{% if post.modifiers['flag alt'] %}title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% if post.modifiers['flag alt'] %}alt="{{ post.modifiers['flag alt'] | e('html_attr') }}" title="{{ post.modifiers['flag alt'] | e('html_attr') }}"{% endif %}>
{% endif %}
<time datetime="{{ post.time|date('%Y-%m-%dT%H:%M:%S') }}{{ timezone() }}">{{ post.time|date(config.post_date) }}</time>
</label>

Loading…
Cancel
Save