merge with vichan-gold

This commit is contained in:
Czterooki
2013-07-20 00:19:08 -04:00
72 changed files with 3508 additions and 429 deletions

123
inc/api.php Normal file
View File

@@ -0,0 +1,123 @@
<?php
/*
* Copyright (c) 2010-2013 Tinyboard Development Group
*/
/**
* Class for generating json API compatible with 4chan API
*/
class Api {
/**
* Translation from local fields to fields in 4chan-style API
*/
public static $postFields = array(
'id' => 'no',
'thread' => 'resto',
'subject' => 'sub',
'email' => 'email',
'name' => 'name',
'trip' => 'trip',
'capcode' => 'capcode',
'body' => 'com',
'time' => 'time',
'thumb' => 'thumb', // non-compatible field
'thumbx' => 'tn_w',
'thumby' => 'tn_h',
'file' => 'file', // non-compatible field
'filex' => 'w',
'filey' => 'h',
'filesize' => 'fsize',
//'filename' => 'filename',
'omitted' => 'omitted_posts',
'omitted_images' => 'omitted_images',
//'posts' => 'replies',
//'ip' => '',
'sticky' => 'sticky',
'locked' => 'locked',
//'bumplocked' => '',
//'embed' => '',
//'root' => '',
//'mod' => '',
//'hr' => '',
);
static $ints = array(
'no' => 1,
'resto' => 1,
'time' => 1,
'tn_w' => 1,
'tn_h' => 1,
'w' => 1,
'h' => 1,
'fsize' => 1,
'omitted_posts' => 1,
'omitted_images' => 1,
'sticky' => 1,
'locked' => 1,
);
private function translatePost($post) {
$apiPost = array();
foreach (self::$postFields as $local => $translated) {
if (!isset($post->$local))
continue;
$toInt = isset(self::$ints[$translated]);
$val = $post->$local;
if ($val !== null && $val !== '') {
$apiPost[$translated] = $toInt ? (int) $val : $val;
}
}
if (isset($post->filename)) {
$dotPos = strrpos($post->filename, '.');
$apiPost['filename'] = substr($post->filename, 0, $dotPos);
$apiPost['ext'] = substr($post->filename, $dotPos);
}
return $apiPost;
}
function translateThread(Thread $thread) {
$apiPosts = array();
$op = $this->translatePost($thread);
$op['resto'] = 0;
$apiPosts['posts'][] = $op;
foreach ($thread->posts as $p) {
$apiPosts['posts'][] = $this->translatePost($p);
}
return $apiPosts;
}
function translatePage(array $threads) {
$apiPage = array();
foreach ($threads as $thread) {
$apiPage['threads'][] = $this->translateThread($thread);
}
return $apiPage;
}
function translateCatalogPage(array $threads) {
$apiPage = array();
foreach ($threads as $thread) {
$ts = $this->translateThread($thread);
$apiPage['threads'][] = current($ts['posts']);
}
return $apiPage;
}
function translateCatalog($catalog) {
$apiCatalog = array();
foreach ($catalog as $page => $threads) {
$apiPage = $this->translateCatalogPage($threads);
$apiPage['page'] = $page;
$apiCatalog[] = $apiPage;
}
return $apiCatalog;
}
}

View File

@@ -326,6 +326,11 @@
// Reply limit (stops bumping thread when this is reached)
$config['reply_limit'] = 250;
// Image hard limit (stops allowing new image replies when this is reached if not zero)
$config['image_hard_limit'] = 0;
// Reply hard limit (stops allowing new replies when this is reached if not zero)
$config['reply_hard_limit'] = 0;
// Strip repeating characters when making hashes
$config['robot_enable'] = false;
$config['robot_strip_repeating'] = true;
@@ -379,6 +384,9 @@
// When true, a blank password will be used for files (not usable for deletion).
$config['field_disable_password'] = false;
// Require users to see the ban page at least once for a ban even if it has since expired?
$config['require_ban_view'] = false;
/*
* ====================
* Markup settings
@@ -552,6 +560,9 @@
// Number of characters in the poster ID (maximum is 40)
$config['poster_id_length'] = 5;
// Show thread subject in page title?
$config['thread_subject_in_title'] = false;
// Page footer
$config['footer'][] = 'All trademarks, copyrights, comments, and images on this page are owned by and are the responsibility of their respective parties.';
@@ -696,6 +707,8 @@
$config['error']['noboard'] = _('Invalid board!');
$config['error']['nonexistant'] = _('Thread specified does not exist.');
$config['error']['locked'] = _('Thread locked. You may not reply at this time.');
$config['error']['reply_hard_limit'] = _('Thread has reached its maximum reply limit.');
$config['error']['image_hard_limit'] = _('Thread has reached its maximum image limit.');
$config['error']['nopost'] = _('You didn\'t make a post.');
$config['error']['flood'] = _('Flood detected; Post discarded.');
$config['error']['spam'] = _('Your request looks automated; Post discarded.');
@@ -723,6 +736,7 @@
$config['error']['captcha'] = _('You seem to have mistyped the verification.');
// Moderator errors
$config['error']['toomanyunban'] = _('You are only allowed to unban %s users at a time. You tried to unban %u users.');
$config['error']['invalid'] = _('Invalid username and/or password.');
$config['error']['notamod'] = _('You are not a mod…');
$config['error']['invalidafter'] = _('Invalid username and/or password. Your user may have been deleted or changed.');
@@ -810,6 +824,9 @@
* Mod settings
* ====================
*/
// Limit how many bans can be removed via the ban list. (Set too -1 to remove limit.)
$config['mod']['unban_limit'] = 5;
// Whether or not to lock moderator sessions to the IP address that was logged in with.
$config['mod']['lock_ip'] = true;
@@ -900,8 +917,8 @@
$config['mod']['shadow_mesage'] = 'Moved to %s.';
// Capcode to use when posting the above message.
$config['mod']['shadow_capcode'] = 'Mod';
// Name to use when posting the above message.
$config['mod']['shadow_name'] = $config['anonymous'];
// Name to use when posting the above message. If false, the default board name will be used. If something else, that will be used.
$config['mod']['shadow_name'] = false;
// Wait indefinitely when rebuilding everything
$config['mod']['rebuild_timelimit'] = 0;
@@ -912,6 +929,9 @@
// Edit raw HTML in posts by default
$config['mod']['raw_html_default'] = false;
// Automatically dismiss all reports regarding a thread when it is locked
$config['mod']['dismiss_reports_on_lock'] = true;
// Probably best not to change these:
if (!defined('JANITOR')) {
define('JANITOR', 0, true);
@@ -1028,6 +1048,9 @@
$config['mod']['createusers'] = ADMIN;
// View the moderation log
$config['mod']['modlog'] = ADMIN;
// View relevant moderation log entries on IP address pages (ie. ban history, etc.)
// Warning: Can be pretty resource exhaustive if your mod logs are huge.
$config['mod']['modlog_ip'] = MOD;
// Create a PM (viewing mod usernames)
$config['mod']['create_pm'] = JANITOR;
// Read any PM, sent to or from anybody

View File

@@ -118,7 +118,7 @@ function pm_snippet($body, $len=null) {
// calculate strlen() so we can add "..." after if needed
$strlen = mb_strlen($body);
$body = substr($body, 0, $len);
$body = mb_substr($body, 0, $len);
// Re-escape the characters.
return '<em>' . utf8tohtml($body) . ($strlen > $len ? '&hellip;' : '') . '</em>';
@@ -204,7 +204,7 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) {
}
} else {
// remove broken HTML entity at the end (if existent)
$body = preg_replace('/&[^;]+$/', '', $body);
$body = preg_replace('/&[^;]*$/', '', $body);
}
$body .= '<span class="toolong">Post too long. Click <a href="' . $url . '">here</a> to view the full text.</span>';
@@ -213,6 +213,25 @@ 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
# it can be used inside another without controlling its direction.
# More info: http://www.iamcal.com/understanding-bidirectional-text/
#
# LRE - U+202A - 0xE2 0x80 0xAA
# RLE - U+202B - 0xE2 0x80 0xAB
# LRO - U+202D - 0xE2 0x80 0xAD
# RLO - U+202E - 0xE2 0x80 0xAE
#
# PDF - U+202C - 0xE2 0x80 0xAC
#
$explicits = '\xE2\x80\xAA|\xE2\x80\xAB|\xE2\x80\xAD|\xE2\x80\xAE';
$pdf = '\xE2\x80\xAC';
$str = preg_replace("!(?<explicits>$explicits)|(?<pdf>$pdf)!", '', $str);
return $str;
}
function secure_link_confirm($text, $title, $confirm_message, $href) {
global $config;

View File

@@ -81,7 +81,7 @@ class Filter {
else
$all_boards = false;
$query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :set, :expires, :reason, :board)");
$query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :set, :expires, :reason, :board, 0)");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':mod', -1);
$query->bindValue(':set', time());

View File

@@ -13,6 +13,7 @@ require_once 'inc/display.php';
require_once 'inc/template.php';
require_once 'inc/database.php';
require_once 'inc/events.php';
require_once 'inc/api.php';
require_once 'inc/lib/gettext/gettext.inc';
// the user is not currently logged in as a moderator
@@ -78,7 +79,7 @@ function loadConfig() {
if ($config['debug']) {
if (!isset($debug)) {
$debug = array('sql' => array(), 'purge' => array(), 'cached' => array());
$debug = array('sql' => array(), 'purge' => array(), 'cached' => array(), 'write' => array());
$debug['start'] = microtime(true);
}
}
@@ -239,12 +240,12 @@ function create_antibot($board, $thread = null) {
return _create_antibot($board, $thread);
}
function rebuildThemes($action) {
function rebuildThemes($action, $board = false) {
// List themes
$query = query("SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
while ($theme = $query->fetch()) {
rebuildTheme($theme['theme'], $action);
rebuildTheme($theme['theme'], $action, $board);
}
}
@@ -261,7 +262,7 @@ function loadThemeConfig($_theme) {
return $theme;
}
function rebuildTheme($theme, $action) {
function rebuildTheme($theme, $action, $board = false) {
global $config, $_theme;
$_theme = $theme;
@@ -270,7 +271,7 @@ function rebuildTheme($theme, $action) {
if (file_exists($config['dir']['themes'] . '/' . $_theme . '/theme.php')) {
require_once $config['dir']['themes'] . '/' . $_theme . '/theme.php';
$theme['build_function']($action, themeSettings($_theme));
$theme['build_function']($action, themeSettings($_theme), $board);
}
}
@@ -328,11 +329,19 @@ function setupBoard($array) {
}
function openBoard($uri) {
$board = getBoardInfo($uri);
if ($board) {
setupBoard($board);
return true;
}
return false;
}
function getBoardInfo($uri) {
global $config;
if ($config['cache']['enabled'] && ($board = cache::get('board_' . $uri))) {
setupBoard($board);
return true;
return $board;
}
$query = prepare("SELECT * FROM `boards` WHERE `uri` = :uri LIMIT 1");
@@ -342,27 +351,16 @@ function openBoard($uri) {
if ($board = $query->fetch()) {
if ($config['cache']['enabled'])
cache::set('board_' . $uri, $board);
setupBoard($board);
return true;
return $board;
}
return false;
}
function boardTitle($uri) {
global $config;
if ($config['cache']['enabled'] && ($board = cache::get('board_' . $uri))) {
$board = getBoardInfo($uri);
if ($board)
return $board['title'];
}
$query = prepare("SELECT `title` FROM `boards` WHERE `uri` = :uri LIMIT 1");
$query->bindValue(':uri', $uri);
$query->execute() or error(db_error($query));
if ($title = $query->fetch()) {
return $title['title'];
}
return false;
}
@@ -395,7 +393,7 @@ function purge($uri) {
}
function file_write($path, $data, $simple = false, $skip_purge = false) {
global $config;
global $config, $debug;
if (preg_match('/^remote:\/\/(.+)\:(.+)$/', $path, $m)) {
if (isset($config['remote'][$m[1]])) {
@@ -422,7 +420,7 @@ function file_write($path, $data, $simple = false, $skip_purge = false) {
error('Unable to truncate file: ' . $path);
// Write data
if (fwrite($fp, $data) === false)
if (($bytes = fwrite($fp, $data)) === false)
error('Unable to write to file: ' . $path);
// Unlock
@@ -448,6 +446,10 @@ function file_write($path, $data, $simple = false, $skip_purge = false) {
purge($path);
}
if ($config['debug']) {
$debug['write'][] = $path . ': ' . $bytes . ' bytes';
}
event('write', $path);
}
@@ -578,6 +580,12 @@ function ago($timestamp) {
function displayBan($ban) {
global $config;
if (!$ban['seen']) {
$query = prepare("UPDATE `bans` SET `seen` = 1 WHERE `id` = :id");
$query->bindValue(':id', $ban['id'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
}
$ban['ip'] = $_SERVER['REMOTE_ADDR'];
// Show banned page and exit
@@ -604,12 +612,12 @@ function checkBan($board = 0) {
if (event('check-ban', $board))
return true;
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND `ip` = :ip ORDER BY `expires` IS NULL DESC, `expires` DESC, `expires` DESC LIMIT 1");
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND `ip` = :ip ORDER BY `expires` IS NULL DESC, `expires` DESC, `expires` DESC LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board);
$query->execute() or error(db_error($query));
if ($query->rowCount() < 1 && $config['ban_range']) {
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND :ip LIKE REPLACE(REPLACE(`ip`, '%', '!%'), '*', '%') ESCAPE '!' ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1");
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board) AND :ip LIKE REPLACE(REPLACE(`ip`, '%', '!%'), '*', '%') ESCAPE '!' ORDER BY `expires` IS NULL DESC, `expires` DESC LIMIT 1");
$query->bindValue(':ip', $_SERVER['REMOTE_ADDR']);
$query->bindValue(':board', $board);
$query->execute() or error(db_error($query));
@@ -617,7 +625,7 @@ function checkBan($board = 0) {
if ($query->rowCount() < 1 && $config['ban_cidr'] && !isIPv6()) {
// my most insane SQL query yet
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board)
$query = prepare("SELECT `set`, `expires`, `reason`, `board`, `seen`, `bans`.`id` FROM `bans` WHERE (`board` IS NULL OR `board` = :board)
AND (
`ip` REGEXP '^(\[0-9]+\.\[0-9]+\.\[0-9]+\.\[0-9]+\)\/(\[0-9]+)$'
AND
@@ -634,15 +642,29 @@ function checkBan($board = 0) {
if ($ban = $query->fetch()) {
if ($ban['expires'] && $ban['expires'] < time()) {
// Ban expired
$query = prepare("DELETE FROM `bans` WHERE `id` = :id LIMIT 1");
$query = prepare("DELETE FROM `bans` WHERE `id` = :id");
$query->bindValue(':id', $ban['id'], PDO::PARAM_INT);
$query->execute() or error(db_error($query));
if ($config['require_ban_view'] && !$ban['seen']) {
displayBan($ban);
}
return;
}
displayBan($ban);
}
// I'm not sure where else to put this. It doesn't really matter where; it just needs to be called every now and then to keep the ban list tidy.
purge_bans();
}
// No reason to keep expired bans in the database (except those that haven't been viewed yet)
function purge_bans() {
$query = prepare("DELETE FROM `bans` WHERE `expires` IS NOT NULL AND `expires` < :time AND `seen` = 1");
$query->bindValue(':time', time());
$query->execute() or error(db_error($query));
}
function threadLocked($id) {
@@ -725,13 +747,13 @@ function post(array $post) {
$query->bindValue(':password', $post['password']);
$query->bindValue(':ip', isset($post['ip']) ? $post['ip'] : $_SERVER['REMOTE_ADDR']);
if ($post['op'] && $post['mod'] && $post['sticky']) {
if ($post['op'] && $post['mod'] && isset($post['sticky']) && $post['sticky']) {
$query->bindValue(':sticky', 1, PDO::PARAM_INT);
} else {
$query->bindValue(':sticky', 0, PDO::PARAM_INT);
}
if ($post['op'] && $post['mod'] && $post['locked']) {
if ($post['op'] && $post['mod'] && isset($post['locked']) && $post['locked']) {
$query->bindValue(':locked', 1, PDO::PARAM_INT);
} else {
$query->bindValue(':locked', 0, PDO::PARAM_INT);
@@ -967,6 +989,8 @@ function index($page, $mod=false) {
if ($query->rowcount() < 1 && $page > 1)
return false;
$threads = array();
while ($th = $query->fetch()) {
$thread = new Thread(
$th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'],
@@ -986,12 +1010,8 @@ function index($page, $mod=false) {
$replies = array_reverse($posts->fetchAll(PDO::FETCH_ASSOC));
if (count($replies) == ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview'])) {
$count = prepare(sprintf("SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` = :thread UNION ALL SELECT COUNT(`id`) FROM `posts_%s` WHERE `file` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri']));
$count->bindValue(':thread', $th['id'], PDO::PARAM_INT);
$count->execute() or error(db_error($count));
$count = $count->fetchAll(PDO::FETCH_COLUMN);
$omitted = array('post_count' => $count[0], 'image_count' => $count[1]);
$count = numPosts($th['id']);
$omitted = array('post_count' => $count['replies'], 'image_count' => $count['images']);
} else {
$omitted = false;
}
@@ -1019,7 +1039,8 @@ function index($page, $mod=false) {
$thread->omitted = $omitted['post_count'] - ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']);
$thread->omitted_images = $omitted['image_count'] - $num_images;
}
$threads[] = $thread;
$body .= $thread->build(true);
}
@@ -1028,7 +1049,8 @@ function index($page, $mod=false) {
'body' => $body,
'post_url' => $config['post_url'],
'config' => $config,
'boardlist' => createBoardlist($mod)
'boardlist' => createBoardlist($mod),
'threads' => $threads
);
}
@@ -1134,14 +1156,19 @@ function checkRobot($body) {
return false;
}
// Returns an associative array with 'replies' and 'images' keys
function numPosts($id) {
global $board;
$query = prepare(sprintf("SELECT COUNT(*) as `count` FROM `posts_%s` WHERE `thread` = :thread", $board['uri']));
$query = prepare(sprintf("SELECT COUNT(*) as `num` FROM `posts_%s` WHERE `thread` = :thread UNION ALL SELECT COUNT(*) FROM `posts_%s` WHERE `file` IS NOT NULL AND `thread` = :thread", $board['uri'], $board['uri']));
$query->bindValue(':thread', $id, PDO::PARAM_INT);
$query->execute() or error(db_error($query));
$result = $query->fetch();
return $result['count'];
$num_posts = $query->fetch();
$num_posts = $num_posts['num'];
$num_images = $query->fetch();
$num_images = $num_images['num'];
return array('replies' => $num_posts, 'images' => $num_images);
}
function muteTime() {
@@ -1213,6 +1240,9 @@ function buildIndex() {
$pages = getPages();
$antibot = create_antibot($board['uri']);
$api = new Api();
$catalog = array();
$page = 1;
while ($page <= $config['max_pages'] && $content = index($page)) {
$filename = $board['dir'] . ($page == 1 ? $config['file_index'] : sprintf($config['file_page'], $page));
@@ -1225,6 +1255,14 @@ function buildIndex() {
$content['antibot'] = $antibot;
file_write($filename, Element('index.html', $content));
// json api
$threads = $content['threads'];
$json = json_encode($api->translatePage($threads));
$jsonFilename = $board['dir'] . ($page-1) . ".json"; // pages should start from 0
file_write($jsonFilename, $json);
$catalog[$page-1] = $threads;
$page++;
}
@@ -1232,8 +1270,16 @@ function buildIndex() {
for (;$page<=$config['max_pages'];$page++) {
$filename = $board['dir'] . ($page==1 ? $config['file_index'] : sprintf($config['file_page'], $page));
file_unlink($filename);
$jsonFilename = $board['dir'] . ($page-1) . ".json";
file_unlink($jsonFilename);
}
}
// json api catalog
$json = json_encode($api->translateCatalog($catalog));
$jsonFilename = $board['dir'] . "catalog.json";
file_write($jsonFilename, $json);
}
function buildJavascript() {
@@ -1246,6 +1292,12 @@ function buildJavascript() {
'uri' => addslashes((!empty($uri) ? $config['uri_stylesheets'] : '') . $uri));
}
// Check if we have translation for the javascripts; if yes, we add it to additional javascripts
list($pure_locale) = explode(".", $config['locale']);
if (file_exists ($jsloc = "inc/locale/".$pure_locale."/LC_MESSAGES/javascript.js")) {
array_unshift($config['additional_javascript'], $jsloc);
}
$script = Element('main.js', array(
'config' => $config,
'stylesheets' => $stylesheets
@@ -1365,8 +1417,8 @@ function unicodify($body) {
// En and em- dashes are rendered exactly the same in
// most monospace fonts (they look the same in code
// editors).
$body = str_replace('--', '&ndash;', $body); // en dash
$body = str_replace('---', '&mdash;', $body); // em dash
$body = str_replace('--', '&ndash;', $body); // en dash
return $body;
}
@@ -1494,7 +1546,7 @@ function markup(&$body, $track_cites = false) {
}
function utf8tohtml($utf8) {
return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x80, 0xffff, 0, 0xffff), 'UTF-8');
return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8');
}
function buildThread($id, $return=false, $mod=false) {
@@ -1535,8 +1587,9 @@ function buildThread($id, $return=false, $mod=false) {
error($config['error']['nonexistant']);
$body = Element('thread.html', array(
'board'=>$board,
'body'=>$thread->build(),
'board' => $board,
'thread' => $thread,
'body' => $thread->build(),
'config' => $config,
'id' => $id,
'mod' => $mod,
@@ -1549,6 +1602,12 @@ function buildThread($id, $return=false, $mod=false) {
return $body;
file_write($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $id), $body);
// json api
$api = new Api();
$json = json_encode($api->translateThread($thread));
$jsonFilename = $board['dir'] . $config['dir']['res'] . $id . ".json";
file_write($jsonFilename, $json);
}
function rrmdir($dir) {

View File

@@ -25,6 +25,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
'until' => new Twig_Filter_Function('until'),
'split' => new Twig_Filter_Function('twig_split_filter'),
'push' => new Twig_Filter_Function('twig_push_filter'),
'bidi_cleanup' => new Twig_Filter_Function('bidi_cleanup'),
'addslashes' => new Twig_Filter_Function('addslashes')
);
}
@@ -57,8 +58,7 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension
}
function twig_timezone_function() {
// there's probably a much easier way of doing this
return sprintf("%s%02d", ($hr = (int)floor(($tz = date('Z')) / 3600)) > 0 ? '+' : '-', abs($hr)) . ':' . sprintf("%02d", (($tz / 3600) - $hr) * 60);
return 'Z';
}
function twig_split_filter($str, $delim) {
@@ -75,7 +75,7 @@ function twig_remove_whitespace_filter($data) {
}
function twig_date_filter($date, $format) {
return strftime($format, $date);
return gmstrftime($format, $date);
}
function twig_hasPermission_filter($mod, $permission, $board = null) {

View File

@@ -0,0 +1 @@
l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to <small>&gt;&gt;{0}<\/small>":"Tryb postowania: Odpowied\u017a na <small>&gt;&gt;{0}<\/small>","Return":"Powr\u00f3t","Click reply to view.":"Kliknij Odpowied\u017a aby zobaczy\u0107.","Click to expand":"Kliknij aby rozwin\u0105\u0107","Hide expanded replies":"Schowaj rozwini\u0119te odpowiedzi","Mon":"pon","Tue":"wto","Wed":"\u015bro","Thu":"czw","Fri":"pi\u0105","Sat":"sob","Sun":"nie","Show locked threads":"Poka\u017c zablokowane tematy","Hide locked threads":"Schowaj zablokowane tematy","Forced anonymity":"Wymuszona anonimowo\u015b\u0107","enabled":"w\u0142\u0105czona","disabled":"wy\u0142\u0105czona","Password":"Has\u0142o","Delete file only":"Usu\u0144 tylko plik","File":"Plik","Delete":"Usu\u0144","Reason":"Pow\u00f3d","Report":"Zg\u0142oszenie"};

View File

@@ -0,0 +1,121 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-07-18 16:31-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../../../../js/quick-reply.js:20 ../../../../js/quick-reply.js:21
msgid "Submit"
msgstr "Wyślij"
#: ../../../../js/quick-reply.js:30 ../../../../js/quick-reply.js:31
msgid "Quick reply"
msgstr "Szybka odpowiedź"
#: ../../../../js/quick-reply.js:32 ../../../../js/quick-reply.js:33
msgid "Posting mode: Replying to <small>&gt;&gt;{0}</small>"
msgstr "Tryb postowania: Odpowiedź na <small>&gt;&gt;{0}</small>"
#: ../../../../js/quick-reply.js:32 ../../../../js/quick-reply.js:33
msgid "Return"
msgstr "Powrót"
#: ../../../../js/expand.js:20
msgid "Click reply to view."
msgstr "Kliknij Odpowiedź aby zobaczyć."
#: ../../../../js/expand.js:20
msgid "Click to expand"
msgstr "Kliknij aby rozwinąć"
#: ../../../../js/expand.js:41
msgid "Hide expanded replies"
msgstr "Schowaj rozwinięte odpowiedzi"
#: ../../../../js/local-time.js:40
msgid "Mon"
msgstr "pon"
#: ../../../../js/local-time.js:40
msgid "Tue"
msgstr "wto"
#: ../../../../js/local-time.js:40
msgid "Wed"
msgstr "śro"
#: ../../../../js/local-time.js:40
msgid "Thu"
msgstr "czw"
#: ../../../../js/local-time.js:40
msgid "Fri"
msgstr "pią"
#: ../../../../js/local-time.js:40
msgid "Sat"
msgstr "sob"
#: ../../../../js/local-time.js:40
msgid "Sun"
msgstr "nie"
#: ../../../../js/toggle-locked-threads.js:39
#: ../../../../js/toggle-locked-threads.js:54
msgid "Show locked threads"
msgstr "Pokaż zablokowane tematy"
#: ../../../../js/toggle-locked-threads.js:39
#: ../../../../js/toggle-locked-threads.js:54
msgid "Hide locked threads"
msgstr "Schowaj zablokowane tematy"
#: ../../../../js/forced-anon.js:59 ../../../../js/forced-anon.js:65
#: ../../../../js/forced-anon.js:69
msgid "Forced anonymity"
msgstr "Wymuszona anonimowość"
#: ../../../../js/forced-anon.js:59 ../../../../js/forced-anon.js:65
msgid "enabled"
msgstr "włączona"
#: ../../../../js/forced-anon.js:59 ../../../../js/forced-anon.js:69
msgid "disabled"
msgstr "wyłączona"
#: ../../../../js/quick-post-controls.js:27
msgid "Password"
msgstr "Hasło"
#: ../../../../js/quick-post-controls.js:29
msgid "Delete file only"
msgstr "Usuń tylko plik"
#: ../../../../js/quick-post-controls.js:30
msgid "File"
msgstr "Plik"
#: ../../../../js/quick-post-controls.js:31
msgid "Delete"
msgstr "Usuń"
#: ../../../../js/quick-post-controls.js:35
msgid "Reason"
msgstr "Powód"
#: ../../../../js/quick-post-controls.js:37
msgid "Report"
msgstr "Zgłoszenie"

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -0,0 +1,844 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-21 11:29-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural==(n != 1);n"
#: ../../inc/lib/gettext/examples/pigs_dropin.php:77
msgid ""
"This is how the story goes.\n"
"\n"
msgstr "Era uma vez\n\n"
#: ../../inc/functions.php:1046 ../../inc/functions.php:1060
msgid "Previous"
msgstr "Anterior"
#: ../../inc/functions.php:1065 ../../inc/functions.php:1074
msgid "Next"
msgstr "Proximo"
#: ../../inc/display.php:91 ../../inc/mod/pages.php:62
msgid "Login"
msgstr "Login"
#: ../../inc/config.php:687
msgid "Lurk some more before posting."
msgstr "Lurke mais antes de postar."
#: ../../inc/config.php:688
msgid "You look like a bot."
msgstr "Você não parece humano."
#: ../../inc/config.php:689
msgid "Your browser sent an invalid or no HTTP referer."
msgstr "Seu browser enviou um referial HTTP inválido ou não enviou o referencial."
#: ../../inc/config.php:690
#, php-format
msgid "The %s field was too long."
msgstr "O campo %s é longo demais."
#: ../../inc/config.php:691
msgid "The body was too long."
msgstr "O corpo do texto é longo demais."
#: ../../inc/config.php:692
msgid "The body was too short or empty."
msgstr "O corpo do texto é pequeno demais ou inexistente."
#: ../../inc/config.php:693
msgid "You must upload an image."
msgstr "Você deve fazer upload de uma imagem."
#: ../../inc/config.php:694
msgid "The server failed to handle your upload."
msgstr "O servidor não conseguiu lidar com seu upload."
#: ../../inc/config.php:695
msgid "Unsupported image format."
msgstr "Tipo de imagem não aceito."
#: ../../inc/config.php:696
msgid "Invalid board!"
msgstr "Board inválida!"
#: ../../inc/config.php:697
msgid "Thread specified does not exist."
msgstr "O tópico especificado não existe.."
#: ../../inc/config.php:698
msgid "Thread locked. You may not reply at this time."
msgstr "Tópico trancado, você não pode postar."
#: ../../inc/config.php:699
msgid "You didn't make a post."
msgstr "Você não escreveu uma mensagem."
#: ../../inc/config.php:700
msgid "Flood detected; Post discarded."
msgstr "Flood detectado; Sua mensagem foi descartada."
#: ../../inc/config.php:701
msgid "Your request looks automated; Post discarded."
msgstr "Sua requisição parece automatizada; Mensagem descartada."
#: ../../inc/config.php:702
msgid "Unoriginal content!"
msgstr "Conteudo não original!"
#: ../../inc/config.php:703
#, php-format
msgid "Unoriginal content! You have been muted for %d seconds."
msgstr "Conteudo não original! Você está impedido de postar por %d segundos."
#: ../../inc/config.php:704
#, php-format
msgid "You are muted! Expires in %d seconds."
msgstr "Você está impedido de postar! Expira em %d segundos."
#: ../../inc/config.php:705
#, php-format
msgid "Your IP address is listed in %s."
msgstr "Seu IP está listado em %s."
#: ../../inc/config.php:706
msgid "Too many links; flood detected."
msgstr "Links demais; Flood detectado."
#: ../../inc/config.php:707
msgid "Too many cites; post discarded."
msgstr "Citações demais; Post descartado."
#: ../../inc/config.php:708
msgid "Too many cross-board links; post discarded."
msgstr "Links entre boards demais; Post descartado."
#: ../../inc/config.php:709
msgid "You didn't select anything to delete."
msgstr "Você não selecionou nada para deletar."
#: ../../inc/config.php:710
msgid "You didn't select anything to report."
msgstr "Você não selecionou nada para denunciar."
#: ../../inc/config.php:711
msgid "You can't report that many posts at once."
msgstr "Você não pode denunciar tantas mensagens ao mesmo tempo."
#: ../../inc/config.php:712
msgid "Wrong password…"
msgstr "Senha incorreta…"
#: ../../inc/config.php:713
msgid "Invalid image."
msgstr "Imagem inválida."
#: ../../inc/config.php:714
msgid "Unknown file extension."
msgstr "Extenção de arquivo desconhecida."
#: ../../inc/config.php:715
msgid "Maximum file size: %maxsz% bytes<br>Your file's size: %filesz% bytes"
msgstr "Tamanho maximo de arquivos: %maxsz% bytes<br>O tamanho do seu arquivo: %filesz% bytes"
#: ../../inc/config.php:716
msgid "The file was too big."
msgstr "Seu arquivo é grande demais."
#: ../../inc/config.php:717
msgid "Invalid archive!"
msgstr "Arquivo inválido!"
#: ../../inc/config.php:718
#, php-format
msgid "That file <a href=\"%s\">already exists</a>!"
msgstr "O arquivo <a href=\"%s\">já existe</a>!"
#: ../../inc/config.php:719
#, php-format
msgid "That file <a href=\"%s\">already exists</a> in this thread!"
msgstr "O arquivo <a href=\"%s\">já existe</a> neste tópico!"
#: ../../inc/config.php:720
#, php-format
msgid "You'll have to wait another %s before deleting that."
msgstr "Você terá que esperar %s segundos antes de deletar isso."
#: ../../inc/config.php:721
msgid "MIME type detection XSS exploit (IE) detected; post discarded."
msgstr "Exploit XSS do tipo MIME (IE) detectado; mensagem descartada."
#: ../../inc/config.php:722
msgid "Couldn't make sense of the URL of the video you tried to embed."
msgstr "Não consegui processar a URL do video que você tentou integrar"
#: ../../inc/config.php:723
msgid "You seem to have mistyped the verification."
msgstr "Você errou o codigo de verificação."
#: ../../inc/config.php:726
msgid "Invalid username and/or password."
msgstr "Login e/ou senha inválido(s)."
#: ../../inc/config.php:727
msgid "You are not a mod…"
msgstr "Você não é mod…"
#: ../../inc/config.php:728
msgid ""
"Invalid username and/or password. Your user may have been deleted or changed."
msgstr "Login e/ou senha inválido(s). Seu login deve ter sido mudado ou removido."
#: ../../inc/config.php:729
msgid "Invalid/malformed cookies."
msgstr "Cookies inválidos ou mal formados."
#: ../../inc/config.php:730
msgid "Your browser didn't submit an input when it should have."
msgstr "Seu browser não enviou uma entrada quando ele deveria."
#: ../../inc/config.php:731
#, php-format
msgid "The %s field is required."
msgstr "O campo %s é necessário."
#: ../../inc/config.php:732
#, php-format
msgid "The %s field was invalid."
msgstr "O campo %s é inválido."
#: ../../inc/config.php:733
#, php-format
msgid "There is already a %s board."
msgstr "A board %s já existe."
#: ../../inc/config.php:734
msgid "You don't have permission to do that."
msgstr "Você não tem permissão para fazer isso."
#: ../../inc/config.php:735
msgid "That post doesn't exist…"
msgstr "Este post já existe…"
#: ../../inc/config.php:736
msgid "Page not found."
msgstr "Pagina não encontrada."
#: ../../inc/config.php:737
#, php-format
msgid "That mod <a href=\"?/users/%d\">already exists</a>!"
msgstr "Este mod <a href=\"?/users/%d\">já existe</a>!"
#: ../../inc/config.php:738
msgid "That theme doesn't exist!"
msgstr "Este tema não existe!"
#: ../../inc/config.php:739
msgid "Invalid security token! Please go back and try again."
msgstr "Token de segurança inválido! Retorne e tente de novo."
#: ../../inc/mod/pages.php:66
msgid "Confirm action"
msgstr "Confirmar ação"
#: ../../inc/mod/pages.php:110
msgid "Could not find current version! (Check .installed)"
msgstr "Não foi possivel encontrar a versão atual! (Cheque o .installed)"
#: ../../inc/mod/pages.php:151
msgid "Dashboard"
msgstr "Dashboard"
#: ../../inc/mod/pages.php:228
msgid "Edit board"
msgstr "Editar board"
#: ../../inc/mod/pages.php:261
msgid "Couldn't open board after creation."
msgstr "Não foi possivel abrir a board após a criação."
#: ../../inc/mod/pages.php:276
msgid "New board"
msgstr "Nova board"
#: ../../inc/mod/pages.php:322
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:96
msgid "Noticeboard"
msgstr "Quadro de noticias"
#: ../../inc/mod/pages.php:382
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:166
msgid "News"
msgstr "Noticias"
#: ../../inc/mod/pages.php:422 ../../inc/mod/pages.php:449
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:255
msgid "Moderation log"
msgstr "Log da moderação"
#: ../../inc/mod/pages.php:592
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:247
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:65
msgid "IP"
msgstr "IP"
#: ../../inc/mod/pages.php:602 ../../inc/mod/pages.php:993
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:377
msgid "New ban"
msgstr "Nova expulsão"
#: ../../inc/mod/pages.php:670
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:224
msgid "Ban list"
msgstr "Lista de expulsões"
#: ../../inc/mod/pages.php:765
msgid "Target and source board are the same."
msgstr "Board alvo e fonte são as mesmas."
#: ../../inc/mod/pages.php:927
msgid "Impossible to move thread; there is only one board."
msgstr "Impossivel de mover o tópico; Só existe uma board."
#: ../../inc/mod/pages.php:931
msgid "Move thread"
msgstr "Mover tópico"
#: ../../inc/mod/pages.php:1045
msgid "Edit post"
msgstr "Editar mensagem"
#: ../../inc/mod/pages.php:1271 ../../inc/mod/pages.php:1320
msgid "Edit user"
msgstr "Editar usuário"
#: ../../inc/mod/pages.php:1333
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232
msgid "Manage users"
msgstr "Administrar usuários"
#: ../../inc/mod/pages.php:1395 ../../inc/mod/pages.php:1467
msgid "New PM for"
msgstr "Nova MP para"
#: ../../inc/mod/pages.php:1399
msgid "Private message"
msgstr "Mensagem pessoal"
#: ../../inc/mod/pages.php:1420
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171
msgid "PM inbox"
msgstr "Entrada de MP"
#: ../../inc/mod/pages.php:1531 ../../inc/mod/pages.php:1535
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263
msgid "Rebuild"
msgstr "Reconstruir"
#: ../../inc/mod/pages.php:1621
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207
msgid "Report queue"
msgstr "Fila de denuncias"
#: ../../inc/mod/pages.php:1743
msgid "Config editor"
msgstr "Editor de configurações"
#: ../../inc/mod/pages.php:1753
msgid "Themes directory doesn't exist!"
msgstr "Diretório de temas não existe!"
#: ../../inc/mod/pages.php:1755
msgid "Cannot open themes directory; check permissions."
msgstr "Não é possivel abrir diretorio de temas; reveja suas permissões."
#: ../../inc/mod/pages.php:1769
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247
msgid "Manage themes"
msgstr "Administrar temas"
#: ../../inc/mod/pages.php:1831
#, php-format
msgid "Installed theme: %s"
msgstr "Tema instalado: %s"
#: ../../inc/mod/pages.php:1841
#, php-format
msgid "Configuring theme: %s"
msgstr "Configurando tema: %s"
#: ../../inc/mod/pages.php:1869
#, php-format
msgid "Rebuilt theme: %s"
msgstr "Reconstruir tema: %s"
#: ../../inc/mod/pages.php:1908
msgid "Debug: Anti-spam"
msgstr "Debug: Anti-spam"
#: ../../inc/mod/pages.php:1932
msgid "Debug: Recent posts"
msgstr "Debug: Mensagens recentes"
#: ../../inc/mod/pages.php:1956
msgid "Debug: SQL"
msgstr ""
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:19
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:29
msgid "Boards"
msgstr "Boards"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:57
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:183
msgid "edit"
msgstr "editar"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:74
msgid "Create new board"
msgstr "Criar nova board"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:84
msgid "Messages"
msgstr "Mensagens"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:120
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:98
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:125
msgid "no subject"
msgstr "sem assunto"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:161
msgid "View all noticeboard entries"
msgstr "Ver todas as noticias do quadro de noticias"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:192
msgid "Administration"
msgstr "Administração"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:239
msgid "Change password"
msgstr "Mudar senha"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:271
msgid "Configuration"
msgstr "Configuração"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:282
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:293
msgid "Search"
msgstr "Procurar"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:289
msgid "Phrase:"
msgstr "Frase:"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:297
msgid ""
"(Search is case-insensitive, and based on keywords. To match exact phrases, "
"use \"quotes\". Use an asterisk (*) for wildcard.)"
msgstr ""
"(A procura não diferencia maiúsculas de minusculas, e baseia-se em palavras chave. para procurar por frases exatas, "
"use \"quotes\". Utilize um asterisco (*) como coringa.)"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:309
msgid "Debug"
msgstr "Debug"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:313
msgid "Anti-spam"
msgstr "Anti-spam"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:316
msgid "Recent posts"
msgstr "Mensagens recentes"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:322
msgid "SQL"
msgstr "SQL"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:360
msgid "User account"
msgstr "Conta de usuário"
#: ../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:365
msgid "Logout"
msgstr "Sair"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:21
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:21
msgid "New post"
msgstr "Nova mensagem"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:27
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:31
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:36
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:27
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:55
msgid "Name"
msgstr "Nome"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:36
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:63
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:53
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:98
msgid "Subject"
msgstr "Assunto"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:42
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:69
msgid "Body"
msgstr "Mensagem"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:49
msgid "Post to noticeboard"
msgstr "Postar no quadro de notícias"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:73
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:100
msgid "delete"
msgstr "deletar"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:106
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:133
msgid "by"
msgstr "por"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:118
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:112
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:344
msgid "deleted?"
msgstr "deletado?"
#: ../../templates/cache/26/6f/05ca0da8ac09e2c2216cba2b6f95.php:125
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:136
msgid "at"
msgstr "em"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:74
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:169
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:331
msgid "Staff"
msgstr "Equipe"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:77
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:179
msgid "Note"
msgstr "Nota"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:80
msgid "Date"
msgstr "Data"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:86
msgid "Actions"
msgstr "Ações"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:142
msgid "remove"
msgstr "remover"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:189
msgid "New note"
msgstr "Nova nota"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:226
msgid "Status"
msgstr "Situação"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:233
msgid "Expired"
msgstr "Expirado"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:238
msgid "Active"
msgstr "Ativo"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:256
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:32
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:30
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:90
msgid "Reason"
msgstr "Razão"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:269
msgid "no reason"
msgstr "sem razão especificada"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:278
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:20
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:142
msgid "Board"
msgstr "Board"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:291
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:150
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:83
msgid "all boards"
msgstr "todas as boards"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:300
msgid "Set"
msgstr "Configurar"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:309
msgid "Expires"
msgstr "Expira em"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:322
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:137
msgid "never"
msgstr "nunca"
#: ../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:357
msgid "Remove ban"
msgstr "Remover expulsão"
#: ../../templates/cache/72/55/0d64283f30702de83ecfcb71f86a.php:25
msgid "There are no reports."
msgstr "Não há denúncias no momento."
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:19
msgid "Delete Post"
msgstr "Deletar Mensagem"
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:22
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:218
msgid "File"
msgstr "Arquivo"
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:23
#: ../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:41
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:310
msgid "Password"
msgstr "Senha"
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:27
msgid "Delete"
msgstr "Deletar"
#: ../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:36
msgid "Report"
msgstr "Denunciar"
#: ../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:28
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:23
msgid "Username"
msgstr "Usuário"
#: ../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:52
msgid "Continue"
msgstr "Prosseguir"
#: ../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:94
#: ../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:175
#: ../../templates/cache/62/8c/21348d46377c3e1b3f8c476ba376.php:63
msgid "Return to dashboard"
msgstr "Voltar à dashboard"
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:36
msgid "Report date"
msgstr "Data da denúncia"
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:45
msgid "Reported by"
msgstr "Denunciado por"
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:63
msgid "Discard abuse report"
msgstr "Descartar denúncia desnecessária"
#: ../../templates/cache/9c/7b/891291bc84f8844c30cefdb949cf.php:80
msgid "Discard all abuse reports by this IP address"
msgstr "Descartar todas denúncias desnecessárias deste IP"
#: ../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:183
msgid "Posting mode: Reply"
msgstr "Modo de postagem: Resposta"
#: ../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:186
#: ../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:232
msgid "Return"
msgstr "Voltar"
#: ../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:76
msgid "Post news entry"
msgstr "Postar nova notícia"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:66
msgid "(or subnet)"
msgstr "(ou subnet)"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:80
msgid "hidden"
msgstr "oculto"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:107
msgid "Message"
msgstr "Mensagem"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:117
msgid "public; attached to post"
msgstr "público; anexado à mensagem"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:133
msgid "Length"
msgstr "Tamanho"
#: ../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:192
msgid "New Ban"
msgstr "Nova Expulsão"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:20
msgid "ID"
msgstr "ID"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:26
msgid "Type"
msgstr "Tipo"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:35
msgid "Last action"
msgstr "Ultima ação"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:61
msgid "Janitor"
msgstr "Faxineiro"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:64
msgid "Mod"
msgstr "Moderador"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:67
msgid "Admin"
msgstr "Administrador"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:78
msgid "none"
msgstr "nenhum"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:153
msgid "Promote"
msgstr "Promover"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:163
msgid "Demote"
msgstr "Rebaixar"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:173
msgid "log"
msgstr "registro"
#: ../../templates/cache/c5/a7/fac83da087ee6e24edaf09e01122.php:193
msgid "PM"
msgstr "MP"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:105
msgid "File:"
msgstr "Arquivo:"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:117
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:129
msgid "Spoiler Image"
msgstr "Imagem Spoiler"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:463
msgid "Reply"
msgstr "Responder"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:490
msgid "1 post"
msgid_plural "%count% posts"
msgstr[0] "1 mensagem"
msgstr[1] "%count% mensagens"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:496
msgid "and"
msgstr "e"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:507
msgid "1 image reply"
msgid_plural "%count% image replies"
msgstr[0] "1 resposta com imagem"
msgstr[1] "%count% respostas com imagem"
#: ../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:512
msgid "omitted. Click reply to view."
msgstr "omitidas. Clique em responder para visualizar."
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:40
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:76
msgid "Email"
msgstr "E-mail"
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:62
msgid "Update"
msgstr "Atualizar"
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:69
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:138
msgid "Comment"
msgstr "Comentar"
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:89
msgid "Currently editing raw HTML."
msgstr "Editando em HTML puro."
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:96
msgid "Edit markup instead?"
msgstr "Editar markup em vez disso?"
#: ../../templates/cache/39/42/cbc36382096edfa72a8bc26e4514.php:105
msgid "Edit raw HTML instead?"
msgstr "Editar em HTML puro em vez disso?"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:111
msgid "Submit"
msgstr "Enviar"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:159
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:185
msgid "Verification"
msgstr "Verification"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:236
msgid "Embed"
msgstr "Inserir"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:259
msgid "Flags"
msgstr "Sinalizações"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:268
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:271
msgid "Sticky"
msgstr "Fixar"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:280
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:283
msgid "Lock"
msgstr "Trancar"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:292
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:295
msgid "Raw HTML"
msgstr "HTML Puro"
#: ../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:319
msgid "(For file deletion.)"
msgstr "(Para excluir arquivos)"

View File

@@ -98,8 +98,10 @@ if (isset($_COOKIE[$config['cookies']['mod']])) {
// Should be username:hash:salt
$cookie = explode(':', $_COOKIE[$config['cookies']['mod']]);
if (count($cookie) != 3) {
// Malformed cookies
destroyCookies();
error($config['error']['malformed']);
mod_login();
exit;
}
$query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username LIMIT 1");
@@ -111,7 +113,8 @@ if (isset($_COOKIE[$config['cookies']['mod']])) {
if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) {
// Malformed cookies
destroyCookies();
error($config['error']['malformed']);
mod_login();
exit;
}
$mod = array(
@@ -125,7 +128,7 @@ if (isset($_COOKIE[$config['cookies']['mod']])) {
function create_pm_header() {
global $mod, $config;
if ($config['cache']['enabled'] && ($header = cache::get('pm_unread_' . $mod['id'])) !== false) {
if ($config['cache']['enabled'] && ($header = cache::get('pm_unread_' . $mod['id'])) != false) {
if ($header === true)
return false;

View File

@@ -56,7 +56,7 @@ function parse_time($str) {
function ban($mask, $reason, $length, $board) {
global $mod, $pdo;
$query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :time, :expires, :reason, :board)");
$query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :time, :expires, :reason, :board, 0)");
$query->bindValue(':ip', $mask);
$query->bindValue(':mod', $mod['id']);
$query->bindValue(':time', time());
@@ -80,16 +80,25 @@ function ban($mask, $reason, $length, $board) {
modLog('Created a new ' .
($length > 0 ? preg_replace('/^(\d+) (\w+?)s?$/', '$1-$2', until($length)) : 'permanent') .
' ban (<small>#' . $pdo->lastInsertId() . '</small>) for ' .
' ban on ' .
($board ? '/' . $board . '/' : 'all boards') .
' for ' .
(filter_var($mask, FILTER_VALIDATE_IP) !== false ? "<a href=\"?/IP/$mask\">$mask</a>" : utf8tohtml($mask)) .
' (<small>#' . $pdo->lastInsertId() . '</small>)' .
' with ' . ($reason ? 'reason: ' . utf8tohtml($reason) . '' : 'no reason'));
}
function unban($id) {
function unban($id) {
$query = prepare("SELECT `ip` FROM `bans` WHERE `id` = :id");
$query->bindValue(':id', $id);
$query->execute() or error(db_error($query));
$mask = $query->fetchColumn();
$query = prepare("DELETE FROM `bans` WHERE `id` = :id");
$query->bindValue(':id', $id);
$query->execute() or error(db_error($query));
modLog("Removed ban #{$id}");
if ($mask)
modLog("Removed ban #{$id} for " . (filter_var($mask, FILTER_VALIDATE_IP) !== false ? "<a href=\"?/IP/$mask\">$mask</a>" : utf8tohtml($mask)));
}

View File

@@ -92,7 +92,7 @@ function mod_dashboard() {
}
}
if (!$config['cache']['enabled'] || ($args['unread_pms'] = cache::get('pm_unreadcount_' . $mod['id'])) === false) {
if (!$config['cache']['enabled'] || ($args['unread_pms'] = cache::get('pm_unreadcount_' . $mod['id'])) == false) {
$query = prepare('SELECT COUNT(*) FROM `pms` WHERE `to` = :id AND `unread` = 1');
$query->bindValue(':id', $mod['id']);
$query->execute() or error(db_error($query));
@@ -114,26 +114,37 @@ function mod_dashboard() {
} else {
$ctx = stream_context_create(array('http' => array('timeout' => 5)));
if ($code = @file_get_contents('http://tinyboard.org/version.txt', 0, $ctx)) {
eval($code);
if (preg_match('/v(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $matches)) {
$current = array(
'massive' => (int) $matches[1],
'major' => (int) $matches[2],
'minor' => (int) $matches[3]
$ver = strtok($code, "\n");
if (preg_match('@^// v(\d+)\.(\d+)\.(\d+)\s*?$@', $ver, $matches)) {
$latest = array(
'massive' => $matches[1],
'major' => $matches[2],
'minor' => $matches[3]
);
if (isset($m[4])) {
// Development versions are always ahead in the versioning numbers
$current['minor'] --;
}
// Check if it's newer
if (!( $latest['massive'] > $current['massive'] ||
$latest['major'] > $current['major'] ||
($latest['massive'] == $current['massive'] &&
$latest['major'] == $current['major'] &&
$latest['minor'] > $current['minor']
)))
if (preg_match('/v(\d+)\.(\d)\.(\d+)(-dev.+)?$/', $config['version'], $matches)) {
$current = array(
'massive' => (int) $matches[1],
'major' => (int) $matches[2],
'minor' => (int) $matches[3]
);
if (isset($m[4])) {
// Development versions are always ahead in the versioning numbers
$current['minor'] --;
}
// Check if it's newer
if (!( $latest['massive'] > $current['massive'] ||
$latest['major'] > $current['major'] ||
($latest['massive'] == $current['massive'] &&
$latest['major'] == $current['major'] &&
$latest['minor'] > $current['minor']
)))
$latest = false;
} else {
$latest = false;
}
} else {
// Couldn't get latest version
$latest = false;
}
} else {
@@ -206,6 +217,19 @@ function mod_edit_board($boardName) {
$query = prepare('DELETE FROM `antispam` WHERE `board` = :board');
$query->bindValue(':board', $board['uri']);
$query->execute() or error(db_error($query));
// Remove board from users/permissions table
$query = query('SELECT `id`,`boards` FROM `mods`') or error(db_error());
while ($user = $query->fetch(PDO::FETCH_ASSOC)) {
$user_boards = explode(',', $user['boards']);
if (in_array($board['uri'], $user_boards)) {
unset($user_boards[array_search($board['uri'], $user_boards)]);
$_query = prepare('UPDATE `mods` SET `boards` = :boards WHERE `id` = :id');
$_query->bindValue(':boards', implode(',', $user_boards));
$_query->bindValue(':id', $user['id']);
$_query->execute() or error(db_error($_query));
}
}
} else {
$query = prepare('UPDATE `boards` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri');
$query->bindValue(':uri', $board['uri']);
@@ -589,6 +613,15 @@ function mod_page_ip($ip) {
$args['notes'] = $query->fetchAll(PDO::FETCH_ASSOC);
}
if (hasPermission($config['mod']['modlog_ip'])) {
$query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `text` LIKE :search ORDER BY `time` DESC LIMIT 20");
$query->bindValue(':search', '%' . $ip . '%');
$query->execute() or error(db_error($query));
$args['logs'] = $query->fetchAll(PDO::FETCH_ASSOC);
} else {
$args['logs'] = array();
}
mod_page(sprintf('%s: %s', _('IP'), $ip), 'mod/view_ip.html', $args, $args['hostname']);
}
@@ -631,7 +664,8 @@ function mod_bans($page_no = 1) {
if (preg_match('/^ban_(\d+)$/', $name, $match))
$unban[] = $match[1];
}
if (isset($config['mod']['unban_limit'])){
if (count($unban) <= $config['mod']['unban_limit'] || $config['mod']['unban_limit'] == -1){
if (!empty($unban)) {
query('DELETE FROM `bans` WHERE `id` = ' . implode(' OR `id` = ', $unban)) or error(db_error());
@@ -639,7 +673,21 @@ function mod_bans($page_no = 1) {
modLog("Removed ban #{$id}");
}
}
} else {
error(sprintf($config['error']['toomanyunban'], $config['mod']['unban_limit'], count($unban) ));
}
} else {
if (!empty($unban)) {
query('DELETE FROM `bans` WHERE `id` = ' . implode(' OR `id` = ', $unban)) or error(db_error());
foreach ($unban as $id) {
modLog("Removed ban #{$id}");
}
}
}
header('Location: ?/bans', true, $config['redirect_http']);
}
@@ -690,6 +738,13 @@ function mod_lock($board, $unlock, $post) {
buildIndex();
}
if ($config['mod']['dismiss_reports_on_lock']) {
$query = prepare('DELETE FROM `reports` WHERE `board` = :board AND `post` = :id');
$query->bindValue(':board', $board);
$query->bindValue(':id', $post);
$query->execute() or error(db_error($query));
}
header('Location: ?/' . sprintf($config['board_path'], $board) . $config['file_index'], true, $config['redirect_http']);
if ($unlock)
@@ -871,8 +926,10 @@ function mod_move($originBoard, $postID) {
modLog("Moved thread #${postID} to " . sprintf($config['board_abbreviation'], $targetBoard) . " (#${newID})", $originBoard);
// build new hread
// build new thread
buildThread($newID);
clean();
buildIndex();
// trigger themes
@@ -892,7 +949,7 @@ function mod_move($originBoard, $postID) {
'mod' => true,
'subject' => '',
'email' => '',
'name' => $config['mod']['shadow_name'],
'name' => (!$config['mod']['shadow_name'] ? $config['anonymous'] : $config['mod']['shadow_name']),
'capcode' => $config['mod']['shadow_capcode'],
'trip' => '',
'password' => '',
@@ -1834,6 +1891,7 @@ function mod_theme_configure($theme_name) {
'result' => $result,
'message' => $message,
));
return;
}
$settings = themeSettings($theme_name);