From e45ffb8592cacecb90443dc77f09f9a9823a029f Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 18:54:10 +1000 Subject: custom timeouet for curl'ing upload urls --- inc/config.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index fbe20d3e..ae45a746 100644 --- a/inc/config.php +++ b/inc/config.php @@ -355,6 +355,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. -- cgit v1.3 From 69741e6c08c86e24fd4d90efc34c9d269a458201 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 20:00:16 +1000 Subject: deleting boards: cache purging, delete directory after sql queries (in case we have permission errors, etc.) --- inc/mod/pages.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 887be16b..63e7266e 100644 --- a/inc/mod/pages.php +++ b/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']); -- cgit v1.3 From abfdd38e59458d871f466952776675238f3179fb Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 19 Aug 2013 23:47:56 +1000 Subject: Unicode bi-directional text: Finally a working fix --- inc/display.php | 45 ++++++++++++++++++++++++++++++++++++++++++--- stylesheets/style.css | 7 +++++-- templates/post_reply.html | 2 +- templates/post_thread.html | 2 +- 4 files changed, 49 insertions(+), 7 deletions(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index 6fa97f4f..81f8c53d 100644 --- a/inc/display.php +++ b/inc/display.php @@ -218,11 +218,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 "$str"; + $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) { diff --git a/stylesheets/style.css b/stylesheets/style.css index e62891e2..c1725e35 100644 --- a/stylesheets/style.css +++ b/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; @@ -406,5 +410,4 @@ table.mod.config-editor input[type="text"] { p.intro.thread-hidden { margin: 0px; padding: 0px; -} - +} \ No newline at end of file diff --git a/templates/post_reply.html b/templates/post_reply.html index a1feb005..c5d24247 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -26,7 +26,7 @@ {{ capcode.cap }} {% endif %} {% if post.mod and post.mod|hasPermission(config.mod.show_ip, board.uri) %} - [{{ post.ip }}] + [{{ post.ip }}] {% endif %} {% if config.display_flags and post.modifiers.flag %} {{ post.ip }}] + [{{ post.ip }}] {% endif %} {% if config.display_flags and post.modifiers.flag %}