diff options
| author | czaks <marcin@6irc.net> | 2013-08-20 18:22:37 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-20 18:22:37 -0400 |
| commit | de035f4a7ecf3e1da0dc408cab424d8a9a81678e (patch) | |
| tree | 1b46b1a80330de57e2b7d1cce3ae2c68bc7ae6ae /inc | |
| parent | f909fd190af4427dae1a8eddd4fa476c1243c433 (diff) | |
| parent | db8173fe62829644a6cdf2e6a787b2ec2244c15b (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
stylesheets/dark_roach.css
stylesheets/style.css
Diffstat (limited to 'inc')
| -rw-r--r-- | inc/config.php | 2 | ||||
| -rw-r--r-- | inc/display.php | 45 | ||||
| -rw-r--r-- | inc/mod/pages.php | 11 |
3 files changed, 52 insertions, 6 deletions
diff --git a/inc/config.php b/inc/config.php index 956851f2..888cbeb8 100644 --- a/inc/config.php +++ b/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. diff --git a/inc/display.php b/inc/display.php index 7ca4386c..84055d5f 100644 --- a/inc/display.php +++ b/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) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 6a9f07c7..2ca7eb55 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']); |
