From 8772c31ce13e65b379be7b74154dd077cbd68ecb Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 20 Jul 2013 22:45:21 -0400 Subject: post search: missed default config --- inc/config.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index bbc899ef..74794645 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1084,6 +1084,28 @@ // Execute un-filtered SQL queries on the database (?/debug/sql) $config['mod']['debug_sql'] = DISABLED; +/* + * ==================== + * Public post search + * ==================== + */ + $config['search'] = array(); + + // Enable the search form + $config['search']['enable'] = false; + + // Maximal number of queries per IP address per minutes + $config['search']['queries_per_minutes'] = Array(15, 2); + + // Global maximal number of queries per minutes + $config['search']['queries_per_minutes_all'] = Array(50, 2); + + // Limit of search results + $config['search']['search_limit'] = 100; + + // Boards for searching + //$config['search']['boards'] = array('a', 'b', 'c', 'd', 'e'); + /* * ==================== * Events (PHP 5.3.0+) -- cgit v1.3 From 97a22e57c1ef3c3e41ed5666255c1e941df21f3e Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 20 Jul 2013 22:47:26 -0400 Subject: Remove imgcaptcha, this code is unused in any of our forks and needs work to get here back. Revert "Merge branch 'imgcaptcha' of https://github.com/asiekierka/Tinyboard" This reverts commit 49afb685c8e658c0f36b8171e176363538eb9419, reversing changes made to 2451a0f29c08e23ff36ef113082c112224f7e576. Conflicts: js/imgcaptcha.js --- imgcaptcha_im.php | 7 --- imgcaptcha_p.php | 5 -- inc/config.php | 15 ------ inc/ic-encrypt.php | 37 ------------- inc/imgcaptcha.php | 136 ----------------------------------------------- js/imgcaptcha.js | 12 ----- post.php | 8 +-- templates/post_form.html | 15 ------ 8 files changed, 1 insertion(+), 234 deletions(-) delete mode 100644 imgcaptcha_im.php delete mode 100644 imgcaptcha_p.php delete mode 100644 inc/ic-encrypt.php delete mode 100644 inc/imgcaptcha.php delete mode 100644 js/imgcaptcha.js (limited to 'inc') diff --git a/imgcaptcha_im.php b/imgcaptcha_im.php deleted file mode 100644 index 152d92ad..00000000 --- a/imgcaptcha_im.php +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/imgcaptcha_p.php b/imgcaptcha_p.php deleted file mode 100644 index 9543dc6c..00000000 --- a/imgcaptcha_p.php +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/inc/config.php b/inc/config.php index 74794645..04ed6812 100644 --- a/inc/config.php +++ b/inc/config.php @@ -233,8 +233,6 @@ 'embed', 'recaptcha_challenge_field', 'recaptcha_response_field', - 'imgcaptcha_hash', - 'imgcaptcha_verify', 'spoiler', 'quick-reply' ); @@ -270,19 +268,6 @@ $config['recaptcha_public'] = '6LcXTcUSAAAAAKBxyFWIt2SO8jwx4W7wcSMRoN3f'; $config['recaptcha_private'] = '6LcXTcUSAAAAAOGVbVdhmEM1_SyRF4xTKe8jbzf_'; - $config['imgcaptcha'] = false; - $config['imgcaptcha_key'] = "cos losowego"; // max 32 znaki - $config['imgcaptcha_list'] = "/sciezka/do/pliku.txt"; - $config['imgcaptcha_images'] = "/sciezka/do/obrazkow"; // without a slash at the end - $config['imgcaptcha_question'] = "Was ist das?"; - $config['imgcaptcha_time_limit'] = 90; // Kapcza wazna przez 90 sekund po wejsciu - $config['imgcaptcha_filler'] = "/plik/kliknijmie.png"; - $config['imgcaptcha_width'] = 128; - $config['imgcaptcha_height'] = 96; - - // JESLI DODAJESZ IMGKAPCZE, NIE ZAPOMNIJ O TYM - // Wymagane tez jQuery - o tam, nizej. - //$config['additional_javascript'][] = 'js/imgcaptcha.js'; /* * ==================== * Post settings diff --git a/inc/ic-encrypt.php b/inc/ic-encrypt.php deleted file mode 100644 index 5d73126b..00000000 --- a/inc/ic-encrypt.php +++ /dev/null @@ -1,37 +0,0 @@ -safe_b64encode($crypttext)); - } - - public function decode($key, $value){ - if(!$value){return false;} - $crypttext = $this->safe_b64decode($value); - $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB); - $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); - $decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv); - return trim($decrypttext); - } -} -?> diff --git a/inc/imgcaptcha.php b/inc/imgcaptcha.php deleted file mode 100644 index ab6db68f..00000000 --- a/inc/imgcaptcha.php +++ /dev/null @@ -1,136 +0,0 @@ -255) { return 255; } - if($a<0) { return 0; } - return $a; - } - function randString($length, $charset='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+=') - { - $str = ''; - $count = strlen($charset); - while ($length--) { - $str .= $charset[rand(0, $count-1)]; - } - return $str; - } - function generateCaptchaHash() { - global $config; - $lines = getImages(); - $pick = pickImage($lines); - $enctext = $pick . ",," . time() . ",," . $_SERVER["REMOTE_ADDR"] . ",," . randString(12); - $converter = new Encryption; - return $converter->encode($config["imgcaptcha_key"],$enctext); - } - function ic_verifyHash($enctext, $output) { - global $config; - //print "VERIFY: " . $enctext . " " . $output . "
"; - $converter = new Encryption; - $dectext = explode(",,",$converter->decode($config["imgcaptcha_key"],$enctext)); - if(count($dectext)<4) return true; - $lines = getImages(); - $pick = $dectext[0]; - $time = time()-$dectext[1]; - if($time>$config["imgcaptcha_time_limit"]) return true; - $lp = $lines[$pick]; - for($i=1;$idecode($config["imgcaptcha_key"],$enctext)); - if(count($dectext)<=1) return; //SC - $lines = getImages(); - return $dectext[0]; - } - function generateImage($enctext) - { - global $config; - $lines = getImages(); - $pick = getPick($enctext); - if(!isset($lines[$pick])) return; //SC - $src = imagecreatefrompng(getIPath($lines[$pick][0])); - if($src == FALSE) return; //SC - $maxc = 8; - $icw = $config["imgcaptcha_width"]; - $ich = $config["imgcaptcha_height"]; - $dst = imagecreatetruecolor($icw,$ich); - $srcxm = imagesx($src)-$icw; - $srcym = imagesy($src)-$ich; - $srcx = rand(0,$srcxm-1); - $srcy = rand(0,$srcym-1); - imagecopy($dst,$src,0,0,$srcx,$srcy,$icw,$ich); - - // Obfuscation step 1 - imagecopymergegray($dst,$dst,0,0,0,0,$icw,$ich,rand(20,45)); - // Obfuscation step 1.5 - for($i=0;$i<8;$i++) { - $w = rand(5,10); $h = rand(5,10); - $x = rand(0,$icw-1-$w); $y = rand(0,$ich-1-$h); - $x2 = rand(0,$icw-1); $y2 = rand(0,$ich-1); - imagefilledrectangle($dst,$x,$y,$x+$w,$y+$h,imagecolorat($dst,$x2,$y2)); - } - for($i=0;$i<5;$i++) { - $w = rand(20,40); $h = rand(20,40); - $x = rand(0,$icw-1-$w); $y = rand(0,$ich-1-$h); - imagecopymergegray($dst,$dst,$x,$y,$x,$y,$w,$h,0); - } - // Obfuscation step 2 - for($i=0;$i<$icw*$ich;$i++) { - $x = $i%$icw; $y = $i/$icw; - $c = imagecolorat($dst,$x,$y); - if(rand(0,4) == 2) { $nc = $c ^ rand(0,16777215); } - else { $nc = imagecolorat($dst,rand(0,$icw-1),rand(0,$ich-1)); } - if(rand(18,24)!=21 and $c != 0 and $c != 0xFF00FF) - { - $nc = ncfix(($c&0xFF) + rand(-16,16)) | ncfix((($c>>8)&0xFF) + rand(-8,8))<<8 | ncfix((($c>>16)&0xFF) + rand(-32,32))<<16; - $nc1 = $nc&0xFF ^ ($nc>>8)&0xFF ^ ($nc>>16)&0xFF; - } else { - $nc1 = $nc&0xFF; - if($nc1>($maxc*25)) $nc1 = $nc % ($maxc*25); - } - $nc2 = $nc1 | $nc1<<8 | $nc1<<16; - if(rand(0,1)==0) $nc2=$nc; - imagesetpixel($dst,$x,$y,$nc2); - } - // Obfuscation step 3 - for($i=0;$i diff --git a/js/imgcaptcha.js b/js/imgcaptcha.js deleted file mode 100644 index 99aad414..00000000 --- a/js/imgcaptcha.js +++ /dev/null @@ -1,12 +0,0 @@ -function ic_odswiezKapcze() { - $.get(configRoot + "imgcaptcha_p.php", function(data) { - $("#imgcaptcha_hash").val(data); - $("#imgcaptcha_img").prop("src",configRoot + "imgcaptcha_im.php?cr=" + data); - }); -} -//function resetujKapcze() { -// $("#imgcaptcha_img").prop("src",configRoot + "zakrytek.png"); -//} -//$(document).ready(function(){ -// //resetujKapcze(); - to nie powinno byc na razie potrzebne -//}); diff --git a/post.php b/post.php index 4ded8622..91d5a2f5 100644 --- a/post.php +++ b/post.php @@ -6,7 +6,6 @@ require 'inc/functions.php'; require 'inc/anti-bot.php'; -require 'inc/imgcaptcha.php'; // Fix for magic quotes if (get_magic_quotes_gpc()) { @@ -198,12 +197,7 @@ if (isset($_POST['delete'])) { error($config['error']['captcha']); } } - if ($config['imgcaptcha']) { - if (!isset($_POST['imgcaptcha_verify']) || !isset($_POST['imgcaptcha_hash'])) - error($config['error']['bot']); - if (ic_verifyHash($_POST['imgcaptcha_hash'],$_POST['imgcaptcha_verify'])) - error($config['error']['captcha']); - } + if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) { require 'inc/mod.php'; if (!$mod) { diff --git a/templates/post_form.html b/templates/post_form.html index 07b53a9f..0ea2b999 100644 --- a/templates/post_form.html +++ b/templates/post_form.html @@ -67,21 +67,6 @@ {% endif %} - {% if config.imgcaptcha %} - - - {% trans %}Verification{% endtrans %} - {{ antibot.html() }} - - - -
- {{ config.imgcaptcha_question }}
- Odswiez - {{ antibot.html() }} - - - {% endif %} {% trans %}File{% endtrans %} -- cgit v1.3 From 308f557fd503898406d7cb54ef7e6e6efb0f84ae Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 21 Jul 2013 15:50:45 -0400 Subject: Option to automatically strip EXIF metadata from JPEGs --- inc/config.php | 3 +++ inc/image.php | 12 ++++++++++-- post.php | 11 ++++++----- 3 files changed, 19 insertions(+), 7 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 424d07d6..c2a68e6c 100644 --- a/inc/config.php +++ b/inc/config.php @@ -418,6 +418,9 @@ // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in PHP Imagick. $config['thumb_method'] = 'gd'; + // Strip EXIF metadata from JPEG files + $config['strip_exif'] = false; + // Regular expression to check for IE MIME type detection XSS exploit. To disable, comment the line out // https://github.com/savetheinternet/Tinyboard/issues/20 $config['ie_mime_type_detection'] = '/<(?:body|head|html|img|plaintext|pre|script|table|title|a href|channel|scriptlet)/i'; diff --git a/inc/image.php b/inc/image.php index abe27bcb..eb98ceda 100644 --- a/inc/image.php +++ b/inc/image.php @@ -166,6 +166,9 @@ class ImageImagick extends ImageBase { } } public function to($src) { + if ($config['strip_exif']) { + $this->image->stripImage(); + } if (preg_match('/\.gif$/i', $src)) $this->image->writeImages($src, true); else @@ -236,9 +239,14 @@ class ImageConvert extends ImageBase { } } public function to($src) { + global $config; + if (!$this->temp) { - // $config['redraw_image'] - shell_exec('convert ' . escapeshellarg($this->src) . ' ' . escapeshellarg($src)); + if ($config['strip_exif']) { + shell_exec('convert ' . escapeshellarg($this->src) . ' -strip ' . escapeshellarg($src)); + } else { + shell_exec('convert ' . escapeshellarg($this->src) . ' ' . escapeshellarg($src)); + } } else { rename($this->temp, $src); chmod($src, 0664); diff --git a/post.php b/post.php index 4e10c0cf..4e3a1a9f 100644 --- a/post.php +++ b/post.php @@ -420,10 +420,11 @@ if (isset($_POST['delete'])) { error($config['error']['maxsize']); } - // The following code corrects the image orientation based on EXIF. - // Currently only works with the 'convert' option selected but it could easily be expanded to work with the rest if you can be bothered. - if ($config['thumb_method'] == 'convert') { - if ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg') { + + if ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg') { + // The following code corrects the image orientation. + // Currently only works with the 'convert' option selected but it could easily be expanded to work with the rest if you can be bothered. + if ($config['thumb_method'] == 'convert') { $exif = exif_read_data($upload); if (isset($exif['Orientation']) && $exif['Orientation'] != 1) { shell_exec('convert ' . escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload)); @@ -473,7 +474,7 @@ if (isset($_POST['delete'])) { $thumb->_destroy(); } - if ($config['redraw_image']) { + if ($config['redraw_image'] || ($config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg'))) { $image->to($post['file']); $dont_copy_file = true; } -- cgit v1.3 From ed8fe6c27a39222604e65acdb09de27fd85fb0a2 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 22 Jul 2013 17:51:13 -0400 Subject: Option to check public ban message by default --- inc/config.php | 4 +++- templates/mod/ban_form.html | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index c2a68e6c..721cff41 100644 --- a/inc/config.php +++ b/inc/config.php @@ -860,7 +860,7 @@ // Number of news entries to display per page $config['mod']['news_page'] = 40; - // Number of results to dispaly per page + // Number of results to display per page $config['mod']['search_page'] = 200; // How many entries to show per page in the moderator noticeboard @@ -868,6 +868,8 @@ // Number of entries to summarize and display on the dashboard $config['mod']['noticeboard_dashboard'] = 5; + // Check public ban message by default + $config['mod']['check_ban_message'] = false; // Default public ban message $config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST'; // What to append to the post for public bans ("%s" is the message) diff --git a/templates/mod/ban_form.html b/templates/mod/ban_form.html index edc1ab3b..6c7560ad 100644 --- a/templates/mod/ban_form.html +++ b/templates/mod/ban_form.html @@ -41,11 +41,11 @@ - + ({% trans 'public; attached to post' %}) {% if config.quick_reply %} diff --git a/templates/post_thread.html b/templates/post_thread.html index d7a62d4f..b702712e 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -88,14 +88,26 @@ {% endif %}"> {{ post.id }} - {% if post.sticky %} - Sticky + {% if post.sticky %} + {% if config.font_awesome %} + + {% else %} + Sticky + {% endif %} {% endif %} - {% if post.locked %} - Locked + {% if post.locked %} + {% if config.font_awesome %} + + {% else %} + Locked + {% endif %} {% endif %} - {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %} - Bumplocked + {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %} + {% if config.font_awesome %} + + {% else %} + Bumplocked + {% endif %} {% endif %} {% if index %} [{% trans %}Reply{% endtrans %}] diff --git a/templates/thread.html b/templates/thread.html index aea8abb5..3d2b51de 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -7,7 +7,8 @@ {{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %} {% if config.meta_keywords %}{% endif %} - {% if config.default_stylesheet.1 != '' %}{% endif %} + {% if config.default_stylesheet.1 != '' %}{% endif %} + {% if config.font_awesome %}{% endif %} {% if not nojavascript %} {% if not config.additional_javascript_compile %} -- cgit v1.3 From 31f657e550ab8b1ea00953cc3a26f4661ee4458c Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 24 Jul 2013 11:15:55 -0400 Subject: Long overdue: Salted password hashes --- inc/mod/auth.php | 34 +++++++++++++++++++++------------- inc/mod/pages.php | 24 ++++++++++++++++++------ install.php | 21 ++++++++++++++++++++- install.sql | 7 ++++--- 4 files changed, 63 insertions(+), 23 deletions(-) (limited to 'inc') diff --git a/inc/mod/auth.php b/inc/mod/auth.php index 173190ab..1bc27dff 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -29,6 +29,11 @@ function mkhash($username, $password, $salt = false) { return $hash; } +function generate_salt() { + mt_srand(microtime(true) * 100000 + memory_get_usage(true)); + return md5(uniqid(mt_rand(), true)); +} + function login($username, $password, $makehash=true) { global $mod; @@ -37,20 +42,23 @@ function login($username, $password, $makehash=true) { $password = sha1($password); } - $query = prepare("SELECT `id`,`type`,`boards` FROM `mods` WHERE `username` = :username AND `password` = :password LIMIT 1"); + $query = prepare("SELECT `id`, `type`, `boards`, `password`, `salt` FROM `mods` WHERE `username` = :username"); $query->bindValue(':username', $username); - $query->bindValue(':password', $password); $query->execute() or error(db_error($query)); - if ($user = $query->fetch()) { - return $mod = array( - 'id' => $user['id'], - 'type' => $user['type'], - 'username' => $username, - 'hash' => mkhash($username, $password), - 'boards' => explode(',', $user['boards']) - ); - } else return false; + if ($user = $query->fetch(PDO::FETCH_ASSOC)) { + if ($user['password'] === hash('sha256', $user['salt'] . $password)) { + return $mod = array( + 'id' => $user['id'], + 'type' => $user['type'], + 'username' => $username, + 'hash' => mkhash($username, $user['password']), + 'boards' => explode(',', $user['boards']) + ); + } + } + + return false; } function setCookies() { @@ -104,10 +112,10 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { exit; } - $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username LIMIT 1"); + $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username"); $query->bindValue(':username', $cookie[0]); $query->execute() or error(db_error($query)); - $user = $query->fetch(); + $user = $query->fetch(PDO::FETCH_ASSOC); // validate password hash if ($cookie[1] !== mkhash($cookie[0], $user['password'], $cookie[2])) { diff --git a/inc/mod/pages.php b/inc/mod/pages.php index cddecad0..1ed9a94b 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1407,9 +1407,13 @@ function mod_user($uid) { } if ($_POST['password'] != '') { - $query = prepare('UPDATE `mods` SET `password` = SHA1(:password) WHERE `id` = :id'); + $salt = generate_salt(); + $password = hash('sha256', $salt . sha1($_POST['password'])); + + $query = prepare('UPDATE `mods` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); $query->bindValue(':id', $uid); - $query->bindValue(':password', $_POST['password']); + $query->bindValue(':password', $password); + $query->bindValue(':salt', $salt); $query->execute() or error(db_error($query)); modLog('Changed password for ' . utf8tohtml($_POST['username']) . ' (#' . $user['id'] . ')'); @@ -1430,9 +1434,13 @@ function mod_user($uid) { if (hasPermission($config['mod']['change_password']) && $uid == $mod['id'] && isset($_POST['password'])) { if ($_POST['password'] != '') { - $query = prepare('UPDATE `mods` SET `password` = SHA1(:password) WHERE `id` = :id'); + $salt = generate_salt(); + $password = hash('sha256', $salt . sha1($_POST['password'])); + + $query = prepare('UPDATE `mods` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); $query->bindValue(':id', $uid); - $query->bindValue(':password', $_POST['password']); + $query->bindValue(':password', $password); + $query->bindValue(':salt', $salt); $query->execute() or error(db_error($query)); modLog('Changed own password'); @@ -1494,9 +1502,13 @@ function mod_user_new() { if ($_POST['type'] !== JANITOR && $_POST['type'] !== MOD && $_POST['type'] !== ADMIN) error(sprintf($config['error']['invalidfield'], 'type')); - $query = prepare('INSERT INTO `mods` VALUES (NULL, :username, SHA1(:password), :type, :boards)'); + $salt = generate_salt(); + $password = hash('sha256', $salt . sha1($_POST['password'])); + + $query = prepare('INSERT INTO `mods` VALUES (NULL, :username, :password, :salt, :type, :boards)'); $query->bindValue(':username', $_POST['username']); - $query->bindValue(':password', $_POST['password']); + $query->bindValue(':password', $password); + $query->bindValue(':salt', $salt); $query->bindValue(':type', $_POST['type']); $query->bindValue(':boards', implode(',', $boards)); $query->execute() or error(db_error($query)); diff --git a/install.php b/install.php index 71d1c910..3c65a4b8 100644 --- a/install.php +++ b/install.php @@ -1,7 +1,7 @@ fetch(PDO::FETCH_ASSOC)) { + if (strlen($user['password']) == 40) { + mt_srand(microtime(true) * 100000 + memory_get_usage(true)); + $salt = md5(uniqid(mt_rand(), true)); + + $user['salt'] = $salt; + $user['password'] = hash('sha256', $user['salt'] . $user['password']); + + $_query = prepare("UPDATE `mods` SET `password` = :password, `salt` = :salt WHERE `id` = :id"); + $_query->bindValue(':username', $user['id']); + $_query->bindValue(':password', $user['password']); + $_query->bindValue(':salt', $user['salt']); + $_query->execute() or error(db_error($_query)); + } + } case false: // Update version number file_write($config['has_installed'], VERSION); diff --git a/install.sql b/install.sql index 04896681..d32c3e3e 100644 --- a/install.sql +++ b/install.sql @@ -129,9 +129,10 @@ CREATE TABLE IF NOT EXISTS `modlogs` ( -- CREATE TABLE IF NOT EXISTS `mods` ( - `id` smallint(6) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, - `password` char(40) NOT NULL COMMENT 'SHA1', + `password` char(64) NOT NULL COMMENT 'SHA256', + `salt` char(32) NOT NULL, `type` smallint(1) NOT NULL COMMENT '0: janitor, 1: mod, 2: admin', `boards` text NOT NULL, PRIMARY KEY (`id`), @@ -143,7 +144,7 @@ CREATE TABLE IF NOT EXISTS `mods` ( -- INSERT INTO `mods` (`id`, `username`, `password`, `type`, `boards`) VALUES -(1, 'admin', '5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8', 2, '*'); +(1, 'admin', 'cedad442efeef7112fed0f50b011b2b9bf83f6898082f995f69dd7865ca19fb7', '4a44c6c55df862ae901b413feecb0d49', 2, '*'); -- -------------------------------------------------------- -- cgit v1.3 From 33a1c00bd51618a4b54fd6fdab721aaaa03bfd33 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 24 Jul 2013 11:30:01 -0400 Subject: %length% in public ban messages --- inc/config.php | 4 +++- inc/mod/pages.php | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index b32f4266..98e127b3 100644 --- a/inc/config.php +++ b/inc/config.php @@ -879,8 +879,10 @@ // Check public ban message by default $config['mod']['check_ban_message'] = false; - // Default public ban message + // Default public ban message. + // In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). $config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST'; + // $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; // Include length in ban message // What to append to the post for public bans ("%s" is the message) $config['mod']['ban_message'] = '(%s)'; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 1ed9a94b..01794d2e 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1152,6 +1152,9 @@ function mod_ban_post($board, $delete, $post, $token = false) { if (isset($_POST['public_message'], $_POST['message'])) { // public ban message + $length_english = parse_time($_POST['length']) ? 'for ' . until(parse_time($_POST['length'])) : 'permanently'; + $_POST['message'] = str_replace('%length%', $length_english, $_POST['message']); + $_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']); $query = prepare(sprintf('UPDATE `posts_%s` SET `body` = CONCAT(`body`, :body) WHERE `id` = :id', $board)); $query->bindValue(':id', $post); $query->bindValue(':body', sprintf($config['mod']['ban_message'], utf8tohtml($_POST['message']))); -- cgit v1.3 From 37d5846e4ecf61a534ba19ecbd3f66388233e5d4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 26 Jul 2013 11:01:13 -0400 Subject: Fix markup overlapping. Issue #124 --- inc/functions.php | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index af810f31..b5660664 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1437,13 +1437,15 @@ function markup(&$body, $track_cites = false) { $tracked_cites = array(); // Cites - if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites)) { + if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { if (count($cites[0]) > $config['max_cites']) { error($config['error']['toomanycites']); } - for ($index=0;$indexbindValue(':id', $cite); $query->execute() or error(db_error($query)); @@ -1453,23 +1455,26 @@ function markup(&$body, $track_cites = false) { $config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $cite . '">' . '>>' . $cite . ''; - $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[3][$index], $body); + $body = substr_replace($body, $matches[1][0] . $replacement . $matches[3][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[3][0]) - mb_strlen($matches[0][0]); if ($track_cites && $config['track_cites']) $tracked_cites[] = array($board['uri'], $post['id']); } } } - + // Cross-board linking - if (preg_match_all('/(^|\s)>>>\/(\w+?)\/(\d+)?([\s,.)?]|$)/m', $body, $cites)) { + if (preg_match_all('/(^|\s)>>>\/(\w+?)\/(\d+)?([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { if (count($cites[0]) > $config['max_cites']) { error($config['error']['toomanycross']); } - for ($index=0;$index' . '>>>/' . $_board . '/' . $cite . ''; - $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body); + $body = substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); if ($track_cites && $config['track_cites']) $tracked_cites[] = array($board['uri'], $post['id']); @@ -1496,7 +1502,8 @@ function markup(&$body, $track_cites = false) { $config['root'] . $board['dir'] . $config['file_index'] . '">' . '>>>/' . $_board . '/' . ''; - $body = str_replace($cites[0][$index], $cites[1][$index] . $replacement . $cites[4][$index], $body); + $body = substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); } } -- cgit v1.3 From ae99c6dd0d8e2b523adfa279e8590c34f93eea13 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:21:30 -0400 Subject: i18n one more string in inc/functions.php --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index cd5cb75b..371a01f1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -591,7 +591,7 @@ function displayBan($ban) { // Show banned page and exit die( Element('page.html', array( - 'title' => 'Banned!', + 'title' => _('Banned!'), 'config' => $config, 'body' => Element('banned.html', array( 'config' => $config, -- cgit v1.3 From 3f2ea6b936d5cb2153f50e51c9a15cf883f6529a Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:33:21 -0400 Subject: i18n some strings in inc/config.php --- inc/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index adfaa5e8..f046392b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -327,7 +327,7 @@ $config['robot_mute_hour'] = 336; // 2 weeks // If you want to alter the algorithm a bit. Default value is 2. n^x $config['robot_mute_multiplier'] = 2; - $config['robot_mute_descritpion'] = 'You have been muted for unoriginal content.'; + $config['robot_mute_descritpion'] = _('You have been muted for unoriginal content.'); // Automatically convert things like "..." to Unicode characters ("…") $config['auto_unicode'] = true; @@ -908,7 +908,7 @@ $config['mod']['check_ban_message'] = false; // Default public ban message. // In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). - $config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST'; + $config['mod']['default_ban_message'] = _('USER WAS BANNED FOR THIS POST'); // $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; // Include length in ban message // What to append to the post for public bans ("%s" is the message) $config['mod']['ban_message'] = '(%s)'; -- cgit v1.3 From 065a6f97c813da1ecc6cf4d431aba9a418092acf Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:50:38 -0400 Subject: localise time values --- inc/functions.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 371a01f1..180c74d5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -546,35 +546,35 @@ function checkFlood($post) { function until($timestamp) { $difference = $timestamp - time(); if ($difference < 60) { - return $difference . ' second' . ($difference != 1 ? 's' : ''); + return $difference . ' ' . ngettext('second', 'seconds', $difference); } elseif ($difference < 60*60) { - return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num); } elseif ($difference < 60*60*24) { - return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num); } elseif ($difference < 60*60*24*7) { - return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num); } elseif ($difference < 60*60*24*365) { - return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num); } - return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num); } function ago($timestamp) { $difference = time() - $timestamp; if ($difference < 60) { - return $difference . ' second' . ($difference != 1 ? 's' : ''); + return $difference . ' ' . ngettext('second', 'seconds', $difference); } elseif ($difference < 60*60) { - return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num); } elseif ($difference < 60*60*24) { - return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num); } elseif ($difference < 60*60*24*7) { - return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num); } elseif ($difference < 60*60*24*365) { - return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num); } - return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num); } function displayBan($ban) { -- cgit v1.3 From 396492aad6b7271752214d4806b0aba3a4048cb1 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 02:01:42 -0400 Subject: Update Polish locale --- inc/locale/pl_PL/LC_MESSAGES/javascript.js | 2 +- inc/locale/pl_PL/LC_MESSAGES/javascript.po | 26 ++- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 18730 -> 19790 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 338 +++++++++++++++++++++++++++-- 4 files changed, 342 insertions(+), 24 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.js b/inc/locale/pl_PL/LC_MESSAGES/javascript.js index 44857b98..caf4a66c 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.js +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.js @@ -1 +1 @@ -l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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"}; \ No newline at end of file +l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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","hide":"ukryj","show":"poka\u017c","hidden":"ukryte","Show images":"Poka\u017c obrazki","Hide images":"Ukryj obrazki"}; \ No newline at end of file diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po index 3c16c8d7..482ec45f 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.po +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-18 16:31-0400\n" +"POT-Creation-Date: 2013-07-27 01:54-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,7 +41,7 @@ msgstr "Kliknij Odpowiedź aby zobaczyć." msgid "Click to expand" msgstr "Kliknij aby rozwinąć" -#: ../../../../js/expand.js:41 +#: ../../../../js/expand.js:41 ../../../../js/expand.js:45 msgid "Hide expanded replies" msgstr "Schowaj rozwinięte odpowiedzi" @@ -104,7 +104,7 @@ msgstr "Hasło" msgid "Delete file only" msgstr "Usuń tylko plik" -#: ../../../../js/quick-post-controls.js:30 +#: ../../../../js/quick-post-controls.js:30 ../../../../js/hide-images.js:50 msgid "File" msgstr "Plik" @@ -119,3 +119,23 @@ msgstr "Powód" #: ../../../../js/quick-post-controls.js:37 msgid "Report" msgstr "Zgłoszenie" + +#: ../../../../js/hide-images.js:50 +msgid "hide" +msgstr "ukryj" + +#: ../../../../js/hide-images.js:56 +msgid "show" +msgstr "pokaż" + +#: ../../../../js/toggle-images.js:41 +msgid "hidden" +msgstr "ukryte" + +#: ../../../../js/toggle-images.js:57 ../../../../js/toggle-images.js:70 +msgid "Show images" +msgstr "Pokaż obrazki" + +#: ../../../../js/toggle-images.js:57 ../../../../js/toggle-images.js:70 +msgid "Hide images" +msgstr "Ukryj obrazki" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index b1ccc28d..2a31d64e 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 8af9b27b..ca4f7ea4 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-20 20:07-0400\n" +"POT-Creation-Date: 2013-07-27 01:54-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,10 +52,11 @@ msgstr "Stwórz nowy board" #: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:75 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:150 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:207 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:155 msgid "all boards" msgstr "wszystkie boardy" -#: /var/www/html/Tinyboard/inc/config.php:305 +#: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 msgid "You have been muted for unoriginal content." msgstr "Zostałeś zagłuszony za nieoryginalną treść." @@ -83,16 +84,19 @@ msgstr "Szybka odpowiedź" #. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 #: ../../../../inc/config.php:692 ../../../../inc/config.php:698 +#: ../../../../inc/config.php:695 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 #: ../../../../inc/config.php:693 ../../../../inc/config.php:699 +#: ../../../../inc/config.php:696 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 #: ../../../../inc/config.php:694 ../../../../inc/config.php:700 +#: ../../../../inc/config.php:697 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " @@ -100,135 +104,161 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 #: ../../../../inc/config.php:695 ../../../../inc/config.php:701 +#: ../../../../inc/config.php:698 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 #: ../../../../inc/config.php:696 ../../../../inc/config.php:702 +#: ../../../../inc/config.php:699 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 #: ../../../../inc/config.php:697 ../../../../inc/config.php:703 +#: ../../../../inc/config.php:700 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 #: ../../../../inc/config.php:698 ../../../../inc/config.php:704 +#: ../../../../inc/config.php:701 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 #: ../../../../inc/config.php:699 ../../../../inc/config.php:705 +#: ../../../../inc/config.php:702 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 #: ../../../../inc/config.php:700 ../../../../inc/config.php:706 +#: ../../../../inc/config.php:703 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 #: ../../../../inc/config.php:701 ../../../../inc/config.php:707 +#: ../../../../inc/config.php:704 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 #: ../../../../inc/config.php:702 ../../../../inc/config.php:708 +#: ../../../../inc/config.php:705 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 #: ../../../../inc/config.php:703 ../../../../inc/config.php:709 +#: ../../../../inc/config.php:706 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 #: ../../../../inc/config.php:706 ../../../../inc/config.php:712 +#: ../../../../inc/config.php:709 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 #: ../../../../inc/config.php:707 ../../../../inc/config.php:713 +#: ../../../../inc/config.php:710 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 #: ../../../../inc/config.php:708 ../../../../inc/config.php:714 +#: ../../../../inc/config.php:711 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 #: ../../../../inc/config.php:709 ../../../../inc/config.php:715 +#: ../../../../inc/config.php:712 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 #: ../../../../inc/config.php:710 ../../../../inc/config.php:716 +#: ../../../../inc/config.php:713 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 +#: ../../../../inc/config.php:714 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 +#: ../../../../inc/config.php:715 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 +#: ../../../../inc/config.php:716 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 +#: ../../../../inc/config.php:717 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 #: ../../../../inc/config.php:715 ../../../../inc/config.php:721 +#: ../../../../inc/config.php:718 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 #: ../../../../inc/config.php:716 ../../../../inc/config.php:722 +#: ../../../../inc/config.php:719 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 #: ../../../../inc/config.php:717 ../../../../inc/config.php:723 +#: ../../../../inc/config.php:720 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 #: ../../../../inc/config.php:718 ../../../../inc/config.php:724 +#: ../../../../inc/config.php:721 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 #: ../../../../inc/config.php:719 ../../../../inc/config.php:725 +#: ../../../../inc/config.php:722 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 #: ../../../../inc/config.php:720 ../../../../inc/config.php:726 +#: ../../../../inc/config.php:723 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 #: ../../../../inc/config.php:721 ../../../../inc/config.php:727 +#: ../../../../inc/config.php:724 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 #: ../../../../inc/config.php:722 ../../../../inc/config.php:728 +#: ../../../../inc/config.php:725 msgid "Maximum file size: %maxsz% bytes
Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
Rozmiar twojego pliku: %filesz% " @@ -236,28 +266,33 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 #: ../../../../inc/config.php:723 ../../../../inc/config.php:729 +#: ../../../../inc/config.php:726 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 #: ../../../../inc/config.php:724 ../../../../inc/config.php:730 +#: ../../../../inc/config.php:727 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 #: ../../../../inc/config.php:725 ../../../../inc/config.php:731 +#: ../../../../inc/config.php:728 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 #: ../../../../inc/config.php:727 ../../../../inc/config.php:733 +#: ../../../../inc/config.php:730 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 #: ../../../../inc/config.php:728 ../../../../inc/config.php:734 +#: ../../../../inc/config.php:731 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " @@ -265,26 +300,31 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 #: ../../../../inc/config.php:729 ../../../../inc/config.php:735 +#: ../../../../inc/config.php:732 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 #: ../../../../inc/config.php:730 ../../../../inc/config.php:736 +#: ../../../../inc/config.php:733 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 #: ../../../../inc/config.php:734 ../../../../inc/config.php:740 +#: ../../../../inc/config.php:737 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 #: ../../../../inc/config.php:735 ../../../../inc/config.php:741 +#: ../../../../inc/config.php:738 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 #: ../../../../inc/config.php:736 ../../../../inc/config.php:742 +#: ../../../../inc/config.php:739 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -293,55 +333,65 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 #: ../../../../inc/config.php:737 ../../../../inc/config.php:743 +#: ../../../../inc/config.php:740 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 #: ../../../../inc/config.php:738 ../../../../inc/config.php:744 +#: ../../../../inc/config.php:741 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 #: ../../../../inc/config.php:739 ../../../../inc/config.php:745 +#: ../../../../inc/config.php:742 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 #: ../../../../inc/config.php:740 ../../../../inc/config.php:746 +#: ../../../../inc/config.php:743 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 #: ../../../../inc/config.php:741 ../../../../inc/config.php:747 +#: ../../../../inc/config.php:744 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 #: ../../../../inc/config.php:742 ../../../../inc/config.php:748 +#: ../../../../inc/config.php:745 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 #: ../../../../inc/config.php:743 ../../../../inc/config.php:749 +#: ../../../../inc/config.php:746 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 #: ../../../../inc/config.php:744 ../../../../inc/config.php:750 +#: ../../../../inc/config.php:747 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 #: ../../../../inc/config.php:745 ../../../../inc/config.php:751 +#: ../../../../inc/config.php:748 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 #: ../../../../inc/config.php:746 ../../../../inc/config.php:752 +#: ../../../../inc/config.php:749 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -377,7 +427,9 @@ msgstr "[Edytuj]" msgid "[Move]" msgstr "[Przenieś]" -#: /var/www/html/Tinyboard/inc/config.php:801 +#. Default public ban message. +#. In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). +#: /var/www/html/Tinyboard/inc/config.php:801 ../../../../inc/config.php:911 msgid "USER WAS BANNED FOR THIS POST" msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" @@ -453,7 +505,7 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:292 #: /var/www/html/Tinyboard/inc/display.php:408 #: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 -#: ../../../../inc/mod/pages.php:1239 +#: ../../../../inc/mod/pages.php:1239 ../../../../inc/mod/pages.php:1242 msgid "Edit post" msgstr "Edytuj post" @@ -485,12 +537,17 @@ msgstr "Zablokuj wątek" msgid "Move thread to another board" msgstr "Przenieś wątek na inny board" +#. line 11 +#. line 7 #. line 11 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:48 #: /var/www/html/Tinyboard/mod.php:667 /var/www/html/Tinyboard/mod.php:750 #: /var/www/html/Tinyboard/mod.php:833 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:55 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:55 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:31 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:36 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:33 msgid "Name" msgstr "Nazwa" @@ -501,11 +558,14 @@ msgstr "Nazwa" msgid "Email" msgstr "E-mail" +#. line 34 +#. line 23 #. line 34 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:96 #: /var/www/html/Tinyboard/mod.php:753 /var/www/html/Tinyboard/mod.php:839 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:95 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:116 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:63 msgid "Subject" msgstr "Temat" @@ -579,6 +639,7 @@ msgstr "Komentarz" #. line 73 #. line 61 #. line 73 +#. line 61 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:191 @@ -638,26 +699,35 @@ msgstr "Weryfikacja" #. line 87 #. line 3 #. line 87 +#. line 3 +#. line 72 +#. line 3 +#. line 72 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:22 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:22 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:250 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:214 msgid "File" msgstr "Plik" #. line 97 +#. line 82 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:163 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:183 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:268 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:232 msgid "Embed" msgstr "Osadź" #. line 109 +#. line 94 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:179 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:206 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:291 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:255 msgid "Flags" msgstr "Flagi" @@ -713,12 +783,18 @@ msgstr "Flagi" #. line 114 #. line 113 #. line 114 +#. line 98 +#. line 99 +#. line 98 +#. line 99 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:218 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:300 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:303 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:264 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:267 msgid "Sticky" msgstr "Przyklejony" @@ -774,12 +850,18 @@ msgstr "Przyklejony" #. line 118 #. line 117 #. line 118 +#. line 102 +#. line 103 +#. line 102 +#. line 103 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:230 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:312 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:315 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:276 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:279 msgid "Lock" msgstr "Zablokowany" @@ -835,18 +917,25 @@ msgstr "Zablokowany" #. line 122 #. line 121 #. line 122 +#. line 106 +#. line 107 +#. line 106 +#. line 107 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:242 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:324 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:327 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:288 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:291 msgid "Raw HTML" msgstr "Czysty HTML" #. line 129 #. line 14 #. line 129 +#. line 114 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:230 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:23 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:257 @@ -854,13 +943,16 @@ msgstr "Czysty HTML" #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:23 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:342 #: ../../../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:41 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:306 msgid "Password" msgstr "Hasło" #. line 134 +#. line 119 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:236 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:266 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:351 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:315 msgid "(For file deletion.)" msgstr "(do usuwania postów)" @@ -887,6 +979,7 @@ msgstr "Odśwież" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:415 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:461 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:472 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:506 msgid "Reply" msgstr "Odpowiedź" @@ -894,6 +987,7 @@ msgstr "Odpowiedź" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:442 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:488 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:499 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:533 msgid "1 post" msgid_plural "%count% posts" msgstr[0] "1 post" @@ -905,6 +999,7 @@ msgstr[2] "%count% postów" #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:494 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 #: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:114 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:539 msgid "and" msgstr "oraz" @@ -912,6 +1007,7 @@ msgstr "oraz" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:459 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:516 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:550 msgid "1 image reply" msgid_plural "%count% image replies" msgstr[0] "1 obrazek" @@ -922,6 +1018,7 @@ msgstr[2] "%count% obrazków" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:464 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:510 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:521 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:555 msgid "omitted. Click reply to view." msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." @@ -935,15 +1032,19 @@ msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." #: ../../../../templates/cache/62/8c/21348d46377c3e1b3f8c476ba376.php:62 #: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:131 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:115 +#: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:132 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:116 msgid "Return to dashboard" msgstr "Powróć na tablicę" #. line 27 #. line 31 +#. line 32 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:165 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:177 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:106 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:123 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:124 msgid "Posting mode: Reply" msgstr "Tryb postowania: Odpowiedź" @@ -955,6 +1056,8 @@ msgstr "Tryb postowania: Odpowiedź" #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:155 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:126 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:172 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:127 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:173 msgid "Return" msgstr "Powrót" @@ -970,6 +1073,12 @@ msgstr "Usuń post" #. line 8 #. line 32 #. line 48 +#. line 106 +#. line 8 +#. line 32 +#. line 106 +#. line 8 +#. line 32 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 @@ -990,6 +1099,8 @@ msgstr "Zgłoszenie" #: /var/www/html/Tinyboard/mod.php:104 /var/www/html/Tinyboard/mod.php:776 #: /var/www/html/Tinyboard/mod.php:862 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:120 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:125 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:89 msgid "no subject" msgstr "brak tematu" @@ -1012,6 +1123,7 @@ msgstr "Aktualności" #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 #: ../../../../inc/mod/pages.php:1682 ../../../../inc/mod/pages.php:1816 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207 +#: ../../../../inc/mod/pages.php:1831 msgid "Report queue" msgstr "Kolejka zgłoszeń" @@ -1026,6 +1138,7 @@ msgstr "Lista banów" #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 #: ../../../../inc/mod/pages.php:1394 ../../../../inc/mod/pages.php:1528 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232 +#: ../../../../inc/mod/pages.php:1543 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -1059,11 +1172,13 @@ msgstr "Pokaż konfigurację" #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 #: ../../../../inc/mod/pages.php:1830 ../../../../inc/mod/pages.php:1964 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247 +#: ../../../../inc/mod/pages.php:1979 msgid "Manage themes" msgstr "Zarządzaj dodatkami" #. line 2 #. line 5 +#. line 2 #: /var/www/html/Tinyboard/mod.php:170 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:19 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:24 @@ -1074,11 +1189,14 @@ msgstr "Wyrażenie:" #. line 2 #. line 106 #. line 2 +#. line 16 +#. line 106 #: /var/www/html/Tinyboard/mod.php:172 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:72 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:19 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:286 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:19 +#: ../../../../search.php:165 msgid "Search" msgstr "Szukaj" @@ -1097,8 +1215,10 @@ msgid "Could not find current version! (Check .installed)" msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" #. line 146 +#. line 158 #: /var/www/html/Tinyboard/mod.php:233 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:364 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:397 msgid "Logout" msgstr "Wyloguj" @@ -1128,17 +1248,25 @@ msgstr "temu" #. line 65 #. line 49 #. line 136 +#. line 116 +#. line 182 +#. line 65 +#. line 116 +#. line 182 +#. line 65 #: /var/www/html/Tinyboard/mod.php:405 /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:278 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:427 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:142 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:131 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:355 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:147 msgid "Board" msgstr "Board" #. line 183 #. line 137 +#. line 183 #: /var/www/html/Tinyboard/mod.php:406 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:430 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:358 @@ -1147,42 +1275,54 @@ msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 #: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 -#: ../../../../inc/mod/pages.php:1948 +#: ../../../../inc/mod/pages.php:1948 ../../../../inc/mod/pages.php:1963 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 #: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 -#: ../../../../inc/mod/pages.php:1950 +#: ../../../../inc/mod/pages.php:1950 ../../../../inc/mod/pages.php:1965 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." +#. line 11 #: /var/www/html/Tinyboard/mod.php:671 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:42 msgid "Version" msgstr "Wersja" +#. line 15 #: /var/www/html/Tinyboard/mod.php:675 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:51 msgid "Description" msgstr "Opis" +#. line 19 #: /var/www/html/Tinyboard/mod.php:679 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:60 msgid "Thumbnail" msgstr "Miniatura" +#. line 25 #: /var/www/html/Tinyboard/mod.php:687 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:86 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:77 msgid "Actions" msgstr "Akcje" +#. line 27 #: /var/www/html/Tinyboard/mod.php:689 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:81 msgid "Use theme" msgstr "Użyj dodatku" #: /var/www/html/Tinyboard/mod.php:690 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:87 msgid "Reconfigure" msgstr "Rekonfiguruj" #: /var/www/html/Tinyboard/mod.php:690 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:88 msgid "Install" msgstr "Instaluj" @@ -1192,10 +1332,13 @@ msgstr "Instaluj" #: ../../../../inc/mod/pages.php:1596 ../../../../inc/mod/pages.php:1726 #: ../../../../inc/mod/pages.php:1730 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263 +#: ../../../../inc/mod/pages.php:1741 ../../../../inc/mod/pages.php:1745 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:98 msgid "Rebuild" msgstr "Przebuduj" #: /var/www/html/Tinyboard/mod.php:694 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:103 msgid "Uninstall" msgstr "Odinstaluj" @@ -1203,7 +1346,9 @@ msgstr "Odinstaluj" msgid "Uninstall all themes." msgstr "Odinstaluj wszystkie dodatki" +#. line 27 #: /var/www/html/Tinyboard/mod.php:756 /var/www/html/Tinyboard/mod.php:842 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:69 msgid "Body" msgstr "Zawartość" @@ -1269,6 +1414,7 @@ msgstr "Nie można się ponownie zalogować po zmianie hasła. (?)" #. line 126 #. line 50 +#. line 126 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:300 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:134 @@ -1277,6 +1423,7 @@ msgstr "Ustawione" #. line 130 #. line 52 +#. line 130 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:309 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:140 @@ -1290,6 +1437,14 @@ msgstr "Wygasa" #. line 17 #. line 54 #. line 133 +#. line 24 +#. line 62 +#. line 150 +#. line 180 +#. line 24 +#. line 62 +#. line 150 +#. line 180 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:74 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:169 @@ -1328,7 +1483,7 @@ msgid "No board to move to; there is only one." msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." #: ../../../../inc/config.php:689 ../../../../inc/config.php:747 -#: ../../../../inc/config.php:753 +#: ../../../../inc/config.php:753 ../../../../inc/config.php:750 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." @@ -1346,6 +1501,10 @@ msgstr "Edytuj board" msgid "New board" msgstr "Nowy board" +#. line 102 +#. line 20 +#. line 102 +#. line 20 #. line 102 #. line 20 #: ../../../../inc/mod/pages.php:586 ../../../../inc/mod/pages.php:612 @@ -1361,6 +1520,7 @@ msgstr "adres IP" #: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 #: ../../../../inc/mod/pages.php:772 ../../../../inc/mod/pages.php:1187 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:398 +#: ../../../../inc/mod/pages.php:1190 msgid "New ban" msgstr "Nowy ban" @@ -1380,6 +1540,7 @@ msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1307 ../../../../inc/mod/pages.php:1356 #: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 #: ../../../../inc/mod/pages.php:1466 ../../../../inc/mod/pages.php:1515 +#: ../../../../inc/mod/pages.php:1477 ../../../../inc/mod/pages.php:1530 msgid "Edit user" msgstr "Edytuj użytkownika" @@ -1388,11 +1549,13 @@ msgstr "Edytuj użytkownika" #: ../../../../inc/mod/pages.php:1431 ../../../../inc/mod/pages.php:1503 #: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 #: ../../../../inc/mod/pages.php:1590 ../../../../inc/mod/pages.php:1662 +#: ../../../../inc/mod/pages.php:1605 ../../../../inc/mod/pages.php:1677 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 #: ../../../../inc/mod/pages.php:1460 ../../../../inc/mod/pages.php:1594 +#: ../../../../inc/mod/pages.php:1609 msgid "Private message" msgstr "Prywatna wiadomość" @@ -1400,33 +1563,39 @@ msgstr "Prywatna wiadomość" #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 #: ../../../../inc/mod/pages.php:1481 ../../../../inc/mod/pages.php:1615 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171 +#: ../../../../inc/mod/pages.php:1630 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 #: ../../../../inc/mod/pages.php:1804 ../../../../inc/mod/pages.php:1938 +#: ../../../../inc/mod/pages.php:1953 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 #: ../../../../inc/mod/pages.php:1970 ../../../../inc/mod/pages.php:2104 +#: ../../../../inc/mod/pages.php:2119 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 #: ../../../../inc/mod/pages.php:1892 ../../../../inc/mod/pages.php:2026 +#: ../../../../inc/mod/pages.php:2041 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 #: ../../../../inc/mod/pages.php:1903 ../../../../inc/mod/pages.php:2037 +#: ../../../../inc/mod/pages.php:2052 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 #: ../../../../inc/mod/pages.php:1931 ../../../../inc/mod/pages.php:2065 +#: ../../../../inc/mod/pages.php:2080 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1438,20 +1607,24 @@ msgid "" msgstr "" #: ../../../../inc/config.php:704 ../../../../inc/config.php:710 +#: ../../../../inc/config.php:707 msgid "Thread has reached its maximum reply limit." msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." #: ../../../../inc/config.php:705 ../../../../inc/config.php:711 +#: ../../../../inc/config.php:708 msgid "Thread has reached its maximum image limit." msgstr "Ten temat osiągnął swój maksymalny limit obrazków." #: ../../../../inc/config.php:726 ../../../../inc/config.php:732 +#: ../../../../inc/config.php:729 #, php-format msgid "That file already exists in this thread!" msgstr "Ten plik już istnieje w tym temacie!" #. Moderator errors #: ../../../../inc/config.php:733 ../../../../inc/config.php:739 +#: ../../../../inc/config.php:736 #, php-format msgid "" "You are only allowed to unban %s users at a time. You tried to unban %u " @@ -1460,12 +1633,12 @@ msgstr "" "Możesz odbanować tylko %s użytkowników na raz. Próbowałeś odbanować %u users." #: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 -#: ../../../../inc/mod/pages.php:2128 +#: ../../../../inc/mod/pages.php:2128 ../../../../inc/mod/pages.php:2143 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" #: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 -#: ../../../../inc/mod/pages.php:2152 +#: ../../../../inc/mod/pages.php:2152 ../../../../inc/mod/pages.php:2167 msgid "Debug: SQL" msgstr "Debug: SQL" @@ -1500,9 +1673,9 @@ msgid "" "(Search is case-insensitive and based on keywords. To match exact phrases, " "use \"quotes\". Use an asterisk (*) for wildcard.)" msgstr "" -"(Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " -"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " -"wieloznacznego.)" +"(Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach " +"kluczowych. Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki " +"(*) jako symbolu wieloznacznego.)" #. line 8 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:32 @@ -1520,14 +1693,14 @@ msgid "" "example, name:Anonymous or subject:\"Some Thread\". " "Wildcards cannot be used in filters." msgstr "" -"Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " -"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " -"wieloznacznego.

Możesz zastosować poniższe " -"filtry do swojego wyszukiwania: id, thread, " -"subject, i name. Aby wykorzystać filtr, " -"po prostu dodaj do swojego zapytania, na przykład: name:Anonymous " -"albo subject:\"Jakiś temat\". Symbole wieloznaczne nie mogą być " -"wykorzystane w filtrach." +"Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach " +"kluczowych. Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki " +"(*) jako symbolu wieloznacznego.

Możesz zastosować poniższe filtry do swojego wyszukiwania: id, thread, subject, i name. Aby wykorzystać filtr, po prostu dodaj do swojego zapytania, na " +"przykład: name:Anonymous albo subject:\"Jakiś temat\". " +"Symbole wieloznaczne nie mogą być wykorzystane w filtrach." #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:57 msgid "edit" @@ -1552,32 +1725,45 @@ msgid "Change password" msgstr "Zmień hasło" #. line 118 +#. line 130 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:308 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:341 msgid "Debug" msgstr "Debug" #. line 120 +#. line 132 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:312 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:345 msgid "Anti-spam" msgstr "Antyspam" #. line 121 +#. line 133 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:315 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:348 msgid "Recent posts" msgstr "Ostatnie posty" #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:321 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:354 msgid "SQL" msgstr "SQL" #. line 143 +#. line 155 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:359 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:392 msgid "User account" msgstr "Konto użytkownika" #. line 25 #. line 67 #. line 18 +#. line 25 +#. line 67 +#. line 25 +#. line 67 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:77 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:179 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:54 @@ -1586,6 +1772,7 @@ msgstr "Notka" #. line 26 #. line 19 +#. line 26 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:80 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:57 msgid "Date" @@ -1634,6 +1821,7 @@ msgstr "nigdy" #. line 140 #. line 53 +#. line 140 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:331 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:143 msgid "Seen" @@ -1656,6 +1844,7 @@ msgstr "Usuń ban" #. line 181 #. line 135 +#. line 181 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:424 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:352 msgid "Time" @@ -1753,16 +1942,19 @@ msgstr "Wiadomość" #. line 46 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:117 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:122 msgid "public; attached to post" msgstr "publiczny; dołączony do posta" #. line 58 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:133 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:138 msgid "Length" msgstr "Długość" #. line 88 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:192 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:197 msgid "New Ban" msgstr "Nowy ban" @@ -1799,3 +1991,109 @@ msgstr[2] "%d wyników na" #: ../../../../search.php:160 msgid "No results." msgstr "Brak wyników." + +#: ../../../../inc/functions.php:594 +msgid "Banned!" +msgstr "Zbanowany!" + +#: ../../../../banned.php:4 +msgid "Banned?" +msgstr "Zbanowany?" + +#: ../../../../banned.php:5 +msgid "You are not banned." +msgstr "Nie jesteś zbanowany." + +#: ../../../../inc/functions.php:549 ../../../../inc/functions.php:566 +msgid "second" +msgid_plural "seconds" +msgstr[0] "sekunda" +msgstr[1] "sekundy" +msgstr[2] "sekund" + +#: ../../../../inc/functions.php:551 ../../../../inc/functions.php:568 +msgid "minute" +msgid_plural "minutes" +msgstr[0] "minuta" +msgstr[1] "minuty" +msgstr[2] "minut" + +#: ../../../../inc/functions.php:553 ../../../../inc/functions.php:570 +msgid "hour" +msgid_plural "hours" +msgstr[0] "godzina" +msgstr[1] "godziny" +msgstr[2] "godzin" + +#: ../../../../inc/functions.php:555 ../../../../inc/functions.php:572 +msgid "day" +msgid_plural "days" +msgstr[0] "dzień" +msgstr[1] "dni" +msgstr[2] "dni" + +#: ../../../../inc/functions.php:557 ../../../../inc/functions.php:574 +msgid "week" +msgid_plural "weeks" +msgstr[0] "tydzień" +msgstr[1] "tygodnie" +msgstr[2] "tygodni" + +#: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 +msgid "year" +msgid_plural "years" +msgstr[0] "rok" +msgstr[1] "lata" +msgstr[2] "lat" + +#. line 118 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:308 +msgid "Other" +msgstr "Inne" + +#: ../../../../templates/cache/b7/7d/de31d12a1684acbc7c0d7ee71653.php:30 +msgid "Successfully installed and built theme." +msgstr "Pomyślnie zainstalowano i zbudowano dodatek." + +#. line 9 +#: ../../../../templates/cache/b7/7d/de31d12a1684acbc7c0d7ee71653.php:37 +msgid "Go back to themes" +msgstr "Wróć do dodatków" + +#. line 3 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:21 +msgid "New post" +msgstr "Nowy post" + +#. line 32 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:76 +msgid "Post news entry" +msgstr "Zapostuj newsa" + +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:100 +msgid "delete" +msgstr "usuń" + +#. line 55 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:133 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:94 +msgid "by" +msgstr "przez" + +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:136 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:97 +msgid "at" +msgstr "dnia" + +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:66 +msgid "(No news to show.)" +msgstr "(Nie ma newsów do wyświetlenia.)" + +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:19 +msgid "There are no themes available." +msgstr "Nie ma dostępnych dodatków." + +#. line 25 +#: ../../../../templates/cache/d1/99/467985632043e204070d354b8290.php:91 +msgid "Install theme" +msgstr "Zainstaluj dodatek" -- cgit v1.3 From 57c8e4ee7cea126e68ade4913c57a46f06d1a2b0 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 28 Jul 2013 20:33:26 -0400 Subject: Strip combining characters from Unicode strings (eg. Zalgo) --- inc/config.php | 2 ++ inc/functions.php | 48 +++++++++++++++++++++++++++++++++++++++++++++++- post.php | 9 ++++++++- 3 files changed, 57 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 98e127b3..d7580a8b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -282,6 +282,8 @@ $config['strip_superfluous_returns'] = true; // Require an image for threads? $config['force_image_op'] = true; + // Strip combining characters from Unicode strings (eg. "Zalgo") + $config['strip_combining_chars'] = true; // Max body length $config['max_body'] = 1800; diff --git a/inc/functions.php b/inc/functions.php index b5660664..9d398002 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1526,7 +1526,53 @@ function utf8tohtml($utf8) { return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'); } -function buildThread($id, $return=false, $mod=false) { +function ordutf8($string, &$offset) { + $code = ord(substr($string, $offset,1)); + if ($code >= 128) { // otherwise 0xxxxxxx + if ($code < 224) + $bytesnumber = 2; // 110xxxxx + else if ($code < 240) + $bytesnumber = 3; // 1110xxxx + else if ($code < 248) + $bytesnumber = 4; // 11110xxx + $codetemp = $code - 192 - ($bytesnumber > 2 ? 32 : 0) - ($bytesnumber > 3 ? 16 : 0); + for ($i = 2; $i <= $bytesnumber; $i++) { + $offset ++; + $code2 = ord(substr($string, $offset, 1)) - 128; //10xxxxxx + $codetemp = $codetemp*64 + $code2; + } + $code = $codetemp; + } + $offset += 1; + if ($offset >= strlen($string)) + $offset = -1; + return $code; +} + +function strip_combining_chars($str) { + $chars = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY); + $str = ''; + foreach ($chars as $char) { + $ord = ordutf8($char, $o = 0); + + if ($ord >= 768 && $ord <= 879) + continue; + + if ($ord >= 7616 && $ord <= 7679) + continue; + + if ($ord >= 8400 && $ord <= 8447) + continue; + + if ($ord >= 65056 && $ord <= 65071) + continue; + + $str .= $char; + } + return $str; +} + +function buildThread($id, $return = false, $mod = false) { global $board, $config; $id = round($id); diff --git a/post.php b/post.php index 4e3a1a9f..6855fe14 100644 --- a/post.php +++ b/post.php @@ -357,6 +357,13 @@ if (isset($_POST['delete'])) { $post['thumb'] = $board['dir'] . $config['dir']['thumb'] . $post['file_id'] . '.' . ($config['thumb_ext'] ? $config['thumb_ext'] : $post['extension']); } + if ($config['strip_combining_chars']) { + $post['name'] = strip_combining_chars($post['name']); + $post['email'] = strip_combining_chars($post['email']); + $post['subject'] = strip_combining_chars($post['name']); + $post['body'] = strip_combining_chars($post['body']); + } + // Check string lengths if (mb_strlen($post['name']) > 35) error(sprintf($config['error']['toolong'], 'name')); @@ -368,7 +375,7 @@ if (isset($_POST['delete'])) { error($config['error']['toolong_body']); if (mb_strlen($post['password']) > 20) error(sprintf($config['error']['toolong'], 'password')); - + wordfilters($post['body']); $post['body_nomarkup'] = $post['body']; -- cgit v1.3 From bd8bd3c02e6cb8e130058649e646a8c8071d3386 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sun, 28 Jul 2013 20:46:00 -0400 Subject: Fix for last commit --- inc/functions.php | 5 +++-- post.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 9d398002..2915e1b6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1552,8 +1552,9 @@ function ordutf8($string, &$offset) { function strip_combining_chars($str) { $chars = preg_split('//u', $str, -1, PREG_SPLIT_NO_EMPTY); $str = ''; - foreach ($chars as $char) { - $ord = ordutf8($char, $o = 0); + foreach ($chars as $char) { + $o = 0; + $ord = ordutf8($char, $o); if ($ord >= 768 && $ord <= 879) continue; diff --git a/post.php b/post.php index 6855fe14..ad045b66 100644 --- a/post.php +++ b/post.php @@ -360,7 +360,7 @@ if (isset($_POST['delete'])) { if ($config['strip_combining_chars']) { $post['name'] = strip_combining_chars($post['name']); $post['email'] = strip_combining_chars($post['email']); - $post['subject'] = strip_combining_chars($post['name']); + $post['subject'] = strip_combining_chars($post['subject']); $post['body'] = strip_combining_chars($post['body']); } -- cgit v1.3 From 5bab0418142fb2b9d37389f68733faa76c381ffe Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 29 Jul 2013 12:27:10 -0400 Subject: Make font-awesome enabled by default --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index d7580a8b..7dda86ab 100644 --- a/inc/config.php +++ b/inc/config.php @@ -568,7 +568,7 @@ // Use Font-Awesome for displaying lock and pin icons, instead of the images in static/. // http://fortawesome.github.io/Font-Awesome/icon/pushpin/ // http://fortawesome.github.io/Font-Awesome/icon/lock/ - $config['font_awesome'] = false; + $config['font_awesome'] = true; $config['font_awesome_css'] = 'stylesheets/font-awesome/css/font-awesome.min.css'; // Boardlinks -- cgit v1.3 From 58306bdc63b7dcaf964ab3541fe4b5a8e0c813b0 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 29 Jul 2013 16:18:06 -0400 Subject: Search posts --- inc/config.php | 2 + inc/mod/pages.php | 41 +++++++++++++++-- templates/mod/search_results.html | 97 +++++++++++++++++++++++++++++++++++++-- 3 files changed, 132 insertions(+), 8 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 7dda86ab..582c3145 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1035,6 +1035,8 @@ $config['mod']['rebuild'] = ADMIN; // Search through posts, IP address notes and bans $config['mod']['search'] = JANITOR; + // Allow searching posts (can be used with board configuration file to disallow searching through a certain board) + $config['mod']['search_posts'] = JANITOR; // Read the moderator noticeboard $config['mod']['noticeboard'] = JANITOR; // Post to the moderator noticeboard diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 01794d2e..8289d0b0 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -225,7 +225,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { // Which `field` to search? if ($type == 'posts') - $sql_field = 'body'; + $sql_field = 'body_nomarkup'; if ($type == 'IP_notes') $sql_field = 'body'; if ($type == 'bans') @@ -246,7 +246,27 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { // Compile SQL query if ($type == 'posts') { - error('Searching posts is under development. Sorry.'); + $query = ''; + + $boards = listBoards(); + if (empty($boards)) + error(_('There are no boards to search!')); + + foreach ($boards as $board) { + openBoard($board['uri']); + if (!hasPermission($config['mod']['search_posts'], $board['uri'])) + continue; + + if (!empty($query)) + $query .= ' UNION ALL '; + $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE %s", $board['uri'], $board['uri'], $sql_like); + } + + // You weren't allowed to search any boards + if (empty($query)) + error($config['error']['noaccess']); + + $query .= ' ORDER BY `sticky` DESC, `id` DESC'; } if ($type == 'IP_notes') { @@ -273,10 +293,15 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { // Execute SQL query (with pages) $q = query($query . ' LIMIT ' . (($page_no - 1) * $config['mod']['search_page']) . ', ' . $config['mod']['search_page']) or error(db_error()); $results = $q->fetchAll(PDO::FETCH_ASSOC); - + // Get total result count - $q = query('SELECT COUNT(*) FROM `' . $sql_table . '` WHERE ' . $sql_like) or error(db_error()); - $result_count = $q->fetchColumn(); + if ($type == 'posts') { + $q = query("SELECT COUNT(*) FROM ($query) AS `tmp_table`") or error(db_error()); + $result_count = $q->fetchColumn(); + } else { + $q = query('SELECT COUNT(*) FROM `' . $sql_table . '` WHERE ' . $sql_like) or error(db_error()); + $result_count = $q->fetchColumn(); + } if ($type == 'bans') { foreach ($results as &$ban) { @@ -285,6 +310,12 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { } } + if ($type == 'posts') { + foreach ($results as &$post) { + $post['snippet'] = pm_snippet($post['body']); + } + } + // $results now contains the search results mod_page(_('Search results'), 'mod/search_results.html', array( diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html index b441a28f..035773fb 100644 --- a/templates/mod/search_results.html +++ b/templates/mod/search_results.html @@ -39,7 +39,7 @@ {% endfor %} -{% endif %} +{% endif %} {% if search_type == 'bans' %} @@ -125,7 +125,7 @@ {% endfor %}
-{% endif %} +{% endif %} {% if search_type == 'log' %} @@ -166,7 +166,98 @@ {% endfor %}
-{% endif %} +{% endif %} + +{% if search_type == 'posts' %} + + + + + + + + + + + + + {% for post in results %} + + + + + + + + + + + + {% endfor %} +
TimeBoardIDThreadIPNameSubjectFileBody (snippet)
+ {{ post.time | ago }} ago + + {{ config.board_abbreviation|sprintf(post.board) }} + + {% if post.thread %} + {% set thread = post.thread %} + {% else %} + {% set thread = post.id %} + {% endif %} + + {{ post.id }} + + + + {% if post.thread %} + {{ post.thread }} + {% else %} + (OP) + {% endif %} + + + {% if mod|hasPermission(config.mod.show_ip, post.board) %} + + {{ post.ip }} + + {% else %} + hidden + {% endif %} + + + {% if post.email|length > 0 %} + {# start email #} + + {% endif %} + {% if capcode %} + {{ capcode.cap }} + {% endif %} + + + {% if post.subject %} + {{ post.subject }} + {% else %} + – + {% endif %} + + {% if post.file %} + {{ post.file }} ({{ post.filesize | filesize }}) + {% else %} + – + {% endif %} + + {{ post.snippet }} +
+{% endif %} {% if result_count > results|count %}

-- cgit v1.3 From 1759ac2ea30d3c374beb6b5b6fa76bfa5501da9f Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Mon, 29 Jul 2013 20:20:07 -0400 Subject: Post search: Search other fields too --- inc/mod/pages.php | 16 ++++++++++++++-- templates/mod/search_results.html | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 8289d0b0..d447fa51 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -174,6 +174,11 @@ function mod_search_redirect() { $query = str_replace('_', '%5F', $query); $query = str_replace('+', '_', $query); + if ($query === '') { + header('Location: ?/', true, $config['redirect_http']); + return; + } + header('Location: ?/search/' . $_POST['type'] . '/' . $query, true, $config['redirect_http']); } else { header('Location: ?/', true, $config['redirect_http']); @@ -225,7 +230,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { // Which `field` to search? if ($type == 'posts') - $sql_field = 'body_nomarkup'; + $sql_field = array('body_nomarkup', 'filename', 'subject', 'filehash', 'ip', 'name', 'trip'); if ($type == 'IP_notes') $sql_field = 'body'; if ($type == 'bans') @@ -239,7 +244,14 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { if (!empty($sql_like)) $sql_like .= ' AND '; $phrase = preg_replace('/^\'(.+)\'$/', '\'%$1%\'', $phrase); - $sql_like .= '`' . $sql_field . '` LIKE ' . $phrase . ' ESCAPE \'!\''; + if (is_array($sql_field)) { + foreach ($sql_field as $field) { + $sql_like .= '`' . $field . '` LIKE ' . $phrase . ' ESCAPE \'!\' OR'; + } + $sql_like = preg_replace('/ OR$/', '', $sql_like); + } else { + $sql_like .= '`' . $sql_field . '` LIKE ' . $phrase . ' ESCAPE \'!\''; + } } diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html index fbad0381..0c87f75f 100644 --- a/templates/mod/search_results.html +++ b/templates/mod/search_results.html @@ -246,7 +246,7 @@ {% if post.file %} - {{ post.file }} ({{ post.filesize | filesize }}) + {{ post.filename }} ({{ post.filesize | filesize }}) {% else %} – {% endif %} -- cgit v1.3 From 461084d400620c32ef262aab1f837573f47b0951 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 30 Jul 2013 16:41:10 -0400 Subject: MySQL's utf8 charset only supports up to 3-byte symbols. Insterting four byte symbols (U+010000 to U+10FFFF) can be done maliciously to break HTML mark-up. The ideal solution was to convert to MySQL's utf8mb4 charset, but then we would lose support for MySQL < 5.5.3. In this fix, incompatible characters are encoded as HTML numeric character references (eg. #65536) and just stripped from body_nommarkup. --- inc/functions.php | 2 +- post.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 2915e1b6..4af7891a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1523,7 +1523,7 @@ function markup(&$body, $track_cites = false) { } function utf8tohtml($utf8) { - return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'); + return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); } function ordutf8($string, &$offset) { diff --git a/post.php b/post.php index ad045b66..e9041ce8 100644 --- a/post.php +++ b/post.php @@ -378,7 +378,7 @@ if (isset($_POST['delete'])) { wordfilters($post['body']); - $post['body_nomarkup'] = $post['body']; + $post['body_nomarkup'] = preg_replace('/[\x{010000}-\x{ffffff}]/u', '', $post['body']); if (!($mod && isset($post['raw']) && $post['raw'])) $post['tracked_cites'] = markup($post['body'], true); -- cgit v1.3 From 8efab06616bfcdab49fb9e996cdc7ddfe79426bb Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 30 Jul 2013 22:08:56 -0400 Subject: Upgrade to utf8mb4 charset for MySQL server versions above 5.5.3. Keep support for older versions. Fix charsets for multiple columns and tables. --- inc/database.php | 21 +++++++++-- inc/functions.php | 5 ++- install.php | 100 +++++++++++++++++++++++++++++++++++++++++++++++++++- install.sql | 95 +++++++++++++++++++++++-------------------------- post.php | 5 ++- templates/posts.sql | 63 +++++++++++++++++---------------- 6 files changed, 202 insertions(+), 87 deletions(-) (limited to 'inc') diff --git a/inc/database.php b/inc/database.php index a0edd1fb..3dc0f0ce 100644 --- a/inc/database.php +++ b/inc/database.php @@ -51,12 +51,16 @@ function sql_open() { try { $options = array( PDO::ATTR_TIMEOUT => $config['db']['timeout'], - PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8', PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true ); if ($config['db']['persistent']) $options[PDO::ATTR_PERSISTENT] = true; - return $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options); + $pdo = new PDO($dsn, $config['db']['user'], $config['db']['password'], $options); + if (mysql_version() >= 50503) + query('SET NAMES utf8mb4') or error(db_error()); + else + query('SET NAMES utf8') or error(db_error()); + return $pdo; } catch(PDOException $e) { $message = $e->getMessage(); @@ -65,10 +69,21 @@ function sql_open() { $message = str_replace($config['db']['password'], 'hidden', $message); // Print error - error('Database error: ' . $message); + error(_('Database error: ') . $message); } } +// 5.6.10 becomes 50610 +function mysql_version() { + global $pdo; + + $version = $pdo->getAttribute(PDO::ATTR_SERVER_VERSION); + $v = explode('.', $version); + if (count($v) != 3) + return false; + return (int) sprintf("%02d%02d%02d", $v[0], $v[1], $v[2]); +} + function prepare($query) { global $pdo, $debug, $config; diff --git a/inc/functions.php b/inc/functions.php index 4af7891a..d5692be5 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1399,6 +1399,9 @@ function markup(&$body, $track_cites = false) { $body = str_replace("\r", '', $body); $body = utf8tohtml($body); + if (mysql_version() < 50503) + $body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); + foreach ($config['markup'] as $markup) { if (is_string($markup[1])) { $body = preg_replace($markup[0], $markup[1], $body); @@ -1523,7 +1526,7 @@ function markup(&$body, $track_cites = false) { } function utf8tohtml($utf8) { - return mb_encode_numericentity(htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'), array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); + return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'); } function ordutf8($string, &$offset) { diff --git a/install.php b/install.php index 08e8046a..c2fe1a55 100644 --- a/install.php +++ b/install.php @@ -1,7 +1,7 @@ execute() or error(db_error($_query)); } } + case 'v0.9.6-dev-9': + function __query($sql) { + if (mysql_version() >= 50503) + return query($sql); + else + return query(str_replace('utf8mb4', 'utf8', $sql)); + } + + foreach ($boards as &$board) { + __query(sprintf("ALTER TABLE `posts_%s` + CHANGE `subject` `subject` VARCHAR(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `email` `email` VARCHAR(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `name` `name` VARCHAR(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `trip` `trip` VARCHAR(15) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `capcode` `capcode` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + CHANGE `body_nomarkup` `body_nomarkup` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `thumb` `thumb` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `thumbwidth` `thumbwidth` INT(11) NULL DEFAULT NULL, + CHANGE `thumbheight` `thumbheight` INT(11) NULL DEFAULT NULL, + CHANGE `file` `file` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `filename` `filename` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `filehash` `filehash` TEXT CHARACTER SET ascii COLLATE ascii_general_ci NULL DEFAULT NULL, + CHANGE `password` `password` VARCHAR(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + CHANGE `ip` `ip` VARCHAR(39) CHARACTER SET ascii COLLATE ascii_general_ci NOT NULL, + CHANGE `embed` `embed` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;", $board['uri'])) or error(db_error()); + } + + __query("ALTER TABLE `antispam` + CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `hash` `hash` CHAR( 40 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL , + DEFAULT CHARACTER SET ASCII COLLATE ascii_bin;") or error(db_error()); + __query("ALTER TABLE `bans` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `reason` `reason` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL , + CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL, + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `boards` + CHANGE `uri` `uri` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `title` `title` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `subtitle` `subtitle` TINYTEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `cites` + CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `target_board` `target_board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + DEFAULT CHARACTER SET ASCII COLLATE ascii_general_ci;") or error(db_error()); + __query("ALTER TABLE `ip_notes` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `ip_notes` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `modlogs` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL , + CHANGE `text` `text` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `mods` + CHANGE `username` `username` VARCHAR( 30 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `password` `password` CHAR( 64 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL COMMENT 'SHA256', + CHANGE `salt` `salt` CHAR( 32 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `boards` `boards` TEXT CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `mutes` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + DEFAULT CHARACTER SET ASCII COLLATE ascii_general_ci;") or error(db_error()); + __query("ALTER TABLE `news` + CHANGE `name` `name` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `subject` `subject` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `noticeboard` + CHANGE `subject` `subject` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `body` `body` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `pms` + CHANGE `message` `message` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `reports` + CHANGE `ip` `ip` VARCHAR( 39 ) CHARACTER SET ASCII COLLATE ascii_general_ci NOT NULL , + CHANGE `board` `board` VARCHAR( 120 ) CHARACTER SET ASCII COLLATE ascii_general_ci NULL DEFAULT NULL , + CHANGE `reason` `reason` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or error(db_error()); + __query("ALTER TABLE `robot` + CHANGE `hash` `hash` VARCHAR( 40 ) CHARACTER SET ASCII COLLATE ascii_bin NOT NULL COMMENT 'SHA1', + DEFAULT CHARACTER SET ASCII COLLATE ascii_bin;") or error(db_error()); + __query("ALTER TABLE `theme_settings` + CHANGE `theme` `theme` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL , + CHANGE `name` `name` VARCHAR( 40 ) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL , + CHANGE `value` `value` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL , + DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;") or eror(db_error()); case false: // Update version number file_write($config['has_installed'], VERSION); @@ -547,6 +641,10 @@ if ($step == 0) { $sql = @file_get_contents('install.sql') or error("Couldn't load install.sql."); + sql_open(); + if (mysql_version() < 50503) + $sql = str_replace('utf8', 'utf8mb4', $sql); + // This code is probably horrible, but what I'm trying // to do is find all of the SQL queires and put them // in an array. diff --git a/install.sql b/install.sql index ee2ca8a9..c4e82820 100644 --- a/install.sql +++ b/install.sql @@ -1,25 +1,20 @@ -- phpMyAdmin SQL Dump --- version 3.4.2 +-- version 4.0.4.1 -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Apr 12, 2012 at 11:22 PM --- Server version: 5.1.61 --- PHP Version: 5.3.3-7+squeeze8 +-- Generation Time: Jul 30, 2013 at 09:45 PM +-- Server version: 5.6.10 +-- PHP Version: 5.3.15 -SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET time_zone = "+00:00"; - /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; --- --- Database: `tinyboard` --- - -- -------------------------------------------------------- -- @@ -27,15 +22,15 @@ SET time_zone = "+00:00"; -- CREATE TABLE IF NOT EXISTS `antispam` ( - `board` varchar(255) NOT NULL, + `board` varchar(120) CHARACTER SET ascii NOT NULL, `thread` int(11) DEFAULT NULL, - `hash` char(40) NOT NULL, + `hash` char(40) COLLATE ascii_bin NOT NULL, `created` int(11) NOT NULL, `expires` int(11) DEFAULT NULL, `passed` smallint(6) NOT NULL, PRIMARY KEY (`hash`), KEY `board` (`board`,`thread`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin; -- -------------------------------------------------------- @@ -44,17 +39,17 @@ CREATE TABLE IF NOT EXISTS `antispam` ( -- CREATE TABLE IF NOT EXISTS `bans` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `ip` varchar(45) NOT NULL, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, `mod` int(11) NOT NULL COMMENT 'which mod made the ban', `set` int(11) NOT NULL, `expires` int(11) DEFAULT NULL, `reason` text, - `board` varchar(120) DEFAULT NULL, + `board` varchar(120) CHARACTER SET ascii DEFAULT NULL, `seen` tinyint(1) NOT NULL, PRIMARY KEY (`id`), FULLTEXT KEY `ip` (`ip`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- @@ -63,18 +58,18 @@ CREATE TABLE IF NOT EXISTS `bans` ( -- CREATE TABLE IF NOT EXISTS `boards` ( - `uri` varchar(120) NOT NULL, + `uri` varchar(120) CHARACTER SET ascii NOT NULL, `title` tinytext NOT NULL, `subtitle` tinytext, PRIMARY KEY (`uri`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -- Dumping data for table `boards` -- -INSERT INTO `boards` (`uri`, `title`, `subtitle`) VALUES -('b', 'Beta', 'In development.'); +INSERT INTO `boards` VALUES +('b', 'Random', NULL); -- -------------------------------------------------------- @@ -83,13 +78,13 @@ INSERT INTO `boards` (`uri`, `title`, `subtitle`) VALUES -- CREATE TABLE IF NOT EXISTS `cites` ( - `board` varchar(8) NOT NULL, + `board` varchar(120) NOT NULL, `post` int(11) NOT NULL, - `target_board` varchar(8) NOT NULL, + `target_board` varchar(120) NOT NULL, `target` int(11) NOT NULL, KEY `target` (`target_board`,`target`), KEY `post` (`board`,`post`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=ascii; -- -------------------------------------------------------- @@ -98,14 +93,14 @@ CREATE TABLE IF NOT EXISTS `cites` ( -- CREATE TABLE IF NOT EXISTS `ip_notes` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `ip` varchar(45) NOT NULL, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, `mod` int(11) DEFAULT NULL, `time` int(11) NOT NULL, `body` text NOT NULL, UNIQUE KEY `id` (`id`), KEY `ip` (`ip`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- @@ -115,12 +110,12 @@ CREATE TABLE IF NOT EXISTS `ip_notes` ( CREATE TABLE IF NOT EXISTS `modlogs` ( `mod` int(11) NOT NULL, - `ip` varchar(45) NOT NULL, - `board` varchar(120) DEFAULT NULL, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, + `board` varchar(120) CHARACTER SET ascii DEFAULT NULL, `time` int(11) NOT NULL, `text` text NOT NULL, KEY `time` (`time`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; -- -------------------------------------------------------- @@ -131,19 +126,19 @@ CREATE TABLE IF NOT EXISTS `modlogs` ( CREATE TABLE IF NOT EXISTS `mods` ( `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT, `username` varchar(30) NOT NULL, - `password` char(64) NOT NULL COMMENT 'SHA256', - `salt` char(32) NOT NULL, + `password` char(64) CHARACTER SET ascii NOT NULL COMMENT 'SHA256', + `salt` char(32) CHARACTER SET ascii NOT NULL, `type` smallint(1) NOT NULL COMMENT '0: janitor, 1: mod, 2: admin', - `boards` text NOT NULL, + `boards` text CHARACTER SET ascii NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `id` (`id`,`username`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=4 ; -- -- Dumping data for table `mods` -- -INSERT INTO `mods` (`id`, `username`, `password`, `salt`, `type`, `boards`) VALUES +INSERT INTO `mods` VALUES (1, 'admin', 'cedad442efeef7112fed0f50b011b2b9bf83f6898082f995f69dd7865ca19fb7', '4a44c6c55df862ae901b413feecb0d49', 2, '*'); -- -------------------------------------------------------- @@ -153,10 +148,10 @@ INSERT INTO `mods` (`id`, `username`, `password`, `salt`, `type`, `boards`) VALU -- CREATE TABLE IF NOT EXISTS `mutes` ( - `ip` varchar(45) NOT NULL, + `ip` varchar(39) NOT NULL, `time` int(11) NOT NULL, KEY `ip` (`ip`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=ascii; -- -------------------------------------------------------- @@ -165,14 +160,14 @@ CREATE TABLE IF NOT EXISTS `mutes` ( -- CREATE TABLE IF NOT EXISTS `news` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` text NOT NULL, `time` int(11) NOT NULL, `subject` text NOT NULL, `body` text NOT NULL, UNIQUE KEY `id` (`id`), KEY `time` (`time`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- @@ -181,13 +176,13 @@ CREATE TABLE IF NOT EXISTS `news` ( -- CREATE TABLE IF NOT EXISTS `noticeboard` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `mod` int(11) NOT NULL, `time` int(11) NOT NULL, `subject` text NOT NULL, `body` text NOT NULL, UNIQUE KEY `id` (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- @@ -196,14 +191,14 @@ CREATE TABLE IF NOT EXISTS `noticeboard` ( -- CREATE TABLE IF NOT EXISTS `pms` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `sender` int(11) NOT NULL, `to` int(11) NOT NULL, `message` text NOT NULL, `time` int(11) NOT NULL, `unread` tinyint(1) NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; -- -------------------------------------------------------- @@ -212,14 +207,14 @@ CREATE TABLE IF NOT EXISTS `pms` ( -- CREATE TABLE IF NOT EXISTS `reports` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `time` int(11) NOT NULL, - `ip` varchar(45) NOT NULL, - `board` varchar(120) DEFAULT NULL, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, + `board` varchar(120) CHARACTER SET ascii DEFAULT NULL, `post` int(11) NOT NULL, `reason` text NOT NULL, PRIMARY KEY (`id`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=3 ; -- -------------------------------------------------------- @@ -228,9 +223,9 @@ CREATE TABLE IF NOT EXISTS `reports` ( -- CREATE TABLE IF NOT EXISTS `robot` ( - `hash` varchar(40) NOT NULL COMMENT 'SHA1', + `hash` varchar(40) COLLATE ascii_bin NOT NULL COMMENT 'SHA1', PRIMARY KEY (`hash`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=ascii COLLATE=ascii_bin; -- -------------------------------------------------------- @@ -243,7 +238,7 @@ CREATE TABLE IF NOT EXISTS `theme_settings` ( `name` varchar(40) DEFAULT NULL, `value` text, KEY `theme` (`theme`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8; +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; diff --git a/post.php b/post.php index e9041ce8..d1749fd1 100644 --- a/post.php +++ b/post.php @@ -378,7 +378,10 @@ if (isset($_POST['delete'])) { wordfilters($post['body']); - $post['body_nomarkup'] = preg_replace('/[\x{010000}-\x{ffffff}]/u', '', $post['body']); + if (mysql_version() >= 50503) + $post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset + else + $post['body_nomarkup'] = preg_replace('/[\x{010000}-\x{ffffff}]/u', '', $post['body']); // MySQL's `utf8` charset only supports up to 3-byte symbols if (!($mod && isset($post['raw']) && $post['raw'])) $post['tracked_cites'] = markup($post['body'], true); diff --git a/templates/posts.sql b/templates/posts.sql index c766d38e..0a1dc92a 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -1,32 +1,33 @@ CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( - `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `thread` int(11) DEFAULT NULL, - `subject` varchar(100) DEFAULT NULL, - `email` varchar(30) DEFAULT NULL, - `name` varchar(35) DEFAULT NULL, - `trip` varchar(15) DEFAULT NULL, - `capcode` varchar(50) DEFAULT NULL, - `body` text NOT NULL, - `body_nomarkup` text DEFAULT NULL, - `time` int(11) NOT NULL, - `bump` int(11) DEFAULT NULL, - `thumb` varchar(50) DEFAULT NULL, - `thumbwidth` int(11) DEFAULT NULL, - `thumbheight` int(11) DEFAULT NULL, - `file` varchar(50) DEFAULT NULL, - `filewidth` int(11) DEFAULT NULL, - `fileheight` int(11) DEFAULT NULL, - `filesize` int(11) DEFAULT NULL, - `filename` text DEFAULT NULL, - `filehash` text DEFAULT NULL, - `password` varchar(20) DEFAULT NULL, - `ip` varchar(45) NOT NULL, - `sticky` int(1) NOT NULL, - `locked` int(1) NOT NULL, - `sage` int(1) NOT NULL, - `embed` text, - UNIQUE KEY `id` (`id`), - KEY `thread_id` (`thread`, `id`), - KEY `time` (`time`), - FULLTEXT KEY `body` (`body`) -) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ; + `id` int(11) unsigned NOT NULL AUTO_INCREMENT, + `thread` int(11) DEFAULT NULL, + `subject` varchar(100) DEFAULT NULL, + `email` varchar(30) DEFAULT NULL, + `name` varchar(35) DEFAULT NULL, + `trip` varchar(15) DEFAULT NULL, + `capcode` varchar(50) DEFAULT NULL, + `body` text NOT NULL, + `body_nomarkup` text, + `time` int(11) NOT NULL, + `bump` int(11) DEFAULT NULL, + `thumb` varchar(50) DEFAULT NULL, + `thumbwidth` int(11) DEFAULT NULL, + `thumbheight` int(11) DEFAULT NULL, + `file` varchar(50) DEFAULT NULL, + `filewidth` int(11) DEFAULT NULL, + `fileheight` int(11) DEFAULT NULL, + `filesize` int(11) DEFAULT NULL, + `filename` text, + `filehash` text CHARACTER SET ascii, + `password` varchar(20) DEFAULT NULL, + `ip` varchar(39) CHARACTER SET ascii NOT NULL, + `sticky` int(1) NOT NULL, + `locked` int(1) NOT NULL, + `sage` int(1) NOT NULL, + `embed` text, + UNIQUE KEY `id` (`id`), + KEY `thread_id` (`thread`,`id`), + KEY `time` (`time`), + FULLTEXT KEY `body` (`body`) + ) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 AUTO_INCREMENT=1 ; + \ No newline at end of file -- cgit v1.3 From 343397d561183a72ed3a6351175b0d34ebe9ffc3 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Tue, 30 Jul 2013 23:30:49 -0400 Subject: ?/IP/: Don't show posts for board user doesn't have access to --- inc/mod/pages.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index d447fa51..fdf9d8e9 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -744,6 +744,8 @@ function mod_page_ip($ip) { $boards = listBoards(); foreach ($boards as $board) { openBoard($board['uri']); + if (!hasPermission($config['mod']['show_ip'], $board['uri'])) + continue; $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $board['uri'])); $query->bindValue(':ip', $ip); -- cgit v1.3 From bb2868896c2f383a913e8e5929627660cc754b14 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 00:04:57 -0400 Subject: Ability to hide IP addresses from mod log --- inc/config.php | 2 ++ templates/mod/log.html | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 582c3145..28a7a4db 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1024,6 +1024,8 @@ $config['mod']['createusers'] = ADMIN; // View the moderation log $config['mod']['modlog'] = ADMIN; + // View IP addresses of other mods in ?/log + $config['mod']['show_ip_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; diff --git a/templates/mod/log.html b/templates/mod/log.html index e75330b5..0aa3f110 100644 --- a/templates/mod/log.html +++ b/templates/mod/log.html @@ -18,7 +18,11 @@ {% endif %} - {{ log.ip }} + {% if mod|hasPermission(config.mod.show_ip_modlog) %} + {{ log.ip }} + {% else %} + hidden + {% endif %} {{ log.time|ago }} -- cgit v1.3 From 42cba538878cb695ba8b3093f72bc66ccd2fa074 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 02:08:55 -0400 Subject: Allow Unicode in board URIs. --- inc/config.php | 3 +++ inc/display.php | 6 +++--- inc/functions.php | 8 ++++---- inc/mod/pages.php | 9 ++++----- install.php | 23 ++++++++++++++++++----- install.sql | 22 +++++++++++----------- mod.php | 33 +++++++++++++++++---------------- post.php | 6 +++--- 8 files changed, 63 insertions(+), 47 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 28a7a4db..36518028 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1130,6 +1130,9 @@ // 'type' => 'scp' //); + // Regex for board URIs + $config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}'; + // Complex regular expression to catch URLs $config['url_regex'] = '/' . '(https?|ftp):\/\/' . '(([\w\-]+\.)+[a-zA-Z]{2,6}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' . '(:\d+)?' . '(\/([\w\-~.#\/?=&;:+%!*\[\]@$\'()+,|\^]+)?)?' . '/'; diff --git a/inc/display.php b/inc/display.php index a7e4826e..0992166d 100644 --- a/inc/display.php +++ b/inc/display.php @@ -235,7 +235,7 @@ function bidi_cleanup($str){ function secure_link_confirm($text, $title, $confirm_message, $href) { global $config; - return '' . $text . ''; + return '' . $text . ''; } function secure_link($href) { return $href . '/' . make_secure_link_token($href); @@ -299,7 +299,7 @@ class Post { // Fix internal links // Very complicated regex $this->body = preg_replace( - '/ ':?/', // redirect to dashboard @@ -45,7 +45,7 @@ $pages = array( '/news/(\d+)' => 'news', // view news '/news/delete/(\d+)' => 'news_delete', // delete from news - '/edit/(\w+)' => 'edit_board', // edit board details + '/edit/(\%b)' => 'edit_board', // edit board details '/new-board' => 'new_board', // create a new board '/rebuild' => 'rebuild', // rebuild static files @@ -63,15 +63,15 @@ $pages = array( // CSRF-protected moderator actions '/ban' => 'secure_POST ban', // new ban - '/(\w+)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster - '/(\w+)/move/(\d+)' => 'secure_POST move', // move thread - '/(\w+)/edit(_raw)?/(\d+)' => 'secure_POST edit_post', // edit post - '/(\w+)/delete/(\d+)' => 'secure delete', // delete post - '/(\w+)/deletefile/(\d+)' => 'secure deletefile', // delete file from post - '/(\w+)/deletebyip/(\d+)(/global)?' => 'secure deletebyip', // delete all posts by IP address - '/(\w+)/(un)?lock/(\d+)' => 'secure lock', // lock thread - '/(\w+)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread - '/(\w+)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread + '/(\%b)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster + '/(\%b)/move/(\d+)' => 'secure_POST move', // move thread + '/(\%b)/edit(_raw)?/(\d+)' => 'secure_POST edit_post', // edit post + '/(\%b)/delete/(\d+)' => 'secure delete', // delete post + '/(\%b)/deletefile/(\d+)' => 'secure deletefile', // delete file from post + '/(\%b)/deletebyip/(\d+)(/global)?' => 'secure deletebyip', // delete all posts by IP address + '/(\%b)/(un)?lock/(\d+)' => 'secure lock', // lock thread + '/(\%b)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread + '/(\%b)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread '/themes' => 'themes_list', // manage themes '/themes/(\w+)' => 'theme_configure', // configure/reconfigure theme @@ -86,10 +86,10 @@ $pages = array( '/debug/sql' => 'secure_POST debug_sql', // This should always be at the end: - '/(\w+)/' => 'view_board', - '/(\w+)/' . preg_quote($config['file_index'], '!') => 'view_board', - '/(\w+)/' . str_replace('%d', '(\d+)', preg_quote($config['file_page'], '!')) => 'view_board', - '/(\w+)/' . preg_quote($config['dir']['res'], '!') . + '/(\%b)/' => 'view_board', + '/(\%b)/' . preg_quote($config['file_index'], '!') => 'view_board', + '/(\%b)/' . str_replace('%d', '(\d+)', preg_quote($config['file_page'], '!')) => 'view_board', + '/(\%b)/' . preg_quote($config['dir']['res'], '!') . str_replace('%d', '(\d+)', preg_quote($config['file_page'], '!')) => 'view_thread', ); @@ -109,7 +109,8 @@ $new_pages = array(); foreach ($pages as $key => $callback) { if (is_string($callback) && preg_match('/^secure /', $callback)) $key .= '(/(?P[a-f0-9]{8}))?'; - $new_pages[@$key[0] == '!' ? $key : '!^' . $key . '(?:&[^&=]+=[^&]*)*$!'] = $callback; + $key = str_replace('\%b', $config['board_regex'], $key); + $new_pages[@$key[0] == '!' ? $key : '!^' . $key . '(?:&[^&=]+=[^&]*)*$!u'] = $callback; } $pages = $new_pages; diff --git a/post.php b/post.php index d1749fd1..85dc2d05 100644 --- a/post.php +++ b/post.php @@ -170,7 +170,7 @@ if (isset($_POST['delete'])) { error($config['error']['bot']); // Check the referrer - if (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], $_SERVER['HTTP_REFERER'])) + if (!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], urldecode($_SERVER['HTTP_REFERER']))) error($config['error']['referer']); checkDNSBL(); @@ -547,9 +547,9 @@ if (isset($_POST['delete'])) { // Remove board directories before inserting them into the database. if ($post['has_file']) { $post['file_path'] = $post['file']; - $post['file'] = substr_replace($post['file'], '', 0, mb_strlen($board['dir'] . $config['dir']['img'])); + $post['file'] = mb_substr($post['file'], mb_strlen($board['dir'] . $config['dir']['img'])); if ($is_an_image && $post['thumb'] != 'spoiler') - $post['thumb'] = substr_replace($post['thumb'], '', 0, mb_strlen($board['dir'] . $config['dir']['thumb'])); + $post['thumb'] = mb_substr($post['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb'])); } $post = (object)$post; -- cgit v1.3 From b22bcdecf9cce8b08c48283290173996b6c8abf2 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 02:19:58 -0400 Subject: Fix last commit: purge() issue --- inc/functions.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 6db21c54..773f8eb6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -366,6 +366,11 @@ function boardTitle($uri) { function purge($uri) { global $config, $debug; + // Fix for Unicode + $uri = urlencode($uri); + $uri = str_replace("%2F", "/", $uri); + $uri = str_replace("%3A", ":", $uri); + if (preg_match($config['referer_match'], $config['root']) && isset($_SERVER['REQUEST_URI'])) { $uri = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/') . $uri; } else { -- cgit v1.3 From 37d769646b7754f37928f9ceb8b0a2a9eea58c6b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 03:12:06 -0400 Subject: Markup/quote fix for multibyte --- inc/functions.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 773f8eb6..2d648df8 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -297,6 +297,10 @@ function sprintf3($str, $vars, $delim = '%') { array_values($replaces), $str); } +function mb_substr_replace($string, $replacement, $start, $length) { + return mb_substr($string, 0, $start) . $replacement . mb_substr($string, $start + $length); +} + function setupBoard($array) { global $board, $config; @@ -1451,6 +1455,7 @@ function markup(&$body, $track_cites = false) { } $skip_chars = 0; + $body_tmp = $body; foreach ($cites as $matches) { $cite = $matches[2][0]; @@ -1458,20 +1463,26 @@ function markup(&$body, $track_cites = false) { $query->bindValue(':id', $cite); $query->execute() or error(db_error($query)); + // preg_replace is not multibyte-safe + foreach ($matches as &$match) { + $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); + } + if ($post = $query->fetch()) { $replacement = '' . '>>' . $cite . ''; - $body = substr_replace($body, $matches[1][0] . $replacement . $matches[3][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); - $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[3][0]) - mb_strlen($matches[0][0]); + $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[3][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[3][0]) - mb_strlen($matches[0][0]); + if ($track_cites && $config['track_cites']) $tracked_cites[] = array($board['uri'], $post['id']); } } } - + // Cross-board linking if (preg_match_all('/(^|\s)>>>\/(' . $config['board_regex'] . 'f?)\/(\d+)?([\s,.)?]|$)/um', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { if (count($cites[0]) > $config['max_cites']) { @@ -1479,11 +1490,17 @@ function markup(&$body, $track_cites = false) { } $skip_chars = 0; + $body_tmp = $body; foreach ($cites as $matches) { $_board = $matches[2][0]; $cite = @$matches[3][0]; + // preg_replace is not multibyte-safe + foreach ($matches as &$match) { + $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); + } + // Temporarily store board information because it will be overwritten $tmp_board = $board['uri']; @@ -1499,7 +1516,8 @@ function markup(&$body, $track_cites = false) { $config['root'] . $board['dir'] . $config['dir']['res'] . ($post['thread']?$post['thread']:$post['id']) . '.html#' . $cite . '">' . '>>>/' . $_board . '/' . $cite . ''; - $body = substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + + $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); if ($track_cites && $config['track_cites']) @@ -1510,7 +1528,7 @@ function markup(&$body, $track_cites = false) { $config['root'] . $board['dir'] . $config['file_index'] . '">' . '>>>/' . $_board . '/' . ''; - $body = substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); + $body = mb_substr_replace($body, $matches[1][0] . $replacement . $matches[4][0], $matches[0][1] + $skip_chars, mb_strlen($matches[0][0])); $skip_chars += mb_strlen($matches[1][0] . $replacement . $matches[4][0]) - mb_strlen($matches[0][0]); } } -- cgit v1.3 From a2d8e4cf3efd97765405e4d51ecdc279b227072b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 03:13:51 -0400 Subject: Previous commit comment fix --- inc/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 2d648df8..15037847 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1463,7 +1463,7 @@ function markup(&$body, $track_cites = false) { $query->bindValue(':id', $cite); $query->execute() or error(db_error($query)); - // preg_replace is not multibyte-safe + // preg_match_all is not multibyte-safe foreach ($matches as &$match) { $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); } @@ -1496,7 +1496,7 @@ function markup(&$body, $track_cites = false) { $_board = $matches[2][0]; $cite = @$matches[3][0]; - // preg_replace is not multibyte-safe + // preg_match_all is not multibyte-safe foreach ($matches as &$match) { $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); } -- cgit v1.3 From f9cdf31ede3bab1aff1ffa5a043bfd9a6eceb6d7 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Sat, 22 Dec 2012 20:16:31 +0100 Subject: Fix animated .gif conversion when $config['thumb_ext'] == '' --- inc/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index eb98ceda..f0909b8c 100644 --- a/inc/image.php +++ b/inc/image.php @@ -186,7 +186,7 @@ class ImageImagick extends ImageBase { public function resize() { global $config; - if ($this->format == 'gif' && $config['thumb_ext'] == 'gif') { + if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '')) { $this->image = new Imagick(); $this->image->setFormat('gif'); @@ -274,7 +274,7 @@ class ImageConvert extends ImageBase { $quality = $config['thumb_quality'] * 10; - if ($this->format == 'gif' && $config['thumb_ext'] == 'gif' && $config['thumb_keep_animation_frames'] > 1) { + if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); -- cgit v1.3 From b7e725bf3e0394193dee9373c18dec7f727ea6ed Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Mon, 24 Dec 2012 05:34:06 +0100 Subject: Support for resizing gifs using gifsicle with resizing the rest using ImageMagick --- inc/config.php | 15 ++++++++++----- inc/image.php | 28 ++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 11 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 36518028..863b9043 100644 --- a/inc/config.php +++ b/inc/config.php @@ -413,11 +413,16 @@ $config['thumb_keep_animation_frames'] = 1; // Thumbnailing method: - // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). This is a prerequisite - // for Tinyboard no matter what method you choose. - // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. A few minor bugs. - // http://pecl.php.net/package/imagick - // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in PHP Imagick. + // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). + // This is a prerequisite for Tinyboard no matter what method you choose. + // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. + // A few minor bugs. http://pecl.php.net/package/imagick + // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in + // PHP Imagick. + // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) + // instead of `convert` for resizing gifs. It's faster and resulting animated gifs + // have less artifacts than if resized with ImageMagick. + $config['thumb_method'] = 'gd'; // Strip EXIF metadata from JPEG files diff --git a/inc/image.php b/inc/image.php index f0909b8c..e4738953 100644 --- a/inc/image.php +++ b/inc/image.php @@ -16,10 +16,10 @@ class Image { $this->src = $src; $this->format = $format; - + if ($config['thumb_method'] == 'imagick') { $classname = 'ImageImagick'; - } elseif ($config['thumb_method'] == 'convert') { + } elseif ($config['thumb_method'] == 'convert' || $config['thumb_method'] == 'convert+gifsicle') { $classname = 'ImageConvert'; } else { $classname = 'Image' . strtoupper($this->format); @@ -29,6 +29,7 @@ class Image { } $this->image = new $classname($this); + if (!$this->image->valid()) { $this->delete(); error($config['error']['invalidimg']); @@ -44,10 +45,15 @@ class Image { public function resize($extension, $max_width, $max_height) { global $config; + $gifsicle = false; + if ($config['thumb_method'] == 'imagick') { $classname = 'ImageImagick'; } elseif ($config['thumb_method'] == 'convert') { $classname = 'ImageConvert'; + } elseif ($config['thumb_method'] == 'convert+gifsicle') { + $classname = 'ImageConvert'; + $gifsicle = true; } else { $classname = 'Image' . strtoupper($extension); if (!class_exists($classname)) { @@ -75,6 +81,9 @@ class Image { $height = $max_height; } + if ($gifsicle) { + $thumb->gifsicle = 1; + } $thumb->_resize($this->image->image, $width, $height); return $thumb; @@ -219,7 +228,7 @@ class ImageImagick extends ImageBase { class ImageConvert extends ImageBase { - public $width, $height, $temp; + public $width, $height, $temp, $gifsicle; public function init() { global $config; @@ -275,9 +284,16 @@ class ImageConvert extends ImageBase { $quality = $config['thumb_quality'] * 10; if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { - if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . - escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) - error('Failed to resize image!'); + if ($this->gifsicle) { + if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} " . + escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + error('Failed to resize image!'); + } + else { + if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . + escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + error('Failed to resize image!'); + } } else { if (shell_exec("convert -background transparent -flatten -filter Point -scale {$this->width}x{$this->height} +antialias -quality {$quality} " . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) -- cgit v1.3 From 73cb2bdf2c429fc302156b5853a409ff3cdc09b8 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Mon, 24 Dec 2012 05:42:53 +0100 Subject: convert+gifsicle: fix previous commit --- inc/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index e4738953..7aea9bfe 100644 --- a/inc/image.php +++ b/inc/image.php @@ -285,8 +285,8 @@ class ImageConvert extends ImageBase { if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->gifsicle) { - if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} " . - escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . + escapeshellarg($this->src . '') . " > " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } else { -- cgit v1.3 From 573f86ccaee3b206ebacdb4c695ea2841d68f8f9 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 03:35:07 -0400 Subject: Tiny code clean-up --- inc/image.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 7aea9bfe..99c10252 100644 --- a/inc/image.php +++ b/inc/image.php @@ -81,9 +81,7 @@ class Image { $height = $max_height; } - if ($gifsicle) { - $thumb->gifsicle = 1; - } + $thumb->gifsicle = $gifsicle; $thumb->_resize($this->image->image, $width, $height); return $thumb; @@ -288,8 +286,7 @@ class ImageConvert extends ImageBase { if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " > " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); - } - else { + } else { if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); -- cgit v1.3 From 44d3b12cefce4e6e2e5c6e367e8443790f38bf57 Mon Sep 17 00:00:00 2001 From: asiekierka Date: Sat, 5 Jan 2013 13:45:21 +0100 Subject: Embedding: added vocaroo support --- inc/config.php | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 863b9043..e2cd79f1 100644 --- a/inc/config.php +++ b/inc/config.php @@ -663,6 +663,10 @@ array( '/^https?:\/\/video\.google\.com\/videoplay\?docid=(\d+)([&#](.+)?)?$/i', '' + ), + array( + '/^https?:\/\/(\w+\.)?vocaroo\.com\/i\/([a-zA-Z0-9]{2,15})$/i', + '' ) ); -- cgit v1.3 From 220609999a78fedce1459df5e89c40b2bd1f7d90 Mon Sep 17 00:00:00 2001 From: szalej Date: Wed, 16 Jan 2013 10:50:20 +0100 Subject: Update inc/functions.php Hide Referrer (nullrefer.com) --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 15037847..bc58b117 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1385,7 +1385,7 @@ function markup_url($matches) { $markup_urls[] = $url; - return '' . $url . '' . $after; + return '' . $url . '' . $after; } function unicodify($body) { -- cgit v1.3 From 5bf53cb581e8e9598405cd1d8531c2672417d32e Mon Sep 17 00:00:00 2001 From: szalej Date: Wed, 16 Jan 2013 11:34:31 +0100 Subject: Update inc/functions.php url ads --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index bc58b117..8bae66d3 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1385,7 +1385,7 @@ function markup_url($matches) { $markup_urls[] = $url; - return '' . $url . '' . $after; + return '' . $url . '' . $after; } function unicodify($body) { -- cgit v1.3 From 3ef2c05bb20d5fc7de528676e8a7c02bfd9135fb Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Wed, 16 Jan 2013 19:49:26 +0100 Subject: url_ads: fix it not working --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 8bae66d3..5d3a5757 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1378,7 +1378,7 @@ function quote($body, $quote=true) { } function markup_url($matches) { - global $markup_urls; + global $config, $markup_urls; $url = $matches[1]; $after = $matches[2]; -- cgit v1.3 From 51efd817c8e82a498dbdd603d1194a0dd43f7192 Mon Sep 17 00:00:00 2001 From: szalej Date: Wed, 16 Jan 2013 11:32:15 +0100 Subject: Update inc/config.php hide referrer option --- inc/config.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index e2cd79f1..cf55d149 100644 --- a/inc/config.php +++ b/inc/config.php @@ -335,6 +335,11 @@ $config['auto_unicode'] = true; // Whether to turn URLs into functional links $config['markup_urls'] = true; + $config['url_ads'] = ''; + // Use it if you want to add something before URL + //for example hide referrer 'http://www.nullrefer.com/?' 'http://anonym.to/?' + //or add some sort of ads + // Wordfilters are used to automatically replace certain words/phrases with something else. // For a normal string replacement: -- cgit v1.3 From 18516ff8289cc4e0c147f185d29824643b1f960d Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 03:43:01 -0400 Subject: Rename $config['url_ads'] to $config['link_prefix'] --- inc/config.php | 6 ++---- inc/functions.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index cf55d149..35b31b86 100644 --- a/inc/config.php +++ b/inc/config.php @@ -335,10 +335,8 @@ $config['auto_unicode'] = true; // Whether to turn URLs into functional links $config['markup_urls'] = true; - $config['url_ads'] = ''; - // Use it if you want to add something before URL - //for example hide referrer 'http://www.nullrefer.com/?' 'http://anonym.to/?' - //or add some sort of ads + // Optional URL prefix for links (eg. "http://anonym.to/?") + $config['link_prefix'] = ''; // Wordfilters are used to automatically replace certain words/phrases with something else. diff --git a/inc/functions.php b/inc/functions.php index 5d3a5757..a261e350 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1385,7 +1385,7 @@ function markup_url($matches) { $markup_urls[] = $url; - return '' . $url . '' . $after; + return '' . $url . '' . $after; } function unicodify($body) { -- cgit v1.3 From 7c8bbe8527be504804893672cc26430d11c272f2 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Sun, 23 Dec 2012 04:38:20 +0100 Subject: Implement image identification buttons using regex.info/exif, google images and tineye --- inc/config.php | 8 ++++++++ templates/post_reply.html | 11 +++++++++++ templates/post_thread.html | 10 ++++++++++ 3 files changed, 29 insertions(+) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 35b31b86..55c49045 100644 --- a/inc/config.php +++ b/inc/config.php @@ -485,6 +485,9 @@ $config['show_ratio'] = false; // Display the file's original filename $config['show_filename']= true; + + // Image identification buttons using regex.info/exif, tineye and google images + $config['image_identification'] = false; // Redraw the image using GD functions to strip any excess data (commonly ZIP archives) // WARNING: Currently strips animated GIFs too @@ -753,6 +756,11 @@ $config['root'] = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/'); else $config['root'] = '/'; // CLI mode + + // The scheme and domain. This is needed to get absolute URL of some page (for instance image + // identification buttons). If you use the CLI tools, it would be wise to override this setting. + $config['domain'] = (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? "https://" : "http://"; + $config['domain'] .= isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; // If for some reason the folders and static HTML index files aren't in the current working direcotry, // enter the directory path here. Otherwise, keep it false. diff --git a/templates/post_reply.html b/templates/post_reply.html index c5735a0e..5f7c2619 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -71,6 +71,17 @@ {{ post.filename|bidi_cleanup }} {% endif %} {% endif %} + {% if post.thumb != 'file' and config.image_identification %} + , + + {% if post.file|extension == 'jpg' %} + e + {% endif %} + g + t + + {% endif %} + )

diff --git a/templates/post_thread.html b/templates/post_thread.html index b702712e..0ada3e70 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -28,6 +28,16 @@ {{ post.filename|bidi_cleanup }} {% endif %} {% endif %} + {% if post.thumb != 'file' and config.image_identification %} + , + + {% if post.file|extension == 'jpg' %} + e + {% endif %} + g + t + + {% endif %} )

-- cgit v1.3 From 64bc410484d9c161275f8a47e212bef345433fb1 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 04:02:40 -0400 Subject: Small comment change --- inc/config.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 55c49045..0ff0600b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -486,7 +486,7 @@ // Display the file's original filename $config['show_filename']= true; - // Image identification buttons using regex.info/exif, tineye and google images + // Image identification links using regex.info/exif, TinEye and Google Images $config['image_identification'] = false; // Redraw the image using GD functions to strip any excess data (commonly ZIP archives) @@ -757,9 +757,9 @@ else $config['root'] = '/'; // CLI mode - // The scheme and domain. This is needed to get absolute URL of some page (for instance image - // identification buttons). If you use the CLI tools, it would be wise to override this setting. - $config['domain'] = (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? "https://" : "http://"; + // The scheme and domain. This is used to get the site's absolute URL (eg. for image identification links). + // If you use the CLI tools, it would be wise to override this setting. + $config['domain'] = (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? "https://" : "http://"; $config['domain'] .= isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; // If for some reason the folders and static HTML index files aren't in the current working direcotry, -- cgit v1.3 From cbab1f9ac219b7b01a59e09ee59b95087b23b860 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Tue, 18 Dec 2012 04:53:24 +0100 Subject: Updated Polish translation --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 12437 -> 13437 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 256 ++++++++++++++++++++++-------- 2 files changed, 186 insertions(+), 70 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 53bc309a..f1f40e8e 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 25567248..3d70a91b 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -1,30 +1,32 @@ -# Polish Tinyboard Translation -# Copyright (C) 2011 Marcin Łabanowski -# Ten plik jest wydany na takiej samej licencji co paczka PACKAGE. -# Marcin Łabanowski (2011) +# 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 , YEAR. # +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0.9.5\n" +"Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-03-15 09:39+0100\n" -"PO-Revision-Date: 2012-03-15 09:39+0100\n" -"Last-Translator: Marcin \"czaks\" Łabanowski \n" -"Language-Team: POLISH \n" -"Language: Polish\n" +"POT-Creation-Date: 2012-12-18 04:43+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #: /var/www/html/Tinyboard/inc/functions.php:958 #: /var/www/html/Tinyboard/inc/functions.php:972 +#: ../../../../inc/functions.php:1041 ../../../../inc/functions.php:1055 msgid "Previous" msgstr "Wstecz" #: /var/www/html/Tinyboard/inc/functions.php:977 #: /var/www/html/Tinyboard/inc/functions.php:986 +#: ../../../../inc/functions.php:1060 ../../../../inc/functions.php:1069 msgid "Next" msgstr "Dalej" @@ -61,218 +63,218 @@ msgstr "Odpowiedz" msgid "Quick Reply" msgstr "Szybka odpowiedź" -#: /var/www/html/Tinyboard/inc/config.php:600 +#: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." -#: /var/www/html/Tinyboard/inc/config.php:601 +#: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 msgid "You look like a bot." msgstr "Wyglądasz jak bot." -#: /var/www/html/Tinyboard/inc/config.php:602 +#: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " "odsyłaczu w nagłówku" -#: /var/www/html/Tinyboard/inc/config.php:603 +#: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" -#: /var/www/html/Tinyboard/inc/config.php:604 +#: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 msgid "The body was too long." msgstr "Zawartość jest za długa." -#: /var/www/html/Tinyboard/inc/config.php:605 +#: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." -#: /var/www/html/Tinyboard/inc/config.php:606 +#: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." -#: /var/www/html/Tinyboard/inc/config.php:607 +#: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." -#: /var/www/html/Tinyboard/inc/config.php:608 +#: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." -#: /var/www/html/Tinyboard/inc/config.php:609 +#: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 msgid "Invalid board!" msgstr "Niepoprawny board!" -#: /var/www/html/Tinyboard/inc/config.php:610 +#: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." -#: /var/www/html/Tinyboard/inc/config.php:611 +#: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." -#: /var/www/html/Tinyboard/inc/config.php:612 +#: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." -#: /var/www/html/Tinyboard/inc/config.php:613 +#: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." -#: /var/www/html/Tinyboard/inc/config.php:614 +#: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." -#: /var/www/html/Tinyboard/inc/config.php:615 +#: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" -#: /var/www/html/Tinyboard/inc/config.php:616 +#: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." -#: /var/www/html/Tinyboard/inc/config.php:617 +#: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." -#: /var/www/html/Tinyboard/inc/config.php:618 +#: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." -#: /var/www/html/Tinyboard/inc/config.php:619 +#: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." -#: /var/www/html/Tinyboard/inc/config.php:620 +#: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." -#: /var/www/html/Tinyboard/inc/config.php:621 +#: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." -#: /var/www/html/Tinyboard/inc/config.php:622 +#: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." -#: /var/www/html/Tinyboard/inc/config.php:623 +#: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." -#: /var/www/html/Tinyboard/inc/config.php:624 +#: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." -#: /var/www/html/Tinyboard/inc/config.php:625 +#: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 msgid "Wrong password…" msgstr "Niepoprawne hasło" -#: /var/www/html/Tinyboard/inc/config.php:626 +#: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 msgid "Invalid image." msgstr "Niepoprawny obrazek." -#: /var/www/html/Tinyboard/inc/config.php:627 +#: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." -#: /var/www/html/Tinyboard/inc/config.php:628 +#: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 msgid "Maximum file size: %maxsz% bytes
Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
Rozmiar twojego pliku: %filesz% " "bajtów" -#: /var/www/html/Tinyboard/inc/config.php:629 +#: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 msgid "The file was too big." msgstr "Plik jest za duży." -#: /var/www/html/Tinyboard/inc/config.php:630 +#: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" -#: /var/www/html/Tinyboard/inc/config.php:631 +#: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 #, php-format msgid "That file
already exists!" msgstr "Ten plik już istnieje!" -#: /var/www/html/Tinyboard/inc/config.php:632 +#: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." -#: /var/www/html/Tinyboard/inc/config.php:633 +#: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " "odrzucony" -#: /var/www/html/Tinyboard/inc/config.php:634 +#: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." -#: /var/www/html/Tinyboard/inc/config.php:635 +#: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." -#: /var/www/html/Tinyboard/inc/config.php:638 +#: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" -#: /var/www/html/Tinyboard/inc/config.php:639 +#: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" -#: /var/www/html/Tinyboard/inc/config.php:640 +#: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" "Niepoprawna nazwa użytkownika, bądź hasło. Twoje konto mogło zostać usunięte " "albo zmienione." -#: /var/www/html/Tinyboard/inc/config.php:641 +#: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." -#: /var/www/html/Tinyboard/inc/config.php:642 +#: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." -#: /var/www/html/Tinyboard/inc/config.php:643 +#: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." -#: /var/www/html/Tinyboard/inc/config.php:644 +#: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." -#: /var/www/html/Tinyboard/inc/config.php:645 +#: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" -#: /var/www/html/Tinyboard/inc/config.php:646 +#: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." -#: /var/www/html/Tinyboard/inc/config.php:647 +#: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." -#: /var/www/html/Tinyboard/inc/config.php:648 +#: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 msgid "Page not found." msgstr "Strona nie znaleziona." -#: /var/www/html/Tinyboard/inc/config.php:649 +#: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" -#: /var/www/html/Tinyboard/inc/config.php:650 +#: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -329,7 +331,8 @@ msgstr "Wystąpił błąd." msgid "Go back" msgstr "Wróć" -#: /var/www/html/Tinyboard/inc/display.php:97 +#: /var/www/html/Tinyboard/inc/display.php:97 ../../../../inc/display.php:91 +#: ../../../../inc/mod/pages.php:59 msgid "Login" msgstr "Logowanie" @@ -344,6 +347,7 @@ msgstr "" #: /var/www/html/Tinyboard/inc/display.php:272 #: /var/www/html/Tinyboard/inc/display.php:365 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:27 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:27 msgid "Delete" msgstr "Usuń" @@ -413,69 +417,90 @@ msgstr "Przenieś wątek na inny board" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:48 #: /var/www/html/Tinyboard/mod.php:667 /var/www/html/Tinyboard/mod.php:750 #: /var/www/html/Tinyboard/mod.php:833 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:55 msgid "Name" msgstr "Nazwa" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:62 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:76 msgid "Email" msgstr "E-mail" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:96 #: /var/www/html/Tinyboard/mod.php:753 /var/www/html/Tinyboard/mod.php:839 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:95 msgid "Subject" msgstr "Temat" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:110 #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:119 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:112 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:117 msgid "Spoiler Image" msgstr "Spoiler obrazek" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:119 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:121 msgid "Comment" msgstr "Komentarz" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 msgid "Verification" msgstr "Weryfikacja" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:22 msgid "File" msgstr "Plik" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:163 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:183 msgid "Embed" msgstr "Osadź" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:179 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:206 msgid "Flags" msgstr "Flagi" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:218 msgid "Sticky" msgstr "Przyklejony" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:230 msgid "Lock" msgstr "Zablokowany" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:242 msgid "Raw HTML" msgstr "Czysty HTML" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:230 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:23 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:257 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:23 msgid "Password" msgstr "Hasło" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:236 +#: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:266 msgid "(For file deletion.)" msgstr "(do usuwania postów)" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:107 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:105 msgid "File:" msgstr "Plik:" @@ -493,10 +518,12 @@ msgid "Refresh" msgstr "Odśwież" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:478 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:415 msgid "Reply" msgstr "Odpowiedź" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:511 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:442 msgid "1 post" msgid_plural "%count% posts" msgstr[0] "1 post" @@ -504,10 +531,12 @@ msgstr[1] "%count% posty" msgstr[2] "%count% postów" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:517 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:448 msgid "and" msgstr "oraz" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:528 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:459 msgid "1 image reply" msgid_plural "%count% image replies" msgstr[0] "1 obrazek" @@ -515,34 +544,43 @@ msgstr[1] "%count% obrazki" msgstr[2] "%count% obrazków" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:533 +#: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:464 msgid "omitted. Click reply to view." msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." #: /var/www/html/Tinyboard/templates/cache/c9/45/de4b7a1b91ef4b1ce35c7a930347.php:82 #: /var/www/html/Tinyboard/templates/cache/56/25/feb68d2e52b15e0d38ae0093f0f4.php:158 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:159 +#: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:169 +#: ../../../../templates/cache/7a/d3/9236b821893e6bc57b16919988fd.php:169 msgid "Return to dashboard" msgstr "Powróć na tablicę" #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:165 +#: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:177 msgid "Posting mode: Reply" msgstr "Tryb postowania: Odpowiedź" #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:168 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:210 +#: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:180 +#: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:222 msgid "Return" msgstr "Powrót" #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:19 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:19 msgid "Delete Post" msgstr "Usuń post" #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 msgid "Reason" msgstr "Powód" #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:36 +#: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:36 msgid "Report" msgstr "Zgłoszenie" @@ -560,18 +598,22 @@ msgid "PM Inbox" msgstr "Wiadomości prywatne" #: /var/www/html/Tinyboard/mod.php:136 /var/www/html/Tinyboard/mod.php:874 +#: ../../../../inc/mod/pages.php:376 msgid "News" msgstr "Aktualności" #: /var/www/html/Tinyboard/mod.php:141 /var/www/html/Tinyboard/mod.php:1614 +#: ../../../../inc/mod/pages.php:1557 msgid "Report queue" msgstr "Kolejna zgłoszeń" #: /var/www/html/Tinyboard/mod.php:144 /var/www/html/Tinyboard/mod.php:1882 +#: ../../../../inc/mod/pages.php:664 msgid "Ban list" msgstr "Lista banów" #: /var/www/html/Tinyboard/mod.php:147 /var/www/html/Tinyboard/mod.php:1288 +#: ../../../../inc/mod/pages.php:1271 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -580,6 +622,7 @@ msgid "Change own password" msgstr "Zmień swoje hasło" #: /var/www/html/Tinyboard/mod.php:152 /var/www/html/Tinyboard/mod.php:477 +#: ../../../../inc/mod/pages.php:416 ../../../../inc/mod/pages.php:443 msgid "Moderation log" msgstr "Log moderacji" @@ -596,6 +639,7 @@ msgid "Show configuration" msgstr "Pokaż konfigurację" #: /var/www/html/Tinyboard/mod.php:165 /var/www/html/Tinyboard/mod.php:709 +#: ../../../../inc/mod/pages.php:1739 msgid "Manage themes" msgstr "Zarządzaj dodatkami" @@ -616,7 +660,7 @@ msgstr "" "kluczowych. Aby dopasować dokładne frazy użyj \"cudzysłowi\". Używaj " "gwiazdki (*) jako znak wieloznaczny." -#: /var/www/html/Tinyboard/mod.php:180 +#: /var/www/html/Tinyboard/mod.php:180 ../../../../inc/mod/pages.php:106 msgid "Could not find current version! (Check .installed)" msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" @@ -624,7 +668,7 @@ msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" msgid "Logout" msgstr "Wyloguj" -#: /var/www/html/Tinyboard/mod.php:245 +#: /var/www/html/Tinyboard/mod.php:245 ../../../../inc/mod/pages.php:147 msgid "Dashboard" msgstr "Tablica" @@ -648,11 +692,11 @@ msgstr "Board" msgid "Action" msgstr "Akcja" -#: /var/www/html/Tinyboard/mod.php:528 +#: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" -#: /var/www/html/Tinyboard/mod.php:530 +#: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -684,7 +728,8 @@ msgstr "Rekonfiguruj" msgid "Install" msgstr "Instaluj" -#: /var/www/html/Tinyboard/mod.php:693 +#: /var/www/html/Tinyboard/mod.php:693 ../../../../inc/mod/pages.php:1467 +#: ../../../../inc/mod/pages.php:1471 msgid "Rebuild" msgstr "Przebuduj" @@ -704,7 +749,7 @@ msgstr "Zawartość" msgid "Post to noticeboard" msgstr "Postuj na tablicy ogłoszeń" -#: /var/www/html/Tinyboard/mod.php:792 +#: /var/www/html/Tinyboard/mod.php:792 ../../../../inc/mod/pages.php:316 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -773,14 +818,85 @@ msgstr "Cache jest wyłączone." msgid "Configuration" msgstr "Konfiguracja" -#: /var/www/html/Tinyboard/mod.php:2174 +#: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." -#: /var/www/html/Tinyboard/mod.php:2678 +#: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." #: /var/www/html/Tinyboard/mod.php:2795 msgid "No board to move to; there is only one." msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." + +#: ../../../../inc/config.php:689 +msgid "Invalid security token! Please go back and try again." +msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." + +#: ../../../../inc/mod/pages.php:63 +msgid "Confirm action" +msgstr "Potwierdź akcję" + +#: ../../../../inc/mod/pages.php:222 +msgid "Edit board" +msgstr "Edytuj board" + +#: ../../../../inc/mod/pages.php:270 +msgid "New board" +msgstr "Nowy board" + +#: ../../../../inc/mod/pages.php:586 +msgid "IP" +msgstr "adres IP" + +#: ../../../../inc/mod/pages.php:596 ../../../../inc/mod/pages.php:985 +msgid "New ban" +msgstr "Nowy ban" + +#: ../../../../inc/mod/pages.php:919 +msgid "Impossible to move thread; there is only one board." +msgstr "Nie można przenieść wątku; istnieje tylko jeden board." + +#: ../../../../inc/mod/pages.php:923 +msgid "Move thread" +msgstr "Przenieś wątek" + +#: ../../../../inc/mod/pages.php:1209 ../../../../inc/mod/pages.php:1258 +msgid "Edit user" +msgstr "Edytuj użytkownika" + +#: ../../../../inc/mod/pages.php:1333 ../../../../inc/mod/pages.php:1405 +msgid "New PM for" +msgstr "Nowe PW dla" + +#: ../../../../inc/mod/pages.php:1337 +msgid "Private message" +msgstr "Prywatna wiadomość" + +#: ../../../../inc/mod/pages.php:1358 +msgid "PM inbox" +msgstr "Odebrane PW" + +#: ../../../../inc/mod/pages.php:1679 +msgid "Config editor" +msgstr "Edytor konfiguracji" + +#: ../../../../inc/mod/pages.php:1713 +msgid "Debug: Anti-spam" +msgstr "Debug: Antyspam" + +#: ../../../../inc/mod/pages.php:1801 +#, php-format +msgid "Installed theme: %s" +msgstr "Zainstalowano dodatek: %s" + +#: ../../../../inc/mod/pages.php:1811 +#, php-format +msgid "Configuring theme: %s" +msgstr "Konfigurowanie dodatku: %s" + +#: ../../../../inc/mod/pages.php:1839 +#, php-format +msgid "Rebuilt theme: %s" +msgstr "Przebudowano dodatek: %s" -- cgit v1.3 From 4266c412b55b5d5b4c2a76578561340ccf993b86 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Tue, 18 Dec 2012 04:58:53 +0100 Subject: Updated Polish translation (2) --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 13437 -> 13437 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index f1f40e8e..592ca18d 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 3d70a91b..d24cbd8e 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -437,7 +437,7 @@ msgstr "Temat" #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:112 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:117 msgid "Spoiler Image" -msgstr "Spoiler obrazek" +msgstr "Schowaj obrazek" #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:119 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:121 -- cgit v1.3 From 39cf9e7de560d0b09e1d13a040727eb031bbc0a2 Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Tue, 18 Dec 2012 06:42:20 +0100 Subject: Updated Polish translation (3) --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 13437 -> 13500 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 21 ++++++++++----------- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 592ca18d..4a0e0f22 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index d24cbd8e..ea0469e9 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -1,22 +1,21 @@ -# 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 , YEAR. -# -#, fuzzy +# Polish Tinyboard Translation +# Copyright (C) 2011 Marcin Łabanowski +# Ten plik jest wydany na takiej samej licencji co paczka PACKAGE. +# Marcin Łabanowski (2011) msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" +"Project-Id-Version: 0.9.6-dev-6\n" +"Report-Msgid-Bugs-To: marcin@6irc.net\n" "POT-Creation-Date: 2012-12-18 04:43+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Language-Team: POLISH \n" +"Language: Polish\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " +"|| n%100>=20) ? 1 : 2;\n" #: /var/www/html/Tinyboard/inc/functions.php:958 #: /var/www/html/Tinyboard/inc/functions.php:972 -- cgit v1.3 From 5ea2f02e7de1bdde17d0b8f0bc729a2c8e11767c Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Tue, 18 Dec 2012 08:07:26 +0100 Subject: Fixed typo in Polish translation --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 13500 -> 13500 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 4a0e0f22..98f2ab5c 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index ea0469e9..374278df 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -604,7 +604,7 @@ msgstr "Aktualności" #: /var/www/html/Tinyboard/mod.php:141 /var/www/html/Tinyboard/mod.php:1614 #: ../../../../inc/mod/pages.php:1557 msgid "Report queue" -msgstr "Kolejna zgłoszeń" +msgstr "Kolejka zgłoszeń" #: /var/www/html/Tinyboard/mod.php:144 /var/www/html/Tinyboard/mod.php:1882 #: ../../../../inc/mod/pages.php:664 -- cgit v1.3 From dd01c8308defcb25e7e129724281906b8b6b3e08 Mon Sep 17 00:00:00 2001 From: 55ch Date: Sat, 15 Jun 2013 07:07:16 -0400 Subject: Brazilian Portuguese translation for Tinyboard --- inc/locale/pt_BR/LC_MESSAGES/tinyboard.mo | Bin 0 -> 12327 bytes inc/locale/pt_BR/LC_MESSAGES/tinyboard.po | 844 ++++++++++++++++++++++++++++++ 2 files changed, 844 insertions(+) create mode 100644 inc/locale/pt_BR/LC_MESSAGES/tinyboard.mo create mode 100644 inc/locale/pt_BR/LC_MESSAGES/tinyboard.po (limited to 'inc') diff --git a/inc/locale/pt_BR/LC_MESSAGES/tinyboard.mo b/inc/locale/pt_BR/LC_MESSAGES/tinyboard.mo new file mode 100644 index 00000000..3bb6778b Binary files /dev/null and b/inc/locale/pt_BR/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pt_BR/LC_MESSAGES/tinyboard.po b/inc/locale/pt_BR/LC_MESSAGES/tinyboard.po new file mode 100644 index 00000000..c2ad38a2 --- /dev/null +++ b/inc/locale/pt_BR/LC_MESSAGES/tinyboard.po @@ -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 , 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 \n" +"Language-Team: LANGUAGE \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
Your file's size: %filesz% bytes" +msgstr "Tamanho maximo de arquivos: %maxsz% bytes
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 already exists!" +msgstr "O arquivo já existe!" + +#: ../../inc/config.php:719 +#, php-format +msgid "That file already exists in this thread!" +msgstr "O arquivo já existe 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 already exists!" +msgstr "Este mod já existe!" + +#: ../../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)" -- cgit v1.3 From 0ffa0b3adfc5c99dec57e7f2416337a0fc155132 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 01:59:36 -0400 Subject: Update Polish translation; javascript l10n --- inc/locale/pl_PL/LC_MESSAGES/javascript.js | 1 + inc/locale/pl_PL/LC_MESSAGES/javascript.po | 121 ++++++++ inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 13500 -> 14100 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 456 +++++++++++++++++++++++++++-- 4 files changed, 546 insertions(+), 32 deletions(-) create mode 100644 inc/locale/pl_PL/LC_MESSAGES/javascript.js create mode 100644 inc/locale/pl_PL/LC_MESSAGES/javascript.po (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.js b/inc/locale/pl_PL/LC_MESSAGES/javascript.js new file mode 100644 index 00000000..e1df81c7 --- /dev/null +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.js @@ -0,0 +1 @@ +l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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 to","Reason":"Pow\u00f3d","Report":"Zg\u0142oszenie"}; \ No newline at end of file diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po new file mode 100644 index 00000000..2b4fa223 --- /dev/null +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -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 , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-03 01:52-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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 +msgid "Submit" +msgstr "Wyślij" + +#: ../../../../js/quick-reply.js:30 +msgid "Quick reply" +msgstr "Szybka odpowiedź" + +#: ../../../../js/quick-reply.js:32 +msgid "Posting mode: Replying to >>{0}" +msgstr "Tryb postowania: Odpowiedź na >>{0}" + +#: ../../../../js/quick-reply.js:32 +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ń to" + +#: ../../../../js/quick-post-controls.js:35 +msgid "Reason" +msgstr "Powód" + +#: ../../../../js/quick-post-controls.js:37 +msgid "Report" +msgstr "Zgłoszenie" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 98f2ab5c..b23e55a8 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 374278df..edbb5212 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -1,31 +1,36 @@ -# Polish Tinyboard Translation -# Copyright (C) 2011 Marcin Łabanowski -# Ten plik jest wydany na takiej samej licencji co paczka PACKAGE. -# Marcin Łabanowski (2011) +# 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 , YEAR. +# +#, fuzzy msgid "" msgstr "" -"Project-Id-Version: 0.9.6-dev-6\n" -"Report-Msgid-Bugs-To: marcin@6irc.net\n" -"POT-Creation-Date: 2012-12-18 04:43+0100\n" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-07-03 01:52-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" -"Language-Team: POLISH \n" -"Language: Polish\n" +"Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " -"|| n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +#. There is no previous page. #: /var/www/html/Tinyboard/inc/functions.php:958 #: /var/www/html/Tinyboard/inc/functions.php:972 #: ../../../../inc/functions.php:1041 ../../../../inc/functions.php:1055 +#: ../../../../inc/functions.php:1039 ../../../../inc/functions.php:1053 msgid "Previous" msgstr "Wstecz" +#. There is no next page. #: /var/www/html/Tinyboard/inc/functions.php:977 #: /var/www/html/Tinyboard/inc/functions.php:986 #: ../../../../inc/functions.php:1060 ../../../../inc/functions.php:1069 +#: ../../../../inc/functions.php:1058 ../../../../inc/functions.php:1067 msgid "Next" msgstr "Dalej" @@ -62,171 +67,216 @@ msgstr "Odpowiedz" msgid "Quick Reply" msgstr "Szybka odpowiedź" +#. +#. * ==================== +#. * Error messages +#. * ==================== +#. +#. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 +#: ../../../../inc/config.php:692 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 +#: ../../../../inc/config.php:693 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 +#: ../../../../inc/config.php:694 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " "odsyłaczu w nagłówku" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 +#: ../../../../inc/config.php:695 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 +#: ../../../../inc/config.php:696 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 +#: ../../../../inc/config.php:697 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 +#: ../../../../inc/config.php:698 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 +#: ../../../../inc/config.php:699 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 +#: ../../../../inc/config.php:700 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 +#: ../../../../inc/config.php:701 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 +#: ../../../../inc/config.php:702 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 +#: ../../../../inc/config.php:703 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 +#: ../../../../inc/config.php:706 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 +#: ../../../../inc/config.php:707 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 +#: ../../../../inc/config.php:708 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 +#: ../../../../inc/config.php:709 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 +#: ../../../../inc/config.php:710 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 +#: ../../../../inc/config.php:711 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 +#: ../../../../inc/config.php:712 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 +#: ../../../../inc/config.php:713 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 +#: ../../../../inc/config.php:714 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 +#: ../../../../inc/config.php:715 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 +#: ../../../../inc/config.php:716 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 +#: ../../../../inc/config.php:717 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 +#: ../../../../inc/config.php:718 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 +#: ../../../../inc/config.php:719 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 +#: ../../../../inc/config.php:720 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 +#: ../../../../inc/config.php:721 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 +#: ../../../../inc/config.php:722 msgid "Maximum file size: %maxsz% bytes
Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
Rozmiar twojego pliku: %filesz% " "bajtów" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 +#: ../../../../inc/config.php:723 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 +#: ../../../../inc/config.php:724 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 +#: ../../../../inc/config.php:725 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 +#: ../../../../inc/config.php:727 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 +#: ../../../../inc/config.php:728 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " "odrzucony" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 +#: ../../../../inc/config.php:729 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 +#: ../../../../inc/config.php:730 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 +#: ../../../../inc/config.php:734 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 +#: ../../../../inc/config.php:735 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 +#: ../../../../inc/config.php:736 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -234,46 +284,56 @@ msgstr "" "albo zmienione." #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 +#: ../../../../inc/config.php:737 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 +#: ../../../../inc/config.php:738 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 +#: ../../../../inc/config.php:739 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 +#: ../../../../inc/config.php:740 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 +#: ../../../../inc/config.php:741 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 +#: ../../../../inc/config.php:742 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 +#: ../../../../inc/config.php:743 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 +#: ../../../../inc/config.php:744 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 +#: ../../../../inc/config.php:745 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 +#: ../../../../inc/config.php:746 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -331,7 +391,7 @@ msgid "Go back" msgstr "Wróć" #: /var/www/html/Tinyboard/inc/display.php:97 ../../../../inc/display.php:91 -#: ../../../../inc/mod/pages.php:59 +#: ../../../../inc/mod/pages.php:59 ../../../../inc/mod/pages.php:62 msgid "Login" msgstr "Logowanie" @@ -343,10 +403,12 @@ msgstr "" "Post za długi. Kliknij tutaj aby zobaczyć pełnego posta." +#. line 5 #: /var/www/html/Tinyboard/inc/display.php:272 #: /var/www/html/Tinyboard/inc/display.php:365 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:27 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:27 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:27 msgid "Delete" msgstr "Usuń" @@ -382,6 +444,7 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:292 #: /var/www/html/Tinyboard/inc/display.php:408 +#: ../../../../inc/mod/pages.php:1080 msgid "Edit post" msgstr "Edytuj post" @@ -413,21 +476,27 @@ msgstr "Zablokuj wątek" msgid "Move thread to another board" msgstr "Przenieś wątek na inny board" +#. line 11 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:48 #: /var/www/html/Tinyboard/mod.php:667 /var/www/html/Tinyboard/mod.php:750 #: /var/www/html/Tinyboard/mod.php:833 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:55 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:55 msgid "Name" msgstr "Nazwa" +#. line 21 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:62 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:76 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:76 msgid "Email" msgstr "E-mail" +#. line 34 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:96 #: /var/www/html/Tinyboard/mod.php:753 /var/www/html/Tinyboard/mod.php:839 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:95 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:116 msgid "Subject" msgstr "Temat" @@ -435,71 +504,327 @@ msgstr "Temat" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:119 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:112 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:117 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:119 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:100 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:133 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:172 msgid "Spoiler Image" msgstr "Schowaj obrazek" +#. line 45 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:119 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:121 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:145 msgid "Comment" msgstr "Komentarz" +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:191 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:217 msgid "Verification" msgstr "Weryfikacja" +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:22 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:22 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:250 msgid "File" msgstr "Plik" +#. line 97 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:163 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:183 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:268 msgid "Embed" msgstr "Osadź" +#. line 109 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:179 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:206 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:291 msgid "Flags" msgstr "Flagi" +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:218 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:300 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:303 msgid "Sticky" msgstr "Przyklejony" +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:230 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:312 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:315 msgid "Lock" msgstr "Zablokowany" +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:242 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:324 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:327 msgid "Raw HTML" msgstr "Czysty HTML" +#. line 129 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:230 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:23 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:257 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:23 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:23 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:342 msgid "Password" msgstr "Hasło" +#. line 134 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:236 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:266 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:351 msgid "(For file deletion.)" msgstr "(do usuwania postów)" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:107 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:105 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:107 msgid "File:" msgstr "Plik:" @@ -518,11 +843,13 @@ msgstr "Odśwież" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:478 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:415 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:461 msgid "Reply" msgstr "Odpowiedź" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:511 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:442 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:488 msgid "1 post" msgid_plural "%count% posts" msgstr[0] "1 post" @@ -531,11 +858,13 @@ msgstr[2] "%count% postów" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:517 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:448 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:494 msgid "and" msgstr "oraz" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:528 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:459 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 msgid "1 image reply" msgid_plural "%count% image replies" msgstr[0] "1 obrazek" @@ -544,6 +873,7 @@ msgstr[2] "%count% obrazków" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:533 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:464 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:510 msgid "omitted. Click reply to view." msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." @@ -552,11 +882,16 @@ msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:159 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:169 #: ../../../../templates/cache/7a/d3/9236b821893e6bc57b16919988fd.php:169 +#: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:121 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:98 +#: ../../../../templates/cache/62/8c/21348d46377c3e1b3f8c476ba376.php:62 msgid "Return to dashboard" msgstr "Powróć na tablicę" +#. line 27 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:165 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:177 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:106 msgid "Posting mode: Reply" msgstr "Tryb postowania: Odpowiedź" @@ -564,22 +899,30 @@ msgstr "Tryb postowania: Odpowiedź" #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:210 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:180 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:222 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:109 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:155 msgid "Return" msgstr "Powrót" +#. line 2 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:19 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:19 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:19 msgid "Delete Post" msgstr "Usuń post" +#. line 8 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:32 msgid "Reason" msgstr "Powód" +#. line 10 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:36 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:36 +#: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:36 msgid "Report" msgstr "Zgłoszenie" @@ -597,22 +940,22 @@ msgid "PM Inbox" msgstr "Wiadomości prywatne" #: /var/www/html/Tinyboard/mod.php:136 /var/www/html/Tinyboard/mod.php:874 -#: ../../../../inc/mod/pages.php:376 +#: ../../../../inc/mod/pages.php:376 ../../../../inc/mod/pages.php:393 msgid "News" msgstr "Aktualności" #: /var/www/html/Tinyboard/mod.php:141 /var/www/html/Tinyboard/mod.php:1614 -#: ../../../../inc/mod/pages.php:1557 +#: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 msgid "Report queue" msgstr "Kolejka zgłoszeń" #: /var/www/html/Tinyboard/mod.php:144 /var/www/html/Tinyboard/mod.php:1882 -#: ../../../../inc/mod/pages.php:664 +#: ../../../../inc/mod/pages.php:664 ../../../../inc/mod/pages.php:705 msgid "Ban list" msgstr "Lista banów" #: /var/www/html/Tinyboard/mod.php:147 /var/www/html/Tinyboard/mod.php:1288 -#: ../../../../inc/mod/pages.php:1271 +#: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -622,6 +965,7 @@ msgstr "Zmień swoje hasło" #: /var/www/html/Tinyboard/mod.php:152 /var/www/html/Tinyboard/mod.php:477 #: ../../../../inc/mod/pages.php:416 ../../../../inc/mod/pages.php:443 +#: ../../../../inc/mod/pages.php:433 ../../../../inc/mod/pages.php:460 msgid "Moderation log" msgstr "Log moderacji" @@ -638,7 +982,7 @@ msgid "Show configuration" msgstr "Pokaż konfigurację" #: /var/www/html/Tinyboard/mod.php:165 /var/www/html/Tinyboard/mod.php:709 -#: ../../../../inc/mod/pages.php:1739 +#: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 msgid "Manage themes" msgstr "Zarządzaj dodatkami" @@ -660,6 +1004,7 @@ msgstr "" "gwiazdki (*) jako znak wieloznaczny." #: /var/www/html/Tinyboard/mod.php:180 ../../../../inc/mod/pages.php:106 +#: ../../../../inc/mod/pages.php:110 msgid "Could not find current version! (Check .installed)" msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" @@ -668,6 +1013,7 @@ msgid "Logout" msgstr "Wyloguj" #: /var/www/html/Tinyboard/mod.php:245 ../../../../inc/mod/pages.php:147 +#: ../../../../inc/mod/pages.php:162 msgid "Dashboard" msgstr "Tablica" @@ -692,10 +1038,12 @@ msgid "Action" msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 +#: ../../../../inc/mod/pages.php:1789 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 +#: ../../../../inc/mod/pages.php:1791 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -728,7 +1076,8 @@ msgid "Install" msgstr "Instaluj" #: /var/www/html/Tinyboard/mod.php:693 ../../../../inc/mod/pages.php:1467 -#: ../../../../inc/mod/pages.php:1471 +#: ../../../../inc/mod/pages.php:1471 ../../../../inc/mod/pages.php:1567 +#: ../../../../inc/mod/pages.php:1571 msgid "Rebuild" msgstr "Przebuduj" @@ -749,6 +1098,7 @@ msgid "Post to noticeboard" msgstr "Postuj na tablicy ogłoszeń" #: /var/www/html/Tinyboard/mod.php:792 ../../../../inc/mod/pages.php:316 +#: ../../../../inc/mod/pages.php:333 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -818,10 +1168,12 @@ msgid "Configuration" msgstr "Konfiguracja" #: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 +#: ../../../../inc/mod/pages.php:272 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." #: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 +#: ../../../../inc/mod/pages.php:800 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." @@ -829,73 +1181,113 @@ msgstr "Docelowy i źródłowy board są takie same." msgid "No board to move to; there is only one." msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." -#: ../../../../inc/config.php:689 +#: ../../../../inc/config.php:689 ../../../../inc/config.php:747 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." -#: ../../../../inc/mod/pages.php:63 +#: ../../../../inc/mod/pages.php:63 ../../../../inc/mod/pages.php:66 msgid "Confirm action" msgstr "Potwierdź akcję" -#: ../../../../inc/mod/pages.php:222 +#: ../../../../inc/mod/pages.php:222 ../../../../inc/mod/pages.php:239 msgid "Edit board" msgstr "Edytuj board" -#: ../../../../inc/mod/pages.php:270 +#: ../../../../inc/mod/pages.php:270 ../../../../inc/mod/pages.php:287 msgid "New board" msgstr "Nowy board" -#: ../../../../inc/mod/pages.php:586 +#: ../../../../inc/mod/pages.php:586 ../../../../inc/mod/pages.php:612 msgid "IP" msgstr "adres IP" #: ../../../../inc/mod/pages.php:596 ../../../../inc/mod/pages.php:985 +#: ../../../../inc/mod/pages.php:622 ../../../../inc/mod/pages.php:1028 msgid "New ban" msgstr "Nowy ban" -#: ../../../../inc/mod/pages.php:919 +#: ../../../../inc/mod/pages.php:919 ../../../../inc/mod/pages.php:962 msgid "Impossible to move thread; there is only one board." msgstr "Nie można przenieść wątku; istnieje tylko jeden board." -#: ../../../../inc/mod/pages.php:923 +#: ../../../../inc/mod/pages.php:923 ../../../../inc/mod/pages.php:966 msgid "Move thread" msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1209 ../../../../inc/mod/pages.php:1258 +#: ../../../../inc/mod/pages.php:1307 ../../../../inc/mod/pages.php:1356 msgid "Edit user" msgstr "Edytuj użytkownika" +#. deleted? #: ../../../../inc/mod/pages.php:1333 ../../../../inc/mod/pages.php:1405 +#: ../../../../inc/mod/pages.php:1431 ../../../../inc/mod/pages.php:1503 msgid "New PM for" msgstr "Nowe PW dla" -#: ../../../../inc/mod/pages.php:1337 +#: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 msgid "Private message" msgstr "Prywatna wiadomość" -#: ../../../../inc/mod/pages.php:1358 +#: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 msgid "PM inbox" msgstr "Odebrane PW" -#: ../../../../inc/mod/pages.php:1679 +#: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 msgid "Config editor" msgstr "Edytor konfiguracji" -#: ../../../../inc/mod/pages.php:1713 +#: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" -#: ../../../../inc/mod/pages.php:1801 +#: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" -#: ../../../../inc/mod/pages.php:1811 +#: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" -#: ../../../../inc/mod/pages.php:1839 +#: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" + +#: ../../../../inc/lib/gettext/examples/pigs_dropin.php:77 +msgid "" +"This is how the story goes.\n" +"\n" +msgstr "" + +#: ../../../../inc/config.php:704 +msgid "Thread has reached its maximum reply limit." +msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." + +#: ../../../../inc/config.php:705 +msgid "Thread has reached its maximum image limit." +msgstr "Ten temat osiągnął swój maksymalny limit obrazków." + +#: ../../../../inc/config.php:726 +#, php-format +msgid "That file already exists in this thread!" +msgstr "Ten plik już istnieje w tym temacie!" + +#. Moderator errors +#: ../../../../inc/config.php:733 +#, php-format +msgid "" +"You are only allowed to unban %s users at a time. You tried to unban %u " +"users." +msgstr "" +"Możesz odbanować tylko %s użytkowników na raz. Próbowałeś odbanować %u users." + +#: ../../../../inc/mod/pages.php:1969 +msgid "Debug: Recent posts" +msgstr "Debug: Ostatnie posty" + +#: ../../../../inc/mod/pages.php:1993 +msgid "Debug: SQL" +msgstr "Debug: SQL" -- cgit v1.3 From ba270168134b50b955cd99925c899ee8c4096677 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 18 Jul 2013 16:34:22 -0400 Subject: locale: update polish translation --- inc/locale/pl_PL/LC_MESSAGES/javascript.js | 2 +- inc/locale/pl_PL/LC_MESSAGES/javascript.po | 12 +- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 14100 -> 14191 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 190 +++++++++++++++++++---------- 4 files changed, 134 insertions(+), 70 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.js b/inc/locale/pl_PL/LC_MESSAGES/javascript.js index e1df81c7..44857b98 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.js +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.js @@ -1 +1 @@ -l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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 to","Reason":"Pow\u00f3d","Report":"Zg\u0142oszenie"}; \ No newline at end of file +l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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"}; \ No newline at end of file diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po index 2b4fa223..3c16c8d7 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.po +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-03 01:52-0400\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 \n" "Language-Team: LANGUAGE \n" @@ -17,19 +17,19 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../../../../js/quick-reply.js:20 +#: ../../../../js/quick-reply.js:20 ../../../../js/quick-reply.js:21 msgid "Submit" msgstr "Wyślij" -#: ../../../../js/quick-reply.js:30 +#: ../../../../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:32 ../../../../js/quick-reply.js:33 msgid "Posting mode: Replying to >>{0}" msgstr "Tryb postowania: Odpowiedź na >>{0}" -#: ../../../../js/quick-reply.js:32 +#: ../../../../js/quick-reply.js:32 ../../../../js/quick-reply.js:33 msgid "Return" msgstr "Powrót" @@ -110,7 +110,7 @@ msgstr "Plik" #: ../../../../js/quick-post-controls.js:31 msgid "Delete" -msgstr "Usuń to" +msgstr "Usuń" #: ../../../../js/quick-post-controls.js:35 msgid "Reason" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index b23e55a8..ac57873e 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index edbb5212..9bc9eece 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-03 01:52-0400\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 \n" "Language-Team: LANGUAGE \n" @@ -23,6 +23,7 @@ msgstr "" #: /var/www/html/Tinyboard/inc/functions.php:972 #: ../../../../inc/functions.php:1041 ../../../../inc/functions.php:1055 #: ../../../../inc/functions.php:1039 ../../../../inc/functions.php:1053 +#: ../../../../inc/functions.php:1068 ../../../../inc/functions.php:1082 msgid "Previous" msgstr "Wstecz" @@ -31,6 +32,7 @@ msgstr "Wstecz" #: /var/www/html/Tinyboard/inc/functions.php:986 #: ../../../../inc/functions.php:1060 ../../../../inc/functions.php:1069 #: ../../../../inc/functions.php:1058 ../../../../inc/functions.php:1067 +#: ../../../../inc/functions.php:1087 ../../../../inc/functions.php:1096 msgid "Next" msgstr "Dalej" @@ -74,209 +76,209 @@ msgstr "Szybka odpowiedź" #. #. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 -#: ../../../../inc/config.php:692 +#: ../../../../inc/config.php:692 ../../../../inc/config.php:698 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 -#: ../../../../inc/config.php:693 +#: ../../../../inc/config.php:693 ../../../../inc/config.php:699 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 -#: ../../../../inc/config.php:694 +#: ../../../../inc/config.php:694 ../../../../inc/config.php:700 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " "odsyłaczu w nagłówku" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 -#: ../../../../inc/config.php:695 +#: ../../../../inc/config.php:695 ../../../../inc/config.php:701 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 -#: ../../../../inc/config.php:696 +#: ../../../../inc/config.php:696 ../../../../inc/config.php:702 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 -#: ../../../../inc/config.php:697 +#: ../../../../inc/config.php:697 ../../../../inc/config.php:703 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 -#: ../../../../inc/config.php:698 +#: ../../../../inc/config.php:698 ../../../../inc/config.php:704 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 -#: ../../../../inc/config.php:699 +#: ../../../../inc/config.php:699 ../../../../inc/config.php:705 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 -#: ../../../../inc/config.php:700 +#: ../../../../inc/config.php:700 ../../../../inc/config.php:706 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 -#: ../../../../inc/config.php:701 +#: ../../../../inc/config.php:701 ../../../../inc/config.php:707 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 -#: ../../../../inc/config.php:702 +#: ../../../../inc/config.php:702 ../../../../inc/config.php:708 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 -#: ../../../../inc/config.php:703 +#: ../../../../inc/config.php:703 ../../../../inc/config.php:709 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 -#: ../../../../inc/config.php:706 +#: ../../../../inc/config.php:706 ../../../../inc/config.php:712 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 -#: ../../../../inc/config.php:707 +#: ../../../../inc/config.php:707 ../../../../inc/config.php:713 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 -#: ../../../../inc/config.php:708 +#: ../../../../inc/config.php:708 ../../../../inc/config.php:714 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 -#: ../../../../inc/config.php:709 +#: ../../../../inc/config.php:709 ../../../../inc/config.php:715 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 -#: ../../../../inc/config.php:710 +#: ../../../../inc/config.php:710 ../../../../inc/config.php:716 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 -#: ../../../../inc/config.php:711 +#: ../../../../inc/config.php:711 ../../../../inc/config.php:717 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 -#: ../../../../inc/config.php:712 +#: ../../../../inc/config.php:712 ../../../../inc/config.php:718 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 -#: ../../../../inc/config.php:713 +#: ../../../../inc/config.php:713 ../../../../inc/config.php:719 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 -#: ../../../../inc/config.php:714 +#: ../../../../inc/config.php:714 ../../../../inc/config.php:720 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 -#: ../../../../inc/config.php:715 +#: ../../../../inc/config.php:715 ../../../../inc/config.php:721 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 -#: ../../../../inc/config.php:716 +#: ../../../../inc/config.php:716 ../../../../inc/config.php:722 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 -#: ../../../../inc/config.php:717 +#: ../../../../inc/config.php:717 ../../../../inc/config.php:723 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 -#: ../../../../inc/config.php:718 +#: ../../../../inc/config.php:718 ../../../../inc/config.php:724 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 -#: ../../../../inc/config.php:719 +#: ../../../../inc/config.php:719 ../../../../inc/config.php:725 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 -#: ../../../../inc/config.php:720 +#: ../../../../inc/config.php:720 ../../../../inc/config.php:726 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 -#: ../../../../inc/config.php:721 +#: ../../../../inc/config.php:721 ../../../../inc/config.php:727 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 -#: ../../../../inc/config.php:722 +#: ../../../../inc/config.php:722 ../../../../inc/config.php:728 msgid "Maximum file size: %maxsz% bytes
Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
Rozmiar twojego pliku: %filesz% " "bajtów" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 -#: ../../../../inc/config.php:723 +#: ../../../../inc/config.php:723 ../../../../inc/config.php:729 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 -#: ../../../../inc/config.php:724 +#: ../../../../inc/config.php:724 ../../../../inc/config.php:730 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 -#: ../../../../inc/config.php:725 +#: ../../../../inc/config.php:725 ../../../../inc/config.php:731 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 -#: ../../../../inc/config.php:727 +#: ../../../../inc/config.php:727 ../../../../inc/config.php:733 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 -#: ../../../../inc/config.php:728 +#: ../../../../inc/config.php:728 ../../../../inc/config.php:734 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " "odrzucony" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 -#: ../../../../inc/config.php:729 +#: ../../../../inc/config.php:729 ../../../../inc/config.php:735 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 -#: ../../../../inc/config.php:730 +#: ../../../../inc/config.php:730 ../../../../inc/config.php:736 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 -#: ../../../../inc/config.php:734 +#: ../../../../inc/config.php:734 ../../../../inc/config.php:740 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 -#: ../../../../inc/config.php:735 +#: ../../../../inc/config.php:735 ../../../../inc/config.php:741 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 -#: ../../../../inc/config.php:736 +#: ../../../../inc/config.php:736 ../../../../inc/config.php:742 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -284,56 +286,56 @@ msgstr "" "albo zmienione." #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 -#: ../../../../inc/config.php:737 +#: ../../../../inc/config.php:737 ../../../../inc/config.php:743 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 -#: ../../../../inc/config.php:738 +#: ../../../../inc/config.php:738 ../../../../inc/config.php:744 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 -#: ../../../../inc/config.php:739 +#: ../../../../inc/config.php:739 ../../../../inc/config.php:745 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 -#: ../../../../inc/config.php:740 +#: ../../../../inc/config.php:740 ../../../../inc/config.php:746 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 -#: ../../../../inc/config.php:741 +#: ../../../../inc/config.php:741 ../../../../inc/config.php:747 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 -#: ../../../../inc/config.php:742 +#: ../../../../inc/config.php:742 ../../../../inc/config.php:748 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 -#: ../../../../inc/config.php:743 +#: ../../../../inc/config.php:743 ../../../../inc/config.php:749 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 -#: ../../../../inc/config.php:744 +#: ../../../../inc/config.php:744 ../../../../inc/config.php:750 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 -#: ../../../../inc/config.php:745 +#: ../../../../inc/config.php:745 ../../../../inc/config.php:751 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 -#: ../../../../inc/config.php:746 +#: ../../../../inc/config.php:746 ../../../../inc/config.php:752 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -444,7 +446,7 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:292 #: /var/www/html/Tinyboard/inc/display.php:408 -#: ../../../../inc/mod/pages.php:1080 +#: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 msgid "Edit post" msgstr "Edytuj post" @@ -564,6 +566,10 @@ msgstr "Komentarz" #. line 73 #. line 61 #. line 73 +#. line 61 +#. line 73 +#. line 61 +#. line 73 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:191 @@ -617,6 +623,10 @@ msgstr "Weryfikacja" #. line 87 #. line 3 #. line 87 +#. line 3 +#. line 87 +#. line 3 +#. line 87 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 @@ -686,6 +696,10 @@ msgstr "Flagi" #. line 114 #. line 113 #. line 114 +#. line 113 +#. line 114 +#. line 113 +#. line 114 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 @@ -741,6 +755,10 @@ msgstr "Przyklejony" #. line 118 #. line 117 #. line 118 +#. line 117 +#. line 118 +#. line 117 +#. line 118 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 @@ -796,6 +814,10 @@ msgstr "Zablokowany" #. line 122 #. line 121 #. line 122 +#. line 121 +#. line 122 +#. line 121 +#. line 122 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 @@ -844,12 +866,14 @@ msgstr "Odśwież" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:478 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:415 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:461 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:472 msgid "Reply" msgstr "Odpowiedź" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:511 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:442 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:488 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:499 msgid "1 post" msgid_plural "%count% posts" msgstr[0] "1 post" @@ -859,12 +883,14 @@ msgstr[2] "%count% postów" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:517 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:448 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:494 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 msgid "and" msgstr "oraz" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:528 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:459 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:516 msgid "1 image reply" msgid_plural "%count% image replies" msgstr[0] "1 obrazek" @@ -874,6 +900,7 @@ msgstr[2] "%count% obrazków" #: /var/www/html/Tinyboard/templates/cache/96/13/d13c7abb8d82989e547dc9be1787.php:533 #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:464 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:510 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:521 msgid "omitted. Click reply to view." msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." @@ -885,13 +912,17 @@ msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." #: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:121 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:98 #: ../../../../templates/cache/62/8c/21348d46377c3e1b3f8c476ba376.php:62 +#: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:131 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:115 msgid "Return to dashboard" msgstr "Powróć na tablicę" #. line 27 +#. line 31 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:165 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:177 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:106 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:123 msgid "Posting mode: Reply" msgstr "Tryb postowania: Odpowiedź" @@ -901,6 +932,8 @@ msgstr "Tryb postowania: Odpowiedź" #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:222 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:109 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:155 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:126 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:172 msgid "Return" msgstr "Powrót" @@ -941,21 +974,25 @@ msgstr "Wiadomości prywatne" #: /var/www/html/Tinyboard/mod.php:136 /var/www/html/Tinyboard/mod.php:874 #: ../../../../inc/mod/pages.php:376 ../../../../inc/mod/pages.php:393 +#: ../../../../inc/mod/pages.php:406 msgid "News" msgstr "Aktualności" #: /var/www/html/Tinyboard/mod.php:141 /var/www/html/Tinyboard/mod.php:1614 #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 +#: ../../../../inc/mod/pages.php:1682 msgid "Report queue" msgstr "Kolejka zgłoszeń" #: /var/www/html/Tinyboard/mod.php:144 /var/www/html/Tinyboard/mod.php:1882 #: ../../../../inc/mod/pages.php:664 ../../../../inc/mod/pages.php:705 +#: ../../../../inc/mod/pages.php:721 msgid "Ban list" msgstr "Lista banów" #: /var/www/html/Tinyboard/mod.php:147 /var/www/html/Tinyboard/mod.php:1288 #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 +#: ../../../../inc/mod/pages.php:1394 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -966,6 +1003,7 @@ msgstr "Zmień swoje hasło" #: /var/www/html/Tinyboard/mod.php:152 /var/www/html/Tinyboard/mod.php:477 #: ../../../../inc/mod/pages.php:416 ../../../../inc/mod/pages.php:443 #: ../../../../inc/mod/pages.php:433 ../../../../inc/mod/pages.php:460 +#: ../../../../inc/mod/pages.php:446 ../../../../inc/mod/pages.php:473 msgid "Moderation log" msgstr "Log moderacji" @@ -983,6 +1021,7 @@ msgstr "Pokaż konfigurację" #: /var/www/html/Tinyboard/mod.php:165 /var/www/html/Tinyboard/mod.php:709 #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 +#: ../../../../inc/mod/pages.php:1830 msgid "Manage themes" msgstr "Zarządzaj dodatkami" @@ -1038,12 +1077,12 @@ msgid "Action" msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 -#: ../../../../inc/mod/pages.php:1789 +#: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 -#: ../../../../inc/mod/pages.php:1791 +#: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -1077,7 +1116,8 @@ msgstr "Instaluj" #: /var/www/html/Tinyboard/mod.php:693 ../../../../inc/mod/pages.php:1467 #: ../../../../inc/mod/pages.php:1471 ../../../../inc/mod/pages.php:1567 -#: ../../../../inc/mod/pages.php:1571 +#: ../../../../inc/mod/pages.php:1571 ../../../../inc/mod/pages.php:1592 +#: ../../../../inc/mod/pages.php:1596 msgid "Rebuild" msgstr "Przebuduj" @@ -1098,7 +1138,7 @@ msgid "Post to noticeboard" msgstr "Postuj na tablicy ogłoszeń" #: /var/www/html/Tinyboard/mod.php:792 ../../../../inc/mod/pages.php:316 -#: ../../../../inc/mod/pages.php:333 +#: ../../../../inc/mod/pages.php:333 ../../../../inc/mod/pages.php:346 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -1168,12 +1208,12 @@ msgid "Configuration" msgstr "Konfiguracja" #: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 -#: ../../../../inc/mod/pages.php:272 +#: ../../../../inc/mod/pages.php:272 ../../../../inc/mod/pages.php:285 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." #: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 -#: ../../../../inc/mod/pages.php:800 +#: ../../../../inc/mod/pages.php:800 ../../../../inc/mod/pages.php:823 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." @@ -1182,6 +1222,7 @@ msgid "No board to move to; there is only one." msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." #: ../../../../inc/config.php:689 ../../../../inc/config.php:747 +#: ../../../../inc/config.php:753 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." @@ -1190,68 +1231,83 @@ msgid "Confirm action" msgstr "Potwierdź akcję" #: ../../../../inc/mod/pages.php:222 ../../../../inc/mod/pages.php:239 +#: ../../../../inc/mod/pages.php:252 msgid "Edit board" msgstr "Edytuj board" #: ../../../../inc/mod/pages.php:270 ../../../../inc/mod/pages.php:287 +#: ../../../../inc/mod/pages.php:300 msgid "New board" msgstr "Nowy board" #: ../../../../inc/mod/pages.php:586 ../../../../inc/mod/pages.php:612 +#: ../../../../inc/mod/pages.php:628 msgid "IP" msgstr "adres IP" #: ../../../../inc/mod/pages.php:596 ../../../../inc/mod/pages.php:985 #: ../../../../inc/mod/pages.php:622 ../../../../inc/mod/pages.php:1028 +#: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 msgid "New ban" msgstr "Nowy ban" #: ../../../../inc/mod/pages.php:919 ../../../../inc/mod/pages.php:962 +#: ../../../../inc/mod/pages.php:987 msgid "Impossible to move thread; there is only one board." msgstr "Nie można przenieść wątku; istnieje tylko jeden board." #: ../../../../inc/mod/pages.php:923 ../../../../inc/mod/pages.php:966 +#: ../../../../inc/mod/pages.php:991 msgid "Move thread" msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1209 ../../../../inc/mod/pages.php:1258 #: ../../../../inc/mod/pages.php:1307 ../../../../inc/mod/pages.php:1356 +#: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 msgid "Edit user" msgstr "Edytuj użytkownika" #. deleted? #: ../../../../inc/mod/pages.php:1333 ../../../../inc/mod/pages.php:1405 #: ../../../../inc/mod/pages.php:1431 ../../../../inc/mod/pages.php:1503 +#: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 +#: ../../../../inc/mod/pages.php:1460 msgid "Private message" msgstr "Prywatna wiadomość" #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 +#: ../../../../inc/mod/pages.php:1481 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 +#: ../../../../inc/mod/pages.php:1804 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 +#: ../../../../inc/mod/pages.php:1970 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 +#: ../../../../inc/mod/pages.php:1892 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 +#: ../../../../inc/mod/pages.php:1903 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 +#: ../../../../inc/mod/pages.php:1931 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1262,21 +1318,21 @@ msgid "" "\n" msgstr "" -#: ../../../../inc/config.php:704 +#: ../../../../inc/config.php:704 ../../../../inc/config.php:710 msgid "Thread has reached its maximum reply limit." msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." -#: ../../../../inc/config.php:705 +#: ../../../../inc/config.php:705 ../../../../inc/config.php:711 msgid "Thread has reached its maximum image limit." msgstr "Ten temat osiągnął swój maksymalny limit obrazków." -#: ../../../../inc/config.php:726 +#: ../../../../inc/config.php:726 ../../../../inc/config.php:732 #, php-format msgid "That file already exists in this thread!" msgstr "Ten plik już istnieje w tym temacie!" #. Moderator errors -#: ../../../../inc/config.php:733 +#: ../../../../inc/config.php:733 ../../../../inc/config.php:739 #, php-format msgid "" "You are only allowed to unban %s users at a time. You tried to unban %u " @@ -1284,10 +1340,18 @@ msgid "" msgstr "" "Możesz odbanować tylko %s użytkowników na raz. Próbowałeś odbanować %u users." -#: ../../../../inc/mod/pages.php:1969 +#: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" -#: ../../../../inc/mod/pages.php:1993 +#: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 msgid "Debug: SQL" msgstr "Debug: SQL" + +#. line 28 +#: ../../../../templates/cache/4b/3e/915cc5ac5fe144c331207c656528.php:104 +msgid "1 reply" +msgid_plural "%count% replies" +msgstr[0] "1 odpowiedź" +msgstr[1] "%count% odpowiedzi" +msgstr[2] "%count% odpowiedzi" -- cgit v1.3 From b772be7c5b37d5bbfb117e6417bd61847a645eba Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 20 Jul 2013 20:23:55 -0400 Subject: Update Polish translation --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 14191 -> 18730 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 482 ++++++++++++++++++++++++++++-- 2 files changed, 463 insertions(+), 19 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index ac57873e..b1ccc28d 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 9bc9eece..8af9b27b 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-18 16:31-0400\n" +"POT-Creation-Date: 2013-07-20 20:07-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,11 +41,17 @@ msgid "Unsupported file format: " msgstr "Niewspierany format pliku: " #: /var/www/html/Tinyboard/inc/mod.php:129 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:74 msgid "Create new board" msgstr "Stwórz nowy board" +#. line 71 #: /var/www/html/Tinyboard/inc/mod.php:138 #: /var/www/html/Tinyboard/mod.php:1833 /var/www/html/Tinyboard/mod.php:3036 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:291 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:75 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:150 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:207 msgid "all boards" msgstr "wszystkie boardy" @@ -447,6 +453,7 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:292 #: /var/www/html/Tinyboard/inc/display.php:408 #: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 +#: ../../../../inc/mod/pages.php:1239 msgid "Edit post" msgstr "Edytuj post" @@ -570,6 +577,8 @@ msgstr "Komentarz" #. line 73 #. line 61 #. line 73 +#. line 61 +#. line 73 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:191 @@ -627,6 +636,8 @@ msgstr "Weryfikacja" #. line 87 #. line 3 #. line 87 +#. line 3 +#. line 87 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 @@ -700,6 +711,8 @@ msgstr "Flagi" #. line 114 #. line 113 #. line 114 +#. line 113 +#. line 114 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 @@ -759,6 +772,8 @@ msgstr "Przyklejony" #. line 118 #. line 117 #. line 118 +#. line 117 +#. line 118 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 @@ -818,6 +833,8 @@ msgstr "Zablokowany" #. line 122 #. line 121 #. line 122 +#. line 121 +#. line 122 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 @@ -827,6 +844,8 @@ msgstr "Zablokowany" msgid "Raw HTML" msgstr "Czysty HTML" +#. line 129 +#. line 14 #. line 129 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:230 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:23 @@ -834,6 +853,7 @@ msgstr "Czysty HTML" #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:23 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:23 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:342 +#: ../../../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:41 msgid "Password" msgstr "Hasło" @@ -884,6 +904,7 @@ msgstr[2] "%count% postów" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:448 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:494 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:114 msgid "and" msgstr "oraz" @@ -945,10 +966,17 @@ msgid "Delete Post" msgstr "Usuń post" #. line 8 +#. line 106 +#. line 8 +#. line 32 +#. line 48 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:32 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:256 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:90 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:128 msgid "Reason" msgstr "Powód" @@ -961,6 +989,7 @@ msgstr "Zgłoszenie" #: /var/www/html/Tinyboard/mod.php:104 /var/www/html/Tinyboard/mod.php:776 #: /var/www/html/Tinyboard/mod.php:862 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:120 msgid "no subject" msgstr "brak tematu" @@ -974,25 +1003,29 @@ msgstr "Wiadomości prywatne" #: /var/www/html/Tinyboard/mod.php:136 /var/www/html/Tinyboard/mod.php:874 #: ../../../../inc/mod/pages.php:376 ../../../../inc/mod/pages.php:393 -#: ../../../../inc/mod/pages.php:406 +#: ../../../../inc/mod/pages.php:406 ../../../../inc/mod/pages.php:540 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:166 msgid "News" msgstr "Aktualności" #: /var/www/html/Tinyboard/mod.php:141 /var/www/html/Tinyboard/mod.php:1614 #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 -#: ../../../../inc/mod/pages.php:1682 +#: ../../../../inc/mod/pages.php:1682 ../../../../inc/mod/pages.php:1816 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207 msgid "Report queue" msgstr "Kolejka zgłoszeń" #: /var/www/html/Tinyboard/mod.php:144 /var/www/html/Tinyboard/mod.php:1882 #: ../../../../inc/mod/pages.php:664 ../../../../inc/mod/pages.php:705 -#: ../../../../inc/mod/pages.php:721 +#: ../../../../inc/mod/pages.php:721 ../../../../inc/mod/pages.php:855 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:224 msgid "Ban list" msgstr "Lista banów" #: /var/www/html/Tinyboard/mod.php:147 /var/www/html/Tinyboard/mod.php:1288 #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 -#: ../../../../inc/mod/pages.php:1394 +#: ../../../../inc/mod/pages.php:1394 ../../../../inc/mod/pages.php:1528 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -1004,6 +1037,9 @@ msgstr "Zmień swoje hasło" #: ../../../../inc/mod/pages.php:416 ../../../../inc/mod/pages.php:443 #: ../../../../inc/mod/pages.php:433 ../../../../inc/mod/pages.php:460 #: ../../../../inc/mod/pages.php:446 ../../../../inc/mod/pages.php:473 +#: ../../../../inc/mod/pages.php:580 ../../../../inc/mod/pages.php:607 +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:65 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:255 msgid "Moderation log" msgstr "Log moderacji" @@ -1021,15 +1057,28 @@ msgstr "Pokaż konfigurację" #: /var/www/html/Tinyboard/mod.php:165 /var/www/html/Tinyboard/mod.php:709 #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 -#: ../../../../inc/mod/pages.php:1830 +#: ../../../../inc/mod/pages.php:1830 ../../../../inc/mod/pages.php:1964 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247 msgid "Manage themes" msgstr "Zarządzaj dodatkami" +#. line 2 +#. line 5 #: /var/www/html/Tinyboard/mod.php:170 +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:19 +#: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:24 msgid "Phrase:" msgstr "Wyrażenie:" +#. line 16 +#. line 2 +#. line 106 +#. line 2 #: /var/www/html/Tinyboard/mod.php:172 +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:72 +#: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:19 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:286 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:19 msgid "Search" msgstr "Szukaj" @@ -1047,7 +1096,9 @@ msgstr "" msgid "Could not find current version! (Check .installed)" msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" +#. line 146 #: /var/www/html/Tinyboard/mod.php:233 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:364 msgid "Logout" msgstr "Wyloguj" @@ -1060,7 +1111,11 @@ msgstr "Tablica" msgid "User" msgstr "Użytkownik" +#. line 16 +#. line 134 #: /var/www/html/Tinyboard/mod.php:403 /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:48 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:349 msgid "IP address" msgstr "Adres IP" @@ -1068,21 +1123,37 @@ msgstr "Adres IP" msgid "Ago" msgstr "temu" +#. line 116 +#. line 182 +#. line 65 +#. line 49 +#. line 136 #: /var/www/html/Tinyboard/mod.php:405 /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:278 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:427 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:142 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:131 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:355 msgid "Board" msgstr "Board" +#. line 183 +#. line 137 #: /var/www/html/Tinyboard/mod.php:406 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:430 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:358 msgid "Action" msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 #: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 +#: ../../../../inc/mod/pages.php:1948 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 #: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 +#: ../../../../inc/mod/pages.php:1950 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -1099,6 +1170,7 @@ msgid "Thumbnail" msgstr "Miniatura" #: /var/www/html/Tinyboard/mod.php:687 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:86 msgid "Actions" msgstr "Akcje" @@ -1117,7 +1189,9 @@ msgstr "Instaluj" #: /var/www/html/Tinyboard/mod.php:693 ../../../../inc/mod/pages.php:1467 #: ../../../../inc/mod/pages.php:1471 ../../../../inc/mod/pages.php:1567 #: ../../../../inc/mod/pages.php:1571 ../../../../inc/mod/pages.php:1592 -#: ../../../../inc/mod/pages.php:1596 +#: ../../../../inc/mod/pages.php:1596 ../../../../inc/mod/pages.php:1726 +#: ../../../../inc/mod/pages.php:1730 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263 msgid "Rebuild" msgstr "Przebuduj" @@ -1137,8 +1211,11 @@ msgstr "Zawartość" msgid "Post to noticeboard" msgstr "Postuj na tablicy ogłoszeń" +#. line 31 #: /var/www/html/Tinyboard/mod.php:792 ../../../../inc/mod/pages.php:316 #: ../../../../inc/mod/pages.php:333 ../../../../inc/mod/pages.php:346 +#: ../../../../inc/mod/pages.php:480 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:96 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -1162,7 +1239,9 @@ msgstr "nieprzeczytane" msgid "ID" msgstr "ID" +#. line 6 #: /var/www/html/Tinyboard/mod.php:1221 +#: ../../../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:28 msgid "Username" msgstr "Nazwa użytkownika" @@ -1170,7 +1249,9 @@ msgstr "Nazwa użytkownika" msgid "Type" msgstr "Typ" +#. line 2 #: /var/www/html/Tinyboard/mod.php:1221 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:19 msgid "Boards" msgstr "Boardy" @@ -1186,15 +1267,37 @@ msgstr "Stwórz nowego użytkownika" msgid "Could not re-login after changing password. (?)" msgstr "Nie można się ponownie zalogować po zmianie hasła. (?)" +#. line 126 +#. line 50 #: /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:300 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:134 msgid "Set" msgstr "Ustawione" +#. line 130 +#. line 52 #: /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:309 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:140 msgid "Expires" msgstr "Wygasa" +#. line 24 +#. line 62 +#. line 150 +#. line 180 +#. line 17 +#. line 54 +#. line 133 #: /var/www/html/Tinyboard/mod.php:1801 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:74 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:169 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:352 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:421 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:51 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:146 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:346 msgid "Staff" msgstr "Ekipa" @@ -1204,16 +1307,19 @@ msgstr "Cache jest wyłączone." #: /var/www/html/Tinyboard/mod.php:1966 /var/www/html/Tinyboard/mod.php:2057 #: /var/www/html/Tinyboard/mod.php:2106 /var/www/html/Tinyboard/mod.php:2110 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:271 msgid "Configuration" msgstr "Konfiguracja" #: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 #: ../../../../inc/mod/pages.php:272 ../../../../inc/mod/pages.php:285 +#: ../../../../inc/mod/pages.php:419 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." #: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 #: ../../../../inc/mod/pages.php:800 ../../../../inc/mod/pages.php:823 +#: ../../../../inc/mod/pages.php:957 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." @@ -1231,39 +1337,49 @@ msgid "Confirm action" msgstr "Potwierdź akcję" #: ../../../../inc/mod/pages.php:222 ../../../../inc/mod/pages.php:239 -#: ../../../../inc/mod/pages.php:252 +#: ../../../../inc/mod/pages.php:252 ../../../../inc/mod/pages.php:386 msgid "Edit board" msgstr "Edytuj board" #: ../../../../inc/mod/pages.php:270 ../../../../inc/mod/pages.php:287 -#: ../../../../inc/mod/pages.php:300 +#: ../../../../inc/mod/pages.php:300 ../../../../inc/mod/pages.php:434 msgid "New board" msgstr "Nowy board" +#. line 102 +#. line 20 #: ../../../../inc/mod/pages.php:586 ../../../../inc/mod/pages.php:612 -#: ../../../../inc/mod/pages.php:628 +#: ../../../../inc/mod/pages.php:628 ../../../../inc/mod/pages.php:762 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:247 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:65 msgid "IP" msgstr "adres IP" +#. line 169 #: ../../../../inc/mod/pages.php:596 ../../../../inc/mod/pages.php:985 #: ../../../../inc/mod/pages.php:622 ../../../../inc/mod/pages.php:1028 #: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 +#: ../../../../inc/mod/pages.php:772 ../../../../inc/mod/pages.php:1187 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:398 msgid "New ban" msgstr "Nowy ban" #: ../../../../inc/mod/pages.php:919 ../../../../inc/mod/pages.php:962 -#: ../../../../inc/mod/pages.php:987 +#: ../../../../inc/mod/pages.php:987 ../../../../inc/mod/pages.php:1121 msgid "Impossible to move thread; there is only one board." msgstr "Nie można przenieść wątku; istnieje tylko jeden board." +#. line 39 #: ../../../../inc/mod/pages.php:923 ../../../../inc/mod/pages.php:966 -#: ../../../../inc/mod/pages.php:991 +#: ../../../../inc/mod/pages.php:991 ../../../../inc/mod/pages.php:1125 +#: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:106 msgid "Move thread" msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1209 ../../../../inc/mod/pages.php:1258 #: ../../../../inc/mod/pages.php:1307 ../../../../inc/mod/pages.php:1356 #: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 +#: ../../../../inc/mod/pages.php:1466 ../../../../inc/mod/pages.php:1515 msgid "Edit user" msgstr "Edytuj użytkownika" @@ -1271,43 +1387,46 @@ msgstr "Edytuj użytkownika" #: ../../../../inc/mod/pages.php:1333 ../../../../inc/mod/pages.php:1405 #: ../../../../inc/mod/pages.php:1431 ../../../../inc/mod/pages.php:1503 #: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 +#: ../../../../inc/mod/pages.php:1590 ../../../../inc/mod/pages.php:1662 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 -#: ../../../../inc/mod/pages.php:1460 +#: ../../../../inc/mod/pages.php:1460 ../../../../inc/mod/pages.php:1594 msgid "Private message" msgstr "Prywatna wiadomość" +#. line 62 #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 -#: ../../../../inc/mod/pages.php:1481 +#: ../../../../inc/mod/pages.php:1481 ../../../../inc/mod/pages.php:1615 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 -#: ../../../../inc/mod/pages.php:1804 +#: ../../../../inc/mod/pages.php:1804 ../../../../inc/mod/pages.php:1938 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 -#: ../../../../inc/mod/pages.php:1970 +#: ../../../../inc/mod/pages.php:1970 ../../../../inc/mod/pages.php:2104 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 -#: ../../../../inc/mod/pages.php:1892 +#: ../../../../inc/mod/pages.php:1892 ../../../../inc/mod/pages.php:2026 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 -#: ../../../../inc/mod/pages.php:1903 +#: ../../../../inc/mod/pages.php:1903 ../../../../inc/mod/pages.php:2037 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 -#: ../../../../inc/mod/pages.php:1931 +#: ../../../../inc/mod/pages.php:1931 ../../../../inc/mod/pages.php:2065 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1341,10 +1460,12 @@ msgstr "" "Możesz odbanować tylko %s użytkowników na raz. Próbowałeś odbanować %u users." #: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 +#: ../../../../inc/mod/pages.php:2128 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" #: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 +#: ../../../../inc/mod/pages.php:2152 msgid "Debug: SQL" msgstr "Debug: SQL" @@ -1355,3 +1476,326 @@ msgid_plural "%count% replies" msgstr[0] "1 odpowiedź" msgstr[1] "%count% odpowiedzi" msgstr[2] "%count% odpowiedzi" + +#. $results now contains the search results +#: ../../../../inc/mod/pages.php:290 +msgid "Search results" +msgstr "Wyniki wyszukiwania" + +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:31 +msgid "Posts" +msgstr "Posty" + +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:41 +msgid "IP address notes" +msgstr "Notatki adresu IP" + +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:53 +msgid "Bans" +msgstr "Bany" + +#. line 18 +#: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:76 +msgid "" +"(Search is case-insensitive and based on keywords. To match exact phrases, " +"use \"quotes\". Use an asterisk (*) for wildcard.)" +msgstr "" +"(Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " +"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " +"wieloznacznego.)" + +#. line 8 +#: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:32 +msgid "Select board" +msgstr "Wybierz board" + +#. line 17 +#: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:61 +msgid "" +"Search is case-insensitive and based on keywords. To match exact phrases, " +"use \"quotes\". Use an asterisk (*) for wildcard.

You may apply the following filters to your searches: " +"id, thread, subject, and " +"name. To apply a filter, simply add to your query, for " +"example, name:Anonymous or subject:\"Some Thread\". " +"Wildcards cannot be used in filters." +msgstr "" +"Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " +"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " +"wieloznacznego.

Możesz zastosować poniższe " +"filtry do swojego wyszukiwania: id, thread, " +"subject, i name. Aby wykorzystać filtr, " +"po prostu dodaj do swojego zapytania, na przykład: name:Anonymous " +"albo subject:\"Jakiś temat\". Symbole wieloznaczne nie mogą być " +"wykorzystane w filtrach." + +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:57 +msgid "edit" +msgstr "edytuj" + +#. line 26 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:84 +msgid "Messages" +msgstr "Wiadomości" + +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:161 +msgid "View all noticeboard entries" +msgstr "Pokaż wszystkie wpisy na tablicy ogłoszeń" + +#. line 70 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:192 +msgid "Administration" +msgstr "Administracja" + +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:239 +msgid "Change password" +msgstr "Zmień hasło" + +#. line 118 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:308 +msgid "Debug" +msgstr "Debug" + +#. line 120 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:312 +msgid "Anti-spam" +msgstr "Antyspam" + +#. line 121 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:315 +msgid "Recent posts" +msgstr "Ostatnie posty" + +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:321 +msgid "SQL" +msgstr "SQL" + +#. line 143 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:359 +msgid "User account" +msgstr "Konto użytkownika" + +#. line 25 +#. line 67 +#. line 18 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:77 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:179 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:54 +msgid "Note" +msgstr "Notka" + +#. line 26 +#. line 19 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:80 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:57 +msgid "Date" +msgstr "Data" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:112 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:365 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:457 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:88 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:321 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:385 +msgid "deleted?" +msgstr "usunięty?" + +#. line 49 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:142 +msgid "remove" +msgstr "usuń" + +#. line 75 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:189 +msgid "New note" +msgstr "Nowa notka" + +#. line 92 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:226 +msgid "Status" +msgstr "Status" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:233 +msgid "Expired" +msgstr "Wygasły" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:238 +msgid "Active" +msgstr "Aktywny" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:269 +msgid "no reason" +msgstr "brak powodu" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:322 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:246 +msgid "never" +msgstr "nigdy" + +#. line 140 +#. line 53 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:331 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:143 +msgid "Seen" +msgstr "Widziano" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:338 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:273 +msgid "Yes" +msgstr "Tak" + +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:343 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:278 +msgid "No" +msgstr "Nie" + +#. line 161 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:378 +msgid "Remove ban" +msgstr "Usuń ban" + +#. line 181 +#. line 135 +#: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:424 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:352 +msgid "Time" +msgstr "Czas" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:41 +msgid "You were banned! ;_;" +msgstr "Byłeś zbanowany! ;_;" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:46 +msgid "You are banned! ;_;" +msgstr "Jesteś zbanowany! ;_;" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:56 +msgid "You were banned from" +msgstr "Byłeś zbanowany na" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:61 +msgid "You have been banned from" +msgstr "Zostałeś zbanowany na" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:83 +msgid "for the following reason:" +msgstr "z następującego powodu:" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:88 +msgid "for an unspecified reason." +msgstr "z nieokreślonego powodu." + +#. line 32 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:109 +msgid "Your ban was filed on" +msgstr "Twój ban został nałożony" + +#. line 51 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:120 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:150 +msgid "has since expired. Refresh the page to continue." +msgstr "już wygasł. Odśwież stronę, aby kontynuować." + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:125 +msgid "expires" +msgstr "wygasa" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:128 +msgid "from now, which is on" +msgstr "od teraz, czyli" + +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:176 +msgid "will not expire" +msgstr "nie wygaśnie" + +#. line 78 +#: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:184 +msgid "Your IP address is" +msgstr "Twój adres IP to" + +#. line 23 +#: ../../../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:52 +msgid "Continue" +msgstr "Kontynuuj" + +#. line 6 +#: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:30 +msgid "Thread ID" +msgstr "ID wątku" + +#. line 14 +#: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:44 +msgid "Leave shadow thread" +msgstr "Pozostaw wątek-cień" + +#. line 18 +#: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:50 +msgid "locks thread; replies to it with a link." +msgstr "blokuje wątek; umieszcza link do nowego." + +#. line 22 +#: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:56 +msgid "Target board" +msgstr "Board docelowy" + +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:66 +msgid "(or subnet)" +msgstr "(lub podsieć)" + +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:80 +msgid "hidden" +msgstr "ukryty" + +#. line 41 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:107 +msgid "Message" +msgstr "Wiadomość" + +#. line 46 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:117 +msgid "public; attached to post" +msgstr "publiczny; dołączony do posta" + +#. line 58 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:133 +msgid "Length" +msgstr "Długość" + +#. line 88 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:192 +msgid "New Ban" +msgstr "Nowy ban" + +#. line 47 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:125 +msgid "IP address/mask" +msgstr "Adres IP lub maska" + +#. line 51 +#: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:137 +msgid "Duration" +msgstr "Czas trwania" + +#: ../../../../search.php:5 +msgid "Post search is disabled" +msgstr "Wyszukiwanie postów jest wyłączone" + +#: ../../../../search.php:25 ../../../../search.php:31 +msgid "Wait a while before searching again, please." +msgstr "Proszę poczekać chwilę przed ponownym szukaniem." + +#: ../../../../search.php:128 +msgid "Query too broad." +msgstr "Zapytanie zbyt szerokie." + +#: ../../../../search.php:149 +#, php-format +msgid "%d result in" +msgid_plural "%d results in" +msgstr[0] "%d wynik na" +msgstr[1] "%d wyniki na" +msgstr[2] "%d wyników na" + +#: ../../../../search.php:160 +msgid "No results." +msgstr "Brak wyników." -- cgit v1.3 From 22556f43f5fd845e3d0536b79c263290a70f3672 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 02:01:42 -0400 Subject: Update Polish locale --- inc/locale/pl_PL/LC_MESSAGES/javascript.js | 2 +- inc/locale/pl_PL/LC_MESSAGES/javascript.po | 26 ++- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 18730 -> 19790 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 338 +++++++++++++++++++++++++++-- 4 files changed, 342 insertions(+), 24 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.js b/inc/locale/pl_PL/LC_MESSAGES/javascript.js index 44857b98..caf4a66c 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.js +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.js @@ -1 +1 @@ -l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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"}; \ No newline at end of file +l10n = {"Submit":"Wy\u015blij","Quick reply":"Szybka odpowied\u017a","Posting mode: Replying to >>{0}<\/small>":"Tryb postowania: Odpowied\u017a na >>{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","hide":"ukryj","show":"poka\u017c","hidden":"ukryte","Show images":"Poka\u017c obrazki","Hide images":"Ukryj obrazki"}; \ No newline at end of file diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po index 3c16c8d7..482ec45f 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.po +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-18 16:31-0400\n" +"POT-Creation-Date: 2013-07-27 01:54-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -41,7 +41,7 @@ msgstr "Kliknij Odpowiedź aby zobaczyć." msgid "Click to expand" msgstr "Kliknij aby rozwinąć" -#: ../../../../js/expand.js:41 +#: ../../../../js/expand.js:41 ../../../../js/expand.js:45 msgid "Hide expanded replies" msgstr "Schowaj rozwinięte odpowiedzi" @@ -104,7 +104,7 @@ msgstr "Hasło" msgid "Delete file only" msgstr "Usuń tylko plik" -#: ../../../../js/quick-post-controls.js:30 +#: ../../../../js/quick-post-controls.js:30 ../../../../js/hide-images.js:50 msgid "File" msgstr "Plik" @@ -119,3 +119,23 @@ msgstr "Powód" #: ../../../../js/quick-post-controls.js:37 msgid "Report" msgstr "Zgłoszenie" + +#: ../../../../js/hide-images.js:50 +msgid "hide" +msgstr "ukryj" + +#: ../../../../js/hide-images.js:56 +msgid "show" +msgstr "pokaż" + +#: ../../../../js/toggle-images.js:41 +msgid "hidden" +msgstr "ukryte" + +#: ../../../../js/toggle-images.js:57 ../../../../js/toggle-images.js:70 +msgid "Show images" +msgstr "Pokaż obrazki" + +#: ../../../../js/toggle-images.js:57 ../../../../js/toggle-images.js:70 +msgid "Hide images" +msgstr "Ukryj obrazki" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index b1ccc28d..2a31d64e 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 8af9b27b..ca4f7ea4 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-20 20:07-0400\n" +"POT-Creation-Date: 2013-07-27 01:54-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -52,10 +52,11 @@ msgstr "Stwórz nowy board" #: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:75 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:150 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:207 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:155 msgid "all boards" msgstr "wszystkie boardy" -#: /var/www/html/Tinyboard/inc/config.php:305 +#: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 msgid "You have been muted for unoriginal content." msgstr "Zostałeś zagłuszony za nieoryginalną treść." @@ -83,16 +84,19 @@ msgstr "Szybka odpowiedź" #. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 #: ../../../../inc/config.php:692 ../../../../inc/config.php:698 +#: ../../../../inc/config.php:695 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 #: ../../../../inc/config.php:693 ../../../../inc/config.php:699 +#: ../../../../inc/config.php:696 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 #: ../../../../inc/config.php:694 ../../../../inc/config.php:700 +#: ../../../../inc/config.php:697 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " @@ -100,135 +104,161 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 #: ../../../../inc/config.php:695 ../../../../inc/config.php:701 +#: ../../../../inc/config.php:698 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 #: ../../../../inc/config.php:696 ../../../../inc/config.php:702 +#: ../../../../inc/config.php:699 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 #: ../../../../inc/config.php:697 ../../../../inc/config.php:703 +#: ../../../../inc/config.php:700 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 #: ../../../../inc/config.php:698 ../../../../inc/config.php:704 +#: ../../../../inc/config.php:701 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 #: ../../../../inc/config.php:699 ../../../../inc/config.php:705 +#: ../../../../inc/config.php:702 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 #: ../../../../inc/config.php:700 ../../../../inc/config.php:706 +#: ../../../../inc/config.php:703 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 #: ../../../../inc/config.php:701 ../../../../inc/config.php:707 +#: ../../../../inc/config.php:704 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 #: ../../../../inc/config.php:702 ../../../../inc/config.php:708 +#: ../../../../inc/config.php:705 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 #: ../../../../inc/config.php:703 ../../../../inc/config.php:709 +#: ../../../../inc/config.php:706 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 #: ../../../../inc/config.php:706 ../../../../inc/config.php:712 +#: ../../../../inc/config.php:709 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 #: ../../../../inc/config.php:707 ../../../../inc/config.php:713 +#: ../../../../inc/config.php:710 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 #: ../../../../inc/config.php:708 ../../../../inc/config.php:714 +#: ../../../../inc/config.php:711 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 #: ../../../../inc/config.php:709 ../../../../inc/config.php:715 +#: ../../../../inc/config.php:712 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 #: ../../../../inc/config.php:710 ../../../../inc/config.php:716 +#: ../../../../inc/config.php:713 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 +#: ../../../../inc/config.php:714 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 +#: ../../../../inc/config.php:715 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 +#: ../../../../inc/config.php:716 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 +#: ../../../../inc/config.php:717 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 #: ../../../../inc/config.php:715 ../../../../inc/config.php:721 +#: ../../../../inc/config.php:718 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 #: ../../../../inc/config.php:716 ../../../../inc/config.php:722 +#: ../../../../inc/config.php:719 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 #: ../../../../inc/config.php:717 ../../../../inc/config.php:723 +#: ../../../../inc/config.php:720 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 #: ../../../../inc/config.php:718 ../../../../inc/config.php:724 +#: ../../../../inc/config.php:721 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 #: ../../../../inc/config.php:719 ../../../../inc/config.php:725 +#: ../../../../inc/config.php:722 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 #: ../../../../inc/config.php:720 ../../../../inc/config.php:726 +#: ../../../../inc/config.php:723 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 #: ../../../../inc/config.php:721 ../../../../inc/config.php:727 +#: ../../../../inc/config.php:724 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 #: ../../../../inc/config.php:722 ../../../../inc/config.php:728 +#: ../../../../inc/config.php:725 msgid "Maximum file size: %maxsz% bytes
Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
Rozmiar twojego pliku: %filesz% " @@ -236,28 +266,33 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 #: ../../../../inc/config.php:723 ../../../../inc/config.php:729 +#: ../../../../inc/config.php:726 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 #: ../../../../inc/config.php:724 ../../../../inc/config.php:730 +#: ../../../../inc/config.php:727 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 #: ../../../../inc/config.php:725 ../../../../inc/config.php:731 +#: ../../../../inc/config.php:728 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 #: ../../../../inc/config.php:727 ../../../../inc/config.php:733 +#: ../../../../inc/config.php:730 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 #: ../../../../inc/config.php:728 ../../../../inc/config.php:734 +#: ../../../../inc/config.php:731 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " @@ -265,26 +300,31 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 #: ../../../../inc/config.php:729 ../../../../inc/config.php:735 +#: ../../../../inc/config.php:732 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 #: ../../../../inc/config.php:730 ../../../../inc/config.php:736 +#: ../../../../inc/config.php:733 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 #: ../../../../inc/config.php:734 ../../../../inc/config.php:740 +#: ../../../../inc/config.php:737 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 #: ../../../../inc/config.php:735 ../../../../inc/config.php:741 +#: ../../../../inc/config.php:738 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 #: ../../../../inc/config.php:736 ../../../../inc/config.php:742 +#: ../../../../inc/config.php:739 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -293,55 +333,65 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 #: ../../../../inc/config.php:737 ../../../../inc/config.php:743 +#: ../../../../inc/config.php:740 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 #: ../../../../inc/config.php:738 ../../../../inc/config.php:744 +#: ../../../../inc/config.php:741 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 #: ../../../../inc/config.php:739 ../../../../inc/config.php:745 +#: ../../../../inc/config.php:742 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 #: ../../../../inc/config.php:740 ../../../../inc/config.php:746 +#: ../../../../inc/config.php:743 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 #: ../../../../inc/config.php:741 ../../../../inc/config.php:747 +#: ../../../../inc/config.php:744 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 #: ../../../../inc/config.php:742 ../../../../inc/config.php:748 +#: ../../../../inc/config.php:745 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 #: ../../../../inc/config.php:743 ../../../../inc/config.php:749 +#: ../../../../inc/config.php:746 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 #: ../../../../inc/config.php:744 ../../../../inc/config.php:750 +#: ../../../../inc/config.php:747 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 #: ../../../../inc/config.php:745 ../../../../inc/config.php:751 +#: ../../../../inc/config.php:748 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 #: ../../../../inc/config.php:746 ../../../../inc/config.php:752 +#: ../../../../inc/config.php:749 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -377,7 +427,9 @@ msgstr "[Edytuj]" msgid "[Move]" msgstr "[Przenieś]" -#: /var/www/html/Tinyboard/inc/config.php:801 +#. Default public ban message. +#. In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). +#: /var/www/html/Tinyboard/inc/config.php:801 ../../../../inc/config.php:911 msgid "USER WAS BANNED FOR THIS POST" msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" @@ -453,7 +505,7 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:292 #: /var/www/html/Tinyboard/inc/display.php:408 #: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 -#: ../../../../inc/mod/pages.php:1239 +#: ../../../../inc/mod/pages.php:1239 ../../../../inc/mod/pages.php:1242 msgid "Edit post" msgstr "Edytuj post" @@ -485,12 +537,17 @@ msgstr "Zablokuj wątek" msgid "Move thread to another board" msgstr "Przenieś wątek na inny board" +#. line 11 +#. line 7 #. line 11 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:48 #: /var/www/html/Tinyboard/mod.php:667 /var/www/html/Tinyboard/mod.php:750 #: /var/www/html/Tinyboard/mod.php:833 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:55 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:55 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:31 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:36 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:33 msgid "Name" msgstr "Nazwa" @@ -501,11 +558,14 @@ msgstr "Nazwa" msgid "Email" msgstr "E-mail" +#. line 34 +#. line 23 #. line 34 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:96 #: /var/www/html/Tinyboard/mod.php:753 /var/www/html/Tinyboard/mod.php:839 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:95 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:116 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:63 msgid "Subject" msgstr "Temat" @@ -579,6 +639,7 @@ msgstr "Komentarz" #. line 73 #. line 61 #. line 73 +#. line 61 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:133 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:142 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:191 @@ -638,26 +699,35 @@ msgstr "Weryfikacja" #. line 87 #. line 3 #. line 87 +#. line 3 +#. line 72 +#. line 3 +#. line 72 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:22 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:22 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:250 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:214 msgid "File" msgstr "Plik" #. line 97 +#. line 82 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:163 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:183 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:268 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:232 msgid "Embed" msgstr "Osadź" #. line 109 +#. line 94 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:179 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:206 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:291 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:255 msgid "Flags" msgstr "Flagi" @@ -713,12 +783,18 @@ msgstr "Flagi" #. line 114 #. line 113 #. line 114 +#. line 98 +#. line 99 +#. line 98 +#. line 99 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:218 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:300 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:303 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:264 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:267 msgid "Sticky" msgstr "Przyklejony" @@ -774,12 +850,18 @@ msgstr "Przyklejony" #. line 118 #. line 117 #. line 118 +#. line 102 +#. line 103 +#. line 102 +#. line 103 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:230 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:312 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:315 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:276 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:279 msgid "Lock" msgstr "Zablokowany" @@ -835,18 +917,25 @@ msgstr "Zablokowany" #. line 122 #. line 121 #. line 122 +#. line 106 +#. line 107 +#. line 106 +#. line 107 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:242 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:324 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:327 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:288 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:291 msgid "Raw HTML" msgstr "Czysty HTML" #. line 129 #. line 14 #. line 129 +#. line 114 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:230 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:23 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:257 @@ -854,13 +943,16 @@ msgstr "Czysty HTML" #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:23 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:342 #: ../../../../templates/cache/04/54/656aa217f895c90eae78024fa060.php:41 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:306 msgid "Password" msgstr "Hasło" #. line 134 +#. line 119 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:236 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:266 #: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:351 +#: ../../../../templates/cache/0c/37/9331df01df7c2986d77a02d3beb0.php:315 msgid "(For file deletion.)" msgstr "(do usuwania postów)" @@ -887,6 +979,7 @@ msgstr "Odśwież" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:415 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:461 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:472 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:506 msgid "Reply" msgstr "Odpowiedź" @@ -894,6 +987,7 @@ msgstr "Odpowiedź" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:442 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:488 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:499 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:533 msgid "1 post" msgid_plural "%count% posts" msgstr[0] "1 post" @@ -905,6 +999,7 @@ msgstr[2] "%count% postów" #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:494 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 #: ../../../../templates/cache/e5/22/4711dd22e4c786b4de405db7a449.php:114 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:539 msgid "and" msgstr "oraz" @@ -912,6 +1007,7 @@ msgstr "oraz" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:459 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:505 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:516 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:550 msgid "1 image reply" msgid_plural "%count% image replies" msgstr[0] "1 obrazek" @@ -922,6 +1018,7 @@ msgstr[2] "%count% obrazków" #: ../../../../templates/cache/cf/0c/61af144f478f5c035cb3a2799e48.php:464 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:510 #: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:521 +#: ../../../../templates/cache/d8/f2/7780eb1adcdbda7e332659e3fb4f.php:555 msgid "omitted. Click reply to view." msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." @@ -935,15 +1032,19 @@ msgstr "pominięte. Kliknij Odpowiedź aby zobaczyć." #: ../../../../templates/cache/62/8c/21348d46377c3e1b3f8c476ba376.php:62 #: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:131 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:115 +#: ../../../../templates/cache/f5/e3/343716327c6183713f70a3fb57f1.php:132 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:116 msgid "Return to dashboard" msgstr "Powróć na tablicę" #. line 27 #. line 31 +#. line 32 #: /var/www/html/Tinyboard/templates/cache/0b/22/d0c24fb343dd5fe77600d77dcc1b.php:165 #: ../../../../templates/cache/82/20/1c3352a2eb8f4503c0f7634bca15.php:177 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:106 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:123 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:124 msgid "Posting mode: Reply" msgstr "Tryb postowania: Odpowiedź" @@ -955,6 +1056,8 @@ msgstr "Tryb postowania: Odpowiedź" #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:155 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:126 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:172 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:127 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:173 msgid "Return" msgstr "Powrót" @@ -970,6 +1073,12 @@ msgstr "Usuń post" #. line 8 #. line 32 #. line 48 +#. line 106 +#. line 8 +#. line 32 +#. line 106 +#. line 8 +#. line 32 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 @@ -990,6 +1099,8 @@ msgstr "Zgłoszenie" #: /var/www/html/Tinyboard/mod.php:104 /var/www/html/Tinyboard/mod.php:776 #: /var/www/html/Tinyboard/mod.php:862 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:120 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:125 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:89 msgid "no subject" msgstr "brak tematu" @@ -1012,6 +1123,7 @@ msgstr "Aktualności" #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 #: ../../../../inc/mod/pages.php:1682 ../../../../inc/mod/pages.php:1816 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207 +#: ../../../../inc/mod/pages.php:1831 msgid "Report queue" msgstr "Kolejka zgłoszeń" @@ -1026,6 +1138,7 @@ msgstr "Lista banów" #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 #: ../../../../inc/mod/pages.php:1394 ../../../../inc/mod/pages.php:1528 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232 +#: ../../../../inc/mod/pages.php:1543 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -1059,11 +1172,13 @@ msgstr "Pokaż konfigurację" #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 #: ../../../../inc/mod/pages.php:1830 ../../../../inc/mod/pages.php:1964 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247 +#: ../../../../inc/mod/pages.php:1979 msgid "Manage themes" msgstr "Zarządzaj dodatkami" #. line 2 #. line 5 +#. line 2 #: /var/www/html/Tinyboard/mod.php:170 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:19 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:24 @@ -1074,11 +1189,14 @@ msgstr "Wyrażenie:" #. line 2 #. line 106 #. line 2 +#. line 16 +#. line 106 #: /var/www/html/Tinyboard/mod.php:172 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:72 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:19 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:286 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:19 +#: ../../../../search.php:165 msgid "Search" msgstr "Szukaj" @@ -1097,8 +1215,10 @@ msgid "Could not find current version! (Check .installed)" msgstr "Nie można znaleźć obecnej wersji! (Sprawdź .installed)" #. line 146 +#. line 158 #: /var/www/html/Tinyboard/mod.php:233 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:364 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:397 msgid "Logout" msgstr "Wyloguj" @@ -1128,17 +1248,25 @@ msgstr "temu" #. line 65 #. line 49 #. line 136 +#. line 116 +#. line 182 +#. line 65 +#. line 116 +#. line 182 +#. line 65 #: /var/www/html/Tinyboard/mod.php:405 /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:278 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:427 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:142 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:131 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:355 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:147 msgid "Board" msgstr "Board" #. line 183 #. line 137 +#. line 183 #: /var/www/html/Tinyboard/mod.php:406 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:430 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:358 @@ -1147,42 +1275,54 @@ msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 #: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 -#: ../../../../inc/mod/pages.php:1948 +#: ../../../../inc/mod/pages.php:1948 ../../../../inc/mod/pages.php:1963 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 #: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 -#: ../../../../inc/mod/pages.php:1950 +#: ../../../../inc/mod/pages.php:1950 ../../../../inc/mod/pages.php:1965 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." +#. line 11 #: /var/www/html/Tinyboard/mod.php:671 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:42 msgid "Version" msgstr "Wersja" +#. line 15 #: /var/www/html/Tinyboard/mod.php:675 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:51 msgid "Description" msgstr "Opis" +#. line 19 #: /var/www/html/Tinyboard/mod.php:679 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:60 msgid "Thumbnail" msgstr "Miniatura" +#. line 25 #: /var/www/html/Tinyboard/mod.php:687 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:86 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:77 msgid "Actions" msgstr "Akcje" +#. line 27 #: /var/www/html/Tinyboard/mod.php:689 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:81 msgid "Use theme" msgstr "Użyj dodatku" #: /var/www/html/Tinyboard/mod.php:690 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:87 msgid "Reconfigure" msgstr "Rekonfiguruj" #: /var/www/html/Tinyboard/mod.php:690 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:88 msgid "Install" msgstr "Instaluj" @@ -1192,10 +1332,13 @@ msgstr "Instaluj" #: ../../../../inc/mod/pages.php:1596 ../../../../inc/mod/pages.php:1726 #: ../../../../inc/mod/pages.php:1730 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263 +#: ../../../../inc/mod/pages.php:1741 ../../../../inc/mod/pages.php:1745 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:98 msgid "Rebuild" msgstr "Przebuduj" #: /var/www/html/Tinyboard/mod.php:694 +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:103 msgid "Uninstall" msgstr "Odinstaluj" @@ -1203,7 +1346,9 @@ msgstr "Odinstaluj" msgid "Uninstall all themes." msgstr "Odinstaluj wszystkie dodatki" +#. line 27 #: /var/www/html/Tinyboard/mod.php:756 /var/www/html/Tinyboard/mod.php:842 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:69 msgid "Body" msgstr "Zawartość" @@ -1269,6 +1414,7 @@ msgstr "Nie można się ponownie zalogować po zmianie hasła. (?)" #. line 126 #. line 50 +#. line 126 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:300 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:134 @@ -1277,6 +1423,7 @@ msgstr "Ustawione" #. line 130 #. line 52 +#. line 130 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:309 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:140 @@ -1290,6 +1437,14 @@ msgstr "Wygasa" #. line 17 #. line 54 #. line 133 +#. line 24 +#. line 62 +#. line 150 +#. line 180 +#. line 24 +#. line 62 +#. line 150 +#. line 180 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:74 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:169 @@ -1328,7 +1483,7 @@ msgid "No board to move to; there is only one." msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." #: ../../../../inc/config.php:689 ../../../../inc/config.php:747 -#: ../../../../inc/config.php:753 +#: ../../../../inc/config.php:753 ../../../../inc/config.php:750 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." @@ -1346,6 +1501,10 @@ msgstr "Edytuj board" msgid "New board" msgstr "Nowy board" +#. line 102 +#. line 20 +#. line 102 +#. line 20 #. line 102 #. line 20 #: ../../../../inc/mod/pages.php:586 ../../../../inc/mod/pages.php:612 @@ -1361,6 +1520,7 @@ msgstr "adres IP" #: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 #: ../../../../inc/mod/pages.php:772 ../../../../inc/mod/pages.php:1187 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:398 +#: ../../../../inc/mod/pages.php:1190 msgid "New ban" msgstr "Nowy ban" @@ -1380,6 +1540,7 @@ msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1307 ../../../../inc/mod/pages.php:1356 #: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 #: ../../../../inc/mod/pages.php:1466 ../../../../inc/mod/pages.php:1515 +#: ../../../../inc/mod/pages.php:1477 ../../../../inc/mod/pages.php:1530 msgid "Edit user" msgstr "Edytuj użytkownika" @@ -1388,11 +1549,13 @@ msgstr "Edytuj użytkownika" #: ../../../../inc/mod/pages.php:1431 ../../../../inc/mod/pages.php:1503 #: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 #: ../../../../inc/mod/pages.php:1590 ../../../../inc/mod/pages.php:1662 +#: ../../../../inc/mod/pages.php:1605 ../../../../inc/mod/pages.php:1677 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 #: ../../../../inc/mod/pages.php:1460 ../../../../inc/mod/pages.php:1594 +#: ../../../../inc/mod/pages.php:1609 msgid "Private message" msgstr "Prywatna wiadomość" @@ -1400,33 +1563,39 @@ msgstr "Prywatna wiadomość" #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 #: ../../../../inc/mod/pages.php:1481 ../../../../inc/mod/pages.php:1615 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171 +#: ../../../../inc/mod/pages.php:1630 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 #: ../../../../inc/mod/pages.php:1804 ../../../../inc/mod/pages.php:1938 +#: ../../../../inc/mod/pages.php:1953 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 #: ../../../../inc/mod/pages.php:1970 ../../../../inc/mod/pages.php:2104 +#: ../../../../inc/mod/pages.php:2119 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 #: ../../../../inc/mod/pages.php:1892 ../../../../inc/mod/pages.php:2026 +#: ../../../../inc/mod/pages.php:2041 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 #: ../../../../inc/mod/pages.php:1903 ../../../../inc/mod/pages.php:2037 +#: ../../../../inc/mod/pages.php:2052 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 #: ../../../../inc/mod/pages.php:1931 ../../../../inc/mod/pages.php:2065 +#: ../../../../inc/mod/pages.php:2080 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1438,20 +1607,24 @@ msgid "" msgstr "" #: ../../../../inc/config.php:704 ../../../../inc/config.php:710 +#: ../../../../inc/config.php:707 msgid "Thread has reached its maximum reply limit." msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." #: ../../../../inc/config.php:705 ../../../../inc/config.php:711 +#: ../../../../inc/config.php:708 msgid "Thread has reached its maximum image limit." msgstr "Ten temat osiągnął swój maksymalny limit obrazków." #: ../../../../inc/config.php:726 ../../../../inc/config.php:732 +#: ../../../../inc/config.php:729 #, php-format msgid "That file already exists in this thread!" msgstr "Ten plik już istnieje w tym temacie!" #. Moderator errors #: ../../../../inc/config.php:733 ../../../../inc/config.php:739 +#: ../../../../inc/config.php:736 #, php-format msgid "" "You are only allowed to unban %s users at a time. You tried to unban %u " @@ -1460,12 +1633,12 @@ msgstr "" "Możesz odbanować tylko %s użytkowników na raz. Próbowałeś odbanować %u users." #: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 -#: ../../../../inc/mod/pages.php:2128 +#: ../../../../inc/mod/pages.php:2128 ../../../../inc/mod/pages.php:2143 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" #: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 -#: ../../../../inc/mod/pages.php:2152 +#: ../../../../inc/mod/pages.php:2152 ../../../../inc/mod/pages.php:2167 msgid "Debug: SQL" msgstr "Debug: SQL" @@ -1500,9 +1673,9 @@ msgid "" "(Search is case-insensitive and based on keywords. To match exact phrases, " "use \"quotes\". Use an asterisk (*) for wildcard.)" msgstr "" -"(Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " -"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " -"wieloznacznego.)" +"(Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach " +"kluczowych. Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki " +"(*) jako symbolu wieloznacznego.)" #. line 8 #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:32 @@ -1520,14 +1693,14 @@ msgid "" "example, name:Anonymous or subject:\"Some Thread\". " "Wildcards cannot be used in filters." msgstr "" -"Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach kluczowych. " -"Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki (*) jako symbolu " -"wieloznacznego.

Możesz zastosować poniższe " -"filtry do swojego wyszukiwania: id, thread, " -"subject, i name. Aby wykorzystać filtr, " -"po prostu dodaj do swojego zapytania, na przykład: name:Anonymous " -"albo subject:\"Jakiś temat\". Symbole wieloznaczne nie mogą być " -"wykorzystane w filtrach." +"Wyszukiwanie jest niezależne od wielkości znaków i bazowane na słowach " +"kluczowych. Aby dopasować pełne frazy, użyj \"cudzysłowi\". Użyj gwiazdki " +"(*) jako symbolu wieloznacznego.

Możesz zastosować poniższe filtry do swojego wyszukiwania: id, thread, subject, i name. Aby wykorzystać filtr, po prostu dodaj do swojego zapytania, na " +"przykład: name:Anonymous albo subject:\"Jakiś temat\". " +"Symbole wieloznaczne nie mogą być wykorzystane w filtrach." #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:57 msgid "edit" @@ -1552,32 +1725,45 @@ msgid "Change password" msgstr "Zmień hasło" #. line 118 +#. line 130 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:308 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:341 msgid "Debug" msgstr "Debug" #. line 120 +#. line 132 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:312 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:345 msgid "Anti-spam" msgstr "Antyspam" #. line 121 +#. line 133 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:315 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:348 msgid "Recent posts" msgstr "Ostatnie posty" #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:321 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:354 msgid "SQL" msgstr "SQL" #. line 143 +#. line 155 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:359 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:392 msgid "User account" msgstr "Konto użytkownika" #. line 25 #. line 67 #. line 18 +#. line 25 +#. line 67 +#. line 25 +#. line 67 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:77 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:179 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:54 @@ -1586,6 +1772,7 @@ msgstr "Notka" #. line 26 #. line 19 +#. line 26 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:80 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:57 msgid "Date" @@ -1634,6 +1821,7 @@ msgstr "nigdy" #. line 140 #. line 53 +#. line 140 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:331 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:143 msgid "Seen" @@ -1656,6 +1844,7 @@ msgstr "Usuń ban" #. line 181 #. line 135 +#. line 181 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:424 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:352 msgid "Time" @@ -1753,16 +1942,19 @@ msgstr "Wiadomość" #. line 46 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:117 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:122 msgid "public; attached to post" msgstr "publiczny; dołączony do posta" #. line 58 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:133 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:138 msgid "Length" msgstr "Długość" #. line 88 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:192 +#: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:197 msgid "New Ban" msgstr "Nowy ban" @@ -1799,3 +1991,109 @@ msgstr[2] "%d wyników na" #: ../../../../search.php:160 msgid "No results." msgstr "Brak wyników." + +#: ../../../../inc/functions.php:594 +msgid "Banned!" +msgstr "Zbanowany!" + +#: ../../../../banned.php:4 +msgid "Banned?" +msgstr "Zbanowany?" + +#: ../../../../banned.php:5 +msgid "You are not banned." +msgstr "Nie jesteś zbanowany." + +#: ../../../../inc/functions.php:549 ../../../../inc/functions.php:566 +msgid "second" +msgid_plural "seconds" +msgstr[0] "sekunda" +msgstr[1] "sekundy" +msgstr[2] "sekund" + +#: ../../../../inc/functions.php:551 ../../../../inc/functions.php:568 +msgid "minute" +msgid_plural "minutes" +msgstr[0] "minuta" +msgstr[1] "minuty" +msgstr[2] "minut" + +#: ../../../../inc/functions.php:553 ../../../../inc/functions.php:570 +msgid "hour" +msgid_plural "hours" +msgstr[0] "godzina" +msgstr[1] "godziny" +msgstr[2] "godzin" + +#: ../../../../inc/functions.php:555 ../../../../inc/functions.php:572 +msgid "day" +msgid_plural "days" +msgstr[0] "dzień" +msgstr[1] "dni" +msgstr[2] "dni" + +#: ../../../../inc/functions.php:557 ../../../../inc/functions.php:574 +msgid "week" +msgid_plural "weeks" +msgstr[0] "tydzień" +msgstr[1] "tygodnie" +msgstr[2] "tygodni" + +#: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 +msgid "year" +msgid_plural "years" +msgstr[0] "rok" +msgstr[1] "lata" +msgstr[2] "lat" + +#. line 118 +#: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:308 +msgid "Other" +msgstr "Inne" + +#: ../../../../templates/cache/b7/7d/de31d12a1684acbc7c0d7ee71653.php:30 +msgid "Successfully installed and built theme." +msgstr "Pomyślnie zainstalowano i zbudowano dodatek." + +#. line 9 +#: ../../../../templates/cache/b7/7d/de31d12a1684acbc7c0d7ee71653.php:37 +msgid "Go back to themes" +msgstr "Wróć do dodatków" + +#. line 3 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:21 +msgid "New post" +msgstr "Nowy post" + +#. line 32 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:76 +msgid "Post news entry" +msgstr "Zapostuj newsa" + +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:100 +msgid "delete" +msgstr "usuń" + +#. line 55 +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:133 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:94 +msgid "by" +msgstr "przez" + +#: ../../../../templates/cache/c8/8b/242bf87b3b6a29a67cdd09a3afeb.php:136 +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:97 +msgid "at" +msgstr "dnia" + +#: ../../../../templates/cache/f3/ad/68dee281a64ebad9a5c774b53279.php:66 +msgid "(No news to show.)" +msgstr "(Nie ma newsów do wyświetlenia.)" + +#: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:19 +msgid "There are no themes available." +msgstr "Nie ma dostępnych dodatków." + +#. line 25 +#: ../../../../templates/cache/d1/99/467985632043e204070d354b8290.php:91 +msgid "Install theme" +msgstr "Zainstaluj dodatek" -- cgit v1.3 From 7e0cec3d9dc0fbf3a1e13909de116ba12594302a Mon Sep 17 00:00:00 2001 From: Marcin Łabanowski Date: Sat, 22 Dec 2012 20:14:43 +0100 Subject: Facilitate styling of subboard listings --- inc/display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index 0992166d..a2d50f74 100644 --- a/inc/display.php +++ b/inc/display.php @@ -25,7 +25,7 @@ function doBoardListPart($list, $root) { $body = ''; foreach ($list as $board) { if (is_array($board)) - $body .= ' [' . doBoardListPart($board, $root) . '] '; + $body .= ' [' . doBoardListPart($board, $root) . '] '; else { if (($key = array_search($board, $list)) && gettype($key) == 'string') { $body .= ' ' . $key . ' /'; -- cgit v1.3 From 123a72d7de692c8f33f6df39d0a8a7a267fe8b0b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 04:28:26 -0400 Subject: Convert to UNIX line endings --- inc/template.php | 144 +++++++------- templates/main.js | 460 ++++++++++++++++++++++----------------------- templates/mod/login.html | 52 ++--- templates/post_reply.html | 222 +++++++++++----------- templates/post_thread.html | 296 ++++++++++++++--------------- templates/posts.sql | 2 +- templates/thread.html | 140 +++++++------- 7 files changed, 658 insertions(+), 658 deletions(-) (limited to 'inc') diff --git a/inc/template.php b/inc/template.php index 071fa761..09e27c26 100644 --- a/inc/template.php +++ b/inc/template.php @@ -1,72 +1,72 @@ -setPaths($config['dir']['template']); - $twig = new Twig_Environment($loader, array( - 'autoescape' => false, - 'cache' => "{$config['dir']['template']}/cache", - 'debug' => $config['debug'] - )); - $twig->addExtension(new Twig_Extensions_Extension_Tinyboard()); - $twig->addExtension(new Twig_Extensions_Extension_I18n()); -} - -function Element($templateFile, array $options) { - global $config, $debug, $twig; - - if (!$twig) - load_twig(); - - if (function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod'])) && !preg_match('!^mod/!', $templateFile)) { - $options['pm'] = create_pm_header(); - } - - if (isset($options['body']) && $config['debug']) { - if (isset($debug['start'])) { - $debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; - unset($debug['start']); - } - $debug['included'] = get_included_files(); - $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; - $options['body'] .= - '

Debug

' .
-				str_replace("\n", '
', utf8tohtml(print_r($debug, true))) . - '
'; - } - - // Read the template file - if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) { - $body = $twig->render($templateFile, $options); - - if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) { - $body = trim(preg_replace("/[\t\r\n]/", '', $body)); - } - - return $body; - } else { - throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!"); - } -} - +setPaths($config['dir']['template']); + $twig = new Twig_Environment($loader, array( + 'autoescape' => false, + 'cache' => "{$config['dir']['template']}/cache", + 'debug' => $config['debug'] + )); + $twig->addExtension(new Twig_Extensions_Extension_Tinyboard()); + $twig->addExtension(new Twig_Extensions_Extension_I18n()); +} + +function Element($templateFile, array $options) { + global $config, $debug, $twig; + + if (!$twig) + load_twig(); + + if (function_exists('create_pm_header') && ((isset($options['mod']) && $options['mod']) || isset($options['__mod'])) && !preg_match('!^mod/!', $templateFile)) { + $options['pm'] = create_pm_header(); + } + + if (isset($options['body']) && $config['debug']) { + if (isset($debug['start'])) { + $debug['time'] = '~' . round((microtime(true) - $debug['start']) * 1000, 2) . 'ms'; + unset($debug['start']); + } + $debug['included'] = get_included_files(); + $debug['memory'] = round(memory_get_usage(true) / (1024 * 1024), 2) . ' MiB'; + $options['body'] .= + '

Debug

' .
+				str_replace("\n", '
', utf8tohtml(print_r($debug, true))) . + '
'; + } + + // Read the template file + if (@file_get_contents("{$config['dir']['template']}/${templateFile}")) { + $body = $twig->render($templateFile, $options); + + if ($config['minify_html'] && preg_match('/\.html$/', $templateFile)) { + $body = trim(preg_replace("/[\t\r\n]/", '', $body)); + } + + return $body; + } else { + throw new Exception("Template file '${templateFile}' does not exist or is empty in '{$config['dir']['template']}'!"); + } +} + diff --git a/templates/main.js b/templates/main.js index 401d3504..71dcd92a 100644 --- a/templates/main.js +++ b/templates/main.js @@ -1,38 +1,38 @@ -{% raw %} - -/* gettext-compatible _ function, example of usage: - * - * > // Loading pl_PL.json here (containing polish translation strings generated by tools/i18n_compile.php) - * > alert(_("Hello!")); - * Witaj! - */ -function _(s) { - return (typeof l10n != 'undefined' && typeof l10n[s] != 'undefined') ? l10n[s] : s; -} - -/* printf-like formatting function, example of usage: - * - * > alert(fmt("There are {0} birds on {1} trees", [3,4])); - * There are 3 birds on 4 trees - * > // Loading pl_PL.json here (containing polish translation strings generated by tools/locale_compile.php) - * > alert(fmt(_("{0} users"), [3])); - * 3 uzytkownikow - */ -function fmt(s,a) { - return s.replace(/\{([0-9]+)\}/g, function(x) { return a[x[1]]; }); -} - -var saved = {}; - - -var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}'; -var styles = { - {% endraw %} - {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}', - {% endraw %}{% endfor %}{% raw %} -}; +{% raw %} + +/* gettext-compatible _ function, example of usage: + * + * > // Loading pl_PL.json here (containing polish translation strings generated by tools/i18n_compile.php) + * > alert(_("Hello!")); + * Witaj! + */ +function _(s) { + return (typeof l10n != 'undefined' && typeof l10n[s] != 'undefined') ? l10n[s] : s; +} + +/* printf-like formatting function, example of usage: + * + * > alert(fmt("There are {0} birds on {1} trees", [3,4])); + * There are 3 birds on 4 trees + * > // Loading pl_PL.json here (containing polish translation strings generated by tools/locale_compile.php) + * > alert(fmt(_("{0} users"), [3])); + * 3 uzytkownikow + */ +function fmt(s,a) { + return s.replace(/\{([0-9]+)\}/g, function(x) { return a[x[1]]; }); +} + +var saved = {}; + + +var selectedstyle = '{% endraw %}{{ config.default_stylesheet.0|addslashes }}{% raw %}'; +var styles = { + {% endraw %} + {% for stylesheet in stylesheets %}{% raw %}'{% endraw %}{{ stylesheet.name|addslashes }}{% raw %}' : '{% endraw %}{{ stylesheet.uri|addslashes }}{% raw %}', + {% endraw %}{% endfor %}{% raw %} +}; var board_name = false; - + function changeStyle(styleName, link) { {% endraw %} {% if config.stylesheets_board %}{% raw %} @@ -43,31 +43,31 @@ function changeStyle(styleName, link) { {% endraw %}{% else %} localStorage.stylesheet = styleName; {% endif %} - {% raw %} - - if (!document.getElementById('stylesheet')) { - var s = document.createElement('link'); - s.rel = 'stylesheet'; - s.type = 'text/css'; - s.id = 'stylesheet'; - var x = document.getElementsByTagName('head')[0]; - x.appendChild(s); - } - - document.getElementById('stylesheet').href = styles[styleName]; - selectedstyle = styleName; - - if (document.getElementsByClassName('styles').length != 0) { - var styleLinks = document.getElementsByClassName('styles')[0].childNodes; - for (var i = 0; i < styleLinks.length; i++) { - styleLinks[i].className = ''; - } - } - - if (link) { - link.className = 'selected'; - } -} + {% raw %} + + if (!document.getElementById('stylesheet')) { + var s = document.createElement('link'); + s.rel = 'stylesheet'; + s.type = 'text/css'; + s.id = 'stylesheet'; + var x = document.getElementsByTagName('head')[0]; + x.appendChild(s); + } + + document.getElementById('stylesheet').href = styles[styleName]; + selectedstyle = styleName; + + if (document.getElementsByClassName('styles').length != 0) { + var styleLinks = document.getElementsByClassName('styles')[0].childNodes; + for (var i = 0; i < styleLinks.length; i++) { + styleLinks[i].className = ''; + } + } + + if (link) { + link.className = 'selected'; + } +} {% endraw %} @@ -95,177 +95,177 @@ function changeStyle(styleName, link) { {% endraw%} {% else %} {% raw %} - if (localStorage.stylesheet) { - for (var styleName in styles) { - if (styleName == localStorage.stylesheet) { - changeStyle(styleName); - break; - } - } + if (localStorage.stylesheet) { + for (var styleName in styles) { + if (styleName == localStorage.stylesheet) { + changeStyle(styleName); + break; + } + } } - {% endraw %} + {% endraw %} {% endif %} {% raw %} - -function init_stylechooser() { - var newElement = document.createElement('div'); - newElement.className = 'styles'; - - for (styleName in styles) { - var style = document.createElement('a'); - style.innerHTML = '[' + styleName + ']'; - style.onclick = function() { - changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this); - }; - if (styleName == selectedstyle) { - style.className = 'selected'; - } - style.href = 'javascript:void(0);'; - newElement.appendChild(style); - } - - document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling); -} - -function get_cookie(cookie_name) { - var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); - if (results) - return (unescape(results[2])); - else - return null; -} - -function highlightReply(id) { - if (typeof window.event != "undefined" && event.which == 2) { - // don't highlight on middle click - return true; - } - - var divs = document.getElementsByTagName('div'); - for (var i = 0; i < divs.length; i++) - { - if (divs[i].className.indexOf('post') != -1) - divs[i].className = divs[i].className.replace(/highlighted/, ''); - } - if (id) { - var post = document.getElementById('reply_'+id); - if (post) - post.className += ' highlighted'; - } -} - -function generatePassword() { - var pass = ''; - var chars = '{% endraw %}{{ config.genpassword_chars }}{% raw %}'; - for (var i = 0; i < 8; i++) { - var rnd = Math.floor(Math.random() * chars.length); - pass += chars.substring(rnd, rnd + 1); - } - return pass; -} - -function dopost(form) { - if (form.elements['name']) { - localStorage.name = form.elements['name'].value.replace(/( |^)## .+$/, ''); - } - if (form.elements['email'] && form.elements['email'].value != 'sage') { - localStorage.email = form.elements['email'].value; - } - - saved[document.location] = form.elements['body'].value; - sessionStorage.body = JSON.stringify(saved); - - return form.elements['body'].value != "" || form.elements['file'].value != ""; -} - -function citeReply(id) { - var body = document.getElementById('body'); - - if (document.selection) { - // IE - body.focus(); - var sel = document.selection.createRange(); - sel.text = '>>' + id + '\n'; - } else if (body.selectionStart || body.selectionStart == '0') { - // Mozilla - var start = body.selectionStart; - var end = body.selectionEnd; - body.value = body.value.substring(0, start) + '>>' + id + '\n' + body.value.substring(end, body.value.length); - } else { - // ??? - body.value += '>>' + id + '\n'; - } -} - -function rememberStuff() { - if (document.forms.post) { - if (document.forms.post.password) { - if (!localStorage.password) - localStorage.password = generatePassword(); - document.forms.post.password.value = localStorage.password; - } - - if (localStorage.name && document.forms.post.elements['name']) - document.forms.post.elements['name'].value = localStorage.name; - if (localStorage.email && document.forms.post.elements['email']) - document.forms.post.elements['email'].value = localStorage.email; - - if (window.location.hash.indexOf('q') == 1) - citeReply(window.location.hash.substring(2)); - - if (sessionStorage.body) { - var saved = JSON.parse(sessionStorage.body); - if (get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) { - // Remove successful posts - var successful = JSON.parse(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')); - for (var url in successful) { - saved[url] = null; - } - sessionStorage.body = JSON.stringify(saved); - - document.cookie = '{% endraw %}{{ config.cookies.js }}{% raw %}={};expires=0;path=/;'; - } - if (saved[document.location]) { - document.forms.post.body.value = saved[document.location]; - } - } - - if (localStorage.body) { - document.forms.post.body.value = localStorage.body; - localStorage.body = ''; - } - } -} - -function init() { - init_stylechooser(); - - if (document.forms.postcontrols) { - document.forms.postcontrols.password.value = localStorage.password; - } - - if (window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1)) - highlightReply(window.location.hash.substring(1)); -} - -var RecaptchaOptions = { - theme : 'clean' -}; - -onready_callbacks = []; -function onready(fnc) { - onready_callbacks.push(fnc); -} - -function ready() { - for (var i = 0; i < onready_callbacks.length; i++) { - onready_callbacks[i](); - } -} - -onready(init); - -{% endraw %}{% if config.google_analytics %}{% raw %} - -var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %} - + +function init_stylechooser() { + var newElement = document.createElement('div'); + newElement.className = 'styles'; + + for (styleName in styles) { + var style = document.createElement('a'); + style.innerHTML = '[' + styleName + ']'; + style.onclick = function() { + changeStyle(this.innerHTML.substring(1, this.innerHTML.length - 1), this); + }; + if (styleName == selectedstyle) { + style.className = 'selected'; + } + style.href = 'javascript:void(0);'; + newElement.appendChild(style); + } + + document.getElementsByTagName('body')[0].insertBefore(newElement, document.getElementsByTagName('body')[0].lastChild.nextSibling); +} + +function get_cookie(cookie_name) { + var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)'); + if (results) + return (unescape(results[2])); + else + return null; +} + +function highlightReply(id) { + if (typeof window.event != "undefined" && event.which == 2) { + // don't highlight on middle click + return true; + } + + var divs = document.getElementsByTagName('div'); + for (var i = 0; i < divs.length; i++) + { + if (divs[i].className.indexOf('post') != -1) + divs[i].className = divs[i].className.replace(/highlighted/, ''); + } + if (id) { + var post = document.getElementById('reply_'+id); + if (post) + post.className += ' highlighted'; + } +} + +function generatePassword() { + var pass = ''; + var chars = '{% endraw %}{{ config.genpassword_chars }}{% raw %}'; + for (var i = 0; i < 8; i++) { + var rnd = Math.floor(Math.random() * chars.length); + pass += chars.substring(rnd, rnd + 1); + } + return pass; +} + +function dopost(form) { + if (form.elements['name']) { + localStorage.name = form.elements['name'].value.replace(/( |^)## .+$/, ''); + } + if (form.elements['email'] && form.elements['email'].value != 'sage') { + localStorage.email = form.elements['email'].value; + } + + saved[document.location] = form.elements['body'].value; + sessionStorage.body = JSON.stringify(saved); + + return form.elements['body'].value != "" || form.elements['file'].value != ""; +} + +function citeReply(id) { + var body = document.getElementById('body'); + + if (document.selection) { + // IE + body.focus(); + var sel = document.selection.createRange(); + sel.text = '>>' + id + '\n'; + } else if (body.selectionStart || body.selectionStart == '0') { + // Mozilla + var start = body.selectionStart; + var end = body.selectionEnd; + body.value = body.value.substring(0, start) + '>>' + id + '\n' + body.value.substring(end, body.value.length); + } else { + // ??? + body.value += '>>' + id + '\n'; + } +} + +function rememberStuff() { + if (document.forms.post) { + if (document.forms.post.password) { + if (!localStorage.password) + localStorage.password = generatePassword(); + document.forms.post.password.value = localStorage.password; + } + + if (localStorage.name && document.forms.post.elements['name']) + document.forms.post.elements['name'].value = localStorage.name; + if (localStorage.email && document.forms.post.elements['email']) + document.forms.post.elements['email'].value = localStorage.email; + + if (window.location.hash.indexOf('q') == 1) + citeReply(window.location.hash.substring(2)); + + if (sessionStorage.body) { + var saved = JSON.parse(sessionStorage.body); + if (get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')) { + // Remove successful posts + var successful = JSON.parse(get_cookie('{% endraw %}{{ config.cookies.js }}{% raw %}')); + for (var url in successful) { + saved[url] = null; + } + sessionStorage.body = JSON.stringify(saved); + + document.cookie = '{% endraw %}{{ config.cookies.js }}{% raw %}={};expires=0;path=/;'; + } + if (saved[document.location]) { + document.forms.post.body.value = saved[document.location]; + } + } + + if (localStorage.body) { + document.forms.post.body.value = localStorage.body; + localStorage.body = ''; + } + } +} + +function init() { + init_stylechooser(); + + if (document.forms.postcontrols) { + document.forms.postcontrols.password.value = localStorage.password; + } + + if (window.location.hash.indexOf('q') != 1 && window.location.hash.substring(1)) + highlightReply(window.location.hash.substring(1)); +} + +var RecaptchaOptions = { + theme : 'clean' +}; + +onready_callbacks = []; +function onready(fnc) { + onready_callbacks.push(fnc); +} + +function ready() { + for (var i = 0; i < onready_callbacks.length; i++) { + onready_callbacks[i](); + } +} + +onready(init); + +{% endraw %}{% if config.google_analytics %}{% raw %} + +var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %} + diff --git a/templates/mod/login.html b/templates/mod/login.html index 43a28d56..476897a6 100644 --- a/templates/mod/login.html +++ b/templates/mod/login.html @@ -1,26 +1,26 @@ -{% if error %}

{{ error }}

{% endif %} -
- - - - - - - - - - - - -
- {% trans 'Username' %} - - -
- {% trans 'Password' %} - - -
- -
-
+{% if error %}

{{ error }}

{% endif %} +
+ + + + + + + + + + + + +
+ {% trans 'Username' %} + + +
+ {% trans 'Password' %} + + +
+ +
+
diff --git a/templates/post_reply.html b/templates/post_reply.html index 450f8246..bc96e74c 100644 --- a/templates/post_reply.html +++ b/templates/post_reply.html @@ -1,111 +1,111 @@ -{% filter remove_whitespace %} -{# tabs and new lines will be ignored #} -
- -

- - - {% if config.poster_ids %} - ID: {{ post.ip|poster_id(post.thread) }} - {% endif %} - No. - - {{ post.id }} - -

- {% if post.embed %} - {{ post.embed }} - {% elseif post.file == 'deleted' %} - - {% elseif post.file and post.file %} -

File: {{ post.file }} - ( - {% if post.thumb == 'spoiler' %} - Spoiler Image, - {% endif %} - {{ post.filesize|filesize }} - {% if post.filex and post.filey %} - , {{ post.filex}}x{{ post.filey }} - {% if config.show_ratio %} - , {{ post.ratio }} - {% endif %} - {% endif %} - {% if config.show_filename and post.filename %} - , - {% if post.filename|length > config.max_filename_display %} - {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} - {% else %} - {{ post.filename|bidi_cleanup }} - {% endif %} - {% endif %} - {% if post.thumb != 'file' and config.image_identification %} - , - - io - {% if post.file|extension == 'jpg' %} - e - {% endif %} - g - t - - {% endif %} - - ) - -

- - - - {% endif %} - {{ post.postControls }} -
- {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} -
-
-
-{% endfilter %} +{% filter remove_whitespace %} +{# tabs and new lines will be ignored #} +
+ +

+ + + {% if config.poster_ids %} + ID: {{ post.ip|poster_id(post.thread) }} + {% endif %} + No. + + {{ post.id }} + +

+ {% if post.embed %} + {{ post.embed }} + {% elseif post.file == 'deleted' %} + + {% elseif post.file and post.file %} +

File: {{ post.file }} + ( + {% if post.thumb == 'spoiler' %} + Spoiler Image, + {% endif %} + {{ post.filesize|filesize }} + {% if post.filex and post.filey %} + , {{ post.filex}}x{{ post.filey }} + {% if config.show_ratio %} + , {{ post.ratio }} + {% endif %} + {% endif %} + {% if config.show_filename and post.filename %} + , + {% if post.filename|length > config.max_filename_display %} + {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} + {% else %} + {{ post.filename|bidi_cleanup }} + {% endif %} + {% endif %} + {% if post.thumb != 'file' and config.image_identification %} + , + + io + {% if post.file|extension == 'jpg' %} + e + {% endif %} + g + t + + {% endif %} + + ) + +

+ + + + {% endif %} + {{ post.postControls }} +
+ {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} +
+
+
+{% endfilter %} diff --git a/templates/post_thread.html b/templates/post_thread.html index 72c841be..6d14f207 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -1,160 +1,160 @@ -{% filter remove_whitespace %} -{# tabs and new lines will be ignored #} - -
- -{% if post.embed %} - {{ post.embed }} -{% elseif post.file == 'deleted' %} - -{% elseif post.file and post.file %} -

{% trans %}File:{% endtrans %} {{ post.file }} - ( - {% if post.thumb == 'spoiler' %} - {% trans %}Spoiler Image{% endtrans %}, - {% endif %} - {{ post.filesize|filesize }} - {% if post.filex and post.filey %} - , {{ post.filex}}x{{ post.filey }} - {% if config.show_ratio %} - , {{ post.ratio }} - {% endif %} - {% endif %} - {% if config.show_filename and post.filename %} - , - {% if post.filename|length > config.max_filename_display %} - {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} - {% else %} - {{ post.filename|bidi_cleanup }} - {% endif %} - {% endif %} - {% if post.thumb != 'file' and config.image_identification %} - , - - io - {% if post.file|extension == 'jpg' %} - e - {% endif %} - g - t - - {% endif %} - ) -

- - -{% endif %} -

- - - {% if config.poster_ids %} - ID: {{ post.ip|poster_id(post.id) }} - {% endif %} - No. - - {{ post.id }} - +{% filter remove_whitespace %} +{# tabs and new lines will be ignored #} + +

+ +{% if post.embed %} + {{ post.embed }} +{% elseif post.file == 'deleted' %} + +{% elseif post.file and post.file %} +

{% trans %}File:{% endtrans %} {{ post.file }} + ( + {% if post.thumb == 'spoiler' %} + {% trans %}Spoiler Image{% endtrans %}, + {% endif %} + {{ post.filesize|filesize }} + {% if post.filex and post.filey %} + , {{ post.filex}}x{{ post.filey }} + {% if config.show_ratio %} + , {{ post.ratio }} + {% endif %} + {% endif %} + {% if config.show_filename and post.filename %} + , + {% if post.filename|length > config.max_filename_display %} + {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} + {% else %} + {{ post.filename|bidi_cleanup }} + {% endif %} + {% endif %} + {% if post.thumb != 'file' and config.image_identification %} + , + + io + {% if post.file|extension == 'jpg' %} + e + {% endif %} + g + t + + {% endif %} + ) +

+ + +{% endif %} +

+ + + {% if config.poster_ids %} + ID: {{ post.ip|poster_id(post.id) }} + {% endif %} + No. + + {{ post.id }} + {% if post.sticky %} {% if config.font_awesome %} - {% else %} + {% else %} Sticky - {% endif %} - {% endif %} + {% endif %} + {% endif %} {% if post.locked %} {% if config.font_awesome %} - {% else %} + {% else %} Locked - {% endif %} - {% endif %} + {% endif %} + {% endif %} {% if post.bumplocked and (config.mod.view_bumplock < 0 or (post.mod and post.mod|hasPermission(config.mod.view_bumplock, board.uri))) %} {% if config.font_awesome %} - {% else %} + {% else %} Bumplocked - {% endif %} - {% endif %} - {% if index %} - [{% trans %}Reply{% endtrans %}] - {% endif %} - {{ post.postControls }} -

-
- {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} -
- {% if post.omitted or post.omitted_images %} - - {% if post.omitted %} - {% trans %} - 1 post - {% plural post.omitted %} - {{ count }} posts - {% endtrans %} - {% if post.omitted_images %} - {% trans %}and{% endtrans %} - {% endif %} - {% endif %} - {% if post.omitted_images %} - {% trans %} - 1 image reply - {% plural post.omitted_images %} - {{ count }} image replies - {% endtrans %} - {% endif %} {% trans %}omitted. Click reply to view.{% endtrans %} - - {% endif %} -{% if not index %} -{% endif %} -
{% endfilter %} -{% set hr = post.hr %} -{% for post in post.posts %} - {% include 'post_reply.html' %} -{% endfor %} -
{% if hr %}
{% endif %} -
+ {% endif %} + {% endif %} + {% if index %} + [{% trans %}Reply{% endtrans %}] + {% endif %} + {{ post.postControls }} +

+
+ {% endfilter %}{% if index %}{{ post.body|truncate_body(post.link) }}{% else %}{{ post.body }}{% endif %}{% filter remove_whitespace %} +
+ {% if post.omitted or post.omitted_images %} + + {% if post.omitted %} + {% trans %} + 1 post + {% plural post.omitted %} + {{ count }} posts + {% endtrans %} + {% if post.omitted_images %} + {% trans %}and{% endtrans %} + {% endif %} + {% endif %} + {% if post.omitted_images %} + {% trans %} + 1 image reply + {% plural post.omitted_images %} + {{ count }} image replies + {% endtrans %} + {% endif %} {% trans %}omitted. Click reply to view.{% endtrans %} + + {% endif %} +{% if not index %} +{% endif %} +
{% endfilter %} +{% set hr = post.hr %} +{% for post in post.posts %} + {% include 'post_reply.html' %} +{% endfor %} +
{% if hr %}
{% endif %} +
diff --git a/templates/posts.sql b/templates/posts.sql index 0a1dc92a..698fad77 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -1,4 +1,4 @@ -CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( +CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `thread` int(11) DEFAULT NULL, `subject` varchar(100) DEFAULT NULL, diff --git a/templates/thread.html b/templates/thread.html index 53c784b4..5882d9b6 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -1,71 +1,71 @@ - - - - - - {% if config.url_favicon %}{% endif %} - {{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %} - - {% if config.meta_keywords %}{% endif %} + + + + + + {% if config.url_favicon %}{% endif %} + {{ board.url }} - {% if config.thread_subject_in_title and thread.subject %}{{ thread.subject }}{% else %}{{ board.title|e }}{% endif %} + + {% if config.meta_keywords %}{% endif %} {% if config.default_stylesheet.1 != '' %}{% endif %} - {% if config.font_awesome %}{% endif %} - {% if not nojavascript %} - - {% if not config.additional_javascript_compile %} - {% for javascript in config.additional_javascript %}{% endfor %} - {% endif %} - {% endif %} - {% if config.recaptcha %}{% endif %} - - - {{ boardlist.top }} - {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} - {% if config.url_banner %}{% endif %} -
-

{{ board.url }} - {{ board.title|e }}

-
- {% if board.subtitle %} - {{ board.subtitle|e }} - {% endif %} - {% if mod %}

{% trans %}Return to dashboard{% endtrans %}

{% endif %} -
-
- - - - {% include 'post_form.html' %} - - {% if config.blotter %}
{{ config.blotter }}
{% endif %} -
-
- - {% if mod %}{% endif %} - {{ body }} - {% include 'report_delete.html' %} -
- [{% trans %}Return{% endtrans %}] - - {{ boardlist.bottom }} -
-

Powered by Tinyboard {{ config.version }} | Tinyboard Copyright © 2010-2013 Tinyboard Development Group

- {% for footer in config.footer %}

{{ footer }}

{% endfor %} -
- - - + {% if config.font_awesome %}{% endif %} + {% if not nojavascript %} + + {% if not config.additional_javascript_compile %} + {% for javascript in config.additional_javascript %}{% endfor %} + {% endif %} + {% endif %} + {% if config.recaptcha %}{% endif %} + + + {{ boardlist.top }} + {% if pm %}
You have an unread PM{% if pm.waiting > 0 %}, plus {{ pm.waiting }} more waiting{% endif %}.

{% endif %} + {% if config.url_banner %}{% endif %} +
+

{{ board.url }} - {{ board.title|e }}

+
+ {% if board.subtitle %} + {{ board.subtitle|e }} + {% endif %} + {% if mod %}

{% trans %}Return to dashboard{% endtrans %}

{% endif %} +
+
+ + + + {% include 'post_form.html' %} + + {% if config.blotter %}
{{ config.blotter }}
{% endif %} +
+
+ + {% if mod %}{% endif %} + {{ body }} + {% include 'report_delete.html' %} +
+ [{% trans %}Return{% endtrans %}] + + {{ boardlist.bottom }} +
+

Powered by Tinyboard {{ config.version }} | Tinyboard Copyright © 2010-2013 Tinyboard Development Group

+ {% for footer in config.footer %}

{{ footer }}

{% endfor %} +
+ + + -- cgit v1.3 From be2e7d9782ebccc6a952468da5fbf94dd9a9d6c0 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:33:21 -0400 Subject: i18n some strings in inc/config.php --- inc/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 0ff0600b..8184f236 100644 --- a/inc/config.php +++ b/inc/config.php @@ -329,7 +329,7 @@ $config['robot_mute_hour'] = 336; // 2 weeks // If you want to alter the algorithm a bit. Default value is 2. n^x $config['robot_mute_multiplier'] = 2; - $config['robot_mute_descritpion'] = 'You have been muted for unoriginal content.'; + $config['robot_mute_descritpion'] = _('You have been muted for unoriginal content.'); // Automatically convert things like "..." to Unicode characters ("…") $config['auto_unicode'] = true; @@ -903,7 +903,7 @@ $config['mod']['check_ban_message'] = false; // Default public ban message. // In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). - $config['mod']['default_ban_message'] = 'USER WAS BANNED FOR THIS POST'; + $config['mod']['default_ban_message'] = _('USER WAS BANNED FOR THIS POST'); // $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; // Include length in ban message // What to append to the post for public bans ("%s" is the message) $config['mod']['ban_message'] = '(%s)'; -- cgit v1.3 From babeec8bb9f54eece943b74628c95f976f5ee814 Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:50:38 -0400 Subject: localise time values --- inc/functions.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index a261e350..8fdd8927 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -554,35 +554,35 @@ function checkFlood($post) { function until($timestamp) { $difference = $timestamp - time(); if ($difference < 60) { - return $difference . ' second' . ($difference != 1 ? 's' : ''); + return $difference . ' ' . ngettext('second', 'seconds', $difference); } elseif ($difference < 60*60) { - return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num); } elseif ($difference < 60*60*24) { - return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num); } elseif ($difference < 60*60*24*7) { - return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num); } elseif ($difference < 60*60*24*365) { - return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num); } - return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num); } function ago($timestamp) { $difference = time() - $timestamp; if ($difference < 60) { - return $difference . ' second' . ($difference != 1 ? 's' : ''); + return $difference . ' ' . ngettext('second', 'seconds', $difference); } elseif ($difference < 60*60) { - return ($num = round($difference/(60))) . ' minute' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60))) . ' ' . ngettext('minute', 'minutes', $num); } elseif ($difference < 60*60*24) { - return ($num = round($difference/(60*60))) . ' hour' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60))) . ' ' . ngettext('hour', 'hours', $num); } elseif ($difference < 60*60*24*7) { - return ($num = round($difference/(60*60*24))) . ' day' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24))) . ' ' . ngettext('day', 'days', $num); } elseif ($difference < 60*60*24*365) { - return ($num = round($difference/(60*60*24*7))) . ' week' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*7))) . ' ' . ngettext('week', 'weeks', $num); } - return ($num = round($difference/(60*60*24*365))) . ' year' . ($num != 1 ? 's' : ''); + return ($num = round($difference/(60*60*24*365))) . ' ' . ngettext('year', 'years', $num); } function displayBan($ban) { -- cgit v1.3 From 3f98522ff2cb6cc90b6f7e1285b27b4ba374eb9c Mon Sep 17 00:00:00 2001 From: czaks Date: Sat, 27 Jul 2013 01:21:30 -0400 Subject: i18n one more string in inc/functions.php --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 8fdd8927..783663e7 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -599,7 +599,7 @@ function displayBan($ban) { // Show banned page and exit die( Element('page.html', array( - 'title' => 'Banned!', + 'title' => _('Banned!'), 'config' => $config, 'body' => Element('banned.html', array( 'config' => $config, -- cgit v1.3 From 67db0a878a033d98a7daab578a7be8b70dc85b64 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 3 Jul 2013 00:25:32 -0400 Subject: js i18n: finish implementation with addition of the compiled locale strings file to additional javascripts --- inc/functions.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 783663e7..d904e1a2 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1277,6 +1277,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 -- cgit v1.3 From 81da2fea040b76c564c063ab88a3ef2a809dfc5f Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 05:03:50 -0400 Subject: Undo 7e0cec for now. Will restore later once I resolve issues --- inc/display.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index a2d50f74..94f8e8cd 100644 --- a/inc/display.php +++ b/inc/display.php @@ -25,7 +25,8 @@ function doBoardListPart($list, $root) { $body = ''; foreach ($list as $board) { if (is_array($board)) - $body .= ' [' . doBoardListPart($board, $root) . '] '; + $body .= ' [' . doBoardListPart($board, $root) . '] '; + // $body .= ' [' . doBoardListPart($board, $root) . '] '; else { if (($key = array_search($board, $list)) && gettype($key) == 'string') { $body .= ' ' . $key . ' /'; -- cgit v1.3 From 439795e63b1468000992275320b6c7e3f43fa9c0 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 06:40:57 -0400 Subject: Disallow board names which are too large for the filesytem to handle --- inc/mod/pages.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index ab4cdaaf..08604039 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -446,6 +446,23 @@ function mod_new_board() { if (!preg_match('/^' . $config['board_regex'] . '$/u', $_POST['uri'])) error(sprintf($config['error']['invalidfield'], 'URI')); + $bytes = 0; + $chars = preg_split('//u', $_POST['uri'], -1, PREG_SPLIT_NO_EMPTY); + foreach ($chars as $char) { + $o = 0; + $ord = ordutf8($char, $o); + if ($ord > 0x0080) + $bytes += 5; // @01ff + else + $bytes ++; + } + $bytes + strlen('posts_.frm'); + + if ($bytes > 255) { + error('Your filesystem cannot handle a board URI of that length (' . $bytes . '/255 bytes)'); + exit; + } + if (openBoard($_POST['uri'])) { error(sprintf($config['error']['boardexists'], $board['url'])); } -- cgit v1.3 From 42e16e233a53e73d8d8796814a588d5df1091f7b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 06:54:53 -0400 Subject: Javascript l10n: Work without $config['additional_javascript_compile'] --- inc/functions.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index d904e1a2..1ffa32df 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1277,16 +1277,17 @@ 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 )); + + // 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")) { + $script = file_get_contents($jsloc) . "\n\n" . $script; + } + if ($config['additional_javascript_compile']) { foreach ($config['additional_javascript'] as $file) { $script .= file_get_contents($file); -- cgit v1.3 From 659310663e9e7c2163234fbbc9ce922147328aa1 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 06:56:57 -0400 Subject: i18n some more strings in inc/config.php --- inc/config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 8184f236..1fd00a3d 100644 --- a/inc/config.php +++ b/inc/config.php @@ -538,8 +538,8 @@ $config['ban_date'] = '%A %e %B, %Y'; // The names on the post buttons. (On most imageboards, these are both "Post") - $config['button_newtopic'] = 'New Topic'; - $config['button_reply'] = 'New Reply'; + $config['button_newtopic'] = _('New Topic'); + $config['button_reply'] = _('New Reply'); // Assign each poster in a thread a unique ID, shown by "ID: {id}" before the post number. $config['poster_ids'] = false; @@ -550,7 +550,7 @@ $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.'; + $config['footer'][] = _('All trademarks, copyrights, comments, and images on this page are owned by and are the responsibility of their respective parties.'); // Characters used to generate a random password (with Javascript) $config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+'; -- cgit v1.3 From 3d979750b1be802549e4e18662c7e642f466daaa Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 15:01:44 -0400 Subject: fix merge --- inc/image.php | 5 ----- 1 file changed, 5 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 8cc9d69b..99c10252 100644 --- a/inc/image.php +++ b/inc/image.php @@ -286,12 +286,7 @@ class ImageConvert extends ImageBase { if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " > " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); -<<<<<<< HEAD - } - else { -======= } else { ->>>>>>> 8e4c493a4c5bbff07483fd4a11c44c687c99e441 if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); -- cgit v1.3 From dc1d1a3fcd0e6a9e4f1ba791e15765d68b09e6dc Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 16:22:27 -0400 Subject: Issue #125 --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 19790 -> 19840 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 2a31d64e..bc603e67 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index ca4f7ea4..20802b7d 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -16,7 +16,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" +"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" #. There is no previous page. #: /var/www/html/Tinyboard/inc/functions.php:958 -- cgit v1.3 From 6cdf6038754f18af4509ecf078f51894f63c5853 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 16:38:09 -0400 Subject: Fix last commit; Make Tinyboard Twig extension more mb-safe --- inc/lib/Twig/Extensions/Extension/Tinyboard.php | 8 ++++---- templates/post_thread.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 61cf9fc9..58a98c40 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -83,9 +83,9 @@ function twig_hasPermission_filter($mod, $permission, $board = null) { } function twig_extension_filter($value, $case_insensitive = true) { - $ext = substr($value, strrpos($value, '.') + 1); + $ext = mb_substr($value, mb_strrpos($value, '.') + 1); if($case_insensitive) - $ext = strtolower($ext); + $ext = mb_strtolower($ext); return $ext; } @@ -96,11 +96,11 @@ function twig_sprintf_filter( $value, $var) { function twig_truncate_filter($value, $length = 30, $preserve = false, $separator = '…') { if (mb_strlen($value) > $length) { if ($preserve) { - if (false !== ($breakpoint = strpos($value, ' ', $length))) { + if (false !== ($breakpoint = mb_strpos($value, ' ', $length))) { $length = $breakpoint; } } - return substr($value, 0, $length) . $separator; + return mb_substr($value, 0, $length) . $separator; } return $value; } diff --git a/templates/post_thread.html b/templates/post_thread.html index 6d14f207..21add308 100644 --- a/templates/post_thread.html +++ b/templates/post_thread.html @@ -23,9 +23,9 @@ {% if config.show_filename and post.filename %} , {% if post.filename|length > config.max_filename_display %} - {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} + {{ post.filename|truncate(config.max_filename_display)|bidi_cleanup }} {% else %} - {{ post.filename|bidi_cleanup }} + {{ post.filename|e|bidi_cleanup }} {% endif %} {% endif %} {% if post.thumb != 'file' and config.image_identification %} -- cgit v1.3 From c2a287cd142b4ba0940c3026af98d4ff949469de Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 17:02:42 -0400 Subject: Only run SQL query to count threads if we really need to --- inc/functions.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 1ffa32df..95487529 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -995,7 +995,10 @@ function index($page, $mod=false) { $query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ($query->rowcount() < 1 && $page > 1) + if ($page == 1 && $query->rowCount() <= $config['threads_per_page']) + $board['thread_count'] = $query->rowCount(); + + if ($query->rowCount() < 1 && $page > 1) return false; while ($th = $query->fetch()) { $thread = new Thread( @@ -1108,10 +1111,13 @@ function getPageButtons($pages, $mod=false) { function getPages($mod=false) { global $board, $config; - // Count threads - $query = query(sprintf("SELECT COUNT(`id`) as `num` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); - - $count = current($query->fetch()); + if (isset($board['thread_count'])) { + $count = $board['thread_count']; + } else { + // Count threads + $query = query(sprintf("SELECT COUNT(`id`) FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); + $count = $query->fetchColumn(); + } $count = floor(($config['threads_per_page'] + $count - 1) / $config['threads_per_page']); if ($count < 1) $count = 1; -- cgit v1.3 From 3a8736cdc0a047e19eaffb4eb82bbf560906ea7f Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 17:04:36 -0400 Subject: Fix last commit --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 95487529..7826d41b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -995,7 +995,7 @@ function index($page, $mod=false) { $query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ($page == 1 && $query->rowCount() <= $config['threads_per_page']) + if ($page == 1 && $query->rowCount() < $config['threads_per_page']) $board['thread_count'] = $query->rowCount(); if ($query->rowCount() < 1 && $page > 1) -- cgit v1.3 From 4891735c49ee7879d0f299d03ebfbe361f3cc73d Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 18:29:09 -0400 Subject: Fix issue #72 --- inc/config.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 1fd00a3d..6f2371ec 100644 --- a/inc/config.php +++ b/inc/config.php @@ -381,10 +381,10 @@ */ // "Wiki" markup syntax ($config['wiki_markup'] in pervious versions): - $config['markup'][] = array("/'''(.+?)'''/", "\$1"); - $config['markup'][] = array("/''(.+?)''/", "\$1"); - $config['markup'][] = array("/\*\*(.+?)\*\*/", "\$1"); - $config['markup'][] = array("/^[ |\t]*==(.+?)==[ |\t]*$/m", "\$1"); + $config['markup'][] = array("/'''([^<]+?)'''/", "\$1"); + $config['markup'][] = array("/''([^<]+?)''/", "\$1"); + $config['markup'][] = array("/\*\*([^<]+?)\*\*/", "\$1"); + $config['markup'][] = array("/^[ |\t]*==([^<]+?)==[ |\t]*$/m", "\$1"); // Highlight PHP code wrapped in tags (PHP 5.3.0+) // $config['markup'][] = array( -- cgit v1.3 From 6d52c8b42813722c49890b6e4f776dc0dabf382c Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 18:59:54 -0400 Subject: Markup modifiers. Fix issue #66 (public ban message lost when rebuilding post body) --- inc/functions.php | 36 +++++++++++++++++++++++++++++++++++- inc/mod/pages.php | 10 ++++++++-- post.php | 3 ++- 3 files changed, 45 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 7826d41b..e638f016 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1456,13 +1456,43 @@ function markup(&$body, $track_cites = false) { } } + if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + $skip_chars = 0; + $body_tmp = $body; + + foreach ($modifiers as $modifier) { + // preg_match_all is not multibyte-safe + foreach ($modifier as &$match) { + $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); + } + + $modifier['type'] = $modifier[1][0]; + $modifier['content'] = $modifier[2][0]; + + if ($modifier['type'] == 'ban message') { + // Public ban message + $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); + } elseif (preg_match('/^escape /', $modifier['type'])) { + // Escaped (not a real modifier) + $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; + } else { + // Unknown + $replacement = ''; + } + + $body = mb_substr_replace($body, $replacement, $modifier[0][1] + $skip_chars, mb_strlen($modifier[0][0])); + $skip_chars += mb_strlen($replacement) - mb_strlen($modifier[0][0]); + + } + } + // replace tabs with 8 spaces $body = str_replace("\t", ' ', $body); $tracked_cites = array(); // Cites - if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + if (isset($board) && preg_match_all('/(^|\s)>>(\d+?)([\s,.)?]|$)/m', $body, $cites, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { if (count($cites[0]) > $config['max_cites']) { error($config['error']['toomanycites']); } @@ -1561,6 +1591,10 @@ function markup(&$body, $track_cites = false) { return $tracked_cites; } +function escape_markup_modifiers($string) { + return preg_replace('@(.+)@', '$2', $string); +} + function utf8tohtml($utf8) { return htmlspecialchars($utf8, ENT_NOQUOTES, 'UTF-8'); } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 08604039..351d3203 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -507,6 +507,7 @@ function mod_noticeboard($page_no = 1) { if (!hasPermission($config['mod']['noticeboard_post'])) error($config['error']['noaccess']); + $_POST['body'] = escape_markup_modifiers($_POST['body']); markup($_POST['body']); $query = prepare('INSERT INTO `noticeboard` VALUES (NULL, :mod, :time, :subject, :body)'); @@ -568,6 +569,7 @@ function mod_news($page_no = 1) { if (!hasPermission($config['mod']['news'])) error($config['error']['noaccess']); + $_POST['body'] = escape_markup_modifiers($_POST['body']); markup($_POST['body']); $query = prepare('INSERT INTO `news` VALUES (NULL, :name, :time, :subject, :body)'); @@ -737,6 +739,7 @@ function mod_page_ip($ip) { if (!hasPermission($config['mod']['create_notes'])) error($config['error']['noaccess']); + $_POST['note'] = escape_markup_modifiers($_POST['note']); markup($_POST['note']); $query = prepare('INSERT INTO `ip_notes` VALUES (NULL, :ip, :mod, :time, :body)'); $query->bindValue(':ip', $ip); @@ -1214,12 +1217,14 @@ function mod_ban_post($board, $delete, $post, $token = false) { if (isset($_POST['public_message'], $_POST['message'])) { // public ban message $length_english = parse_time($_POST['length']) ? 'for ' . until(parse_time($_POST['length'])) : 'permanently'; + $_POST['message'] = preg_replace('/[\r\n]/', '', $_POST['message']); $_POST['message'] = str_replace('%length%', $length_english, $_POST['message']); $_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']); - $query = prepare(sprintf('UPDATE `posts_%s` SET `body` = CONCAT(`body`, :body) WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE `posts_%s` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board)); $query->bindValue(':id', $post); - $query->bindValue(':body', sprintf($config['mod']['ban_message'], utf8tohtml($_POST['message']))); + $query->bindValue(':body_nomarkup', sprintf('%s', $_POST['message'])); $query->execute() or error(db_error($query)); + rebuildPost($post); modLog("Attached a public ban message to post #{$post}: " . utf8tohtml($_POST['message'])); buildThread($thread ? $thread : $post); @@ -1713,6 +1718,7 @@ function mod_new_pm($username) { } if (isset($_POST['message'])) { + $_POST['message'] = escape_markup_modifiers($_POST['message']); markup($_POST['message']); $query = prepare("INSERT INTO `pms` VALUES (NULL, :me, :id, :message, :time, 1)"); diff --git a/post.php b/post.php index 8820db2d..adb44b58 100644 --- a/post.php +++ b/post.php @@ -107,7 +107,7 @@ if (isset($_POST['delete'])) { if (count($report) > $config['report_limit']) error($config['error']['toomanyreports']); - $reason = &$_POST['reason']; + $reason = escape_markup_modifiers($_POST['reason']); markup($reason); foreach ($report as &$id) { @@ -377,6 +377,7 @@ if (isset($_POST['delete'])) { error(sprintf($config['error']['toolong'], 'password')); wordfilters($post['body']); + $post['body'] = escape_markup_modifiers($post['body']); if (mysql_version() >= 50503) { $post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset -- cgit v1.3 From 6bbe407e18681f2812db4345036bb5ae639f5973 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 19:18:55 -0400 Subject: Markup modifiers: raw HTML --- inc/functions.php | 65 +++++++++++++++++++++++++++++-------------------------- post.php | 7 ++++-- 2 files changed, 39 insertions(+), 33 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index e638f016..7cde156b 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1421,6 +1421,39 @@ function markup(&$body, $track_cites = false) { $body = str_replace("\r", '', $body); $body = utf8tohtml($body); + if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + $skip_chars = 0; + $body_tmp = $body; + + foreach ($modifiers as $modifier) { + // preg_match_all is not multibyte-safe + foreach ($modifier as &$match) { + $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); + } + + $modifier['type'] = $modifier[1][0]; + $modifier['content'] = $modifier[2][0]; + + if ($modifier['type'] == 'ban message') { + // Public ban message + $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); + } elseif ($modifier['type'] == 'raw html') { + $body = html_entity_decode($modifier['content']); + return array(); + } elseif (preg_match('/^escape /', $modifier['type'])) { + // Escaped (not a real modifier) + $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; + } else { + // Unknown + $replacement = ''; + } + + $body = mb_substr_replace($body, $replacement, $modifier[0][1] + $skip_chars, mb_strlen($modifier[0][0])); + $skip_chars += mb_strlen($replacement) - mb_strlen($modifier[0][0]); + + } + } + if (mysql_version() < 50503) $body = mb_encode_numericentity($body, array(0x010000, 0xffffff, 0, 0xffffff), 'UTF-8'); @@ -1456,36 +1489,6 @@ function markup(&$body, $track_cites = false) { } } - if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { - $skip_chars = 0; - $body_tmp = $body; - - foreach ($modifiers as $modifier) { - // preg_match_all is not multibyte-safe - foreach ($modifier as &$match) { - $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); - } - - $modifier['type'] = $modifier[1][0]; - $modifier['content'] = $modifier[2][0]; - - if ($modifier['type'] == 'ban message') { - // Public ban message - $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); - } elseif (preg_match('/^escape /', $modifier['type'])) { - // Escaped (not a real modifier) - $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; - } else { - // Unknown - $replacement = ''; - } - - $body = mb_substr_replace($body, $replacement, $modifier[0][1] + $skip_chars, mb_strlen($modifier[0][0])); - $skip_chars += mb_strlen($replacement) - mb_strlen($modifier[0][0]); - - } - } - // replace tabs with 8 spaces $body = str_replace("\t", ' ', $body); @@ -1592,7 +1595,7 @@ function markup(&$body, $track_cites = false) { } function escape_markup_modifiers($string) { - return preg_replace('@(.+)@', '$2', $string); + return preg_replace('@(.+)@m', '$2', $string); } function utf8tohtml($utf8) { diff --git a/post.php b/post.php index adb44b58..db077866 100644 --- a/post.php +++ b/post.php @@ -379,6 +379,10 @@ if (isset($_POST['delete'])) { wordfilters($post['body']); $post['body'] = escape_markup_modifiers($post['body']); + if ($mod && isset($post['raw']) && $post['raw']) { + $post['body'] = '' . $post['body'] . ''; + } + if (mysql_version() >= 50503) { $post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset } else { @@ -396,8 +400,7 @@ if (isset($_POST['delete'])) { } } - if (!($mod && isset($post['raw']) && $post['raw'])) - $post['tracked_cites'] = markup($post['body'], true); + $post['tracked_cites'] = markup($post['body'], true); // Check for a flood if (!hasPermission($config['mod']['flood'], $board['uri']) && checkFlood($post)) { -- cgit v1.3 From fa5922b45efec1c0e334706ab5bccedb1856572b Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 19:50:25 -0400 Subject: fix post editing for tinyboard markup --- inc/mod/pages.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 351d3203..0eadd6ad 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1276,7 +1276,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) { if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) { if ($edit_raw_html) - $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup WHERE `id` = :id', $board)); else $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); @@ -1284,6 +1284,10 @@ function mod_edit_post($board, $edit_raw_html, $postID) { $query->bindValue(':email', $_POST['email']); $query->bindValue(':subject', $_POST['subject']); $query->bindValue(':body', $_POST['body']); + if ($edit_raw_html) { + $body_nomarkup = '' . $_POST['body'] . ''; + $query->bindValue(':body_nomarkup', $body_nomarkup); + } $query->execute() or error(db_error($query)); if ($edit_raw_html) { -- cgit v1.3 From e7dd0bbc4a4a17a4f7e5f6750b48ee3c0946c40e Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:11:11 -0400 Subject: facilitate using markup modifiers multiple times; make raw html not consume the whole post --- inc/functions.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 1f702ba0..5dace908 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1451,7 +1451,7 @@ function markup(&$body, $track_cites = false) { $body = str_replace("\r", '', $body); $body = utf8tohtml($body); - if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + if (preg_match_all('@<tinyboard ([\w\s]+)>(.+?)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { $skip_chars = 0; $body_tmp = $body; @@ -1468,8 +1468,7 @@ function markup(&$body, $track_cites = false) { // Public ban message $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); } elseif ($modifier['type'] == 'raw html') { - $body = html_entity_decode($modifier['content']); - return array(); + $replacement = html_entity_decode($modifier['content']); } elseif (preg_match('/^escape /', $modifier['type'])) { // Escaped (not a real modifier) $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; -- cgit v1.3 From d7ea47a91f63382f7a4e002086e415550e342a11 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:13:19 -0400 Subject: markup modifiers: make it even harder to escape --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 5dace908..b52c58fb 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1624,7 +1624,7 @@ function markup(&$body, $track_cites = false) { } function escape_markup_modifiers($string) { - return preg_replace('@(.+)@m', '$2', $string); + return preg_replace('@@m', '', $string); } function utf8tohtml($utf8) { -- cgit v1.3 From ce2af291b084f7f6f36a0718fbf4d84a832aef12 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:33:27 -0400 Subject: markup modifiers: there was a plan for adding markup to ban reasons, but assignment was missing; escape markup there too --- inc/mod/ban.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/ban.php b/inc/mod/ban.php index cfc2636f..99dfd196 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -61,7 +61,8 @@ function ban($mask, $reason, $length, $board) { $query->bindValue(':mod', $mod['id']); $query->bindValue(':time', time()); if ($reason !== '') { - markup($reason); + $reason = escape_markup_modifiers($reason); + $reason = markup($reason); $query->bindValue(':reason', $reason); } else $query->bindValue(':reason', null, PDO::PARAM_NULL); -- cgit v1.3 From 03d91df1d8af49aa1fd9e87fa8e9643b52fd52d9 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:41:56 -0400 Subject: fix previous commit; markup is called via reference --- inc/mod/ban.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/ban.php b/inc/mod/ban.php index 99dfd196..3f30db8f 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -62,7 +62,7 @@ function ban($mask, $reason, $length, $board) { $query->bindValue(':time', time()); if ($reason !== '') { $reason = escape_markup_modifiers($reason); - $reason = markup($reason); + markup($reason); $query->bindValue(':reason', $reason); } else $query->bindValue(':reason', null, PDO::PARAM_NULL); -- cgit v1.3 From 328484bee7cab9ce354121413cc8d96c3e227aea Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 20:51:43 -0400 Subject: SQL cleanup --- inc/functions.php | 63 +++++++++++++++++++------------------- inc/mod/auth.php | 2 +- inc/mod/pages.php | 32 +++++++++---------- post.php | 10 +++--- templates/themes/catalog/theme.php | 2 +- templates/themes/recent/theme.php | 19 +++++------- templates/themes/rrdtool/theme.php | 5 ++- 7 files changed, 64 insertions(+), 69 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 7cde156b..0b4ac211 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -243,7 +243,7 @@ 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()) { + while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { rebuildTheme($theme['theme'], $action, $board); } } @@ -281,7 +281,7 @@ function themeSettings($theme) { $query->execute() or error(db_error($query)); $settings = array(); - while ($s = $query->fetch()) { + while ($s = $query->fetch(PDO::FETCH_ASSOC)) { $settings[$s['name']] = $s['value']; } @@ -351,7 +351,7 @@ function getBoardInfo($uri) { $query->bindValue(':uri', $uri); $query->execute() or error(db_error($query)); - if ($board = $query->fetch()) { + if ($board = $query->fetch(PDO::FETCH_ASSOC)) { if ($config['cache']['enabled']) cache::set('board_' . $uri, $board); return $board; @@ -543,7 +543,7 @@ function checkFlood($post) { $query->bindValue(':floodsametime', time()-$config['flood_time_same'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - $flood = (bool)$query->fetch(); + $flood = (bool) $query->fetch(PDO::FETCH_ASSOC); if (event('check-flood', $post)) return true; @@ -647,7 +647,7 @@ function checkBan($board = 0) { $query->execute() or error(db_error($query)); } - if ($ban = $query->fetch()) { + if ($ban = $query->fetch(PDO::FETCH_ASSOC)) { if ($ban['expires'] && $ban['expires'] < time()) { // Ban expired $query = prepare("DELETE FROM `bans` WHERE `id` = :id"); @@ -685,12 +685,12 @@ function threadLocked($id) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error()); - if (!$post = $query->fetch()) { + if (($locked = $query->fetchColumn()) === false) { // Non-existant, so it can't be locked... return false; } - return (bool)$post['locked']; + return (bool)$locked; } function threadSageLocked($id) { @@ -703,12 +703,12 @@ function threadSageLocked($id) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error()); - if (!$post = $query->fetch()) { + if (($sagelocked = $query->fetchColumn()) === false) { // Non-existant, so it can't be locked... return false; } - return (bool) $post['sage']; + return (bool)$sagelocked; } function threadExists($id) { @@ -842,7 +842,7 @@ function deleteFile($id, $remove_entirely_if_already=true) { $query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if (!$post = $query->fetch()) + if (!$post = $query->fetch(PDO::FETCH_ASSOC)) error($config['error']['invalidpost']); if ($post['file'] == 'deleted' && !$post['thread']) @@ -880,7 +880,7 @@ function rebuildPost($id) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ((!$post = $query->fetch()) || !$post['body_nomarkup']) + if ((!$post = $query->fetch(PDO::FETCH_ASSOC)) || !$post['body_nomarkup']) return false; markup($body = &$post['body_nomarkup']); @@ -913,7 +913,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { $ids = array(); // Delete posts and maybe replies - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { if (!$post['thread']) { // Delete thread HTML page file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['id'])); @@ -946,7 +946,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { $query = prepare("SELECT `board`, `post` FROM `cites` WHERE `target_board` = :board AND (`target` = " . implode(' OR `target` = ', $ids) . ")"); $query->bindValue(':board', $board['uri']); $query->execute() or error(db_error($query)); - while ($cite = $query->fetch()) { + while ($cite = $query->fetch(PDO::FETCH_ASSOC)) { if ($board['uri'] != $cite['board']) { if (!isset($tmp_board)) $tmp_board = $board['uri']; @@ -979,7 +979,7 @@ function clean() { $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { deletePost($post['id']); } } @@ -1000,7 +1000,7 @@ function index($page, $mod=false) { if ($query->rowCount() < 1 && $page > 1) return false; - while ($th = $query->fetch()) { + while ($th = $query->fetch(PDO::FETCH_ASSOC)) { $thread = new Thread( $th['id'], $th['subject'], $th['email'], $th['name'], $th['trip'], $th['capcode'], $th['body'], $th['time'], $th['thumb'], $th['thumbwidth'], $th['thumbheight'], $th['file'], $th['filewidth'], $th['fileheight'], $th['filesize'], $th['filename'], $th['ip'], @@ -1115,7 +1115,7 @@ function getPages($mod=false) { $count = $board['thread_count']; } else { // Count threads - $query = query(sprintf("SELECT COUNT(`id`) FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); + $query = query(sprintf("SELECT COUNT(*) FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); $count = $query->fetchColumn(); } $count = floor(($config['threads_per_page'] + $count - 1) / $config['threads_per_page']); @@ -1155,7 +1155,7 @@ function checkRobot($body) { $query->bindValue(':hash', $body); $query->execute() or error(db_error($query)); - if ($query->fetch()) { + if ($query->fetchColumn()) { return true; } @@ -1163,20 +1163,19 @@ function checkRobot($body) { $query = prepare("INSERT INTO `robot` VALUES (:hash)"); $query->bindValue(':hash', $body); $query->execute() or error(db_error($query)); + return false; } // Returns an associative array with 'replies' and 'images' keys function numPosts($id) { global $board; - $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 = prepare(sprintf("SELECT COUNT(*) 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)); - $num_posts = $query->fetch(); - $num_posts = $num_posts['num']; - $num_images = $query->fetch(); - $num_images = $num_images['num']; + $num_posts = $query->fetchColumn(); + $num_images = $query->fetchColumn(); return array('replies' => $num_posts, 'images' => $num_images); } @@ -1188,14 +1187,14 @@ function muteTime() { return $time; // Find number of mutes in the past X hours - $query = prepare("SELECT COUNT(*) as `count` FROM `mutes` WHERE `time` >= :time AND `ip` = :ip"); + $query = prepare("SELECT COUNT(*) FROM `mutes` WHERE `time` >= :time AND `ip` = :ip"); $query->bindValue(':time', time()-($config['robot_mute_hour']*3600), PDO::PARAM_INT); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->execute() or error(db_error($query)); - $result = $query->fetch(); - if ($result['count'] == 0) return 0; - return pow($config['robot_mute_multiplier'], $result['count']); + if (!$result = $query->fetchColumn()) + return 0; + return pow($config['robot_mute_multiplier'], $result); } function mute() { @@ -1225,7 +1224,7 @@ function checkMute() { $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->execute() or error(db_error($query)); - if (!$mute = $query->fetch()) { + if (!$mute = $query->fetch(PDO::FETCH_ASSOC)) { // What!? He's muted but he's not muted... return; } @@ -1514,7 +1513,7 @@ function markup(&$body, $track_cites = false) { $match[1] = mb_strlen(substr($body_tmp, 0, $match[1])); } - if ($post = $query->fetch()) { + if ($post = $query->fetch(PDO::FETCH_ASSOC)) { $replacement = '' . '>>' . $cite . @@ -1557,7 +1556,7 @@ function markup(&$body, $track_cites = false) { $query->bindValue(':id', $cite); $query->execute() or error(db_error($query)); - if ($post = $query->fetch()) { + if ($post = $query->fetch(PDO::FETCH_ASSOC)) { $replacement = '' . '>>>/' . $_board . '/' . $cite . @@ -1666,7 +1665,7 @@ function buildThread($id, $return = false, $mod = false) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { if (!isset($thread)) { $thread = new Thread( $post['id'], $post['subject'], $post['email'], $post['name'], $post['trip'], $post['capcode'], $post['body'], $post['time'], @@ -1801,7 +1800,7 @@ function getPostByHash($hash) { $query->bindValue(':hash', $hash, PDO::PARAM_STR); $query->execute() or error(db_error($query)); - if ($post = $query->fetch()) { + if ($post = $query->fetch(PDO::FETCH_ASSOC)) { return $post; } @@ -1815,7 +1814,7 @@ function getPostByHashInThread($hash, $thread) { $query->bindValue(':thread', $thread, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ($post = $query->fetch()) { + if ($post = $query->fetch(PDO::FETCH_ASSOC)) { return $post; } diff --git a/inc/mod/auth.php b/inc/mod/auth.php index 1bc27dff..a0986a1f 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -147,7 +147,7 @@ function create_pm_header() { $query->bindValue(':id', $mod['id'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ($pm = $query->fetch()) + if ($pm = $query->fetch(PDO::FETCH_ASSOC)) $header = array('id' => $pm['id'], 'waiting' => $query->rowCount() - 1); else $header = true; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 351d3203..f5b1101d 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -96,14 +96,14 @@ function mod_dashboard() { $query = prepare('SELECT COUNT(*) FROM `pms` WHERE `to` = :id AND `unread` = 1'); $query->bindValue(':id', $mod['id']); $query->execute() or error(db_error($query)); - $args['unread_pms'] = $query->fetchColumn(0); + $args['unread_pms'] = $query->fetchColumn(); if ($config['cache']['enabled']) cache::set('pm_unreadcount_' . $mod['id'], $args['unread_pms']); } $query = query('SELECT COUNT(*) FROM `reports`') or error(db_error($query)); - $args['reports'] = $query->fetchColumn(0); + $args['reports'] = $query->fetchColumn(); if ($mod['type'] >= ADMIN && $config['check_updates']) { if (!$config['version']) @@ -536,7 +536,7 @@ function mod_noticeboard($page_no = 1) { $query = prepare("SELECT COUNT(*) FROM `noticeboard`"); $query->execute() or error(db_error($query)); - $count = $query->fetchColumn(0); + $count = $query->fetchColumn(); mod_page(_('Noticeboard'), 'mod/noticeboard.html', array('noticeboard' => $noticeboard, 'count' => $count)); } @@ -597,7 +597,7 @@ function mod_news($page_no = 1) { $query = prepare("SELECT COUNT(*) FROM `news`"); $query->execute() or error(db_error($query)); - $count = $query->fetchColumn(0); + $count = $query->fetchColumn(); mod_page(_('News'), 'mod/news.html', array('news' => $news, 'count' => $count)); } @@ -637,7 +637,7 @@ function mod_log($page_no = 1) { $query = prepare("SELECT COUNT(*) FROM `modlogs`"); $query->execute() or error(db_error($query)); - $count = $query->fetchColumn(0); + $count = $query->fetchColumn(); mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count)); } @@ -664,7 +664,7 @@ function mod_user_log($username, $page_no = 1) { $query = prepare("SELECT COUNT(*) FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); - $count = $query->fetchColumn(0); + $count = $query->fetchColumn(); mod_page(_('Moderation log'), 'mod/log.html', array('logs' => $logs, 'count' => $count, 'username' => $username)); } @@ -906,7 +906,7 @@ function mod_bans($page_no = 1) { $query = prepare("SELECT COUNT(*) FROM `bans`"); $query->execute() or error(db_error($query)); - $count = $query->fetchColumn(0); + $count = $query->fetchColumn(); foreach ($bans as &$ban) { if (filter_var($ban['ip'], FILTER_VALIDATE_IP) !== false) @@ -1058,7 +1058,7 @@ function mod_move($originBoard, $postID) { $replies = array(); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $post['mod'] = true; $post['thread'] = $newID; @@ -1365,7 +1365,7 @@ function mod_deletebyip($boardName, $post, $global = false) { $query = prepare(sprintf('SELECT `ip` FROM `posts_%s` WHERE `id` = :id', $boardName)); $query->bindValue(':id', $post); $query->execute() or error(db_error($query)); - if (!$ip = $query->fetchColumn(0)) + if (!$ip = $query->fetchColumn()) error($config['error']['invalidpost']); $boards = $global ? listBoards() : array(array('uri' => $boardName)); @@ -1387,7 +1387,7 @@ function mod_deletebyip($boardName, $post, $global = false) { $threads_to_rebuild = array(); $threads_deleted = array(); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); deletePost($post['id'], false, false); @@ -1684,7 +1684,7 @@ function mod_inbox() { $query = prepare('SELECT COUNT(*) FROM `pms` WHERE `to` = :mod AND `unread` = 1'); $query->bindValue(':mod', $mod['id']); $query->execute() or error(db_error($query)); - $unread = $query->fetchColumn(0); + $unread = $query->fetchColumn(); foreach ($messages as &$message) { $message['snippet'] = pm_snippet($message['message']); @@ -1706,12 +1706,12 @@ function mod_new_pm($username) { $query = prepare("SELECT `id` FROM `mods` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); - if (!$id = $query->fetchColumn(0)) { + if (!$id = $query->fetchColumn()) { // Old style ?/PM: by user ID $query = prepare("SELECT `username` FROM `mods` WHERE `id` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); - if ($username = $query->fetchColumn(0)) + if ($username = $query->fetchColumn()) header('Location: ?/new_PM/' . $username, true, $config['redirect_http']); else error($config['error']['404']); @@ -1832,7 +1832,7 @@ function mod_reports() { $report_posts[$board] = array(); $query = query(sprintf('SELECT * FROM `posts_%s` WHERE `id` = ' . implode(' OR `id` = ', $posts), $board)) or error(db_error()); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $report_posts[$board][$post['id']] = $post; } } @@ -2169,10 +2169,10 @@ function mod_debug_antispam() { } $query = query('SELECT COUNT(*) FROM `antispam`' . ($where ? " WHERE $where" : '')) or error(db_error()); - $args['total'] = number_format($query->fetchColumn(0)); + $args['total'] = number_format($query->fetchColumn()); $query = query('SELECT COUNT(*) FROM `antispam` WHERE `expires` IS NOT NULL' . ($where ? " AND $where" : '')) or error(db_error()); - $args['expiring'] = number_format($query->fetchColumn(0)); + $args['expiring'] = number_format($query->fetchColumn()); $query = query('SELECT * FROM `antispam` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `passed` DESC LIMIT 40') or error(db_error()); $args['top'] = $query->fetchAll(PDO::FETCH_ASSOC); diff --git a/post.php b/post.php index db077866..f4499845 100644 --- a/post.php +++ b/post.php @@ -52,7 +52,7 @@ if (isset($_POST['delete'])) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - if ($post = $query->fetch()) { + if ($post = $query->fetch(PDO::FETCH_ASSOC)) { if ($password != '' && $post['password'] != $password) error($config['error']['invalidpassword']); @@ -115,12 +115,12 @@ if (isset($_POST['delete'])) { $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - $post = $query->fetch(); + $thread = $query->fetchColumn(); - if ($post) { + if ($thread) { if ($config['syslog']) _syslog(LOG_INFO, 'Reported post: ' . - '/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $id) . ($post['thread'] ? '#' . $id : '') . + '/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $thread ? $thread : $id) . ($thread ? '#' . $id : '') . ' for "' . $reason . '"' ); $query = prepare("INSERT INTO `reports` VALUES (NULL, :time, :ip, :board, :post, :reason)"); @@ -231,7 +231,7 @@ if (isset($_POST['delete'])) { $query->bindValue(':id', $post['thread'], PDO::PARAM_INT); $query->execute() or error(db_error()); - if (!$thread = $query->fetch()) { + if (!$thread = $query->fetch(PDO::FETCH_ASSOC)) { // Non-existant error($config['error']['nonexistant']); } diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index e585cf17..5c9f6769 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -39,7 +39,7 @@ $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error()); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])); $post['board_name'] = $board['name']; $post['file'] = $config['uri_thumb'] . $post['thumb']; diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index 75907e77..98fabfa1 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -47,7 +47,7 @@ $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query); $query = query($query) or error(db_error()); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); // board settings won't be available in the template file, so generate links now @@ -67,7 +67,7 @@ $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_posts'], $query); $query = query($query) or error(db_error()); - while ($post = $query->fetch()) { + while ($post = $query->fetch(PDO::FETCH_ASSOC)) { openBoard($post['board']); $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])) . '#' . $post['id']; @@ -78,7 +78,7 @@ } // Total posts - $query = 'SELECT SUM(`top`) AS `count` FROM ('; + $query = 'SELECT SUM(`top`) FROM ('; foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; @@ -86,11 +86,10 @@ } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); - $res = $query->fetch(); - $stats['total_posts'] = number_format($res['count']); + $stats['total_posts'] = number_format($query->fetchColumn()); // Unique IPs - $query = 'SELECT COUNT(DISTINCT(`ip`)) AS `count` FROM ('; + $query = 'SELECT COUNT(DISTINCT(`ip`)) FROM ('; foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; @@ -98,11 +97,10 @@ } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); - $res = $query->fetch(); - $stats['unique_posters'] = number_format($res['count']); + $stats['unique_posters'] = number_format($query->fetchColumn()); // Active content - $query = 'SELECT SUM(`filesize`) AS `count` FROM ('; + $query = 'SELECT SUM(`filesize`) FROM ('; foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; @@ -110,8 +108,7 @@ } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); - $res = $query->fetch(); - $stats['active_content'] = $res['count']; + $stats['active_content'] = $query->fetchColumn(); return Element('themes/recent/recent.html', Array( 'settings' => $settings, diff --git a/templates/themes/rrdtool/theme.php b/templates/themes/rrdtool/theme.php index 68fc1850..0e0a2f15 100644 --- a/templates/themes/rrdtool/theme.php +++ b/templates/themes/rrdtool/theme.php @@ -61,9 +61,8 @@ // debug just the graphing (not updating) with the --debug switch if (!isset($argv[1]) || $argv[1] != '--debug') { // Update graph - $query = query(sprintf("SELECT MAX(`id`) AS `count` FROM `posts_%s`", $board)); - $count = $query->fetch(); - $count = $count['count']; + $query = query(sprintf("SELECT MAX(`id`) FROM `posts_%s`", $board)); + $count = $query->fetchColumn(); if (!rrd_update($file, Array( '-t', -- cgit v1.3 From 0f9df0ac6608d3398cd480465dcab1b0227ec9c0 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 20:54:20 -0400 Subject: Newline before --- inc/mod/pages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index f5b1101d..7edc0ee6 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1222,7 +1222,7 @@ function mod_ban_post($board, $delete, $post, $token = false) { $_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']); $query = prepare(sprintf('UPDATE `posts_%s` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board)); $query->bindValue(':id', $post); - $query->bindValue(':body_nomarkup', sprintf('%s', $_POST['message'])); + $query->bindValue(':body_nomarkup', sprintf("\n%s", $_POST['message'])); $query->execute() or error(db_error($query)); rebuildPost($post); -- cgit v1.3 From a5312ebe897036e89db57480abb0ae617a2bcb38 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 21:02:26 -0400 Subject: Allow public ban messages on raw HTML posts --- inc/functions.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 0b4ac211..b40b40d2 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1423,6 +1423,7 @@ function markup(&$body, $track_cites = false) { if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { $skip_chars = 0; $body_tmp = $body; + $end_markup = false; foreach ($modifiers as $modifier) { // preg_match_all is not multibyte-safe @@ -1436,9 +1437,13 @@ function markup(&$body, $track_cites = false) { if ($modifier['type'] == 'ban message') { // Public ban message $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); + if ($end_markup) { + $body .= $replacement; + } } elseif ($modifier['type'] == 'raw html') { $body = html_entity_decode($modifier['content']); - return array(); + $replacement = ''; + $end_markup = true; } elseif (preg_match('/^escape /', $modifier['type'])) { // Escaped (not a real modifier) $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; @@ -1447,9 +1452,14 @@ function markup(&$body, $track_cites = false) { $replacement = ''; } - $body = mb_substr_replace($body, $replacement, $modifier[0][1] + $skip_chars, mb_strlen($modifier[0][0])); - $skip_chars += mb_strlen($replacement) - mb_strlen($modifier[0][0]); - + if (!$end_markup) { + $body = mb_substr_replace($body, $replacement, $modifier[0][1] + $skip_chars, mb_strlen($modifier[0][0])); + $skip_chars += mb_strlen($replacement) - mb_strlen($modifier[0][0]); + } + } + + if ($end_markup) { + return array(); } } -- cgit v1.3 From 055c3a73820dd949ab8bf71012fac66cac9daebd Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 21:22:32 -0400 Subject: Revert "facilitate using markup modifiers multiple times; make raw html not consume the whole post" This reverts commit e7dd0bbc4a4a17a4f7e5f6750b48ee3c0946c40e. --- inc/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 2cbf3e6b..a6fd35c7 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1449,7 +1449,7 @@ function markup(&$body, $track_cites = false) { $body = str_replace("\r", '', $body); $body = utf8tohtml($body); - if (preg_match_all('@<tinyboard ([\w\s]+)>(.+?)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { $skip_chars = 0; $body_tmp = $body; @@ -1466,7 +1466,8 @@ function markup(&$body, $track_cites = false) { // Public ban message $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); } elseif ($modifier['type'] == 'raw html') { - $replacement = html_entity_decode($modifier['content']); + $body = html_entity_decode($modifier['content']); + return array(); } elseif (preg_match('/^escape /', $modifier['type'])) { // Escaped (not a real modifier) $replacement = '<tinyboard ' . substr($modifier['type'], strlen('escape ')) . '>' . $modifier['content'] . '</tinyboard>'; -- cgit v1.3 From e93d5b2f8e033735ca40a9d3a44771be9f3842c8 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 21:22:57 -0400 Subject: Revert "markup modifiers: make it even harder to escape" This reverts commit d7ea47a91f63382f7a4e002086e415550e342a11. --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index a6fd35c7..e57fd32a 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1623,7 +1623,7 @@ function markup(&$body, $track_cites = false) { } function escape_markup_modifiers($string) { - return preg_replace('@@m', '', $string); + return preg_replace('@(.+)@m', '$2', $string); } function utf8tohtml($utf8) { -- cgit v1.3 From ea2b8cce077a092e0cbf136f9a45158668cc5ecf Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 21:24:17 -0400 Subject: Bugfix: HTML injection in post editing (introduces and fixes yet another bug) --- inc/functions.php | 4 ++-- inc/mod/pages.php | 9 ++++++--- templates/mod/edit_post_form.html | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index b40b40d2..9e1ce1fa 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1420,7 +1420,7 @@ function markup(&$body, $track_cites = false) { $body = str_replace("\r", '', $body); $body = utf8tohtml($body); - if (preg_match_all('@<tinyboard ([\w\s]+)>(.+)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { + if (preg_match_all('@<tinyboard ([\w\s]+)>(.+?)</tinyboard>@um', $body, $modifiers, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) { $skip_chars = 0; $body_tmp = $body; $end_markup = false; @@ -1436,7 +1436,7 @@ function markup(&$body, $track_cites = false) { if ($modifier['type'] == 'ban message') { // Public ban message - $replacement = sprintf($config['mod']['ban_message'], $modifier['content']); + $replacement = sprintf($config['mod']['ban_message'], html_entity_decode($modifier['content'])); if ($end_markup) { $body .= $replacement; } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 7edc0ee6..2808dc56 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1222,7 +1222,7 @@ function mod_ban_post($board, $delete, $post, $token = false) { $_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']); $query = prepare(sprintf('UPDATE `posts_%s` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board)); $query->bindValue(':id', $post); - $query->bindValue(':body_nomarkup', sprintf("\n%s", $_POST['message'])); + $query->bindValue(':body_nomarkup', sprintf("\n%s", utf8tohtml($_POST['message']))); $query->execute() or error(db_error($query)); rebuildPost($post); @@ -1298,10 +1298,13 @@ function mod_edit_post($board, $edit_raw_html, $postID) { header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $postID) . '#' . $postID, true, $config['redirect_http']); } else { if ($config['minify_html']) { - $post['body_nomarkup'] = str_replace("\n", ' ', $post['body_nomarkup']); - $post['body'] = str_replace("\n", ' ', $post['body']); + // $post['body_nomarkup'] = str_replace("\n", ' ', $post['body_nomarkup']); + // $post['body'] = str_replace("\n", ' ', $post['body']); } + // Minifying this page causes an issue with newlines in the textarea. This is a temporary solution. + $config['minify_html'] = false; + mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post)); } } diff --git a/templates/mod/edit_post_form.html b/templates/mod/edit_post_form.html index 146e725b..b9359c68 100644 --- a/templates/mod/edit_post_form.html +++ b/templates/mod/edit_post_form.html @@ -32,7 +32,7 @@ {% trans %}Comment{% endtrans %} - + -- cgit v1.3 From ab364525433a7194d050e4ec13ae08d603fdad43 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 19:50:25 -0400 Subject: fix post editing for tinyboard markup --- inc/mod/pages.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 2808dc56..3ff6a9b1 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1276,7 +1276,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) { if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) { if ($edit_raw_html) - $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup WHERE `id` = :id', $board)); else $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); @@ -1284,6 +1284,10 @@ function mod_edit_post($board, $edit_raw_html, $postID) { $query->bindValue(':email', $_POST['email']); $query->bindValue(':subject', $_POST['subject']); $query->bindValue(':body', $_POST['body']); + if ($edit_raw_html) { + $body_nomarkup = '' . $_POST['body'] . ''; + $query->bindValue(':body_nomarkup', $body_nomarkup); + } $query->execute() or error(db_error($query)); if ($edit_raw_html) { -- cgit v1.3 From 232f4ff8680e81dbee3902c01af6c702555fbc0f Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:13:19 -0400 Subject: markup modifiers: make it even harder to escape --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 9e1ce1fa..403f6112 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1604,7 +1604,7 @@ function markup(&$body, $track_cites = false) { } function escape_markup_modifiers($string) { - return preg_replace('@(.+)@m', '$2', $string); + return preg_replace('@@m', '', $string); } function utf8tohtml($utf8) { -- cgit v1.3 From a052a791b553c770ef407f91b697bef7a62df5b1 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Wed, 31 Jul 2013 22:14:26 -0400 Subject: Add optional database table prefix (issue #118; see issue comments for details) --- inc/anti-bot.php | 12 +-- inc/config.php | 2 + inc/database.php | 4 + inc/filters.php | 2 +- inc/functions.php | 80 +++++++-------- inc/mod/auth.php | 8 +- inc/mod/ban.php | 6 +- inc/mod/pages.php | 188 +++++++++++++++++----------------- install.php | 6 +- post.php | 10 +- templates/posts.sql | 2 +- templates/themes/basic/theme.php | 2 +- templates/themes/catalog/theme.php | 2 +- templates/themes/categories/theme.php | 2 +- templates/themes/frameset/theme.php | 2 +- templates/themes/recent/theme.php | 10 +- templates/themes/rrdtool/theme.php | 2 +- templates/themes/sitemap/theme.php | 2 +- 18 files changed, 177 insertions(+), 165 deletions(-) (limited to 'inc') diff --git a/inc/anti-bot.php b/inc/anti-bot.php index bf29b3cb..fde97096 100644 --- a/inc/anti-bot.php +++ b/inc/anti-bot.php @@ -182,12 +182,12 @@ function _create_antibot($board, $thread) { $antibot = new AntiBot(array($board, $thread)); - query('DELETE FROM `antispam` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); + query('DELETE FROM ``antispam`` WHERE `expires` < UNIX_TIMESTAMP()') or error(db_error()); if ($thread) - $query = prepare('UPDATE `antispam` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL'); + $query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` = :thread AND `expires` IS NULL'); else - $query = prepare('UPDATE `antispam` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` IS NULL AND `expires` IS NULL'); + $query = prepare('UPDATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE `board` = :board AND `thread` IS NULL AND `expires` IS NULL'); $query->bindValue(':board', $board); if ($thread) @@ -195,7 +195,7 @@ function _create_antibot($board, $thread) { $query->bindValue(':expires', $config['spam']['hidden_inputs_expire']); $query->execute() or error(db_error($query)); - $query = prepare('INSERT INTO `antispam` VALUES (:board, :thread, :hash, UNIX_TIMESTAMP(), NULL, 0)'); + $query = prepare('INSERT INTO ``antispam`` VALUES (:board, :thread, :hash, UNIX_TIMESTAMP(), NULL, 0)'); $query->bindValue(':board', $board); $query->bindValue(':thread', $thread); $query->bindValue(':hash', $antibot->hash()); @@ -248,7 +248,7 @@ function checkSpam(array $extra_salt = array()) { if ($hash != $_hash) return true; - $query = prepare('SELECT `passed` FROM `antispam` WHERE `hash` = :hash'); + $query = prepare('SELECT `passed` FROM ``antispam`` WHERE `hash` = :hash'); $query->bindValue(':hash', $hash); $query->execute() or error(db_error($query)); if ((($passed = $query->fetchColumn(0)) === false) || ($passed > $config['spam']['hidden_inputs_max_pass'])) { @@ -260,7 +260,7 @@ function checkSpam(array $extra_salt = array()) { } function incrementSpamHash($hash) { - $query = prepare('UPDATE `antispam` SET `passed` = `passed` + 1 WHERE `hash` = :hash'); + $query = prepare('UPDATE ``antispam`` SET `passed` = `passed` + 1 WHERE `hash` = :hash'); $query->bindValue(':hash', $hash); $query->execute() or error(db_error($query)); } diff --git a/inc/config.php b/inc/config.php index 6f2371ec..75384d3f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -76,6 +76,8 @@ $config['db']['password'] = ''; // Tinyboard database $config['db']['database'] = ''; + // Table prefix + $config['db']['prefix'] = ''; // Use a persistent connection (experimental) $config['db']['persistent'] = false; // Anything more to add to the DSN string (eg. port=xxx;foo=bar) diff --git a/inc/database.php b/inc/database.php index 3dc0f0ce..7be001ea 100644 --- a/inc/database.php +++ b/inc/database.php @@ -87,6 +87,8 @@ function mysql_version() { function prepare($query) { global $pdo, $debug, $config; + $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + sql_open(); if ($config['debug']) @@ -98,6 +100,8 @@ function prepare($query) { function query($query) { global $pdo, $debug, $config; + $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + sql_open(); if ($config['debug']) { diff --git a/inc/filters.php b/inc/filters.php index 524d37cf..9f03154d 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -81,7 +81,7 @@ class Filter { else $all_boards = false; - $query = prepare("INSERT INTO `bans` VALUES (NULL, :ip, :mod, :set, :expires, :reason, :board, 0)"); + $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()); diff --git a/inc/functions.php b/inc/functions.php index 403f6112..e871fee0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -241,7 +241,7 @@ function create_antibot($board, $thread = null) { 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()); + $query = query("SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error()); while ($theme = $query->fetch(PDO::FETCH_ASSOC)) { rebuildTheme($theme['theme'], $action, $board); @@ -276,7 +276,7 @@ function rebuildTheme($theme, $action, $board = false) { function themeSettings($theme) { - $query = prepare("SELECT `name`, `value` FROM `theme_settings` WHERE `theme` = :theme AND `name` IS NOT NULL"); + $query = prepare("SELECT `name`, `value` FROM ``theme_settings`` WHERE `theme` = :theme AND `name` IS NOT NULL"); $query->bindValue(':theme', $theme); $query->execute() or error(db_error($query)); @@ -347,7 +347,7 @@ function getBoardInfo($uri) { return $board; } - $query = prepare("SELECT * FROM `boards` WHERE `uri` = :uri LIMIT 1"); + $query = prepare("SELECT * FROM ``boards`` WHERE `uri` = :uri LIMIT 1"); $query->bindValue(':uri', $uri); $query->execute() or error(db_error($query)); @@ -523,7 +523,7 @@ function listBoards() { if ($config['cache']['enabled'] && ($boards = cache::get('all_boards'))) return $boards; - $query = query("SELECT * FROM `boards` ORDER BY `uri`") or error(db_error()); + $query = query("SELECT * FROM ``boards`` ORDER BY `uri`") or error(db_error()); $boards = $query->fetchAll(); if ($config['cache']['enabled']) @@ -535,7 +535,7 @@ function listBoards() { function checkFlood($post) { global $board, $config; - $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`ip` = :ip AND `time` >= :floodtime) OR (`ip` = :ip AND `body` != '' AND `body` = :body AND `time` >= :floodsameiptime) OR (`body` != '' AND `body` = :body AND `time` >= :floodsametime) LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`ip` = :ip AND `time` >= :floodtime) OR (`ip` = :ip AND `body` != '' AND `body` = :body AND `time` >= :floodsameiptime) OR (`body` != '' AND `body` = :body AND `time` >= :floodsametime) LIMIT 1", $board['uri'])); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->bindValue(':body', $post['body']); $query->bindValue(':floodtime', time()-$config['flood_time'], PDO::PARAM_INT); @@ -589,7 +589,7 @@ function displayBan($ban) { global $config; if (!$ban['seen']) { - $query = prepare("UPDATE `bans` SET `seen` = 1 WHERE `id` = :id"); + $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)); } @@ -620,12 +620,12 @@ function checkBan($board = 0) { if (event('check-ban', $board)) return true; - $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 = 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`, `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 = 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)); @@ -633,7 +633,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`, `seen`, `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 @@ -650,7 +650,7 @@ function checkBan($board = 0) { if ($ban = $query->fetch(PDO::FETCH_ASSOC)) { if ($ban['expires'] && $ban['expires'] < time()) { // Ban expired - $query = prepare("DELETE FROM `bans` WHERE `id` = :id"); + $query = prepare("DELETE FROM ``bans`` WHERE `id` = :id"); $query->bindValue(':id', $ban['id'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -670,7 +670,7 @@ function checkBan($board = 0) { // 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 = 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)); } @@ -681,7 +681,7 @@ function threadLocked($id) { if (event('check-locked', $id)) return true; - $query = prepare(sprintf("SELECT `locked` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `locked` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error()); @@ -699,7 +699,7 @@ function threadSageLocked($id) { if (event('check-sage-locked', $id)) return true; - $query = prepare(sprintf("SELECT `sage` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `sage` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error()); @@ -714,7 +714,7 @@ function threadSageLocked($id) { function threadExists($id) { global $board; - $query = prepare(sprintf("SELECT 1 FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT 1 FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error()); @@ -727,7 +727,7 @@ function threadExists($id) { function post(array $post) { global $pdo, $board; - $query = prepare(sprintf("INSERT INTO `posts_%s` (`id`, `thread`, `subject`, `email`, `name`, `trip`, `capcode`, `body`, `body_nomarkup`, `time`, `bump`, `thumb`, `thumbwidth`, `thumbheight`, `file`, `filewidth`, `fileheight`, `filesize`, `filename`, `filehash`, `password`, `ip`, `sticky`, `locked`, `sage`, `embed`) VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri'])); + $query = prepare(sprintf("INSERT INTO ``posts_%s`` VALUES ( NULL, :thread, :subject, :email, :name, :trip, :capcode, :body, :body_nomarkup, :time, :time, :thumb, :thumbwidth, :thumbheight, :file, :width, :height, :filesize, :filename, :filehash, :password, :ip, :sticky, :locked, 0, :embed)", $board['uri'])); // Basic stuff if (!empty($post['subject'])) { @@ -829,7 +829,7 @@ function bumpThread($id) { if (event('bump', $id)) return true; - $query = prepare(sprintf("UPDATE `posts_%s` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri'])); + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump` = :time WHERE `id` = :id AND `thread` IS NULL", $board['uri'])); $query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -839,7 +839,7 @@ function bumpThread($id) { function deleteFile($id, $remove_entirely_if_already=true) { global $board, $config; - $query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `thread`,`thumb`,`file` FROM ``posts_%s`` WHERE `id` = :id LIMIT 1", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); if (!$post = $query->fetch(PDO::FETCH_ASSOC)) @@ -848,7 +848,7 @@ function deleteFile($id, $remove_entirely_if_already=true) { if ($post['file'] == 'deleted' && !$post['thread']) return; // Can't delete OP's image completely. - $query = prepare(sprintf("UPDATE `posts_%s` SET `thumb` = NULL, `thumbwidth` = NULL, `thumbheight` = NULL, `filewidth` = NULL, `fileheight` = NULL, `filesize` = NULL, `filename` = NULL, `filehash` = NULL, `file` = :file WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `thumb` = NULL, `thumbwidth` = NULL, `thumbheight` = NULL, `filewidth` = NULL, `fileheight` = NULL, `filesize` = NULL, `filename` = NULL, `filehash` = NULL, `file` = :file WHERE `id` = :id", $board['uri'])); if ($post['file'] == 'deleted' && $remove_entirely_if_already) { // Already deleted; remove file fully $query->bindValue(':file', null, PDO::PARAM_NULL); @@ -876,7 +876,7 @@ function deleteFile($id, $remove_entirely_if_already=true) { function rebuildPost($id) { global $board; - $query = prepare(sprintf("SELECT `body_nomarkup`, `thread` FROM `posts_%s` WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT `body_nomarkup`, `thread` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -885,7 +885,7 @@ function rebuildPost($id) { markup($body = &$post['body_nomarkup']); - $query = prepare(sprintf("UPDATE `posts_%s` SET `body` = :body WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `body` = :body WHERE `id` = :id", $board['uri'])); $query->bindValue(':body', $body); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -900,7 +900,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { global $board, $config; // Select post and replies (if thread) in one query - $query = prepare(sprintf("SELECT `id`,`thread`,`thumb`,`file` FROM `posts_%s` WHERE `id` = :id OR `thread` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT `id`,`thread`,`thumb`,`file` FROM ``posts_%s`` WHERE `id` = :id OR `thread` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -918,7 +918,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { // Delete thread HTML page file_unlink($board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['id'])); - $antispam_query = prepare('DELETE FROM `antispam` WHERE `board` = :board AND `thread` = :thread'); + $antispam_query = prepare('DELETE FROM ``antispam`` WHERE `board` = :board AND `thread` = :thread'); $antispam_query->bindValue(':board', $board['uri']); $antispam_query->bindValue(':thread', $post['id']); $antispam_query->execute() or error(db_error($antispam_query)); @@ -939,11 +939,11 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { } - $query = prepare(sprintf("DELETE FROM `posts_%s` WHERE `id` = :id OR `thread` = :id", $board['uri'])); + $query = prepare(sprintf("DELETE FROM ``posts_%s`` WHERE `id` = :id OR `thread` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); - $query = prepare("SELECT `board`, `post` FROM `cites` WHERE `target_board` = :board AND (`target` = " . implode(' OR `target` = ', $ids) . ")"); + $query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board AND (`target` = " . implode(' OR `target` = ', $ids) . ")"); $query->bindValue(':board', $board['uri']); $query->execute() or error(db_error($query)); while ($cite = $query->fetch(PDO::FETCH_ASSOC)) { @@ -958,7 +958,7 @@ function deletePost($id, $error_if_doesnt_exist=true, $rebuild_after=true) { if (isset($tmp_board)) openBoard($tmp_board); - $query = prepare("DELETE FROM `cites` WHERE (`target_board` = :board AND `target` = :id) OR (`board` = :board AND `post` = :id)"); + $query = prepare("DELETE FROM ``cites`` WHERE (`target_board` = :board AND `target` = :id) OR (`board` = :board AND `post` = :id)"); $query->bindValue(':board', $board['uri']); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -975,7 +975,7 @@ function clean() { $offset = round($config['max_pages']*$config['threads_per_page']); // I too wish there was an easier way of doing this... - $query = prepare(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'])); + $query = prepare(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset, 9001", $board['uri'])); $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -990,7 +990,7 @@ function index($page, $mod=false) { $body = ''; $offset = round($page*$config['threads_per_page']-$config['threads_per_page']); - $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset,:threads_per_page", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `sticky` DESC, `bump` DESC LIMIT :offset,:threads_per_page", $board['uri'])); $query->bindValue(':offset', $offset, PDO::PARAM_INT); $query->bindValue(':threads_per_page', $config['threads_per_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -1011,7 +1011,7 @@ function index($page, $mod=false) { $replies = $cached['replies']; $omitted = $cached['omitted']; } else { - $posts = prepare(sprintf("SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri'])); + $posts = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `id` DESC LIMIT :limit", $board['uri'])); $posts->bindValue(':id', $th['id']); $posts->bindValue(':limit', ($th['sticky'] ? $config['threads_preview_sticky'] : $config['threads_preview']), PDO::PARAM_INT); $posts->execute() or error(db_error($posts)); @@ -1115,7 +1115,7 @@ function getPages($mod=false) { $count = $board['thread_count']; } else { // Count threads - $query = query(sprintf("SELECT COUNT(*) FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); + $query = query(sprintf("SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); $count = $query->fetchColumn(); } $count = floor(($config['threads_per_page'] + $count - 1) / $config['threads_per_page']); @@ -1151,7 +1151,7 @@ function checkRobot($body) { return true; $body = makerobot($body); - $query = prepare("SELECT 1 FROM `robot` WHERE `hash` = :hash LIMIT 1"); + $query = prepare("SELECT 1 FROM ``robot`` WHERE `hash` = :hash LIMIT 1"); $query->bindValue(':hash', $body); $query->execute() or error(db_error($query)); @@ -1160,7 +1160,7 @@ function checkRobot($body) { } // Insert new hash - $query = prepare("INSERT INTO `robot` VALUES (:hash)"); + $query = prepare("INSERT INTO ``robot`` VALUES (:hash)"); $query->bindValue(':hash', $body); $query->execute() or error(db_error($query)); @@ -1170,7 +1170,7 @@ function checkRobot($body) { // Returns an associative array with 'replies' and 'images' keys function numPosts($id) { global $board; - $query = prepare(sprintf("SELECT COUNT(*) 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 = prepare(sprintf("SELECT COUNT(*) 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)); @@ -1187,7 +1187,7 @@ function muteTime() { return $time; // Find number of mutes in the past X hours - $query = prepare("SELECT COUNT(*) FROM `mutes` WHERE `time` >= :time AND `ip` = :ip"); + $query = prepare("SELECT COUNT(*) FROM ``mutes`` WHERE `time` >= :time AND `ip` = :ip"); $query->bindValue(':time', time()-($config['robot_mute_hour']*3600), PDO::PARAM_INT); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->execute() or error(db_error($query)); @@ -1199,7 +1199,7 @@ function muteTime() { function mute() { // Insert mute - $query = prepare("INSERT INTO `mutes` VALUES (:ip, :time)"); + $query = prepare("INSERT INTO ``mutes`` VALUES (:ip, :time)"); $query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->execute() or error(db_error($query)); @@ -1220,7 +1220,7 @@ function checkMute() { $mutetime = muteTime(); if ($mutetime > 0) { // Find last mute time - $query = prepare("SELECT `time` FROM `mutes` WHERE `ip` = :ip ORDER BY `time` DESC LIMIT 1"); + $query = prepare("SELECT `time` FROM ``mutes`` WHERE `ip` = :ip ORDER BY `time` DESC LIMIT 1"); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->execute() or error(db_error($query)); @@ -1514,7 +1514,7 @@ function markup(&$body, $track_cites = false) { foreach ($cites as $matches) { $cite = $matches[2][0]; - $query = prepare(sprintf("SELECT `thread`,`id` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `thread`,`id` FROM ``posts_%s`` WHERE `id` = :id LIMIT 1", $board['uri'])); $query->bindValue(':id', $cite); $query->execute() or error(db_error($query)); @@ -1562,7 +1562,7 @@ function markup(&$body, $track_cites = false) { // Check if the board exists, and load settings if (openBoard($_board)) { if ($cite) { - $query = prepare(sprintf("SELECT `thread`,`id` FROM `posts_%s` WHERE `id` = :id LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `thread`,`id` FROM ``posts_%s`` WHERE `id` = :id LIMIT 1", $board['uri'])); $query->bindValue(':id', $cite); $query->execute() or error(db_error($query)); @@ -1671,7 +1671,7 @@ function buildThread($id, $return = false, $mod = false) { cache::delete("thread_{$board['uri']}_{$id}"); } - $query = prepare(sprintf("SELECT * FROM `posts_%s` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri'])); + $query = prepare(sprintf("SELECT * FROM ``posts_%s`` WHERE (`thread` IS NULL AND `id` = :id) OR `thread` = :id ORDER BY `thread`,`id`", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -1806,7 +1806,7 @@ function fraction($numerator, $denominator, $sep) { function getPostByHash($hash) { global $board; - $query = prepare(sprintf("SELECT `id`,`thread` FROM `posts_%s` WHERE `filehash` = :hash", $board['uri'])); + $query = prepare(sprintf("SELECT `id`,`thread` FROM ``posts_%s`` WHERE `filehash` = :hash", $board['uri'])); $query->bindValue(':hash', $hash, PDO::PARAM_STR); $query->execute() or error(db_error($query)); @@ -1819,7 +1819,7 @@ function getPostByHash($hash) { function getPostByHashInThread($hash, $thread) { global $board; - $query = prepare(sprintf("SELECT `id`,`thread` FROM `posts_%s` WHERE `filehash` = :hash AND ( `thread` = :thread OR `id` = :thread )", $board['uri'])); + $query = prepare(sprintf("SELECT `id`,`thread` FROM ``posts_%s`` WHERE `filehash` = :hash AND ( `thread` = :thread OR `id` = :thread )", $board['uri'])); $query->bindValue(':hash', $hash, PDO::PARAM_STR); $query->bindValue(':thread', $thread, PDO::PARAM_INT); $query->execute() or error(db_error($query)); diff --git a/inc/mod/auth.php b/inc/mod/auth.php index a0986a1f..bfab0f7e 100644 --- a/inc/mod/auth.php +++ b/inc/mod/auth.php @@ -42,7 +42,7 @@ function login($username, $password, $makehash=true) { $password = sha1($password); } - $query = prepare("SELECT `id`, `type`, `boards`, `password`, `salt` FROM `mods` WHERE `username` = :username"); + $query = prepare("SELECT `id`, `type`, `boards`, `password`, `salt` FROM ``mods`` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); @@ -83,7 +83,7 @@ function destroyCookies() { function modLog($action, $_board=null) { global $mod, $board, $config; - $query = prepare("INSERT INTO `modlogs` VALUES (:id, :ip, :board, :time, :text)"); + $query = prepare("INSERT INTO ``modlogs`` VALUES (:id, :ip, :board, :time, :text)"); $query->bindValue(':id', $mod['id'], PDO::PARAM_INT); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR']); $query->bindValue(':time', time(), PDO::PARAM_INT); @@ -112,7 +112,7 @@ if (isset($_COOKIE[$config['cookies']['mod']])) { exit; } - $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM `mods` WHERE `username` = :username"); + $query = prepare("SELECT `id`, `type`, `boards`, `password` FROM ``mods`` WHERE `username` = :username"); $query->bindValue(':username', $cookie[0]); $query->execute() or error(db_error($query)); $user = $query->fetch(PDO::FETCH_ASSOC); @@ -143,7 +143,7 @@ function create_pm_header() { return $header; } - $query = prepare("SELECT `id` FROM `pms` WHERE `to` = :id AND `unread` = 1"); + $query = prepare("SELECT `id` FROM ``pms`` WHERE `to` = :id AND `unread` = 1"); $query->bindValue(':id', $mod['id'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); diff --git a/inc/mod/ban.php b/inc/mod/ban.php index cfc2636f..9166223f 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -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, 0)"); + $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()); @@ -89,12 +89,12 @@ function ban($mask, $reason, $length, $board) { } function unban($id) { - $query = prepare("SELECT `ip` FROM `bans` WHERE `id` = :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 = prepare("DELETE FROM ``bans`` WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 3ff6a9b1..1e0dc7c9 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -82,7 +82,7 @@ function mod_dashboard() { if (hasPermission($config['mod']['noticeboard'])) { if (!$config['cache']['enabled'] || !$args['noticeboard'] = cache::get('noticeboard_preview')) { - $query = prepare("SELECT `noticeboard`.*, `username` FROM `noticeboard` LEFT JOIN `mods` ON `mods`.`id` = `mod` ORDER BY `id` DESC LIMIT :limit"); + $query = prepare("SELECT ``noticeboard``.*, `username` FROM ``noticeboard`` LEFT JOIN ``mods`` ON ``mods``.`id` = `mod` ORDER BY `id` DESC LIMIT :limit"); $query->bindValue(':limit', $config['mod']['noticeboard_dashboard'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); $args['noticeboard'] = $query->fetchAll(PDO::FETCH_ASSOC); @@ -93,7 +93,7 @@ function mod_dashboard() { } 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 = prepare('SELECT COUNT(*) FROM ``pms`` WHERE `to` = :id AND `unread` = 1'); $query->bindValue(':id', $mod['id']); $query->execute() or error(db_error($query)); $args['unread_pms'] = $query->fetchColumn(); @@ -102,7 +102,7 @@ function mod_dashboard() { cache::set('pm_unreadcount_' . $mod['id'], $args['unread_pms']); } - $query = query('SELECT COUNT(*) FROM `reports`') or error(db_error($query)); + $query = query('SELECT COUNT(*) FROM ``reports``') or error(db_error($query)); $args['reports'] = $query->fetchColumn(); if ($mod['type'] >= ADMIN && $config['check_updates']) { @@ -208,6 +208,8 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { // Use asterisk as wildcard instead $query = str_replace('*', '%', $query); + $query = str_replace('`', '!`', $query); + // Array of phrases to match $match = array(); @@ -271,7 +273,7 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { if (!empty($query)) $query .= ' UNION ALL '; - $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE %s", $board['uri'], $board['uri'], $sql_like); + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE %s", $board['uri'], $board['uri'], $sql_like); } // You weren't allowed to search any boards @@ -282,21 +284,21 @@ function mod_search($type, $search_query_escaped, $page_no = 1) { } if ($type == 'IP_notes') { - $query = 'SELECT * FROM `ip_notes` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE ' . $sql_like . ' ORDER BY `time` DESC'; + $query = 'SELECT * FROM ``ip_notes`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE ' . $sql_like . ' ORDER BY `time` DESC'; $sql_table = 'ip_notes'; if (!hasPermission($config['mod']['view_notes']) || !hasPermission($config['mod']['show_ip'])) error($config['error']['noaccess']); } if ($type == 'bans') { - $query = 'SELECT `bans`.*, `username` FROM `bans` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE ' . $sql_like . ' ORDER BY (`expires` IS NOT NULL AND `expires` < UNIX_TIMESTAMP()), `set` DESC'; + $query = 'SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE ' . $sql_like . ' ORDER BY (`expires` IS NOT NULL AND `expires` < UNIX_TIMESTAMP()), `set` DESC'; $sql_table = 'bans'; if (!hasPermission($config['mod']['view_banlist'])) error($config['error']['noaccess']); } if ($type == 'log') { - $query = 'SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE ' . $sql_like . ' ORDER BY `time` DESC'; + $query = 'SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE ' . $sql_like . ' ORDER BY `time` DESC'; $sql_table = 'modlogs'; if (!hasPermission($config['mod']['modlog'])) error($config['error']['noaccess']); @@ -353,7 +355,7 @@ function mod_edit_board($boardName) { if (!hasPermission($config['mod']['manageboards'], $board['uri'])) error($config['error']['deleteboard']); - $query = prepare('DELETE FROM `boards` WHERE `uri` = :uri'); + $query = prepare('DELETE FROM ``boards`` WHERE `uri` = :uri'); $query->bindValue(':uri', $board['uri']); $query->execute() or error(db_error($query)); @@ -363,19 +365,19 @@ function mod_edit_board($boardName) { rrmdir($board['uri'] . '/'); // Delete posting table - $query = query(sprintf('DROP TABLE IF EXISTS `posts_%s`', $board['uri'])) or error(db_error()); + $query = query(sprintf('DROP TABLE IF EXISTS ``posts_%s``', $board['uri'])) or error(db_error()); // Clear reports - $query = prepare('DELETE FROM `reports` WHERE `board` = :id'); + $query = prepare('DELETE FROM ``reports`` WHERE `board` = :id'); $query->bindValue(':id', $board['uri'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); // Delete from table - $query = prepare('DELETE FROM `boards` WHERE `uri` = :uri'); + $query = prepare('DELETE FROM ``boards`` WHERE `uri` = :uri'); $query->bindValue(':uri', $board['uri'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); - $query = prepare("SELECT `board`, `post` FROM `cites` WHERE `target_board` = :board"); + $query = prepare("SELECT `board`, `post` FROM ``cites`` WHERE `target_board` = :board"); $query->bindValue(':board', $board['uri']); $query->execute() or error(db_error($query)); while ($cite = $query->fetch(PDO::FETCH_ASSOC)) { @@ -387,28 +389,28 @@ function mod_edit_board($boardName) { } } - $query = prepare('DELETE FROM `cites` WHERE `board` = :board OR `target_board` = :board'); + $query = prepare('DELETE FROM ``cites`` WHERE `board` = :board OR `target_board` = :board'); $query->bindValue(':board', $board['uri']); $query->execute() or error(db_error($query)); - $query = prepare('DELETE FROM `antispam` WHERE `board` = :board'); + $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()); + $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 = 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 = prepare('UPDATE ``boards`` SET `title` = :title, `subtitle` = :subtitle WHERE `uri` = :uri'); $query->bindValue(':uri', $board['uri']); $query->bindValue(':title', $_POST['title']); $query->bindValue(':subtitle', $_POST['subtitle']); @@ -467,7 +469,7 @@ function mod_new_board() { error(sprintf($config['error']['boardexists'], $board['url'])); } - $query = prepare('INSERT INTO `boards` VALUES (:uri, :title, :subtitle)'); + $query = prepare('INSERT INTO ``boards`` VALUES (:uri, :title, :subtitle)'); $query->bindValue(':uri', $_POST['uri']); $query->bindValue(':title', $_POST['title']); $query->bindValue(':subtitle', $_POST['subtitle']); @@ -510,7 +512,7 @@ function mod_noticeboard($page_no = 1) { $_POST['body'] = escape_markup_modifiers($_POST['body']); markup($_POST['body']); - $query = prepare('INSERT INTO `noticeboard` VALUES (NULL, :mod, :time, :subject, :body)'); + $query = prepare('INSERT INTO ``noticeboard`` VALUES (NULL, :mod, :time, :subject, :body)'); $query->bindValue(':mod', $mod['id']); $query->bindvalue(':time', time()); $query->bindValue(':subject', $_POST['subject']); @@ -525,7 +527,7 @@ function mod_noticeboard($page_no = 1) { header('Location: ?/noticeboard#' . $pdo->lastInsertId(), true, $config['redirect_http']); } - $query = prepare("SELECT `noticeboard`.*, `username` FROM `noticeboard` LEFT JOIN `mods` ON `mods`.`id` = `mod` ORDER BY `id` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT ``noticeboard``.*, `username` FROM ``noticeboard`` LEFT JOIN ``mods`` ON ``mods``.`id` = `mod` ORDER BY `id` DESC LIMIT :offset, :limit"); $query->bindValue(':limit', $config['mod']['noticeboard_page'], PDO::PARAM_INT); $query->bindValue(':offset', ($page_no - 1) * $config['mod']['noticeboard_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -534,7 +536,7 @@ function mod_noticeboard($page_no = 1) { if (empty($noticeboard) && $page_no > 1) error($config['error']['404']); - $query = prepare("SELECT COUNT(*) FROM `noticeboard`"); + $query = prepare("SELECT COUNT(*) FROM ``noticeboard``"); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); @@ -547,7 +549,7 @@ function mod_noticeboard_delete($id) { if (!hasPermission($config['mod']['noticeboard_delete'])) error($config['error']['noaccess']); - $query = prepare('DELETE FROM `noticeboard` WHERE `id` = :id'); + $query = prepare('DELETE FROM ``noticeboard`` WHERE `id` = :id'); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -572,7 +574,7 @@ function mod_news($page_no = 1) { $_POST['body'] = escape_markup_modifiers($_POST['body']); markup($_POST['body']); - $query = prepare('INSERT INTO `news` VALUES (NULL, :name, :time, :subject, :body)'); + $query = prepare('INSERT INTO ``news`` VALUES (NULL, :name, :time, :subject, :body)'); $query->bindValue(':name', isset($_POST['name']) && hasPermission($config['mod']['news_custom']) ? $_POST['name'] : $mod['username']); $query->bindvalue(':time', time()); $query->bindValue(':subject', $_POST['subject']); @@ -586,7 +588,7 @@ function mod_news($page_no = 1) { header('Location: ?/news#' . $pdo->lastInsertId(), true, $config['redirect_http']); } - $query = prepare("SELECT * FROM `news` ORDER BY `id` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT * FROM ``news`` ORDER BY `id` DESC LIMIT :offset, :limit"); $query->bindValue(':limit', $config['mod']['news_page'], PDO::PARAM_INT); $query->bindValue(':offset', ($page_no - 1) * $config['mod']['news_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -595,7 +597,7 @@ function mod_news($page_no = 1) { if (empty($news) && $page_no > 1) error($config['error']['404']); - $query = prepare("SELECT COUNT(*) FROM `news`"); + $query = prepare("SELECT COUNT(*) FROM ``news``"); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); @@ -608,7 +610,7 @@ function mod_news_delete($id) { if (!hasPermission($config['mod']['news_delete'])) error($config['error']['noaccess']); - $query = prepare('DELETE FROM `news` WHERE `id` = :id'); + $query = prepare('DELETE FROM ``news`` WHERE `id` = :id'); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -626,7 +628,7 @@ function mod_log($page_no = 1) { if (!hasPermission($config['mod']['modlog'])) error($config['error']['noaccess']); - $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` ORDER BY `time` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` ORDER BY `time` DESC LIMIT :offset, :limit"); $query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT); $query->bindValue(':offset', ($page_no - 1) * $config['mod']['modlog_page'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -635,7 +637,7 @@ function mod_log($page_no = 1) { if (empty($logs) && $page_no > 1) error($config['error']['404']); - $query = prepare("SELECT COUNT(*) FROM `modlogs`"); + $query = prepare("SELECT COUNT(*) FROM ``modlogs``"); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); @@ -651,7 +653,7 @@ function mod_user_log($username, $page_no = 1) { if (!hasPermission($config['mod']['modlog'])) error($config['error']['noaccess']); - $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `username` = :username ORDER BY `time` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT `username`, `mod`, `ip`, `board`, `time`, `text` FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `username` = :username ORDER BY `time` DESC LIMIT :offset, :limit"); $query->bindValue(':username', $username); $query->bindValue(':limit', $config['mod']['modlog_page'], PDO::PARAM_INT); $query->bindValue(':offset', ($page_no - 1) * $config['mod']['modlog_page'], PDO::PARAM_INT); @@ -661,7 +663,7 @@ function mod_user_log($username, $page_no = 1) { if (empty($logs) && $page_no > 1) error($config['error']['404']); - $query = prepare("SELECT COUNT(*) FROM `modlogs` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `username` = :username"); + $query = prepare("SELECT COUNT(*) FROM ``modlogs`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); @@ -707,7 +709,7 @@ function mod_ip_remove_note($ip, $id) { if (filter_var($ip, FILTER_VALIDATE_IP) === false) error("Invalid IP address."); - $query = prepare('DELETE FROM `ip_notes` WHERE `ip` = :ip AND `id` = :id'); + $query = prepare('DELETE FROM ``ip_notes`` WHERE `ip` = :ip AND `id` = :id'); $query->bindValue(':ip', $ip); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -741,7 +743,7 @@ function mod_page_ip($ip) { $_POST['note'] = escape_markup_modifiers($_POST['note']); markup($_POST['note']); - $query = prepare('INSERT INTO `ip_notes` VALUES (NULL, :ip, :mod, :time, :body)'); + $query = prepare('INSERT INTO ``ip_notes`` VALUES (NULL, :ip, :mod, :time, :body)'); $query->bindValue(':ip', $ip); $query->bindValue(':mod', $mod['id']); $query->bindValue(':time', time()); @@ -766,7 +768,7 @@ function mod_page_ip($ip) { openBoard($board['uri']); if (!hasPermission($config['mod']['show_ip'], $board['uri'])) continue; - $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $board['uri'])); + $query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `ip` = :ip ORDER BY `sticky` DESC, `id` DESC LIMIT :limit', $board['uri'])); $query->bindValue(':ip', $ip); $query->bindValue(':limit', $config['mod']['ip_recentposts'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -798,21 +800,21 @@ function mod_page_ip($ip) { $args['token'] = make_secure_link_token('ban'); if (hasPermission($config['mod']['view_ban'])) { - $query = prepare("SELECT `bans`.*, `username` FROM `bans` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip"); + $query = prepare("SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip"); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); $args['bans'] = $query->fetchAll(PDO::FETCH_ASSOC); } if (hasPermission($config['mod']['view_notes'])) { - $query = prepare("SELECT `ip_notes`.*, `username` FROM `ip_notes` LEFT JOIN `mods` ON `mod` = `mods`.`id` WHERE `ip` = :ip"); + $query = prepare("SELECT ``ip_notes``.*, `username` FROM ``ip_notes`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip"); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); $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 = 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); @@ -865,7 +867,7 @@ function mod_bans($page_no = 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()); + query('DELETE FROM ``bans`` WHERE `id` = ' . implode(' OR `id` = ', $unban)) or error(db_error()); foreach ($unban as $id) { modLog("Removed ban #{$id}"); @@ -878,7 +880,7 @@ function mod_bans($page_no = 1) { } else { if (!empty($unban)) { - query('DELETE FROM `bans` WHERE `id` = ' . implode(' OR `id` = ', $unban)) or error(db_error()); + query('DELETE FROM ``bans`` WHERE `id` = ' . implode(' OR `id` = ', $unban)) or error(db_error()); foreach ($unban as $id) { modLog("Removed ban #{$id}"); @@ -890,10 +892,10 @@ function mod_bans($page_no = 1) { } if ($config['mod']['view_banexpired']) { - $query = prepare("SELECT `bans`.*, `username` FROM `bans` LEFT JOIN `mods` ON `mod` = `mods`.`id` ORDER BY (`expires` IS NOT NULL AND `expires` < :time), `set` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` ORDER BY (`expires` IS NOT NULL AND `expires` < :time), `set` DESC LIMIT :offset, :limit"); } else { // Filter out expired bans - $query = prepare("SELECT `bans`.*, `username` FROM `bans` INNER JOIN `mods` ON `mod` = `mods`.`id` WHERE `expires` = 0 OR `expires` > :time ORDER BY `set` DESC LIMIT :offset, :limit"); + $query = prepare("SELECT ``bans``.*, `username` FROM ``bans`` INNER JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `expires` = 0 OR `expires` > :time ORDER BY `set` DESC LIMIT :offset, :limit"); } $query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':limit', $config['mod']['banlist_page'], PDO::PARAM_INT); @@ -904,7 +906,7 @@ function mod_bans($page_no = 1) { if (empty($bans) && $page_no > 1) error($config['error']['404']); - $query = prepare("SELECT COUNT(*) FROM `bans`"); + $query = prepare("SELECT COUNT(*) FROM ``bans``"); $query->execute() or error(db_error($query)); $count = $query->fetchColumn(); @@ -926,7 +928,7 @@ function mod_lock($board, $unlock, $post) { if (!hasPermission($config['mod']['lock'], $board)) error($config['error']['noaccess']); - $query = prepare(sprintf('UPDATE `posts_%s` SET `locked` = :locked WHERE `id` = :id AND `thread` IS NULL', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `locked` = :locked WHERE `id` = :id AND `thread` IS NULL', $board)); $query->bindValue(':id', $post); $query->bindValue(':locked', $unlock ? 0 : 1); $query->execute() or error(db_error($query)); @@ -937,7 +939,7 @@ function mod_lock($board, $unlock, $post) { } if ($config['mod']['dismiss_reports_on_lock']) { - $query = prepare('DELETE FROM `reports` WHERE `board` = :board AND `post` = :id'); + $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)); @@ -960,7 +962,7 @@ function mod_sticky($board, $unsticky, $post) { if (!hasPermission($config['mod']['sticky'], $board)) error($config['error']['noaccess']); - $query = prepare(sprintf('UPDATE `posts_%s` SET `sticky` = :sticky WHERE `id` = :id AND `thread` IS NULL', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `sticky` = :sticky WHERE `id` = :id AND `thread` IS NULL', $board)); $query->bindValue(':id', $post); $query->bindValue(':sticky', $unsticky ? 0 : 1); $query->execute() or error(db_error($query)); @@ -982,7 +984,7 @@ function mod_bumplock($board, $unbumplock, $post) { if (!hasPermission($config['mod']['bumplock'], $board)) error($config['error']['noaccess']); - $query = prepare(sprintf('UPDATE `posts_%s` SET `sage` = :bumplock WHERE `id` = :id AND `thread` IS NULL', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `sage` = :bumplock WHERE `id` = :id AND `thread` IS NULL', $board)); $query->bindValue(':id', $post); $query->bindValue(':bumplock', $unbumplock ? 0 : 1); $query->execute() or error(db_error($query)); @@ -1004,7 +1006,7 @@ function mod_move($originBoard, $postID) { if (!hasPermission($config['mod']['move'], $originBoard)) error($config['error']['noaccess']); - $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL', $originBoard)); + $query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL', $originBoard)); $query->bindValue(':id', $postID); $query->execute() or error(db_error($query)); if (!$post = $query->fetch(PDO::FETCH_ASSOC)) @@ -1052,7 +1054,7 @@ function mod_move($originBoard, $postID) { // go back to the original board to fetch replies openBoard($originBoard); - $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `thread` = :id ORDER BY `id`', $originBoard)); + $query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `thread` = :id ORDER BY `id`', $originBoard)); $query->bindValue(':id', $postID, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -1081,7 +1083,7 @@ function mod_move($originBoard, $postID) { openBoard($targetBoard); foreach ($replies as &$post) { - $query = prepare('SELECT `target` FROM `cites` WHERE `target_board` = :board AND `board` = :board AND `post` = :post'); + $query = prepare('SELECT `target` FROM ``cites`` WHERE `target_board` = :board AND `board` = :board AND `post` = :post'); $query->bindValue(':board', $originBoard); $query->bindValue(':post', $post['id'], PDO::PARAM_INT); $query->execute() or error(db_error($qurey)); @@ -1113,7 +1115,7 @@ function mod_move($originBoard, $postID) { } foreach ($post['tracked_cites'] as $cite) { - $query = prepare('INSERT INTO `cites` VALUES (:board, :post, :target_board, :target)'); + $query = prepare('INSERT INTO ``cites`` VALUES (:board, :post, :target_board, :target)'); $query->bindValue(':board', $board['uri']); $query->bindValue(':post', $newPostID, PDO::PARAM_INT); $query->bindValue(':target_board',$cite[0]); @@ -1138,7 +1140,7 @@ function mod_move($originBoard, $postID) { if ($shadow) { // lock old thread - $query = prepare(sprintf('UPDATE `posts_%s` SET `locked` = 1 WHERE `id` = :id', $originBoard)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `locked` = 1 WHERE `id` = :id', $originBoard)); $query->bindValue(':id', $postID, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -1197,7 +1199,7 @@ function mod_ban_post($board, $delete, $post, $token = false) { $security_token = make_secure_link_token($board . '/ban/' . $post); - $query = prepare(sprintf('SELECT `ip`, `thread` FROM `posts_%s` WHERE `id` = :id', $board)); + $query = prepare(sprintf('SELECT `ip`, `thread` FROM ``posts_%s`` WHERE `id` = :id', $board)); $query->bindValue(':id', $post); $query->execute() or error(db_error($query)); if (!$_post = $query->fetch(PDO::FETCH_ASSOC)) @@ -1220,7 +1222,7 @@ function mod_ban_post($board, $delete, $post, $token = false) { $_POST['message'] = preg_replace('/[\r\n]/', '', $_POST['message']); $_POST['message'] = str_replace('%length%', $length_english, $_POST['message']); $_POST['message'] = str_replace('%LENGTH%', strtoupper($length_english), $_POST['message']); - $query = prepare(sprintf('UPDATE `posts_%s` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `body_nomarkup` = CONCAT(`body_nomarkup`, :body_nomarkup) WHERE `id` = :id', $board)); $query->bindValue(':id', $post); $query->bindValue(':body_nomarkup', sprintf("\n%s", utf8tohtml($_POST['message']))); $query->execute() or error(db_error($query)); @@ -1267,7 +1269,7 @@ function mod_edit_post($board, $edit_raw_html, $postID) { $security_token = make_secure_link_token($board . '/edit' . ($edit_raw_html ? '_raw' : '') . '/' . $postID); - $query = prepare(sprintf('SELECT * FROM `posts_%s` WHERE `id` = :id', $board)); + $query = prepare(sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); $query->execute() or error(db_error($query)); @@ -1276,9 +1278,9 @@ function mod_edit_post($board, $edit_raw_html, $postID) { if (isset($_POST['name'], $_POST['email'], $_POST['subject'], $_POST['body'])) { if ($edit_raw_html) - $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body` = :body, `body_nomarkup` = :body_nomarkup WHERE `id` = :id', $board)); else - $query = prepare(sprintf('UPDATE `posts_%s` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body WHERE `id` = :id', $board)); + $query = prepare(sprintf('UPDATE ``posts_%s`` SET `name` = :name, `email` = :email, `subject` = :subject, `body_nomarkup` = :body WHERE `id` = :id', $board)); $query->bindValue(':id', $postID); $query->bindValue('name', $_POST['name']); $query->bindValue(':email', $_POST['email']); @@ -1369,7 +1371,7 @@ function mod_deletebyip($boardName, $post, $global = false) { error($config['error']['noaccess']); // Find IP address - $query = prepare(sprintf('SELECT `ip` FROM `posts_%s` WHERE `id` = :id', $boardName)); + $query = prepare(sprintf('SELECT `ip` FROM ``posts_%s`` WHERE `id` = :id', $boardName)); $query->bindValue(':id', $post); $query->execute() or error(db_error($query)); if (!$ip = $query->fetchColumn()) @@ -1379,7 +1381,7 @@ function mod_deletebyip($boardName, $post, $global = false) { $query = ''; foreach ($boards as $_board) { - $query .= sprintf("SELECT `thread`, `id`, '%s' AS `board` FROM `posts_%s` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); + $query .= sprintf("SELECT `thread`, `id`, '%s' AS `board` FROM ``posts_%s`` WHERE `ip` = :ip UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', '', $query); @@ -1431,7 +1433,7 @@ function mod_user($uid) { if (!hasPermission($config['mod']['editusers']) && !(hasPermission($config['mod']['change_password']) && $uid == $mod['id'])) error($config['error']['noaccess']); - $query = prepare('SELECT * FROM `mods` WHERE `id` = :id'); + $query = prepare('SELECT * FROM ``mods`` WHERE `id` = :id'); $query->bindValue(':id', $uid); $query->execute() or error(db_error($query)); if (!$user = $query->fetch(PDO::FETCH_ASSOC)) @@ -1457,7 +1459,7 @@ function mod_user($uid) { if (!hasPermission($config['mod']['deleteusers'])) error($config['error']['noaccess']); - $query = prepare('DELETE FROM `mods` WHERE `id` = :id'); + $query = prepare('DELETE FROM ``mods`` WHERE `id` = :id'); $query->bindValue(':id', $uid); $query->execute() or error(db_error($query)); @@ -1471,7 +1473,7 @@ function mod_user($uid) { if ($_POST['username'] == '') error(sprintf($config['error']['required'], 'username')); - $query = prepare('UPDATE `mods` SET `username` = :username, `boards` = :boards WHERE `id` = :id'); + $query = prepare('UPDATE ``mods`` SET `username` = :username, `boards` = :boards WHERE `id` = :id'); $query->bindValue(':id', $uid); $query->bindValue(':username', $_POST['username']); $query->bindValue(':boards', implode(',', $boards)); @@ -1486,7 +1488,7 @@ function mod_user($uid) { $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); - $query = prepare('UPDATE `mods` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); + $query = prepare('UPDATE ``mods`` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); $query->bindValue(':id', $uid); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); @@ -1513,7 +1515,7 @@ function mod_user($uid) { $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); - $query = prepare('UPDATE `mods` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); + $query = prepare('UPDATE ``mods`` SET `password` = :password, `salt` = :salt WHERE `id` = :id'); $query->bindValue(':id', $uid); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); @@ -1534,7 +1536,7 @@ function mod_user($uid) { } if (hasPermission($config['mod']['modlog'])) { - $query = prepare('SELECT * FROM `modlogs` WHERE `mod` = :id ORDER BY `time` DESC LIMIT 5'); + $query = prepare('SELECT * FROM ``modlogs`` WHERE `mod` = :id ORDER BY `time` DESC LIMIT 5'); $query->bindValue(':id', $uid); $query->execute() or error(db_error($query)); $log = $query->fetchAll(PDO::FETCH_ASSOC); @@ -1581,7 +1583,7 @@ function mod_user_new() { $salt = generate_salt(); $password = hash('sha256', $salt . sha1($_POST['password'])); - $query = prepare('INSERT INTO `mods` VALUES (NULL, :username, :password, :salt, :type, :boards)'); + $query = prepare('INSERT INTO ``mods`` VALUES (NULL, :username, :password, :salt, :type, :boards)'); $query->bindValue(':username', $_POST['username']); $query->bindValue(':password', $password); $query->bindValue(':salt', $salt); @@ -1607,7 +1609,7 @@ function mod_users() { if (!hasPermission($config['mod']['manageusers'])) error($config['error']['noaccess']); - $query = query("SELECT *, (SELECT `time` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`, (SELECT `text` FROM `modlogs` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action` FROM `mods` ORDER BY `type` DESC,`id`") or error(db_error()); + $query = query("SELECT *, (SELECT `time` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `last`, (SELECT `text` FROM ``modlogs`` WHERE `mod` = `id` ORDER BY `time` DESC LIMIT 1) AS `action` FROM ``mods`` ORDER BY `type` DESC,`id`") or error(db_error()); $users = $query->fetchAll(PDO::FETCH_ASSOC); mod_page(sprintf('%s (%d)', _('Manage users'), count($users)), 'mod/users.html', array('users' => $users)); @@ -1619,7 +1621,7 @@ function mod_user_promote($uid, $action) { if (!hasPermission($config['mod']['promoteusers'])) error($config['error']['noaccess']); - $query = prepare("UPDATE `mods` SET `type` = `type` " . ($action == 'promote' ? "+1 WHERE `type` < " . (int)ADMIN : "-1 WHERE `type` > " . (int)JANITOR) . " AND `id` = :id"); + $query = prepare("UPDATE ``mods`` SET `type` = `type` " . ($action == 'promote' ? "+1 WHERE `type` < " . (int)ADMIN : "-1 WHERE `type` > " . (int)JANITOR) . " AND `id` = :id"); $query->bindValue(':id', $uid); $query->execute() or error(db_error($query)); @@ -1634,7 +1636,7 @@ function mod_pm($id, $reply = false) { if ($reply && !hasPermission($config['mod']['create_pm'])) error($config['error']['noaccess']); - $query = prepare("SELECT `mods`.`username`, `mods_to`.`username` AS `to_username`, `pms`.* FROM `pms` LEFT JOIN `mods` ON `mods`.`id` = `sender` LEFT JOIN `mods` AS `mods_to` ON `mods_to`.`id` = `to` WHERE `pms`.`id` = :id"); + $query = prepare("SELECT ``mods``.`username`, `mods_to`.`username` AS `to_username`, ``pms``.* FROM ``pms`` LEFT JOIN ``mods`` ON ``mods``.`id` = `sender` LEFT JOIN ``mods`` AS `mods_to` ON `mods_to`.`id` = `to` WHERE ``pms``.`id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -1642,7 +1644,7 @@ function mod_pm($id, $reply = false) { error($config['error']['404']); if (isset($_POST['delete'])) { - $query = prepare("DELETE FROM `pms` WHERE `id` = :id"); + $query = prepare("DELETE FROM ``pms`` WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -1656,7 +1658,7 @@ function mod_pm($id, $reply = false) { } if ($pm['unread'] && $pm['to'] == $mod['id']) { - $query = prepare("UPDATE `pms` SET `unread` = 0 WHERE `id` = :id"); + $query = prepare("UPDATE ``pms`` SET `unread` = 0 WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); @@ -1683,12 +1685,12 @@ function mod_pm($id, $reply = false) { function mod_inbox() { global $config, $mod; - $query = prepare('SELECT `unread`,`pms`.`id`, `time`, `sender`, `to`, `message`, `username` FROM `pms` LEFT JOIN `mods` ON `mods`.`id` = `sender` WHERE `to` = :mod ORDER BY `unread` DESC, `time` DESC'); + $query = prepare('SELECT `unread`,``pms``.`id`, `time`, `sender`, `to`, `message`, `username` FROM ``pms`` LEFT JOIN ``mods`` ON ``mods``.`id` = `sender` WHERE `to` = :mod ORDER BY `unread` DESC, `time` DESC'); $query->bindValue(':mod', $mod['id']); $query->execute() or error(db_error($query)); $messages = $query->fetchAll(PDO::FETCH_ASSOC); - $query = prepare('SELECT COUNT(*) FROM `pms` WHERE `to` = :mod AND `unread` = 1'); + $query = prepare('SELECT COUNT(*) FROM ``pms`` WHERE `to` = :mod AND `unread` = 1'); $query->bindValue(':mod', $mod['id']); $query->execute() or error(db_error($query)); $unread = $query->fetchColumn(); @@ -1710,12 +1712,12 @@ function mod_new_pm($username) { if (!hasPermission($config['mod']['create_pm'])) error($config['error']['noaccess']); - $query = prepare("SELECT `id` FROM `mods` WHERE `username` = :username"); + $query = prepare("SELECT `id` FROM ``mods`` WHERE `username` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); if (!$id = $query->fetchColumn()) { // Old style ?/PM: by user ID - $query = prepare("SELECT `username` FROM `mods` WHERE `id` = :username"); + $query = prepare("SELECT `username` FROM ``mods`` WHERE `id` = :username"); $query->bindValue(':username', $username); $query->execute() or error(db_error($query)); if ($username = $query->fetchColumn()) @@ -1728,7 +1730,7 @@ function mod_new_pm($username) { $_POST['message'] = escape_markup_modifiers($_POST['message']); markup($_POST['message']); - $query = prepare("INSERT INTO `pms` VALUES (NULL, :me, :id, :message, :time, 1)"); + $query = prepare("INSERT INTO ``pms`` VALUES (NULL, :me, :id, :message, :time, 1)"); $query->bindValue(':me', $mod['id']); $query->bindValue(':id', $id); $query->bindValue(':message', $_POST['message']); @@ -1801,7 +1803,7 @@ function mod_rebuild() { } if (isset($_POST['rebuild_thread'])) { - $query = query(sprintf("SELECT `id` FROM `posts_%s` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); + $query = query(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL", $board['uri'])) or error(db_error()); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $log[] = '' . sprintf($config['board_abbreviation'], $board['uri']) . ': Rebuilding thread #' . $post['id']; buildThread($post['id']); @@ -1822,7 +1824,7 @@ function mod_reports() { if (!hasPermission($config['mod']['reports'])) error($config['error']['noaccess']); - $query = prepare("SELECT * FROM `reports` ORDER BY `time` DESC LIMIT :limit"); + $query = prepare("SELECT * FROM ``reports`` ORDER BY `time` DESC LIMIT :limit"); $query->bindValue(':limit', $config['mod']['recent_reports'], PDO::PARAM_INT); $query->execute() or error(db_error($query)); $reports = $query->fetchAll(PDO::FETCH_ASSOC); @@ -1838,7 +1840,7 @@ function mod_reports() { foreach ($report_queries as $board => $posts) { $report_posts[$board] = array(); - $query = query(sprintf('SELECT * FROM `posts_%s` WHERE `id` = ' . implode(' OR `id` = ', $posts), $board)) or error(db_error()); + $query = query(sprintf('SELECT * FROM ``posts_%s`` WHERE `id` = ' . implode(' OR `id` = ', $posts), $board)) or error(db_error()); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $report_posts[$board][$post['id']] = $post; } @@ -1849,7 +1851,7 @@ function mod_reports() { foreach ($reports as $report) { if (!isset($report_posts[$report['board']][$report['post']])) { // // Invalid report (post has since been deleted) - $query = prepare("DELETE FROM `reports` WHERE `post` = :id AND `board` = :board"); + $query = prepare("DELETE FROM ``reports`` WHERE `post` = :id AND `board` = :board"); $query->bindValue(':id', $report['post'], PDO::PARAM_INT); $query->bindValue(':board', $report['board']); $query->execute() or error(db_error($query)); @@ -1905,7 +1907,7 @@ function mod_reports() { function mod_report_dismiss($id, $all = false) { global $config; - $query = prepare("SELECT `post`, `board`, `ip` FROM `reports` WHERE `id` = :id"); + $query = prepare("SELECT `post`, `board`, `ip` FROM ``reports`` WHERE `id` = :id"); $query->bindValue(':id', $id); $query->execute() or error(db_error($query)); if ($report = $query->fetch(PDO::FETCH_ASSOC)) { @@ -1922,10 +1924,10 @@ function mod_report_dismiss($id, $all = false) { error($config['error']['noaccess']); if ($all) { - $query = prepare("DELETE FROM `reports` WHERE `ip` = :ip"); + $query = prepare("DELETE FROM ``reports`` WHERE `ip` = :ip"); $query->bindValue(':ip', $ip); } else { - $query = prepare("DELETE FROM `reports` WHERE `id` = :id"); + $query = prepare("DELETE FROM ``reports`` WHERE `id` = :id"); $query->bindValue(':id', $id); } $query->execute() or error(db_error($query)); @@ -2035,7 +2037,7 @@ function mod_themes_list() { if (!$dir = opendir($config['dir']['themes'])) error(_('Cannot open themes directory; check permissions.')); - $query = query('SELECT `theme` FROM `theme_settings` WHERE `name` IS NULL AND `value` IS NULL') or error(db_error()); + $query = query('SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL') or error(db_error()); $themes_in_use = $query->fetchAll(PDO::FETCH_COLUMN); // Scan directory for themes @@ -2071,19 +2073,19 @@ function mod_theme_configure($theme_name) { } // Clear previous settings - $query = prepare("DELETE FROM `theme_settings` WHERE `theme` = :theme"); + $query = prepare("DELETE FROM ``theme_settings`` WHERE `theme` = :theme"); $query->bindValue(':theme', $theme_name); $query->execute() or error(db_error($query)); foreach ($theme['config'] as &$conf) { - $query = prepare("INSERT INTO `theme_settings` VALUES(:theme, :name, :value)"); + $query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, :name, :value)"); $query->bindValue(':theme', $theme_name); $query->bindValue(':name', $conf['name']); $query->bindValue(':value', $_POST[$conf['name']]); $query->execute() or error(db_error($query)); } - $query = prepare("INSERT INTO `theme_settings` VALUES(:theme, NULL, NULL)"); + $query = prepare("INSERT INTO ``theme_settings`` VALUES(:theme, NULL, NULL)"); $query->bindValue(':theme', $theme_name); $query->execute() or error(db_error($query)); @@ -2101,7 +2103,7 @@ function mod_theme_configure($theme_name) { if (!$result) { // Install failed - $query = prepare("DELETE FROM `theme_settings` WHERE `theme` = :theme"); + $query = prepare("DELETE FROM ``theme_settings`` WHERE `theme` = :theme"); $query->bindValue(':theme', $theme_name); $query->execute() or error(db_error($query)); } @@ -2133,7 +2135,7 @@ function mod_theme_uninstall($theme_name) { if (!hasPermission($config['mod']['themes'])) error($config['error']['noaccess']); - $query = prepare("DELETE FROM `theme_settings` WHERE `theme` = :theme"); + $query = prepare("DELETE FROM ``theme_settings`` WHERE `theme` = :theme"); $query->bindValue(':theme', $theme_name); $query->execute() or error(db_error($query)); @@ -2164,7 +2166,7 @@ function mod_debug_antispam() { $where .= ' AND `thread` = ' . $pdo->quote($_POST['thread']); if (isset($_POST['purge'])) { - $query = prepare(', DATE `antispam` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE' . $where); + $query = prepare(', DATE ``antispam`` SET `expires` = UNIX_TIMESTAMP() + :expires WHERE' . $where); $query->bindValue(':expires', $config['spam']['hidden_inputs_expire']); $query->execute() or error(db_error()); } @@ -2175,16 +2177,16 @@ function mod_debug_antispam() { $where = ''; } - $query = query('SELECT COUNT(*) FROM `antispam`' . ($where ? " WHERE $where" : '')) or error(db_error()); + $query = query('SELECT COUNT(*) FROM ``antispam``' . ($where ? " WHERE $where" : '')) or error(db_error()); $args['total'] = number_format($query->fetchColumn()); - $query = query('SELECT COUNT(*) FROM `antispam` WHERE `expires` IS NOT NULL' . ($where ? " AND $where" : '')) or error(db_error()); + $query = query('SELECT COUNT(*) FROM ``antispam`` WHERE `expires` IS NOT NULL' . ($where ? " AND $where" : '')) or error(db_error()); $args['expiring'] = number_format($query->fetchColumn()); - $query = query('SELECT * FROM `antispam` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `passed` DESC LIMIT 40') or error(db_error()); + $query = query('SELECT * FROM ``antispam`` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `passed` DESC LIMIT 40') or error(db_error()); $args['top'] = $query->fetchAll(PDO::FETCH_ASSOC); - $query = query('SELECT * FROM `antispam` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `created` DESC LIMIT 20') or error(db_error()); + $query = query('SELECT * FROM ``antispam`` ' . ($where ? "WHERE $where" : '') . ' ORDER BY `created` DESC LIMIT 20') or error(db_error()); $args['recent'] = $query->fetchAll(PDO::FETCH_ASSOC); mod_page(_('Debug: Anti-spam'), 'mod/debug/antispam.html', $args); @@ -2200,7 +2202,7 @@ function mod_debug_recent_posts() { // Manually build an SQL query $query = 'SELECT * FROM ('; foreach ($boards as $board) { - $query .= sprintf('SELECT *, %s AS `board` FROM `posts_%s` UNION ALL ', $pdo->quote($board['uri']), $board['uri']); + $query .= sprintf('SELECT *, %s AS `board` FROM ``posts_%s`` UNION ALL ', $pdo->quote($board['uri']), $board['uri']); } // Remove the last "UNION ALL" seperator and complete the query $query = preg_replace('/UNION ALL $/', ') AS `all_posts` ORDER BY `time` DESC LIMIT ' . $limit, $query); diff --git a/install.php b/install.php index 847876ab..2f51b22f 100644 --- a/install.php +++ b/install.php @@ -501,6 +501,9 @@ if ($step == 0) { + + + @@ -668,7 +671,8 @@ if ($step == 0) { $queries[] = Element('posts.sql', array('board' => 'b')); $sql_errors = ''; - foreach ($queries as &$query) { + foreach ($queries as $query) { + $query = preg_replace('/^([\w\s]*)`([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)`/u', '$1``$2``', $query); if (!query($query)) $sql_errors .= '
  • ' . db_error() . '
  • '; } diff --git a/post.php b/post.php index f4499845..22782ca7 100644 --- a/post.php +++ b/post.php @@ -48,7 +48,7 @@ if (isset($_POST['delete'])) { error($config['error']['nodelete']); foreach ($delete as &$id) { - $query = prepare(sprintf("SELECT `thread`, `time`,`password` FROM `posts_%s` WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT `thread`, `time`,`password` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -111,7 +111,7 @@ if (isset($_POST['delete'])) { markup($reason); foreach ($report as &$id) { - $query = prepare(sprintf("SELECT `thread` FROM `posts_%s` WHERE `id` = :id", $board['uri'])); + $query = prepare(sprintf("SELECT `thread` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); $query->bindValue(':id', $id, PDO::PARAM_INT); $query->execute() or error(db_error($query)); @@ -123,7 +123,7 @@ if (isset($_POST['delete'])) { '/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $thread ? $thread : $id) . ($thread ? '#' . $id : '') . ' for "' . $reason . '"' ); - $query = prepare("INSERT INTO `reports` VALUES (NULL, :time, :ip, :board, :post, :reason)"); + $query = prepare("INSERT INTO ``reports`` VALUES (NULL, :time, :ip, :board, :post, :reason)"); $query->bindValue(':time', time(), PDO::PARAM_INT); $query->bindValue(':ip', $_SERVER['REMOTE_ADDR'], PDO::PARAM_STR); $query->bindValue(':board', $board['uri'], PDO::PARAM_INT); @@ -227,7 +227,7 @@ if (isset($_POST['delete'])) { //Check if thread exists if (!$post['op']) { - $query = prepare(sprintf("SELECT `sticky`,`locked`,`sage` FROM `posts_%s` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); + $query = prepare(sprintf("SELECT `sticky`,`locked`,`sage` FROM ``posts_%s`` WHERE `id` = :id AND `thread` IS NULL LIMIT 1", $board['uri'])); $query->bindValue(':id', $post['thread'], PDO::PARAM_INT); $query->execute() or error(db_error()); @@ -583,7 +583,7 @@ if (isset($_POST['delete'])) { if (isset($post['tracked_cites'])) { foreach ($post['tracked_cites'] as $cite) { - $query = prepare('INSERT INTO `cites` VALUES (:board, :post, :target_board, :target)'); + $query = prepare('INSERT INTO ``cites`` VALUES (:board, :post, :target_board, :target)'); $query->bindValue(':board', $board['uri']); $query->bindValue(':post', $id, PDO::PARAM_INT); $query->bindValue(':target_board',$cite[0]); diff --git a/templates/posts.sql b/templates/posts.sql index 698fad77..ca2ec304 100644 --- a/templates/posts.sql +++ b/templates/posts.sql @@ -1,4 +1,4 @@ -CREATE TABLE IF NOT EXISTS `posts_{{ board }}` ( +CREATE TABLE IF NOT EXISTS ``posts_{{ board }}`` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `thread` int(11) DEFAULT NULL, `subject` varchar(100) DEFAULT NULL, diff --git a/templates/themes/basic/theme.php b/templates/themes/basic/theme.php index 7ba0d1e7..6ba09ce6 100644 --- a/templates/themes/basic/theme.php +++ b/templates/themes/basic/theme.php @@ -25,7 +25,7 @@ $settings['no_recent'] = (int) $settings['no_recent']; - $query = query("SELECT * FROM `news` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error()); + $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); return Element('themes/basic/index.html', Array( diff --git a/templates/themes/catalog/theme.php b/templates/themes/catalog/theme.php index 5c9f6769..4e2d40db 100644 --- a/templates/themes/catalog/theme.php +++ b/templates/themes/catalog/theme.php @@ -37,7 +37,7 @@ $recent_posts = array(); $stats = array(); - $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM `posts_%s` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM `posts_%s` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error()); + $query = query(sprintf("SELECT *, `id` AS `thread_id`, (SELECT COUNT(*) FROM ``posts_%s`` WHERE `thread` = `thread_id`) AS `reply_count`, '%s' AS `board` FROM ``posts_%s`` WHERE `thread` IS NULL ORDER BY `bump` DESC", $board_name, $board_name, $board_name)) or error(db_error()); while ($post = $query->fetch(PDO::FETCH_ASSOC)) { $post['link'] = $config['root'] . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], ($post['thread'] ? $post['thread'] : $post['id'])); diff --git a/templates/themes/categories/theme.php b/templates/themes/categories/theme.php index 7d468d0d..74ed61ed 100644 --- a/templates/themes/categories/theme.php +++ b/templates/themes/categories/theme.php @@ -36,7 +36,7 @@ public static function news($settings) { global $config; - $query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error()); + $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC") or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); return Element('themes/categories/news.html', Array( diff --git a/templates/themes/frameset/theme.php b/templates/themes/frameset/theme.php index 5fd9d29e..ffab0538 100644 --- a/templates/themes/frameset/theme.php +++ b/templates/themes/frameset/theme.php @@ -36,7 +36,7 @@ public static function news($settings) { global $config; - $query = query("SELECT * FROM `news` ORDER BY `time` DESC") or error(db_error()); + $query = query("SELECT * FROM ``news`` ORDER BY `time` DESC") or error(db_error()); $news = $query->fetchAll(PDO::FETCH_ASSOC); return Element('themes/frameset/news.html', Array( diff --git a/templates/themes/recent/theme.php b/templates/themes/recent/theme.php index 98fabfa1..08d910f8 100644 --- a/templates/themes/recent/theme.php +++ b/templates/themes/recent/theme.php @@ -42,7 +42,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']); + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` WHERE `file` IS NOT NULL AND `file` != 'deleted' AND `thumb` != 'spoiler' UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_images'], $query); $query = query($query) or error(db_error()); @@ -62,7 +62,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT *, '%s' AS `board` FROM `posts_%s` UNION ALL ", $_board['uri'], $_board['uri']); + $query .= sprintf("SELECT *, '%s' AS `board` FROM ``posts_%s`` UNION ALL ", $_board['uri'], $_board['uri']); } $query = preg_replace('/UNION ALL $/', 'ORDER BY `time` DESC LIMIT ' . (int)$settings['limit_posts'], $query); $query = query($query) or error(db_error()); @@ -82,7 +82,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT MAX(`id`) AS `top` FROM `posts_%s` UNION ALL ", $_board['uri']); + $query .= sprintf("SELECT MAX(`id`) AS `top` FROM ``posts_%s`` UNION ALL ", $_board['uri']); } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); @@ -93,7 +93,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT `ip` FROM `posts_%s` UNION ALL ", $_board['uri']); + $query .= sprintf("SELECT `ip` FROM ``posts_%s`` UNION ALL ", $_board['uri']); } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); @@ -104,7 +104,7 @@ foreach ($boards as &$_board) { if (in_array($_board['uri'], $this->excluded)) continue; - $query .= sprintf("SELECT `filesize` FROM `posts_%s` UNION ALL ", $_board['uri']); + $query .= sprintf("SELECT `filesize` FROM ``posts_%s`` UNION ALL ", $_board['uri']); } $query = preg_replace('/UNION ALL $/', ') AS `posts_all`', $query); $query = query($query) or error(db_error()); diff --git a/templates/themes/rrdtool/theme.php b/templates/themes/rrdtool/theme.php index 0e0a2f15..a14169a3 100644 --- a/templates/themes/rrdtool/theme.php +++ b/templates/themes/rrdtool/theme.php @@ -61,7 +61,7 @@ // debug just the graphing (not updating) with the --debug switch if (!isset($argv[1]) || $argv[1] != '--debug') { // Update graph - $query = query(sprintf("SELECT MAX(`id`) FROM `posts_%s`", $board)); + $query = query(sprintf("SELECT MAX(`id`) FROM ``posts_%s``", $board)); $count = $query->fetchColumn(); if (!rrd_update($file, Array( diff --git a/templates/themes/sitemap/theme.php b/templates/themes/sitemap/theme.php index e210316b..226f8357 100644 --- a/templates/themes/sitemap/theme.php +++ b/templates/themes/sitemap/theme.php @@ -19,7 +19,7 @@ $threads = array(); foreach ($boards as $board) { - $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM `posts_%s` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM `posts_%s` WHERE `thread` IS NULL", $board, $board)) or error(db_error()); + $query = query(sprintf("SELECT `id` AS `thread_id`, (SELECT `time` FROM ``posts_%s`` WHERE `thread` = `thread_id` OR `id` = `thread_id` ORDER BY `time` DESC LIMIT 1) AS `lastmod` FROM ``posts_%s`` WHERE `thread` IS NULL", $board, $board)) or error(db_error()); $threads[$board] = $query->fetchAll(PDO::FETCH_ASSOC); } -- cgit v1.3 From 235ee484fd1b2f665da2b1402d7393033056a3f7 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:04:09 -0400 Subject: removed a relict from older post hider --- inc/config.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index ec5d71d4..cb3f528b 100644 --- a/inc/config.php +++ b/inc/config.php @@ -636,9 +636,6 @@ // $config['additional_javascript'][] = 'js/jquery.min.js'; // $config['additional_javascript'][] = 'js/auto-reload.js'; - // Enable hiding posts. Remember to put this AFTER jQuery. - // $config['additional_javascript'][] = 'js/post-hider.js'; - // Where these script files are located on the web (defaults to $config['root']). // $config['additional_javascript_url'] = '/js/'; -- cgit v1.3 From 05fb4cbca4f93ea55d55da3b2e3a7f2f5a174b21 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:33:27 -0400 Subject: markup modifiers: there was a plan for adding markup to ban reasons, but assignment was missing; escape markup there too --- inc/mod/ban.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/ban.php b/inc/mod/ban.php index 9166223f..45973ae6 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -61,7 +61,8 @@ function ban($mask, $reason, $length, $board) { $query->bindValue(':mod', $mod['id']); $query->bindValue(':time', time()); if ($reason !== '') { - markup($reason); + $reason = escape_markup_modifiers($reason); + $reason = markup($reason); $query->bindValue(':reason', $reason); } else $query->bindValue(':reason', null, PDO::PARAM_NULL); -- cgit v1.3 From bc76d934fe30c9a6fcea27678dc155e903eb88c3 Mon Sep 17 00:00:00 2001 From: czaks Date: Wed, 31 Jul 2013 20:41:56 -0400 Subject: fix previous commit; markup is called via reference --- inc/mod/ban.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/mod/ban.php b/inc/mod/ban.php index 45973ae6..71173326 100644 --- a/inc/mod/ban.php +++ b/inc/mod/ban.php @@ -62,7 +62,7 @@ function ban($mask, $reason, $length, $board) { $query->bindValue(':time', time()); if ($reason !== '') { $reason = escape_markup_modifiers($reason); - $reason = markup($reason); + markup($reason); $query->bindValue(':reason', $reason); } else $query->bindValue(':reason', null, PDO::PARAM_NULL); -- cgit v1.3 From 47647648852af9ab5d7541589e2ad08a57e13059 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:43:33 -0400 Subject: the prefix work: fix it to be dependent on a board_regex config value --- inc/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/database.php b/inc/database.php index 7be001ea..95dfc775 100644 --- a/inc/database.php +++ b/inc/database.php @@ -87,7 +87,7 @@ function mysql_version() { function prepare($query) { global $pdo, $debug, $config; - $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + $query = preg_replace('/``('.$config['board_regex'].')``/u', '`' . $config['db']['prefix'] . '$1`', $query); sql_open(); @@ -100,7 +100,7 @@ function prepare($query) { function query($query) { global $pdo, $debug, $config; - $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + $query = preg_replace('/``('.$config['board_regex'].')``/u', '`' . $config['db']['prefix'] . '$1`', $query); sql_open(); -- cgit v1.3 From a1e105a470d3f049b666abaf5cf3ccaef48d6bc8 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:47:15 -0400 Subject: i18n strings in inc/display.php --- inc/display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index 3ce8eced..1dcb60fb 100644 --- a/inc/display.php +++ b/inc/display.php @@ -72,14 +72,14 @@ function error($message, $priority = true) { die(Element('page.html', array( 'config'=>$config, - 'title'=>'Error', - 'subtitle'=>'An error has occured.', + 'title'=>_('Error'), + 'subtitle'=>_('An error has occured.'), 'body'=>'
    ' . '

    ' . _($message) . '

    ' . (isset($board) ? "

    Go back.

    " : '') . + $board['dir'] . $config['file_index'] . "\">"._("Go back").".

    " : '') . '
    ' ))); } -- cgit v1.3 From e109d8179fa0e4e34d0191b287b31cbb40414e02 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:43:33 -0400 Subject: the prefix work: fix it to be dependent on a board_regex config value --- inc/database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/database.php b/inc/database.php index 7be001ea..95dfc775 100644 --- a/inc/database.php +++ b/inc/database.php @@ -87,7 +87,7 @@ function mysql_version() { function prepare($query) { global $pdo, $debug, $config; - $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + $query = preg_replace('/``('.$config['board_regex'].')``/u', '`' . $config['db']['prefix'] . '$1`', $query); sql_open(); @@ -100,7 +100,7 @@ function prepare($query) { function query($query) { global $pdo, $debug, $config; - $query = preg_replace('/``([0-9a-zA-Z$_\x{0080}-\x{FFFF}]+)``/u', '`' . $config['db']['prefix'] . '$1`', $query); + $query = preg_replace('/``('.$config['board_regex'].')``/u', '`' . $config['db']['prefix'] . '$1`', $query); sql_open(); -- cgit v1.3 From b9769d0cea205e4ddf831f374901ec8d220ecc7a Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:47:15 -0400 Subject: i18n strings in inc/display.php --- inc/display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index 94f8e8cd..c68af9d6 100644 --- a/inc/display.php +++ b/inc/display.php @@ -72,14 +72,14 @@ function error($message, $priority = true) { die(Element('page.html', array( 'config'=>$config, - 'title'=>'Error', - 'subtitle'=>'An error has occured.', + 'title'=>_('Error'), + 'subtitle'=>_('An error has occured.'), 'body'=>'
    ' . '

    ' . _($message) . '

    ' . (isset($board) ? "

    Go back.

    " : '') . + $board['dir'] . $config['file_index'] . "\">"._("Go back").".

    " : '') . '
    ' ))); } -- cgit v1.3 From 3b03e18d68de3d56930956ac0d61d934d82d4f49 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:56:04 -0400 Subject: i18n even more strings in inc/display.php --- inc/display.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index 1dcb60fb..fd21e83c 100644 --- a/inc/display.php +++ b/inc/display.php @@ -208,7 +208,7 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { $body = preg_replace('/&[^;]*$/', '', $body); } - $body .= 'Post too long. Click here to view the full text.'; + $body .= ''.sprintf(_('Post too long. Click here to view the full text.'), $url).''; } return $body; @@ -331,19 +331,19 @@ class Post { // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], 'Delete file', 'Are you sure you want to delete this file?', $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; @@ -420,54 +420,54 @@ class Thread { // Mod controls (on posts) // Delete if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['uri'] . '/delete/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], _('Delete'), _('Are you sure you want to delete this?'), $board['uri'] . '/delete/' . $this->id); // Delete all posts by IP if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['uri'] . '/deletebyip/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], _('Delete all posts by IP'), _('Are you sure you want to delete all posts by this IP address?'), $board['uri'] . '/deletebyip/' . $this->id); // Delete all posts by IP (global) if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['uri'] . '/deletebyip/' . $this->id . '/global'); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], _('Delete all posts by IP across all boards'), _('Are you sure you want to delete all posts by this IP address, across all boards?'), $board['uri'] . '/deletebyip/' . $this->id . '/global'); // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && $this->file != 'deleted' && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], 'Delete file', 'Are you sure you want to delete this file?', $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); // Sticky if (hasPermission($config['mod']['sticky'], $board['uri'], $this->mod)) if ($this->sticky) - $built .= ' ' . $config['mod']['link_desticky'] . ''; + $built .= ' ' . $config['mod']['link_desticky'] . ''; else - $built .= ' ' . $config['mod']['link_sticky'] . ''; + $built .= ' ' . $config['mod']['link_sticky'] . ''; if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod)) if ($this->bumplocked) - $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; + $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; else - $built .= ' ' . $config['mod']['link_bumplock'] . ''; + $built .= ' ' . $config['mod']['link_bumplock'] . ''; // Lock if (hasPermission($config['mod']['lock'], $board['uri'], $this->mod)) if ($this->locked) - $built .= ' ' . $config['mod']['link_unlock'] . ''; + $built .= ' ' . $config['mod']['link_unlock'] . ''; else - $built .= ' ' . $config['mod']['link_lock'] . ''; + $built .= ' ' . $config['mod']['link_lock'] . ''; if (hasPermission($config['mod']['move'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_move'] . ''; + $built .= ' ' . $config['mod']['link_move'] . ''; // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; -- cgit v1.3 From bea5509d63426824993b0d15d6c5b06d1cae7c66 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 02:06:34 -0400 Subject: Update Polish locale --- inc/locale/pl_PL/LC_MESSAGES/javascript.po | 3 +- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 19840 -> 20956 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 269 +++++++++++++++++++---------- 3 files changed, 181 insertions(+), 91 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po index 482ec45f..ae1bb5c9 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.po +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-27 01:54-0400\n" +"POT-Creation-Date: 2013-08-01 01:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,6 +42,7 @@ msgid "Click to expand" msgstr "Kliknij aby rozwinąć" #: ../../../../js/expand.js:41 ../../../../js/expand.js:45 +#: ../../../../js/expand.js:43 msgid "Hide expanded replies" msgstr "Schowaj rozwinięte odpowiedzi" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index bc603e67..73f434f7 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 20802b7d..8a46fda9 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-27 01:54-0400\n" +"POT-Creation-Date: 2013-08-01 01:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,6 +24,7 @@ msgstr "" #: ../../../../inc/functions.php:1041 ../../../../inc/functions.php:1055 #: ../../../../inc/functions.php:1039 ../../../../inc/functions.php:1053 #: ../../../../inc/functions.php:1068 ../../../../inc/functions.php:1082 +#: ../../../../inc/functions.php:1079 ../../../../inc/functions.php:1093 msgid "Previous" msgstr "Wstecz" @@ -33,6 +34,7 @@ msgstr "Wstecz" #: ../../../../inc/functions.php:1060 ../../../../inc/functions.php:1069 #: ../../../../inc/functions.php:1058 ../../../../inc/functions.php:1067 #: ../../../../inc/functions.php:1087 ../../../../inc/functions.php:1096 +#: ../../../../inc/functions.php:1098 ../../../../inc/functions.php:1107 msgid "Next" msgstr "Dalej" @@ -57,6 +59,7 @@ msgid "all boards" msgstr "wszystkie boardy" #: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 +#: ../../../../inc/config.php:334 msgid "You have been muted for unoriginal content." msgstr "Zostałeś zagłuszony za nieoryginalną treść." @@ -64,11 +67,12 @@ msgstr "Zostałeś zagłuszony za nieoryginalną treść." msgid "Anonymous" msgstr "Anonimowy" -#: /var/www/html/Tinyboard/inc/config.php:481 +#. The names on the post buttons. (On most imageboards, these are both "Post") +#: /var/www/html/Tinyboard/inc/config.php:481 ../../../../inc/config.php:552 msgid "New Topic" msgstr "Nowy wątek" -#: /var/www/html/Tinyboard/inc/config.php:482 +#: /var/www/html/Tinyboard/inc/config.php:482 ../../../../inc/config.php:553 msgid "New Reply" msgstr "Odpowiedz" @@ -84,19 +88,19 @@ msgstr "Szybka odpowiedź" #. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 #: ../../../../inc/config.php:692 ../../../../inc/config.php:698 -#: ../../../../inc/config.php:695 +#: ../../../../inc/config.php:695 ../../../../inc/config.php:701 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 #: ../../../../inc/config.php:693 ../../../../inc/config.php:699 -#: ../../../../inc/config.php:696 +#: ../../../../inc/config.php:696 ../../../../inc/config.php:702 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 #: ../../../../inc/config.php:694 ../../../../inc/config.php:700 -#: ../../../../inc/config.php:697 +#: ../../../../inc/config.php:697 ../../../../inc/config.php:703 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " @@ -104,161 +108,161 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 #: ../../../../inc/config.php:695 ../../../../inc/config.php:701 -#: ../../../../inc/config.php:698 +#: ../../../../inc/config.php:698 ../../../../inc/config.php:704 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 #: ../../../../inc/config.php:696 ../../../../inc/config.php:702 -#: ../../../../inc/config.php:699 +#: ../../../../inc/config.php:699 ../../../../inc/config.php:705 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 #: ../../../../inc/config.php:697 ../../../../inc/config.php:703 -#: ../../../../inc/config.php:700 +#: ../../../../inc/config.php:700 ../../../../inc/config.php:706 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 #: ../../../../inc/config.php:698 ../../../../inc/config.php:704 -#: ../../../../inc/config.php:701 +#: ../../../../inc/config.php:701 ../../../../inc/config.php:707 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 #: ../../../../inc/config.php:699 ../../../../inc/config.php:705 -#: ../../../../inc/config.php:702 +#: ../../../../inc/config.php:702 ../../../../inc/config.php:708 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 #: ../../../../inc/config.php:700 ../../../../inc/config.php:706 -#: ../../../../inc/config.php:703 +#: ../../../../inc/config.php:703 ../../../../inc/config.php:709 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 #: ../../../../inc/config.php:701 ../../../../inc/config.php:707 -#: ../../../../inc/config.php:704 +#: ../../../../inc/config.php:704 ../../../../inc/config.php:710 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 #: ../../../../inc/config.php:702 ../../../../inc/config.php:708 -#: ../../../../inc/config.php:705 +#: ../../../../inc/config.php:705 ../../../../inc/config.php:711 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 #: ../../../../inc/config.php:703 ../../../../inc/config.php:709 -#: ../../../../inc/config.php:706 +#: ../../../../inc/config.php:706 ../../../../inc/config.php:712 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 #: ../../../../inc/config.php:706 ../../../../inc/config.php:712 -#: ../../../../inc/config.php:709 +#: ../../../../inc/config.php:709 ../../../../inc/config.php:715 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 #: ../../../../inc/config.php:707 ../../../../inc/config.php:713 -#: ../../../../inc/config.php:710 +#: ../../../../inc/config.php:710 ../../../../inc/config.php:716 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 #: ../../../../inc/config.php:708 ../../../../inc/config.php:714 -#: ../../../../inc/config.php:711 +#: ../../../../inc/config.php:711 ../../../../inc/config.php:717 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 #: ../../../../inc/config.php:709 ../../../../inc/config.php:715 -#: ../../../../inc/config.php:712 +#: ../../../../inc/config.php:712 ../../../../inc/config.php:718 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 #: ../../../../inc/config.php:710 ../../../../inc/config.php:716 -#: ../../../../inc/config.php:713 +#: ../../../../inc/config.php:713 ../../../../inc/config.php:719 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 -#: ../../../../inc/config.php:714 +#: ../../../../inc/config.php:714 ../../../../inc/config.php:720 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 -#: ../../../../inc/config.php:715 +#: ../../../../inc/config.php:715 ../../../../inc/config.php:721 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 -#: ../../../../inc/config.php:716 +#: ../../../../inc/config.php:716 ../../../../inc/config.php:722 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 -#: ../../../../inc/config.php:717 +#: ../../../../inc/config.php:717 ../../../../inc/config.php:723 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 #: ../../../../inc/config.php:715 ../../../../inc/config.php:721 -#: ../../../../inc/config.php:718 +#: ../../../../inc/config.php:718 ../../../../inc/config.php:724 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 #: ../../../../inc/config.php:716 ../../../../inc/config.php:722 -#: ../../../../inc/config.php:719 +#: ../../../../inc/config.php:719 ../../../../inc/config.php:725 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 #: ../../../../inc/config.php:717 ../../../../inc/config.php:723 -#: ../../../../inc/config.php:720 +#: ../../../../inc/config.php:720 ../../../../inc/config.php:726 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 #: ../../../../inc/config.php:718 ../../../../inc/config.php:724 -#: ../../../../inc/config.php:721 +#: ../../../../inc/config.php:721 ../../../../inc/config.php:727 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 #: ../../../../inc/config.php:719 ../../../../inc/config.php:725 -#: ../../../../inc/config.php:722 +#: ../../../../inc/config.php:722 ../../../../inc/config.php:728 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 #: ../../../../inc/config.php:720 ../../../../inc/config.php:726 -#: ../../../../inc/config.php:723 +#: ../../../../inc/config.php:723 ../../../../inc/config.php:729 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 #: ../../../../inc/config.php:721 ../../../../inc/config.php:727 -#: ../../../../inc/config.php:724 +#: ../../../../inc/config.php:724 ../../../../inc/config.php:730 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 #: ../../../../inc/config.php:722 ../../../../inc/config.php:728 -#: ../../../../inc/config.php:725 +#: ../../../../inc/config.php:725 ../../../../inc/config.php:731 msgid "Maximum file size: %maxsz% bytes
    Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
    Rozmiar twojego pliku: %filesz% " @@ -266,33 +270,33 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 #: ../../../../inc/config.php:723 ../../../../inc/config.php:729 -#: ../../../../inc/config.php:726 +#: ../../../../inc/config.php:726 ../../../../inc/config.php:732 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 #: ../../../../inc/config.php:724 ../../../../inc/config.php:730 -#: ../../../../inc/config.php:727 +#: ../../../../inc/config.php:727 ../../../../inc/config.php:733 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 #: ../../../../inc/config.php:725 ../../../../inc/config.php:731 -#: ../../../../inc/config.php:728 +#: ../../../../inc/config.php:728 ../../../../inc/config.php:734 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 #: ../../../../inc/config.php:727 ../../../../inc/config.php:733 -#: ../../../../inc/config.php:730 +#: ../../../../inc/config.php:730 ../../../../inc/config.php:736 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 #: ../../../../inc/config.php:728 ../../../../inc/config.php:734 -#: ../../../../inc/config.php:731 +#: ../../../../inc/config.php:731 ../../../../inc/config.php:737 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " @@ -300,31 +304,31 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 #: ../../../../inc/config.php:729 ../../../../inc/config.php:735 -#: ../../../../inc/config.php:732 +#: ../../../../inc/config.php:732 ../../../../inc/config.php:738 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 #: ../../../../inc/config.php:730 ../../../../inc/config.php:736 -#: ../../../../inc/config.php:733 +#: ../../../../inc/config.php:733 ../../../../inc/config.php:739 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 #: ../../../../inc/config.php:734 ../../../../inc/config.php:740 -#: ../../../../inc/config.php:737 +#: ../../../../inc/config.php:737 ../../../../inc/config.php:743 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 #: ../../../../inc/config.php:735 ../../../../inc/config.php:741 -#: ../../../../inc/config.php:738 +#: ../../../../inc/config.php:738 ../../../../inc/config.php:744 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 #: ../../../../inc/config.php:736 ../../../../inc/config.php:742 -#: ../../../../inc/config.php:739 +#: ../../../../inc/config.php:739 ../../../../inc/config.php:745 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -333,65 +337,65 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 #: ../../../../inc/config.php:737 ../../../../inc/config.php:743 -#: ../../../../inc/config.php:740 +#: ../../../../inc/config.php:740 ../../../../inc/config.php:746 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 #: ../../../../inc/config.php:738 ../../../../inc/config.php:744 -#: ../../../../inc/config.php:741 +#: ../../../../inc/config.php:741 ../../../../inc/config.php:747 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 #: ../../../../inc/config.php:739 ../../../../inc/config.php:745 -#: ../../../../inc/config.php:742 +#: ../../../../inc/config.php:742 ../../../../inc/config.php:748 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 #: ../../../../inc/config.php:740 ../../../../inc/config.php:746 -#: ../../../../inc/config.php:743 +#: ../../../../inc/config.php:743 ../../../../inc/config.php:749 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 #: ../../../../inc/config.php:741 ../../../../inc/config.php:747 -#: ../../../../inc/config.php:744 +#: ../../../../inc/config.php:744 ../../../../inc/config.php:750 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 #: ../../../../inc/config.php:742 ../../../../inc/config.php:748 -#: ../../../../inc/config.php:745 +#: ../../../../inc/config.php:745 ../../../../inc/config.php:751 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 #: ../../../../inc/config.php:743 ../../../../inc/config.php:749 -#: ../../../../inc/config.php:746 +#: ../../../../inc/config.php:746 ../../../../inc/config.php:752 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 #: ../../../../inc/config.php:744 ../../../../inc/config.php:750 -#: ../../../../inc/config.php:747 +#: ../../../../inc/config.php:747 ../../../../inc/config.php:753 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 #: ../../../../inc/config.php:745 ../../../../inc/config.php:751 -#: ../../../../inc/config.php:748 +#: ../../../../inc/config.php:748 ../../../../inc/config.php:754 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 #: ../../../../inc/config.php:746 ../../../../inc/config.php:752 -#: ../../../../inc/config.php:749 +#: ../../../../inc/config.php:749 ../../../../inc/config.php:755 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -430,6 +434,7 @@ msgstr "[Przenieś]" #. Default public ban message. #. In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). #: /var/www/html/Tinyboard/inc/config.php:801 ../../../../inc/config.php:911 +#: ../../../../inc/config.php:917 msgid "USER WAS BANNED FOR THIS POST" msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" @@ -438,20 +443,21 @@ msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" msgid "Moved to %s." msgstr "Przeniesiono do %s." -#: /var/www/html/Tinyboard/inc/display.php:80 +#: /var/www/html/Tinyboard/inc/display.php:80 ../../../../inc/display.php:75 msgid "Error" msgstr "Błąd" -#: /var/www/html/Tinyboard/inc/display.php:81 +#: /var/www/html/Tinyboard/inc/display.php:81 ../../../../inc/display.php:76 msgid "An error has occured." msgstr "Wystąpił błąd." -#: /var/www/html/Tinyboard/inc/display.php:87 +#: /var/www/html/Tinyboard/inc/display.php:87 ../../../../inc/display.php:82 msgid "Go back" msgstr "Wróć" #: /var/www/html/Tinyboard/inc/display.php:97 ../../../../inc/display.php:91 #: ../../../../inc/mod/pages.php:59 ../../../../inc/mod/pages.php:62 +#: ../../../../inc/display.php:92 msgid "Login" msgstr "Logowanie" @@ -469,31 +475,34 @@ msgstr "" #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:27 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:27 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:27 +#: ../../../../inc/display.php:423 msgid "Delete" msgstr "Usuń" #: /var/www/html/Tinyboard/inc/display.php:272 -#: /var/www/html/Tinyboard/inc/display.php:365 +#: /var/www/html/Tinyboard/inc/display.php:365 ../../../../inc/display.php:423 msgid "Are you sure you want to delete this?" msgstr "Czy jesteś pewien, że chcesz to usunąć?" #: /var/www/html/Tinyboard/inc/display.php:276 -#: /var/www/html/Tinyboard/inc/display.php:369 +#: /var/www/html/Tinyboard/inc/display.php:369 ../../../../inc/display.php:427 msgid "Delete all posts by IP" msgstr "Usuń wszystkie posty z tego adresu IP" #: /var/www/html/Tinyboard/inc/display.php:276 -#: /var/www/html/Tinyboard/inc/display.php:369 +#: /var/www/html/Tinyboard/inc/display.php:369 ../../../../inc/display.php:427 msgid "Are you sure you want to delete all posts by this IP address?" msgstr "Czy na pewno chcesz usunąć wszystkie posty z tego adresu IP?" #: /var/www/html/Tinyboard/inc/display.php:280 -#: /var/www/html/Tinyboard/inc/display.php:373 +#: /var/www/html/Tinyboard/inc/display.php:373 ../../../../inc/display.php:334 +#: ../../../../inc/display.php:435 msgid "Ban" msgstr "Ban" #: /var/www/html/Tinyboard/inc/display.php:284 -#: /var/www/html/Tinyboard/inc/display.php:377 +#: /var/www/html/Tinyboard/inc/display.php:377 ../../../../inc/display.php:338 +#: ../../../../inc/display.php:439 msgid "Ban & Delete" msgstr "Usuń i zbanuj" @@ -506,34 +515,36 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:408 #: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 #: ../../../../inc/mod/pages.php:1239 ../../../../inc/mod/pages.php:1242 +#: ../../../../inc/display.php:346 ../../../../inc/display.php:470 +#: ../../../../inc/mod/pages.php:1314 msgid "Edit post" msgstr "Edytuj post" -#: /var/www/html/Tinyboard/inc/display.php:386 +#: /var/www/html/Tinyboard/inc/display.php:386 ../../../../inc/display.php:448 msgid "Make thread not sticky" msgstr "Odklej wątek" -#: /var/www/html/Tinyboard/inc/display.php:388 +#: /var/www/html/Tinyboard/inc/display.php:388 ../../../../inc/display.php:450 msgid "Make thread sticky" msgstr "Przyklej wątek" -#: /var/www/html/Tinyboard/inc/display.php:392 +#: /var/www/html/Tinyboard/inc/display.php:392 ../../../../inc/display.php:454 msgid "Allow thread to be bumped" msgstr "Zezwól wątkowi na bumpowanie" -#: /var/www/html/Tinyboard/inc/display.php:394 +#: /var/www/html/Tinyboard/inc/display.php:394 ../../../../inc/display.php:456 msgid "Prevent thread from being bumped" msgstr "Zabroń wątkowi na bumpowanie" -#: /var/www/html/Tinyboard/inc/display.php:399 +#: /var/www/html/Tinyboard/inc/display.php:399 ../../../../inc/display.php:461 msgid "Unlock thread" msgstr "Odblokuj wątek" -#: /var/www/html/Tinyboard/inc/display.php:401 +#: /var/www/html/Tinyboard/inc/display.php:401 ../../../../inc/display.php:463 msgid "Lock thread" msgstr "Zablokuj wątek" -#: /var/www/html/Tinyboard/inc/display.php:404 +#: /var/www/html/Tinyboard/inc/display.php:404 ../../../../inc/display.php:466 msgid "Move thread to another board" msgstr "Przenieś wątek na inny board" @@ -703,6 +714,8 @@ msgstr "Weryfikacja" #. line 72 #. line 3 #. line 72 +#. line 3 +#. line 72 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 @@ -787,6 +800,8 @@ msgstr "Flagi" #. line 99 #. line 98 #. line 99 +#. line 98 +#. line 99 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 @@ -854,6 +869,8 @@ msgstr "Przyklejony" #. line 103 #. line 102 #. line 103 +#. line 102 +#. line 103 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 @@ -921,6 +938,8 @@ msgstr "Zablokowany" #. line 107 #. line 106 #. line 107 +#. line 106 +#. line 107 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 @@ -1058,6 +1077,7 @@ msgstr "Tryb postowania: Odpowiedź" #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:172 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:127 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:173 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:174 msgid "Return" msgstr "Powrót" @@ -1079,6 +1099,7 @@ msgstr "Usuń post" #. line 106 #. line 8 #. line 32 +#. line 8 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 @@ -1116,6 +1137,7 @@ msgstr "Wiadomości prywatne" #: ../../../../inc/mod/pages.php:376 ../../../../inc/mod/pages.php:393 #: ../../../../inc/mod/pages.php:406 ../../../../inc/mod/pages.php:540 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:166 +#: ../../../../inc/mod/pages.php:604 msgid "News" msgstr "Aktualności" @@ -1123,7 +1145,7 @@ msgstr "Aktualności" #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 #: ../../../../inc/mod/pages.php:1682 ../../../../inc/mod/pages.php:1816 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207 -#: ../../../../inc/mod/pages.php:1831 +#: ../../../../inc/mod/pages.php:1831 ../../../../inc/mod/pages.php:1904 msgid "Report queue" msgstr "Kolejka zgłoszeń" @@ -1131,6 +1153,7 @@ msgstr "Kolejka zgłoszeń" #: ../../../../inc/mod/pages.php:664 ../../../../inc/mod/pages.php:705 #: ../../../../inc/mod/pages.php:721 ../../../../inc/mod/pages.php:855 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:224 +#: ../../../../inc/mod/pages.php:918 msgid "Ban list" msgstr "Lista banów" @@ -1138,7 +1161,7 @@ msgstr "Lista banów" #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 #: ../../../../inc/mod/pages.php:1394 ../../../../inc/mod/pages.php:1528 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232 -#: ../../../../inc/mod/pages.php:1543 +#: ../../../../inc/mod/pages.php:1543 ../../../../inc/mod/pages.php:1615 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -1153,6 +1176,7 @@ msgstr "Zmień swoje hasło" #: ../../../../inc/mod/pages.php:580 ../../../../inc/mod/pages.php:607 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:65 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:255 +#: ../../../../inc/mod/pages.php:644 ../../../../inc/mod/pages.php:671 msgid "Moderation log" msgstr "Log moderacji" @@ -1172,7 +1196,7 @@ msgstr "Pokaż konfigurację" #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 #: ../../../../inc/mod/pages.php:1830 ../../../../inc/mod/pages.php:1964 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247 -#: ../../../../inc/mod/pages.php:1979 +#: ../../../../inc/mod/pages.php:1979 ../../../../inc/mod/pages.php:2052 msgid "Manage themes" msgstr "Zarządzaj dodatkami" @@ -1196,7 +1220,7 @@ msgstr "Wyrażenie:" #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:19 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:286 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:19 -#: ../../../../search.php:165 +#: ../../../../search.php:165 ../../../../search.php:168 msgid "Search" msgstr "Szukaj" @@ -1276,12 +1300,14 @@ msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 #: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 #: ../../../../inc/mod/pages.php:1948 ../../../../inc/mod/pages.php:1963 +#: ../../../../inc/mod/pages.php:2036 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 #: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 #: ../../../../inc/mod/pages.php:1950 ../../../../inc/mod/pages.php:1965 +#: ../../../../inc/mod/pages.php:2038 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -1334,6 +1360,7 @@ msgstr "Instaluj" #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263 #: ../../../../inc/mod/pages.php:1741 ../../../../inc/mod/pages.php:1745 #: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:98 +#: ../../../../inc/mod/pages.php:1814 ../../../../inc/mod/pages.php:1818 msgid "Rebuild" msgstr "Przebuduj" @@ -1361,6 +1388,7 @@ msgstr "Postuj na tablicy ogłoszeń" #: ../../../../inc/mod/pages.php:333 ../../../../inc/mod/pages.php:346 #: ../../../../inc/mod/pages.php:480 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:96 +#: ../../../../inc/mod/pages.php:543 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -1468,13 +1496,13 @@ msgstr "Konfiguracja" #: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 #: ../../../../inc/mod/pages.php:272 ../../../../inc/mod/pages.php:285 -#: ../../../../inc/mod/pages.php:419 +#: ../../../../inc/mod/pages.php:419 ../../../../inc/mod/pages.php:481 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." #: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 #: ../../../../inc/mod/pages.php:800 ../../../../inc/mod/pages.php:823 -#: ../../../../inc/mod/pages.php:957 +#: ../../../../inc/mod/pages.php:957 ../../../../inc/mod/pages.php:1020 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." @@ -1484,6 +1512,7 @@ msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." #: ../../../../inc/config.php:689 ../../../../inc/config.php:747 #: ../../../../inc/config.php:753 ../../../../inc/config.php:750 +#: ../../../../inc/config.php:756 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." @@ -1493,11 +1522,13 @@ msgstr "Potwierdź akcję" #: ../../../../inc/mod/pages.php:222 ../../../../inc/mod/pages.php:239 #: ../../../../inc/mod/pages.php:252 ../../../../inc/mod/pages.php:386 +#: ../../../../inc/mod/pages.php:431 msgid "Edit board" msgstr "Edytuj board" #: ../../../../inc/mod/pages.php:270 ../../../../inc/mod/pages.php:287 #: ../../../../inc/mod/pages.php:300 ../../../../inc/mod/pages.php:434 +#: ../../../../inc/mod/pages.php:496 msgid "New board" msgstr "Nowy board" @@ -1511,6 +1542,7 @@ msgstr "Nowy board" #: ../../../../inc/mod/pages.php:628 ../../../../inc/mod/pages.php:762 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:247 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:65 +#: ../../../../inc/mod/pages.php:825 msgid "IP" msgstr "adres IP" @@ -1520,12 +1552,14 @@ msgstr "adres IP" #: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 #: ../../../../inc/mod/pages.php:772 ../../../../inc/mod/pages.php:1187 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:398 -#: ../../../../inc/mod/pages.php:1190 +#: ../../../../inc/mod/pages.php:1190 ../../../../inc/mod/pages.php:835 +#: ../../../../inc/mod/pages.php:1255 msgid "New ban" msgstr "Nowy ban" #: ../../../../inc/mod/pages.php:919 ../../../../inc/mod/pages.php:962 #: ../../../../inc/mod/pages.php:987 ../../../../inc/mod/pages.php:1121 +#: ../../../../inc/mod/pages.php:1184 msgid "Impossible to move thread; there is only one board." msgstr "Nie można przenieść wątku; istnieje tylko jeden board." @@ -1533,6 +1567,7 @@ msgstr "Nie można przenieść wątku; istnieje tylko jeden board." #: ../../../../inc/mod/pages.php:923 ../../../../inc/mod/pages.php:966 #: ../../../../inc/mod/pages.php:991 ../../../../inc/mod/pages.php:1125 #: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:106 +#: ../../../../inc/mod/pages.php:1188 msgid "Move thread" msgstr "Przenieś wątek" @@ -1541,6 +1576,7 @@ msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 #: ../../../../inc/mod/pages.php:1466 ../../../../inc/mod/pages.php:1515 #: ../../../../inc/mod/pages.php:1477 ../../../../inc/mod/pages.php:1530 +#: ../../../../inc/mod/pages.php:1549 ../../../../inc/mod/pages.php:1602 msgid "Edit user" msgstr "Edytuj użytkownika" @@ -1550,12 +1586,13 @@ msgstr "Edytuj użytkownika" #: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 #: ../../../../inc/mod/pages.php:1590 ../../../../inc/mod/pages.php:1662 #: ../../../../inc/mod/pages.php:1605 ../../../../inc/mod/pages.php:1677 +#: ../../../../inc/mod/pages.php:1750 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 #: ../../../../inc/mod/pages.php:1460 ../../../../inc/mod/pages.php:1594 -#: ../../../../inc/mod/pages.php:1609 +#: ../../../../inc/mod/pages.php:1609 ../../../../inc/mod/pages.php:1681 msgid "Private message" msgstr "Prywatna wiadomość" @@ -1563,39 +1600,39 @@ msgstr "Prywatna wiadomość" #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 #: ../../../../inc/mod/pages.php:1481 ../../../../inc/mod/pages.php:1615 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171 -#: ../../../../inc/mod/pages.php:1630 +#: ../../../../inc/mod/pages.php:1630 ../../../../inc/mod/pages.php:1702 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 #: ../../../../inc/mod/pages.php:1804 ../../../../inc/mod/pages.php:1938 -#: ../../../../inc/mod/pages.php:1953 +#: ../../../../inc/mod/pages.php:1953 ../../../../inc/mod/pages.php:2026 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 #: ../../../../inc/mod/pages.php:1970 ../../../../inc/mod/pages.php:2104 -#: ../../../../inc/mod/pages.php:2119 +#: ../../../../inc/mod/pages.php:2119 ../../../../inc/mod/pages.php:2192 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 #: ../../../../inc/mod/pages.php:1892 ../../../../inc/mod/pages.php:2026 -#: ../../../../inc/mod/pages.php:2041 +#: ../../../../inc/mod/pages.php:2041 ../../../../inc/mod/pages.php:2114 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 #: ../../../../inc/mod/pages.php:1903 ../../../../inc/mod/pages.php:2037 -#: ../../../../inc/mod/pages.php:2052 +#: ../../../../inc/mod/pages.php:2052 ../../../../inc/mod/pages.php:2125 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 #: ../../../../inc/mod/pages.php:1931 ../../../../inc/mod/pages.php:2065 -#: ../../../../inc/mod/pages.php:2080 +#: ../../../../inc/mod/pages.php:2080 ../../../../inc/mod/pages.php:2153 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1607,24 +1644,24 @@ msgid "" msgstr "" #: ../../../../inc/config.php:704 ../../../../inc/config.php:710 -#: ../../../../inc/config.php:707 +#: ../../../../inc/config.php:707 ../../../../inc/config.php:713 msgid "Thread has reached its maximum reply limit." msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." #: ../../../../inc/config.php:705 ../../../../inc/config.php:711 -#: ../../../../inc/config.php:708 +#: ../../../../inc/config.php:708 ../../../../inc/config.php:714 msgid "Thread has reached its maximum image limit." msgstr "Ten temat osiągnął swój maksymalny limit obrazków." #: ../../../../inc/config.php:726 ../../../../inc/config.php:732 -#: ../../../../inc/config.php:729 +#: ../../../../inc/config.php:729 ../../../../inc/config.php:735 #, php-format msgid "That file already exists in this thread!" msgstr "Ten plik już istnieje w tym temacie!" #. Moderator errors #: ../../../../inc/config.php:733 ../../../../inc/config.php:739 -#: ../../../../inc/config.php:736 +#: ../../../../inc/config.php:736 ../../../../inc/config.php:742 #, php-format msgid "" "You are only allowed to unban %s users at a time. You tried to unban %u " @@ -1634,11 +1671,13 @@ msgstr "" #: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 #: ../../../../inc/mod/pages.php:2128 ../../../../inc/mod/pages.php:2143 +#: ../../../../inc/mod/pages.php:2216 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" #: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 #: ../../../../inc/mod/pages.php:2152 ../../../../inc/mod/pages.php:2167 +#: ../../../../inc/mod/pages.php:2240 msgid "Debug: SQL" msgstr "Debug: SQL" @@ -1651,7 +1690,7 @@ msgstr[1] "%count% odpowiedzi" msgstr[2] "%count% odpowiedzi" #. $results now contains the search results -#: ../../../../inc/mod/pages.php:290 +#: ../../../../inc/mod/pages.php:290 ../../../../inc/mod/pages.php:335 msgid "Search results" msgstr "Wyniki wyszukiwania" @@ -1976,11 +2015,11 @@ msgstr "Wyszukiwanie postów jest wyłączone" msgid "Wait a while before searching again, please." msgstr "Proszę poczekać chwilę przed ponownym szukaniem." -#: ../../../../search.php:128 +#: ../../../../search.php:128 ../../../../search.php:131 msgid "Query too broad." msgstr "Zapytanie zbyt szerokie." -#: ../../../../search.php:149 +#: ../../../../search.php:149 ../../../../search.php:152 #, php-format msgid "%d result in" msgid_plural "%d results in" @@ -1988,11 +2027,11 @@ msgstr[0] "%d wynik na" msgstr[1] "%d wyniki na" msgstr[2] "%d wyników na" -#: ../../../../search.php:160 +#: ../../../../search.php:160 ../../../../search.php:163 msgid "No results." msgstr "Brak wyników." -#: ../../../../inc/functions.php:594 +#: ../../../../inc/functions.php:594 ../../../../inc/functions.php:603 msgid "Banned!" msgstr "Zbanowany!" @@ -2005,6 +2044,7 @@ msgid "You are not banned." msgstr "Nie jesteś zbanowany." #: ../../../../inc/functions.php:549 ../../../../inc/functions.php:566 +#: ../../../../inc/functions.php:558 ../../../../inc/functions.php:575 msgid "second" msgid_plural "seconds" msgstr[0] "sekunda" @@ -2012,6 +2052,7 @@ msgstr[1] "sekundy" msgstr[2] "sekund" #: ../../../../inc/functions.php:551 ../../../../inc/functions.php:568 +#: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 msgid "minute" msgid_plural "minutes" msgstr[0] "minuta" @@ -2019,6 +2060,7 @@ msgstr[1] "minuty" msgstr[2] "minut" #: ../../../../inc/functions.php:553 ../../../../inc/functions.php:570 +#: ../../../../inc/functions.php:562 ../../../../inc/functions.php:579 msgid "hour" msgid_plural "hours" msgstr[0] "godzina" @@ -2026,6 +2068,7 @@ msgstr[1] "godziny" msgstr[2] "godzin" #: ../../../../inc/functions.php:555 ../../../../inc/functions.php:572 +#: ../../../../inc/functions.php:564 ../../../../inc/functions.php:581 msgid "day" msgid_plural "days" msgstr[0] "dzień" @@ -2033,6 +2076,7 @@ msgstr[1] "dni" msgstr[2] "dni" #: ../../../../inc/functions.php:557 ../../../../inc/functions.php:574 +#: ../../../../inc/functions.php:566 ../../../../inc/functions.php:583 msgid "week" msgid_plural "weeks" msgstr[0] "tydzień" @@ -2040,6 +2084,7 @@ msgstr[1] "tygodnie" msgstr[2] "tygodni" #: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 +#: ../../../../inc/functions.php:569 ../../../../inc/functions.php:586 msgid "year" msgid_plural "years" msgstr[0] "rok" @@ -2097,3 +2142,47 @@ msgstr "Nie ma dostępnych dodatków." #: ../../../../templates/cache/d1/99/467985632043e204070d354b8290.php:91 msgid "Install theme" msgstr "Zainstaluj dodatek" + +#: ../../../../inc/display.php:211 +#, php-format +msgid "Post too long. Click here to view the full text." +msgstr "Post za długi. Kliknij tutaj, aby zobaczyć jego pełną treść." + +#: ../../../../inc/display.php:342 ../../../../inc/display.php:443 +msgid "Delete file" +msgstr "Usuń plik" + +#: ../../../../inc/display.php:342 ../../../../inc/display.php:443 +msgid "Are you sure you want to delete this file?" +msgstr "Czy jesteś pewien, że chcesz usunąć ten plik?" + +#: ../../../../inc/display.php:431 +msgid "Delete all posts by IP across all boards" +msgstr "Usuń wszystkie posty z tego IP ze wszystkich boardów" + +#: ../../../../inc/display.php:431 +msgid "" +"Are you sure you want to delete all posts by this IP address, across all " +"boards?" +msgstr "" +"Czy jesteś pewien, że chcesz usunąć wszystkie posty z tego adresu IP, ze " +"wszystkich boardów?" + +#. Page footer +#: ../../../../inc/config.php:564 +msgid "" +"All trademarks, copyrights, comments, and images on this page are owned by " +"and are the responsibility of their respective parties." +msgstr "" +"Wszystkie znaki towarowe, prawa autorskie, komentarze oraz obrazki na tej " +"stronie są własnością i odpowiedzialność za nie spoczywa na ich odpowiednich " +"właścicielach." + +#: ../../../../inc/mod/pages.php:267 +msgid "There are no boards to search!" +msgstr "Nie ma boardów do przeszukania!" + +#. Print error +#: ../../../../inc/database.php:72 +msgid "Database error: " +msgstr "Błąd bazy danych: " -- cgit v1.3 From 9769e1f964eee89c2dcf1f585d665bd5e8d77357 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 01:56:04 -0400 Subject: i18n even more strings in inc/display.php --- inc/display.php | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'inc') diff --git a/inc/display.php b/inc/display.php index c68af9d6..5da2f302 100644 --- a/inc/display.php +++ b/inc/display.php @@ -208,7 +208,7 @@ function truncate($body, $url, $max_lines = false, $max_chars = false) { $body = preg_replace('/&[^;]*$/', '', $body); } - $body .= 'Post too long. Click here to view the full text.'; + $body .= ''.sprintf(_('Post too long. Click here to view the full text.'), $url).''; } return $body; @@ -331,19 +331,19 @@ class Post { // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], 'Delete file', 'Are you sure you want to delete this file?', $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; @@ -420,54 +420,54 @@ class Thread { // Mod controls (on posts) // Delete if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['uri'] . '/delete/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], _('Delete'), _('Are you sure you want to delete this?'), $board['uri'] . '/delete/' . $this->id); // Delete all posts by IP if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['uri'] . '/deletebyip/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], _('Delete all posts by IP'), _('Are you sure you want to delete all posts by this IP address?'), $board['uri'] . '/deletebyip/' . $this->id); // Delete all posts by IP (global) if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['uri'] . '/deletebyip/' . $this->id . '/global'); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], _('Delete all posts by IP across all boards'), _('Are you sure you want to delete all posts by this IP address, across all boards?'), $board['uri'] . '/deletebyip/' . $this->id . '/global'); // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && $this->file != 'deleted' && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], 'Delete file', 'Are you sure you want to delete this file?', $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); // Sticky if (hasPermission($config['mod']['sticky'], $board['uri'], $this->mod)) if ($this->sticky) - $built .= ' ' . $config['mod']['link_desticky'] . ''; + $built .= ' ' . $config['mod']['link_desticky'] . ''; else - $built .= ' ' . $config['mod']['link_sticky'] . ''; + $built .= ' ' . $config['mod']['link_sticky'] . ''; if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod)) if ($this->bumplocked) - $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; + $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; else - $built .= ' ' . $config['mod']['link_bumplock'] . ''; + $built .= ' ' . $config['mod']['link_bumplock'] . ''; // Lock if (hasPermission($config['mod']['lock'], $board['uri'], $this->mod)) if ($this->locked) - $built .= ' ' . $config['mod']['link_unlock'] . ''; + $built .= ' ' . $config['mod']['link_unlock'] . ''; else - $built .= ' ' . $config['mod']['link_lock'] . ''; + $built .= ' ' . $config['mod']['link_lock'] . ''; if (hasPermission($config['mod']['move'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_move'] . ''; + $built .= ' ' . $config['mod']['link_move'] . ''; // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; -- cgit v1.3 From 6c2887ba9f3d20f23015e1a34e5170d219d5e648 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 02:06:34 -0400 Subject: Update Polish locale --- inc/locale/pl_PL/LC_MESSAGES/javascript.po | 3 +- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 19840 -> 20956 bytes inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 269 +++++++++++++++++++---------- 3 files changed, 181 insertions(+), 91 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/javascript.po b/inc/locale/pl_PL/LC_MESSAGES/javascript.po index 482ec45f..ae1bb5c9 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/javascript.po +++ b/inc/locale/pl_PL/LC_MESSAGES/javascript.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-27 01:54-0400\n" +"POT-Creation-Date: 2013-08-01 01:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -42,6 +42,7 @@ msgid "Click to expand" msgstr "Kliknij aby rozwinąć" #: ../../../../js/expand.js:41 ../../../../js/expand.js:45 +#: ../../../../js/expand.js:43 msgid "Hide expanded replies" msgstr "Schowaj rozwinięte odpowiedzi" diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index bc603e67..73f434f7 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 20802b7d..8a46fda9 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-07-27 01:54-0400\n" +"POT-Creation-Date: 2013-08-01 01:58-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -24,6 +24,7 @@ msgstr "" #: ../../../../inc/functions.php:1041 ../../../../inc/functions.php:1055 #: ../../../../inc/functions.php:1039 ../../../../inc/functions.php:1053 #: ../../../../inc/functions.php:1068 ../../../../inc/functions.php:1082 +#: ../../../../inc/functions.php:1079 ../../../../inc/functions.php:1093 msgid "Previous" msgstr "Wstecz" @@ -33,6 +34,7 @@ msgstr "Wstecz" #: ../../../../inc/functions.php:1060 ../../../../inc/functions.php:1069 #: ../../../../inc/functions.php:1058 ../../../../inc/functions.php:1067 #: ../../../../inc/functions.php:1087 ../../../../inc/functions.php:1096 +#: ../../../../inc/functions.php:1098 ../../../../inc/functions.php:1107 msgid "Next" msgstr "Dalej" @@ -57,6 +59,7 @@ msgid "all boards" msgstr "wszystkie boardy" #: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 +#: ../../../../inc/config.php:334 msgid "You have been muted for unoriginal content." msgstr "Zostałeś zagłuszony za nieoryginalną treść." @@ -64,11 +67,12 @@ msgstr "Zostałeś zagłuszony za nieoryginalną treść." msgid "Anonymous" msgstr "Anonimowy" -#: /var/www/html/Tinyboard/inc/config.php:481 +#. The names on the post buttons. (On most imageboards, these are both "Post") +#: /var/www/html/Tinyboard/inc/config.php:481 ../../../../inc/config.php:552 msgid "New Topic" msgstr "Nowy wątek" -#: /var/www/html/Tinyboard/inc/config.php:482 +#: /var/www/html/Tinyboard/inc/config.php:482 ../../../../inc/config.php:553 msgid "New Reply" msgstr "Odpowiedz" @@ -84,19 +88,19 @@ msgstr "Szybka odpowiedź" #. Error messages #: /var/www/html/Tinyboard/inc/config.php:600 ../../../../inc/config.php:638 #: ../../../../inc/config.php:692 ../../../../inc/config.php:698 -#: ../../../../inc/config.php:695 +#: ../../../../inc/config.php:695 ../../../../inc/config.php:701 msgid "Lurk some more before posting." msgstr "Nie postuj pierwszego dnia." #: /var/www/html/Tinyboard/inc/config.php:601 ../../../../inc/config.php:639 #: ../../../../inc/config.php:693 ../../../../inc/config.php:699 -#: ../../../../inc/config.php:696 +#: ../../../../inc/config.php:696 ../../../../inc/config.php:702 msgid "You look like a bot." msgstr "Wyglądasz jak bot." #: /var/www/html/Tinyboard/inc/config.php:602 ../../../../inc/config.php:640 #: ../../../../inc/config.php:694 ../../../../inc/config.php:700 -#: ../../../../inc/config.php:697 +#: ../../../../inc/config.php:697 ../../../../inc/config.php:703 msgid "Your browser sent an invalid or no HTTP referer." msgstr "" "Twoja przeglądarka przesłała niepoprawny, bądź nie przesłała informacji o " @@ -104,161 +108,161 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:603 ../../../../inc/config.php:641 #: ../../../../inc/config.php:695 ../../../../inc/config.php:701 -#: ../../../../inc/config.php:698 +#: ../../../../inc/config.php:698 ../../../../inc/config.php:704 #, php-format msgid "The %s field was too long." msgstr "Pole %s jest za długie" #: /var/www/html/Tinyboard/inc/config.php:604 ../../../../inc/config.php:642 #: ../../../../inc/config.php:696 ../../../../inc/config.php:702 -#: ../../../../inc/config.php:699 +#: ../../../../inc/config.php:699 ../../../../inc/config.php:705 msgid "The body was too long." msgstr "Zawartość jest za długa." #: /var/www/html/Tinyboard/inc/config.php:605 ../../../../inc/config.php:643 #: ../../../../inc/config.php:697 ../../../../inc/config.php:703 -#: ../../../../inc/config.php:700 +#: ../../../../inc/config.php:700 ../../../../inc/config.php:706 msgid "The body was too short or empty." msgstr "Zawartość jest za krótka, bądź pusta." #: /var/www/html/Tinyboard/inc/config.php:606 ../../../../inc/config.php:644 #: ../../../../inc/config.php:698 ../../../../inc/config.php:704 -#: ../../../../inc/config.php:701 +#: ../../../../inc/config.php:701 ../../../../inc/config.php:707 msgid "You must upload an image." msgstr "Musisz wysłać obrazek." #: /var/www/html/Tinyboard/inc/config.php:607 ../../../../inc/config.php:645 #: ../../../../inc/config.php:699 ../../../../inc/config.php:705 -#: ../../../../inc/config.php:702 +#: ../../../../inc/config.php:702 ../../../../inc/config.php:708 msgid "The server failed to handle your upload." msgstr "Nie udało się obsłużyć twojego pliku." #: /var/www/html/Tinyboard/inc/config.php:608 ../../../../inc/config.php:646 #: ../../../../inc/config.php:700 ../../../../inc/config.php:706 -#: ../../../../inc/config.php:703 +#: ../../../../inc/config.php:703 ../../../../inc/config.php:709 msgid "Unsupported image format." msgstr "Niewspierany format obrazka." #: /var/www/html/Tinyboard/inc/config.php:609 ../../../../inc/config.php:647 #: ../../../../inc/config.php:701 ../../../../inc/config.php:707 -#: ../../../../inc/config.php:704 +#: ../../../../inc/config.php:704 ../../../../inc/config.php:710 msgid "Invalid board!" msgstr "Niepoprawny board!" #: /var/www/html/Tinyboard/inc/config.php:610 ../../../../inc/config.php:648 #: ../../../../inc/config.php:702 ../../../../inc/config.php:708 -#: ../../../../inc/config.php:705 +#: ../../../../inc/config.php:705 ../../../../inc/config.php:711 msgid "Thread specified does not exist." msgstr "Wybrany wątek nie istnieje." #: /var/www/html/Tinyboard/inc/config.php:611 ../../../../inc/config.php:649 #: ../../../../inc/config.php:703 ../../../../inc/config.php:709 -#: ../../../../inc/config.php:706 +#: ../../../../inc/config.php:706 ../../../../inc/config.php:712 msgid "Thread locked. You may not reply at this time." msgstr "Wątek jest zablokowany. Nie możesz w nim teraz postować." #: /var/www/html/Tinyboard/inc/config.php:612 ../../../../inc/config.php:650 #: ../../../../inc/config.php:706 ../../../../inc/config.php:712 -#: ../../../../inc/config.php:709 +#: ../../../../inc/config.php:709 ../../../../inc/config.php:715 msgid "You didn't make a post." msgstr "Nie zrobiłeś posta." #: /var/www/html/Tinyboard/inc/config.php:613 ../../../../inc/config.php:651 #: ../../../../inc/config.php:707 ../../../../inc/config.php:713 -#: ../../../../inc/config.php:710 +#: ../../../../inc/config.php:710 ../../../../inc/config.php:716 msgid "Flood detected; Post discarded." msgstr "Wykryto flood; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:614 ../../../../inc/config.php:652 #: ../../../../inc/config.php:708 ../../../../inc/config.php:714 -#: ../../../../inc/config.php:711 +#: ../../../../inc/config.php:711 ../../../../inc/config.php:717 msgid "Your request looks automated; Post discarded." msgstr "Twoje żądanie wygląda na zautomatyzowane; Post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:615 ../../../../inc/config.php:653 #: ../../../../inc/config.php:709 ../../../../inc/config.php:715 -#: ../../../../inc/config.php:712 +#: ../../../../inc/config.php:712 ../../../../inc/config.php:718 msgid "Unoriginal content!" msgstr "Nieoryginalna treść!" #: /var/www/html/Tinyboard/inc/config.php:616 ../../../../inc/config.php:654 #: ../../../../inc/config.php:710 ../../../../inc/config.php:716 -#: ../../../../inc/config.php:713 +#: ../../../../inc/config.php:713 ../../../../inc/config.php:719 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 -#: ../../../../inc/config.php:714 +#: ../../../../inc/config.php:714 ../../../../inc/config.php:720 #, php-format msgid "You are muted! Expires in %d seconds." msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 -#: ../../../../inc/config.php:715 +#: ../../../../inc/config.php:715 ../../../../inc/config.php:721 #, php-format msgid "Your IP address is listed in %s." msgstr "Twój adres IP jest na liście %s." #: /var/www/html/Tinyboard/inc/config.php:619 ../../../../inc/config.php:657 #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 -#: ../../../../inc/config.php:716 +#: ../../../../inc/config.php:716 ../../../../inc/config.php:722 msgid "Too many links; flood detected." msgstr "Zbyt dużo linków; wykryto flood." #: /var/www/html/Tinyboard/inc/config.php:620 ../../../../inc/config.php:658 #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 -#: ../../../../inc/config.php:717 +#: ../../../../inc/config.php:717 ../../../../inc/config.php:723 msgid "Too many cites; post discarded." msgstr "Zbyt dużo cytatów; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:621 ../../../../inc/config.php:659 #: ../../../../inc/config.php:715 ../../../../inc/config.php:721 -#: ../../../../inc/config.php:718 +#: ../../../../inc/config.php:718 ../../../../inc/config.php:724 msgid "Too many cross-board links; post discarded." msgstr "Zbyt dużo linków między boardami; post odrzucony." #: /var/www/html/Tinyboard/inc/config.php:622 ../../../../inc/config.php:660 #: ../../../../inc/config.php:716 ../../../../inc/config.php:722 -#: ../../../../inc/config.php:719 +#: ../../../../inc/config.php:719 ../../../../inc/config.php:725 msgid "You didn't select anything to delete." msgstr "Nie wybrano nic do usunięcia." #: /var/www/html/Tinyboard/inc/config.php:623 ../../../../inc/config.php:661 #: ../../../../inc/config.php:717 ../../../../inc/config.php:723 -#: ../../../../inc/config.php:720 +#: ../../../../inc/config.php:720 ../../../../inc/config.php:726 msgid "You didn't select anything to report." msgstr "Nie wybrano nic do zgłoszenia." #: /var/www/html/Tinyboard/inc/config.php:624 ../../../../inc/config.php:662 #: ../../../../inc/config.php:718 ../../../../inc/config.php:724 -#: ../../../../inc/config.php:721 +#: ../../../../inc/config.php:721 ../../../../inc/config.php:727 msgid "You can't report that many posts at once." msgstr "Nie możesz raportować tyle postów na raz." #: /var/www/html/Tinyboard/inc/config.php:625 ../../../../inc/config.php:663 #: ../../../../inc/config.php:719 ../../../../inc/config.php:725 -#: ../../../../inc/config.php:722 +#: ../../../../inc/config.php:722 ../../../../inc/config.php:728 msgid "Wrong password…" msgstr "Niepoprawne hasło" #: /var/www/html/Tinyboard/inc/config.php:626 ../../../../inc/config.php:664 #: ../../../../inc/config.php:720 ../../../../inc/config.php:726 -#: ../../../../inc/config.php:723 +#: ../../../../inc/config.php:723 ../../../../inc/config.php:729 msgid "Invalid image." msgstr "Niepoprawny obrazek." #: /var/www/html/Tinyboard/inc/config.php:627 ../../../../inc/config.php:665 #: ../../../../inc/config.php:721 ../../../../inc/config.php:727 -#: ../../../../inc/config.php:724 +#: ../../../../inc/config.php:724 ../../../../inc/config.php:730 msgid "Unknown file extension." msgstr "Nieznane rozszerzenie pliku." #: /var/www/html/Tinyboard/inc/config.php:628 ../../../../inc/config.php:666 #: ../../../../inc/config.php:722 ../../../../inc/config.php:728 -#: ../../../../inc/config.php:725 +#: ../../../../inc/config.php:725 ../../../../inc/config.php:731 msgid "Maximum file size: %maxsz% bytes
    Your file's size: %filesz% bytes" msgstr "" "Maksymalny rozmiar pliku: %maxsz% bajtów
    Rozmiar twojego pliku: %filesz% " @@ -266,33 +270,33 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:629 ../../../../inc/config.php:667 #: ../../../../inc/config.php:723 ../../../../inc/config.php:729 -#: ../../../../inc/config.php:726 +#: ../../../../inc/config.php:726 ../../../../inc/config.php:732 msgid "The file was too big." msgstr "Plik jest za duży." #: /var/www/html/Tinyboard/inc/config.php:630 ../../../../inc/config.php:668 #: ../../../../inc/config.php:724 ../../../../inc/config.php:730 -#: ../../../../inc/config.php:727 +#: ../../../../inc/config.php:727 ../../../../inc/config.php:733 msgid "Invalid archive!" msgstr "Niepoprawne archiwum!" #: /var/www/html/Tinyboard/inc/config.php:631 ../../../../inc/config.php:669 #: ../../../../inc/config.php:725 ../../../../inc/config.php:731 -#: ../../../../inc/config.php:728 +#: ../../../../inc/config.php:728 ../../../../inc/config.php:734 #, php-format msgid "That file already exists!" msgstr "Ten plik już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:632 ../../../../inc/config.php:670 #: ../../../../inc/config.php:727 ../../../../inc/config.php:733 -#: ../../../../inc/config.php:730 +#: ../../../../inc/config.php:730 ../../../../inc/config.php:736 #, php-format msgid "You'll have to wait another %s before deleting that." msgstr "Musisz poczekać kolejne %s przed usunięciem tego." #: /var/www/html/Tinyboard/inc/config.php:633 ../../../../inc/config.php:671 #: ../../../../inc/config.php:728 ../../../../inc/config.php:734 -#: ../../../../inc/config.php:731 +#: ../../../../inc/config.php:731 ../../../../inc/config.php:737 msgid "MIME type detection XSS exploit (IE) detected; post discarded." msgstr "" "Wykryto próbę wykorzystania luki wykrywania typu MIME (XSS w IE); post " @@ -300,31 +304,31 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:634 ../../../../inc/config.php:672 #: ../../../../inc/config.php:729 ../../../../inc/config.php:735 -#: ../../../../inc/config.php:732 +#: ../../../../inc/config.php:732 ../../../../inc/config.php:738 msgid "Couldn't make sense of the URL of the video you tried to embed." msgstr "Nie można było zrozumieć URL-a wideo, którego próbowano zapostować." #: /var/www/html/Tinyboard/inc/config.php:635 ../../../../inc/config.php:673 #: ../../../../inc/config.php:730 ../../../../inc/config.php:736 -#: ../../../../inc/config.php:733 +#: ../../../../inc/config.php:733 ../../../../inc/config.php:739 msgid "You seem to have mistyped the verification." msgstr "Wygląda na to, że przepisano źle weryfikację." #: /var/www/html/Tinyboard/inc/config.php:638 ../../../../inc/config.php:676 #: ../../../../inc/config.php:734 ../../../../inc/config.php:740 -#: ../../../../inc/config.php:737 +#: ../../../../inc/config.php:737 ../../../../inc/config.php:743 msgid "Invalid username and/or password." msgstr "Błędna nazwa użytkownika, bądź hasło" #: /var/www/html/Tinyboard/inc/config.php:639 ../../../../inc/config.php:677 #: ../../../../inc/config.php:735 ../../../../inc/config.php:741 -#: ../../../../inc/config.php:738 +#: ../../../../inc/config.php:738 ../../../../inc/config.php:744 msgid "You are not a mod…" msgstr "Nie jesteś moderatorem" #: /var/www/html/Tinyboard/inc/config.php:640 ../../../../inc/config.php:678 #: ../../../../inc/config.php:736 ../../../../inc/config.php:742 -#: ../../../../inc/config.php:739 +#: ../../../../inc/config.php:739 ../../../../inc/config.php:745 msgid "" "Invalid username and/or password. Your user may have been deleted or changed." msgstr "" @@ -333,65 +337,65 @@ msgstr "" #: /var/www/html/Tinyboard/inc/config.php:641 ../../../../inc/config.php:679 #: ../../../../inc/config.php:737 ../../../../inc/config.php:743 -#: ../../../../inc/config.php:740 +#: ../../../../inc/config.php:740 ../../../../inc/config.php:746 msgid "Invalid/malformed cookies." msgstr "Niepoprawne/zmodyfikowane pliki cookie." #: /var/www/html/Tinyboard/inc/config.php:642 ../../../../inc/config.php:680 #: ../../../../inc/config.php:738 ../../../../inc/config.php:744 -#: ../../../../inc/config.php:741 +#: ../../../../inc/config.php:741 ../../../../inc/config.php:747 msgid "Your browser didn't submit an input when it should have." msgstr "Twoja przeglądarka nie wysłała pola, kiedy powinna." #: /var/www/html/Tinyboard/inc/config.php:643 ../../../../inc/config.php:681 #: ../../../../inc/config.php:739 ../../../../inc/config.php:745 -#: ../../../../inc/config.php:742 +#: ../../../../inc/config.php:742 ../../../../inc/config.php:748 #, php-format msgid "The %s field is required." msgstr "Pole %s jest wymagane." #: /var/www/html/Tinyboard/inc/config.php:644 ../../../../inc/config.php:682 #: ../../../../inc/config.php:740 ../../../../inc/config.php:746 -#: ../../../../inc/config.php:743 +#: ../../../../inc/config.php:743 ../../../../inc/config.php:749 #, php-format msgid "The %s field was invalid." msgstr "Pole %s jest niepoprawne." #: /var/www/html/Tinyboard/inc/config.php:645 ../../../../inc/config.php:683 #: ../../../../inc/config.php:741 ../../../../inc/config.php:747 -#: ../../../../inc/config.php:744 +#: ../../../../inc/config.php:744 ../../../../inc/config.php:750 #, php-format msgid "There is already a %s board." msgstr "Już istnieje board %s" #: /var/www/html/Tinyboard/inc/config.php:646 ../../../../inc/config.php:684 #: ../../../../inc/config.php:742 ../../../../inc/config.php:748 -#: ../../../../inc/config.php:745 +#: ../../../../inc/config.php:745 ../../../../inc/config.php:751 msgid "You don't have permission to do that." msgstr "Nie masz uprawnień do wykonania tej czynności." #: /var/www/html/Tinyboard/inc/config.php:647 ../../../../inc/config.php:685 #: ../../../../inc/config.php:743 ../../../../inc/config.php:749 -#: ../../../../inc/config.php:746 +#: ../../../../inc/config.php:746 ../../../../inc/config.php:752 msgid "That post doesn't exist…" msgstr "Ten post nie istnieje..." #: /var/www/html/Tinyboard/inc/config.php:648 ../../../../inc/config.php:686 #: ../../../../inc/config.php:744 ../../../../inc/config.php:750 -#: ../../../../inc/config.php:747 +#: ../../../../inc/config.php:747 ../../../../inc/config.php:753 msgid "Page not found." msgstr "Strona nie znaleziona." #: /var/www/html/Tinyboard/inc/config.php:649 ../../../../inc/config.php:687 #: ../../../../inc/config.php:745 ../../../../inc/config.php:751 -#: ../../../../inc/config.php:748 +#: ../../../../inc/config.php:748 ../../../../inc/config.php:754 #, php-format msgid "That mod already exists!" msgstr "Ten moderator już istnieje!" #: /var/www/html/Tinyboard/inc/config.php:650 ../../../../inc/config.php:688 #: ../../../../inc/config.php:746 ../../../../inc/config.php:752 -#: ../../../../inc/config.php:749 +#: ../../../../inc/config.php:749 ../../../../inc/config.php:755 msgid "That theme doesn't exist!" msgstr "Ten dodatek nie istnieje!" @@ -430,6 +434,7 @@ msgstr "[Przenieś]" #. Default public ban message. #. In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). #: /var/www/html/Tinyboard/inc/config.php:801 ../../../../inc/config.php:911 +#: ../../../../inc/config.php:917 msgid "USER WAS BANNED FOR THIS POST" msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" @@ -438,20 +443,21 @@ msgstr "UŻYTKOWNIK ZOSTAŁ ZBANOWANY ZA TEGO POSTA" msgid "Moved to %s." msgstr "Przeniesiono do %s." -#: /var/www/html/Tinyboard/inc/display.php:80 +#: /var/www/html/Tinyboard/inc/display.php:80 ../../../../inc/display.php:75 msgid "Error" msgstr "Błąd" -#: /var/www/html/Tinyboard/inc/display.php:81 +#: /var/www/html/Tinyboard/inc/display.php:81 ../../../../inc/display.php:76 msgid "An error has occured." msgstr "Wystąpił błąd." -#: /var/www/html/Tinyboard/inc/display.php:87 +#: /var/www/html/Tinyboard/inc/display.php:87 ../../../../inc/display.php:82 msgid "Go back" msgstr "Wróć" #: /var/www/html/Tinyboard/inc/display.php:97 ../../../../inc/display.php:91 #: ../../../../inc/mod/pages.php:59 ../../../../inc/mod/pages.php:62 +#: ../../../../inc/display.php:92 msgid "Login" msgstr "Logowanie" @@ -469,31 +475,34 @@ msgstr "" #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:27 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:27 #: ../../../../templates/cache/82/40/4c4a4b82f787181e6500ce83494d.php:27 +#: ../../../../inc/display.php:423 msgid "Delete" msgstr "Usuń" #: /var/www/html/Tinyboard/inc/display.php:272 -#: /var/www/html/Tinyboard/inc/display.php:365 +#: /var/www/html/Tinyboard/inc/display.php:365 ../../../../inc/display.php:423 msgid "Are you sure you want to delete this?" msgstr "Czy jesteś pewien, że chcesz to usunąć?" #: /var/www/html/Tinyboard/inc/display.php:276 -#: /var/www/html/Tinyboard/inc/display.php:369 +#: /var/www/html/Tinyboard/inc/display.php:369 ../../../../inc/display.php:427 msgid "Delete all posts by IP" msgstr "Usuń wszystkie posty z tego adresu IP" #: /var/www/html/Tinyboard/inc/display.php:276 -#: /var/www/html/Tinyboard/inc/display.php:369 +#: /var/www/html/Tinyboard/inc/display.php:369 ../../../../inc/display.php:427 msgid "Are you sure you want to delete all posts by this IP address?" msgstr "Czy na pewno chcesz usunąć wszystkie posty z tego adresu IP?" #: /var/www/html/Tinyboard/inc/display.php:280 -#: /var/www/html/Tinyboard/inc/display.php:373 +#: /var/www/html/Tinyboard/inc/display.php:373 ../../../../inc/display.php:334 +#: ../../../../inc/display.php:435 msgid "Ban" msgstr "Ban" #: /var/www/html/Tinyboard/inc/display.php:284 -#: /var/www/html/Tinyboard/inc/display.php:377 +#: /var/www/html/Tinyboard/inc/display.php:377 ../../../../inc/display.php:338 +#: ../../../../inc/display.php:439 msgid "Ban & Delete" msgstr "Usuń i zbanuj" @@ -506,34 +515,36 @@ msgstr "Usuń plik" #: /var/www/html/Tinyboard/inc/display.php:408 #: ../../../../inc/mod/pages.php:1080 ../../../../inc/mod/pages.php:1105 #: ../../../../inc/mod/pages.php:1239 ../../../../inc/mod/pages.php:1242 +#: ../../../../inc/display.php:346 ../../../../inc/display.php:470 +#: ../../../../inc/mod/pages.php:1314 msgid "Edit post" msgstr "Edytuj post" -#: /var/www/html/Tinyboard/inc/display.php:386 +#: /var/www/html/Tinyboard/inc/display.php:386 ../../../../inc/display.php:448 msgid "Make thread not sticky" msgstr "Odklej wątek" -#: /var/www/html/Tinyboard/inc/display.php:388 +#: /var/www/html/Tinyboard/inc/display.php:388 ../../../../inc/display.php:450 msgid "Make thread sticky" msgstr "Przyklej wątek" -#: /var/www/html/Tinyboard/inc/display.php:392 +#: /var/www/html/Tinyboard/inc/display.php:392 ../../../../inc/display.php:454 msgid "Allow thread to be bumped" msgstr "Zezwól wątkowi na bumpowanie" -#: /var/www/html/Tinyboard/inc/display.php:394 +#: /var/www/html/Tinyboard/inc/display.php:394 ../../../../inc/display.php:456 msgid "Prevent thread from being bumped" msgstr "Zabroń wątkowi na bumpowanie" -#: /var/www/html/Tinyboard/inc/display.php:399 +#: /var/www/html/Tinyboard/inc/display.php:399 ../../../../inc/display.php:461 msgid "Unlock thread" msgstr "Odblokuj wątek" -#: /var/www/html/Tinyboard/inc/display.php:401 +#: /var/www/html/Tinyboard/inc/display.php:401 ../../../../inc/display.php:463 msgid "Lock thread" msgstr "Zablokuj wątek" -#: /var/www/html/Tinyboard/inc/display.php:404 +#: /var/www/html/Tinyboard/inc/display.php:404 ../../../../inc/display.php:466 msgid "Move thread to another board" msgstr "Przenieś wątek na inny board" @@ -703,6 +714,8 @@ msgstr "Weryfikacja" #. line 72 #. line 3 #. line 72 +#. line 3 +#. line 72 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:149 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:22 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:165 @@ -787,6 +800,8 @@ msgstr "Flagi" #. line 99 #. line 98 #. line 99 +#. line 98 +#. line 99 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:188 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:191 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:215 @@ -854,6 +869,8 @@ msgstr "Przyklejony" #. line 103 #. line 102 #. line 103 +#. line 102 +#. line 103 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:200 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:203 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:227 @@ -921,6 +938,8 @@ msgstr "Zablokowany" #. line 107 #. line 106 #. line 107 +#. line 106 +#. line 107 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:212 #: /var/www/html/Tinyboard/templates/cache/1d/5e/91ec2bc929b77377b8b877d82db4.php:215 #: ../../../../templates/cache/d1/2d/eda9403e966240c642b13ca43eb6.php:239 @@ -1058,6 +1077,7 @@ msgstr "Tryb postowania: Odpowiedź" #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:172 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:127 #: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:173 +#: ../../../../templates/cache/aa/f6/f10fd83961bcd8c947af6ddf919d.php:174 msgid "Return" msgstr "Powrót" @@ -1079,6 +1099,7 @@ msgstr "Usuń post" #. line 106 #. line 8 #. line 32 +#. line 8 #: /var/www/html/Tinyboard/templates/cache/dd/1a/77e08f0c1b4ecf707c5a3e5a70be.php:32 #: /var/www/html/Tinyboard/mod.php:1801 #: ../../../../templates/cache/a8/a6/1022091d3402e085395b12e6279a.php:32 @@ -1116,6 +1137,7 @@ msgstr "Wiadomości prywatne" #: ../../../../inc/mod/pages.php:376 ../../../../inc/mod/pages.php:393 #: ../../../../inc/mod/pages.php:406 ../../../../inc/mod/pages.php:540 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:166 +#: ../../../../inc/mod/pages.php:604 msgid "News" msgstr "Aktualności" @@ -1123,7 +1145,7 @@ msgstr "Aktualności" #: ../../../../inc/mod/pages.php:1557 ../../../../inc/mod/pages.php:1657 #: ../../../../inc/mod/pages.php:1682 ../../../../inc/mod/pages.php:1816 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:207 -#: ../../../../inc/mod/pages.php:1831 +#: ../../../../inc/mod/pages.php:1831 ../../../../inc/mod/pages.php:1904 msgid "Report queue" msgstr "Kolejka zgłoszeń" @@ -1131,6 +1153,7 @@ msgstr "Kolejka zgłoszeń" #: ../../../../inc/mod/pages.php:664 ../../../../inc/mod/pages.php:705 #: ../../../../inc/mod/pages.php:721 ../../../../inc/mod/pages.php:855 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:224 +#: ../../../../inc/mod/pages.php:918 msgid "Ban list" msgstr "Lista banów" @@ -1138,7 +1161,7 @@ msgstr "Lista banów" #: ../../../../inc/mod/pages.php:1271 ../../../../inc/mod/pages.php:1369 #: ../../../../inc/mod/pages.php:1394 ../../../../inc/mod/pages.php:1528 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:232 -#: ../../../../inc/mod/pages.php:1543 +#: ../../../../inc/mod/pages.php:1543 ../../../../inc/mod/pages.php:1615 msgid "Manage users" msgstr "Zarządzaj użytkownikami" @@ -1153,6 +1176,7 @@ msgstr "Zmień swoje hasło" #: ../../../../inc/mod/pages.php:580 ../../../../inc/mod/pages.php:607 #: ../../../../templates/cache/55/dd/8ffe738533bd12359200e5745905.php:65 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:255 +#: ../../../../inc/mod/pages.php:644 ../../../../inc/mod/pages.php:671 msgid "Moderation log" msgstr "Log moderacji" @@ -1172,7 +1196,7 @@ msgstr "Pokaż konfigurację" #: ../../../../inc/mod/pages.php:1739 ../../../../inc/mod/pages.php:1805 #: ../../../../inc/mod/pages.php:1830 ../../../../inc/mod/pages.php:1964 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:247 -#: ../../../../inc/mod/pages.php:1979 +#: ../../../../inc/mod/pages.php:1979 ../../../../inc/mod/pages.php:2052 msgid "Manage themes" msgstr "Zarządzaj dodatkami" @@ -1196,7 +1220,7 @@ msgstr "Wyrażenie:" #: ../../../../templates/cache/c3/de/6ff26042c5b94cc80055e6f209d2.php:19 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:286 #: ../../../../templates/cache/4c/fb/a3bf13b0badfc09442bd42da1cce.php:19 -#: ../../../../search.php:165 +#: ../../../../search.php:165 ../../../../search.php:168 msgid "Search" msgstr "Szukaj" @@ -1276,12 +1300,14 @@ msgstr "Akcja" #: /var/www/html/Tinyboard/mod.php:528 ../../../../inc/mod/pages.php:1723 #: ../../../../inc/mod/pages.php:1789 ../../../../inc/mod/pages.php:1814 #: ../../../../inc/mod/pages.php:1948 ../../../../inc/mod/pages.php:1963 +#: ../../../../inc/mod/pages.php:2036 msgid "Themes directory doesn't exist!" msgstr "Katalog dodatków (themes) nie istnieje!" #: /var/www/html/Tinyboard/mod.php:530 ../../../../inc/mod/pages.php:1725 #: ../../../../inc/mod/pages.php:1791 ../../../../inc/mod/pages.php:1816 #: ../../../../inc/mod/pages.php:1950 ../../../../inc/mod/pages.php:1965 +#: ../../../../inc/mod/pages.php:2038 msgid "Cannot open themes directory; check permissions." msgstr "Nie można otworzyć katalogu dodatków (themes); sprawdź uprawnienia." @@ -1334,6 +1360,7 @@ msgstr "Instaluj" #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:263 #: ../../../../inc/mod/pages.php:1741 ../../../../inc/mod/pages.php:1745 #: ../../../../templates/cache/86/31/3f70fa8521e56d617b21133af4d8.php:98 +#: ../../../../inc/mod/pages.php:1814 ../../../../inc/mod/pages.php:1818 msgid "Rebuild" msgstr "Przebuduj" @@ -1361,6 +1388,7 @@ msgstr "Postuj na tablicy ogłoszeń" #: ../../../../inc/mod/pages.php:333 ../../../../inc/mod/pages.php:346 #: ../../../../inc/mod/pages.php:480 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:96 +#: ../../../../inc/mod/pages.php:543 msgid "Noticeboard" msgstr "Tablica ogłoszeń" @@ -1468,13 +1496,13 @@ msgstr "Konfiguracja" #: /var/www/html/Tinyboard/mod.php:2174 ../../../../inc/mod/pages.php:255 #: ../../../../inc/mod/pages.php:272 ../../../../inc/mod/pages.php:285 -#: ../../../../inc/mod/pages.php:419 +#: ../../../../inc/mod/pages.php:419 ../../../../inc/mod/pages.php:481 msgid "Couldn't open board after creation." msgstr "Nie można otworzyć boardu po utworzeniu." #: /var/www/html/Tinyboard/mod.php:2678 ../../../../inc/mod/pages.php:759 #: ../../../../inc/mod/pages.php:800 ../../../../inc/mod/pages.php:823 -#: ../../../../inc/mod/pages.php:957 +#: ../../../../inc/mod/pages.php:957 ../../../../inc/mod/pages.php:1020 msgid "Target and source board are the same." msgstr "Docelowy i źródłowy board są takie same." @@ -1484,6 +1512,7 @@ msgstr "Nie ma boardu na który można to przenieść; istnieje tylko jeden." #: ../../../../inc/config.php:689 ../../../../inc/config.php:747 #: ../../../../inc/config.php:753 ../../../../inc/config.php:750 +#: ../../../../inc/config.php:756 msgid "Invalid security token! Please go back and try again." msgstr "Niepoprawny token bezpieczeństwa! Proszę cofnąć i spróbować ponownie." @@ -1493,11 +1522,13 @@ msgstr "Potwierdź akcję" #: ../../../../inc/mod/pages.php:222 ../../../../inc/mod/pages.php:239 #: ../../../../inc/mod/pages.php:252 ../../../../inc/mod/pages.php:386 +#: ../../../../inc/mod/pages.php:431 msgid "Edit board" msgstr "Edytuj board" #: ../../../../inc/mod/pages.php:270 ../../../../inc/mod/pages.php:287 #: ../../../../inc/mod/pages.php:300 ../../../../inc/mod/pages.php:434 +#: ../../../../inc/mod/pages.php:496 msgid "New board" msgstr "Nowy board" @@ -1511,6 +1542,7 @@ msgstr "Nowy board" #: ../../../../inc/mod/pages.php:628 ../../../../inc/mod/pages.php:762 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:247 #: ../../../../templates/cache/18/9c/c365d711719f494c684aab98a4ae.php:65 +#: ../../../../inc/mod/pages.php:825 msgid "IP" msgstr "adres IP" @@ -1520,12 +1552,14 @@ msgstr "adres IP" #: ../../../../inc/mod/pages.php:638 ../../../../inc/mod/pages.php:1053 #: ../../../../inc/mod/pages.php:772 ../../../../inc/mod/pages.php:1187 #: ../../../../templates/cache/24/a0/f1ddafed7a8f9625e747a5ca33f5.php:398 -#: ../../../../inc/mod/pages.php:1190 +#: ../../../../inc/mod/pages.php:1190 ../../../../inc/mod/pages.php:835 +#: ../../../../inc/mod/pages.php:1255 msgid "New ban" msgstr "Nowy ban" #: ../../../../inc/mod/pages.php:919 ../../../../inc/mod/pages.php:962 #: ../../../../inc/mod/pages.php:987 ../../../../inc/mod/pages.php:1121 +#: ../../../../inc/mod/pages.php:1184 msgid "Impossible to move thread; there is only one board." msgstr "Nie można przenieść wątku; istnieje tylko jeden board." @@ -1533,6 +1567,7 @@ msgstr "Nie można przenieść wątku; istnieje tylko jeden board." #: ../../../../inc/mod/pages.php:923 ../../../../inc/mod/pages.php:966 #: ../../../../inc/mod/pages.php:991 ../../../../inc/mod/pages.php:1125 #: ../../../../templates/cache/dd/1a/7d548894242b9d7bff167de40716.php:106 +#: ../../../../inc/mod/pages.php:1188 msgid "Move thread" msgstr "Przenieś wątek" @@ -1541,6 +1576,7 @@ msgstr "Przenieś wątek" #: ../../../../inc/mod/pages.php:1332 ../../../../inc/mod/pages.php:1381 #: ../../../../inc/mod/pages.php:1466 ../../../../inc/mod/pages.php:1515 #: ../../../../inc/mod/pages.php:1477 ../../../../inc/mod/pages.php:1530 +#: ../../../../inc/mod/pages.php:1549 ../../../../inc/mod/pages.php:1602 msgid "Edit user" msgstr "Edytuj użytkownika" @@ -1550,12 +1586,13 @@ msgstr "Edytuj użytkownika" #: ../../../../inc/mod/pages.php:1456 ../../../../inc/mod/pages.php:1528 #: ../../../../inc/mod/pages.php:1590 ../../../../inc/mod/pages.php:1662 #: ../../../../inc/mod/pages.php:1605 ../../../../inc/mod/pages.php:1677 +#: ../../../../inc/mod/pages.php:1750 msgid "New PM for" msgstr "Nowe PW dla" #: ../../../../inc/mod/pages.php:1337 ../../../../inc/mod/pages.php:1435 #: ../../../../inc/mod/pages.php:1460 ../../../../inc/mod/pages.php:1594 -#: ../../../../inc/mod/pages.php:1609 +#: ../../../../inc/mod/pages.php:1609 ../../../../inc/mod/pages.php:1681 msgid "Private message" msgstr "Prywatna wiadomość" @@ -1563,39 +1600,39 @@ msgstr "Prywatna wiadomość" #: ../../../../inc/mod/pages.php:1358 ../../../../inc/mod/pages.php:1456 #: ../../../../inc/mod/pages.php:1481 ../../../../inc/mod/pages.php:1615 #: ../../../../templates/cache/3a/df/ab38a77244cb9c729b4c6f99759a.php:171 -#: ../../../../inc/mod/pages.php:1630 +#: ../../../../inc/mod/pages.php:1630 ../../../../inc/mod/pages.php:1702 msgid "PM inbox" msgstr "Odebrane PW" #: ../../../../inc/mod/pages.php:1679 ../../../../inc/mod/pages.php:1779 #: ../../../../inc/mod/pages.php:1804 ../../../../inc/mod/pages.php:1938 -#: ../../../../inc/mod/pages.php:1953 +#: ../../../../inc/mod/pages.php:1953 ../../../../inc/mod/pages.php:2026 msgid "Config editor" msgstr "Edytor konfiguracji" #: ../../../../inc/mod/pages.php:1713 ../../../../inc/mod/pages.php:1945 #: ../../../../inc/mod/pages.php:1970 ../../../../inc/mod/pages.php:2104 -#: ../../../../inc/mod/pages.php:2119 +#: ../../../../inc/mod/pages.php:2119 ../../../../inc/mod/pages.php:2192 msgid "Debug: Anti-spam" msgstr "Debug: Antyspam" #: ../../../../inc/mod/pages.php:1801 ../../../../inc/mod/pages.php:1867 #: ../../../../inc/mod/pages.php:1892 ../../../../inc/mod/pages.php:2026 -#: ../../../../inc/mod/pages.php:2041 +#: ../../../../inc/mod/pages.php:2041 ../../../../inc/mod/pages.php:2114 #, php-format msgid "Installed theme: %s" msgstr "Zainstalowano dodatek: %s" #: ../../../../inc/mod/pages.php:1811 ../../../../inc/mod/pages.php:1878 #: ../../../../inc/mod/pages.php:1903 ../../../../inc/mod/pages.php:2037 -#: ../../../../inc/mod/pages.php:2052 +#: ../../../../inc/mod/pages.php:2052 ../../../../inc/mod/pages.php:2125 #, php-format msgid "Configuring theme: %s" msgstr "Konfigurowanie dodatku: %s" #: ../../../../inc/mod/pages.php:1839 ../../../../inc/mod/pages.php:1906 #: ../../../../inc/mod/pages.php:1931 ../../../../inc/mod/pages.php:2065 -#: ../../../../inc/mod/pages.php:2080 +#: ../../../../inc/mod/pages.php:2080 ../../../../inc/mod/pages.php:2153 #, php-format msgid "Rebuilt theme: %s" msgstr "Przebudowano dodatek: %s" @@ -1607,24 +1644,24 @@ msgid "" msgstr "" #: ../../../../inc/config.php:704 ../../../../inc/config.php:710 -#: ../../../../inc/config.php:707 +#: ../../../../inc/config.php:707 ../../../../inc/config.php:713 msgid "Thread has reached its maximum reply limit." msgstr "Ten temat osiągnął swój maksymalny limit odpowiedzi." #: ../../../../inc/config.php:705 ../../../../inc/config.php:711 -#: ../../../../inc/config.php:708 +#: ../../../../inc/config.php:708 ../../../../inc/config.php:714 msgid "Thread has reached its maximum image limit." msgstr "Ten temat osiągnął swój maksymalny limit obrazków." #: ../../../../inc/config.php:726 ../../../../inc/config.php:732 -#: ../../../../inc/config.php:729 +#: ../../../../inc/config.php:729 ../../../../inc/config.php:735 #, php-format msgid "That file already exists in this thread!" msgstr "Ten plik już istnieje w tym temacie!" #. Moderator errors #: ../../../../inc/config.php:733 ../../../../inc/config.php:739 -#: ../../../../inc/config.php:736 +#: ../../../../inc/config.php:736 ../../../../inc/config.php:742 #, php-format msgid "" "You are only allowed to unban %s users at a time. You tried to unban %u " @@ -1634,11 +1671,13 @@ msgstr "" #: ../../../../inc/mod/pages.php:1969 ../../../../inc/mod/pages.php:1994 #: ../../../../inc/mod/pages.php:2128 ../../../../inc/mod/pages.php:2143 +#: ../../../../inc/mod/pages.php:2216 msgid "Debug: Recent posts" msgstr "Debug: Ostatnie posty" #: ../../../../inc/mod/pages.php:1993 ../../../../inc/mod/pages.php:2018 #: ../../../../inc/mod/pages.php:2152 ../../../../inc/mod/pages.php:2167 +#: ../../../../inc/mod/pages.php:2240 msgid "Debug: SQL" msgstr "Debug: SQL" @@ -1651,7 +1690,7 @@ msgstr[1] "%count% odpowiedzi" msgstr[2] "%count% odpowiedzi" #. $results now contains the search results -#: ../../../../inc/mod/pages.php:290 +#: ../../../../inc/mod/pages.php:290 ../../../../inc/mod/pages.php:335 msgid "Search results" msgstr "Wyniki wyszukiwania" @@ -1976,11 +2015,11 @@ msgstr "Wyszukiwanie postów jest wyłączone" msgid "Wait a while before searching again, please." msgstr "Proszę poczekać chwilę przed ponownym szukaniem." -#: ../../../../search.php:128 +#: ../../../../search.php:128 ../../../../search.php:131 msgid "Query too broad." msgstr "Zapytanie zbyt szerokie." -#: ../../../../search.php:149 +#: ../../../../search.php:149 ../../../../search.php:152 #, php-format msgid "%d result in" msgid_plural "%d results in" @@ -1988,11 +2027,11 @@ msgstr[0] "%d wynik na" msgstr[1] "%d wyniki na" msgstr[2] "%d wyników na" -#: ../../../../search.php:160 +#: ../../../../search.php:160 ../../../../search.php:163 msgid "No results." msgstr "Brak wyników." -#: ../../../../inc/functions.php:594 +#: ../../../../inc/functions.php:594 ../../../../inc/functions.php:603 msgid "Banned!" msgstr "Zbanowany!" @@ -2005,6 +2044,7 @@ msgid "You are not banned." msgstr "Nie jesteś zbanowany." #: ../../../../inc/functions.php:549 ../../../../inc/functions.php:566 +#: ../../../../inc/functions.php:558 ../../../../inc/functions.php:575 msgid "second" msgid_plural "seconds" msgstr[0] "sekunda" @@ -2012,6 +2052,7 @@ msgstr[1] "sekundy" msgstr[2] "sekund" #: ../../../../inc/functions.php:551 ../../../../inc/functions.php:568 +#: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 msgid "minute" msgid_plural "minutes" msgstr[0] "minuta" @@ -2019,6 +2060,7 @@ msgstr[1] "minuty" msgstr[2] "minut" #: ../../../../inc/functions.php:553 ../../../../inc/functions.php:570 +#: ../../../../inc/functions.php:562 ../../../../inc/functions.php:579 msgid "hour" msgid_plural "hours" msgstr[0] "godzina" @@ -2026,6 +2068,7 @@ msgstr[1] "godziny" msgstr[2] "godzin" #: ../../../../inc/functions.php:555 ../../../../inc/functions.php:572 +#: ../../../../inc/functions.php:564 ../../../../inc/functions.php:581 msgid "day" msgid_plural "days" msgstr[0] "dzień" @@ -2033,6 +2076,7 @@ msgstr[1] "dni" msgstr[2] "dni" #: ../../../../inc/functions.php:557 ../../../../inc/functions.php:574 +#: ../../../../inc/functions.php:566 ../../../../inc/functions.php:583 msgid "week" msgid_plural "weeks" msgstr[0] "tydzień" @@ -2040,6 +2084,7 @@ msgstr[1] "tygodnie" msgstr[2] "tygodni" #: ../../../../inc/functions.php:560 ../../../../inc/functions.php:577 +#: ../../../../inc/functions.php:569 ../../../../inc/functions.php:586 msgid "year" msgid_plural "years" msgstr[0] "rok" @@ -2097,3 +2142,47 @@ msgstr "Nie ma dostępnych dodatków." #: ../../../../templates/cache/d1/99/467985632043e204070d354b8290.php:91 msgid "Install theme" msgstr "Zainstaluj dodatek" + +#: ../../../../inc/display.php:211 +#, php-format +msgid "Post too long. Click here to view the full text." +msgstr "Post za długi. Kliknij tutaj, aby zobaczyć jego pełną treść." + +#: ../../../../inc/display.php:342 ../../../../inc/display.php:443 +msgid "Delete file" +msgstr "Usuń plik" + +#: ../../../../inc/display.php:342 ../../../../inc/display.php:443 +msgid "Are you sure you want to delete this file?" +msgstr "Czy jesteś pewien, że chcesz usunąć ten plik?" + +#: ../../../../inc/display.php:431 +msgid "Delete all posts by IP across all boards" +msgstr "Usuń wszystkie posty z tego IP ze wszystkich boardów" + +#: ../../../../inc/display.php:431 +msgid "" +"Are you sure you want to delete all posts by this IP address, across all " +"boards?" +msgstr "" +"Czy jesteś pewien, że chcesz usunąć wszystkie posty z tego adresu IP, ze " +"wszystkich boardów?" + +#. Page footer +#: ../../../../inc/config.php:564 +msgid "" +"All trademarks, copyrights, comments, and images on this page are owned by " +"and are the responsibility of their respective parties." +msgstr "" +"Wszystkie znaki towarowe, prawa autorskie, komentarze oraz obrazki na tej " +"stronie są własnością i odpowiedzialność za nie spoczywa na ich odpowiednich " +"właścicielach." + +#: ../../../../inc/mod/pages.php:267 +msgid "There are no boards to search!" +msgstr "Nie ma boardów do przeszukania!" + +#. Print error +#: ../../../../inc/database.php:72 +msgid "Database error: " +msgstr "Błąd bazy danych: " -- cgit v1.3 From 0aac198c42dde176b22bba43b8b33460e6c9fda8 Mon Sep 17 00:00:00 2001 From: Jakub Skrzypnik Date: Thu, 1 Aug 2013 08:46:24 +0200 Subject: Correcting polish locale a bit --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 8a46fda9..e8caf477 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -61,7 +61,7 @@ msgstr "wszystkie boardy" #: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 #: ../../../../inc/config.php:334 msgid "You have been muted for unoriginal content." -msgstr "Zostałeś zagłuszony za nieoryginalną treść." +msgstr "Zostałeś wyciszony za nieoryginalną treść." #: /var/www/html/Tinyboard/inc/config.php:447 msgid "Anonymous" @@ -197,7 +197,7 @@ msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 #, php-format msgid "You are muted! Expires in %d seconds." -msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." +msgstr "Jesteś wyciszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 -- cgit v1.3 From 731905ed05eb7b2d516253594bc328a9a8475a69 Mon Sep 17 00:00:00 2001 From: Jakub Skrzypnik Date: Thu, 1 Aug 2013 08:49:14 +0200 Subject: Correcting polish locale a bit --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index e8caf477..a5a58616 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -190,7 +190,7 @@ msgstr "Nieoryginalna treść!" #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." -msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." +msgstr "Nieoryginalna treść! Zostałeś wyciszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 -- cgit v1.3 From 7dd57432a22e95397b509cba3c319cca1d5e364f Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 02:52:35 -0400 Subject: Compile Polish locale --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 20956 -> 20950 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 73f434f7..d2807a37 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ -- cgit v1.3 From 0a026c8f3fd62de31e3e7a0c091f0aed4fa5164c Mon Sep 17 00:00:00 2001 From: Jakub Skrzypnik Date: Thu, 1 Aug 2013 08:46:24 +0200 Subject: Correcting polish locale a bit --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index 8a46fda9..e8caf477 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -61,7 +61,7 @@ msgstr "wszystkie boardy" #: /var/www/html/Tinyboard/inc/config.php:305 ../../../../inc/config.php:330 #: ../../../../inc/config.php:334 msgid "You have been muted for unoriginal content." -msgstr "Zostałeś zagłuszony za nieoryginalną treść." +msgstr "Zostałeś wyciszony za nieoryginalną treść." #: /var/www/html/Tinyboard/inc/config.php:447 msgid "Anonymous" @@ -197,7 +197,7 @@ msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." #: ../../../../inc/config.php:714 ../../../../inc/config.php:720 #, php-format msgid "You are muted! Expires in %d seconds." -msgstr "Jesteś zagłuszony! Wygasa w ciągu %d sekund." +msgstr "Jesteś wyciszony! Wygasa w ciągu %d sekund." #: /var/www/html/Tinyboard/inc/config.php:618 ../../../../inc/config.php:656 #: ../../../../inc/config.php:712 ../../../../inc/config.php:718 -- cgit v1.3 From 00600f241ff0357f57abdcd3a9f4c88cbfc1f5bd Mon Sep 17 00:00:00 2001 From: Jakub Skrzypnik Date: Thu, 1 Aug 2013 08:49:14 +0200 Subject: Correcting polish locale a bit --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po index e8caf477..a5a58616 100644 --- a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po +++ b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.po @@ -190,7 +190,7 @@ msgstr "Nieoryginalna treść!" #: ../../../../inc/config.php:713 ../../../../inc/config.php:719 #, php-format msgid "Unoriginal content! You have been muted for %d seconds." -msgstr "Nieoryginalna treść! Zostałeś zagłuszony na %d sekund." +msgstr "Nieoryginalna treść! Zostałeś wyciszony na %d sekund." #: /var/www/html/Tinyboard/inc/config.php:617 ../../../../inc/config.php:655 #: ../../../../inc/config.php:711 ../../../../inc/config.php:717 -- cgit v1.3 From 9487eb4ac74afabe08b4c6a582bf385bda224aa3 Mon Sep 17 00:00:00 2001 From: czaks Date: Thu, 1 Aug 2013 02:52:35 -0400 Subject: Compile Polish locale --- inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo | Bin 20956 -> 20950 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'inc') diff --git a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo index 73f434f7..d2807a37 100644 Binary files a/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo and b/inc/locale/pl_PL/LC_MESSAGES/tinyboard.mo differ -- cgit v1.3 From 4851d4cabeebdd72764e75fe8d51f45c0e436c32 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 03:51:50 -0400 Subject: Forgot "global $config" here --- inc/image.php | 1 + 1 file changed, 1 insertion(+) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 99c10252..c39d7694 100644 --- a/inc/image.php +++ b/inc/image.php @@ -173,6 +173,7 @@ class ImageImagick extends ImageBase { } } public function to($src) { + global $config; if ($config['strip_exif']) { $this->image->stripImage(); } -- cgit v1.3 From 22f3a95e0e421de05a11633eac846df96a2a4768 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 04:24:34 -0400 Subject: convert+gifscale didn't respect $config['thumb_keep_animation_frames'] --- inc/config.php | 7 +++---- inc/image.php | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 75384d3f..cec996c1 100644 --- a/inc/config.php +++ b/inc/config.php @@ -412,9 +412,9 @@ // Thumbnail extension, empty for inherited (png recommended) $config['thumb_ext'] = 'png'; - // EXPERIMENTAL: // Maximum amount of frames to resize (more frames means more processing power). "1" means no animated thumbnails. - // Requires $config['thumb_ext'] to be 'gif' $config['imagick'] to be enabled. + // Requires $config['thumb_ext'] to be 'gif' and $config['thumb_method'] to be 'imagick', 'convert', or 'convert+gifsicle'. + // Not respected by 'convert'; will just resize all frames if this is > 1. $config['thumb_keep_animation_frames'] = 1; // Thumbnailing method: @@ -426,8 +426,7 @@ // PHP Imagick. // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) // instead of `convert` for resizing gifs. It's faster and resulting animated gifs - // have less artifacts than if resized with ImageMagick. - + // have less artifacts than if resized with ImageMagick. $config['thumb_method'] = 'gd'; // Strip EXIF metadata from JPEG files diff --git a/inc/image.php b/inc/image.php index c39d7694..5910cb85 100644 --- a/inc/image.php +++ b/inc/image.php @@ -282,10 +282,13 @@ class ImageConvert extends ImageBase { $quality = $config['thumb_quality'] * 10; + $config['thumb_keep_animation_frames'] = (int) $config['thumb_keep_animation_frames']; + if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->gifsicle) { if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . - escapeshellarg($this->src . '') . " > " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " . + escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } else { if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . -- cgit v1.3 From 0fe552857468aa12097a74e08f51f5aaa983be07 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 15:20:12 -0400 Subject: Upgrade Twig library --- inc/lib/Twig/Autoloader.php | 20 +- inc/lib/Twig/Compiler.php | 82 +- inc/lib/Twig/CompilerInterface.php | 10 +- inc/lib/Twig/Environment.php | 510 ++++++++--- inc/lib/Twig/Error.php | 144 +-- inc/lib/Twig/Error/Loader.php | 15 +- inc/lib/Twig/Error/Runtime.php | 3 +- inc/lib/Twig/Error/Syntax.php | 3 +- inc/lib/Twig/ExistsLoaderInterface.php | 28 + inc/lib/Twig/ExpressionParser.php | 306 ++++++- inc/lib/Twig/Extension.php | 4 +- inc/lib/Twig/Extension/Core.php | 993 ++++++++++++++++----- inc/lib/Twig/Extension/Debug.php | 71 ++ inc/lib/Twig/Extension/Escaper.php | 44 +- inc/lib/Twig/Extension/Staging.php | 113 +++ inc/lib/Twig/Extension/StringLoader.php | 64 ++ inc/lib/Twig/ExtensionInterface.php | 25 +- inc/lib/Twig/Extensions/Extension/Tinyboard.php | 5 - inc/lib/Twig/Filter.php | 31 +- inc/lib/Twig/Filter/Function.php | 8 +- inc/lib/Twig/Filter/Method.php | 11 +- inc/lib/Twig/Filter/Node.php | 39 + inc/lib/Twig/FilterCallableInterface.php | 23 + inc/lib/Twig/FilterInterface.php | 22 +- inc/lib/Twig/Function.php | 25 +- inc/lib/Twig/Function/Function.php | 8 +- inc/lib/Twig/Function/Method.php | 11 +- inc/lib/Twig/Function/Node.php | 39 + inc/lib/Twig/FunctionCallableInterface.php | 23 + inc/lib/Twig/FunctionInterface.php | 18 +- inc/lib/Twig/Lexer.php | 226 +++-- inc/lib/Twig/LexerInterface.php | 10 +- inc/lib/Twig/Loader/Array.php | 39 +- inc/lib/Twig/Loader/Chain.php | 79 +- inc/lib/Twig/Loader/Filesystem.php | 129 ++- inc/lib/Twig/Loader/String.php | 34 +- inc/lib/Twig/LoaderInterface.php | 21 +- inc/lib/Twig/Markup.php | 14 +- inc/lib/Twig/Node.php | 11 +- inc/lib/Twig/Node/AutoEscape.php | 3 +- inc/lib/Twig/Node/Block.php | 3 +- inc/lib/Twig/Node/BlockReference.php | 3 +- inc/lib/Twig/Node/Body.php | 19 + inc/lib/Twig/Node/Do.php | 38 + inc/lib/Twig/Node/Embed.php | 38 + inc/lib/Twig/Node/Expression.php | 3 +- inc/lib/Twig/Node/Expression/Array.php | 51 +- inc/lib/Twig/Node/Expression/AssignName.php | 6 +- inc/lib/Twig/Node/Expression/Binary/FloorDiv.php | 4 +- inc/lib/Twig/Node/Expression/BlockReference.php | 3 +- inc/lib/Twig/Node/Expression/Call.php | 178 ++++ .../Twig/Node/Expression/ExtensionReference.php | 3 +- inc/lib/Twig/Node/Expression/Filter.php | 60 +- inc/lib/Twig/Node/Expression/Filter/Default.php | 43 + inc/lib/Twig/Node/Expression/Function.php | 38 +- inc/lib/Twig/Node/Expression/GetAttr.php | 56 +- inc/lib/Twig/Node/Expression/MethodCall.php | 41 + inc/lib/Twig/Node/Expression/Name.php | 71 +- inc/lib/Twig/Node/Expression/Parent.php | 24 +- inc/lib/Twig/Node/Expression/TempName.php | 26 + inc/lib/Twig/Node/Expression/Test.php | 44 +- inc/lib/Twig/Node/Expression/Test/Constant.php | 46 + inc/lib/Twig/Node/Expression/Test/Defined.php | 54 ++ inc/lib/Twig/Node/Expression/Test/Divisibleby.php | 33 + inc/lib/Twig/Node/Expression/Test/Even.php | 32 + inc/lib/Twig/Node/Expression/Test/Null.php | 31 + inc/lib/Twig/Node/Expression/Test/Odd.php | 32 + inc/lib/Twig/Node/Expression/Test/Sameas.php | 29 + inc/lib/Twig/Node/Flush.php | 36 + inc/lib/Twig/Node/For.php | 63 +- inc/lib/Twig/Node/ForLoop.php | 55 ++ inc/lib/Twig/Node/If.php | 3 +- inc/lib/Twig/Node/Import.php | 3 +- inc/lib/Twig/Node/Include.php | 45 +- inc/lib/Twig/Node/Macro.php | 59 +- inc/lib/Twig/Node/Module.php | 127 ++- inc/lib/Twig/Node/Print.php | 3 +- inc/lib/Twig/Node/Sandbox.php | 3 +- inc/lib/Twig/Node/SandboxedModule.php | 23 +- inc/lib/Twig/Node/SandboxedPrint.php | 3 +- inc/lib/Twig/Node/Set.php | 9 +- inc/lib/Twig/Node/SetTemp.php | 35 + inc/lib/Twig/Node/Spaceless.php | 3 +- inc/lib/Twig/Node/Text.php | 3 +- inc/lib/Twig/NodeInterface.php | 12 +- inc/lib/Twig/NodeOutputInterface.php | 3 +- inc/lib/Twig/NodeTraverser.php | 3 +- inc/lib/Twig/NodeVisitor/Escaper.php | 58 +- inc/lib/Twig/NodeVisitor/Optimizer.php | 68 +- inc/lib/Twig/NodeVisitor/SafeAnalysis.php | 32 +- inc/lib/Twig/NodeVisitor/Sandbox.php | 7 +- inc/lib/Twig/NodeVisitorInterface.php | 13 +- inc/lib/Twig/Parser.php | 126 ++- inc/lib/Twig/ParserInterface.php | 8 +- inc/lib/Twig/Sandbox/SecurityError.php | 3 +- inc/lib/Twig/Sandbox/SecurityPolicy.php | 3 +- inc/lib/Twig/Sandbox/SecurityPolicyInterface.php | 9 +- inc/lib/Twig/SimpleFilter.php | 94 ++ inc/lib/Twig/SimpleFunction.php | 84 ++ inc/lib/Twig/SimpleTest.php | 46 + inc/lib/Twig/Template.php | 215 +++-- inc/lib/Twig/TemplateInterface.php | 10 +- inc/lib/Twig/Test.php | 34 + inc/lib/Twig/Test/Function.php | 12 +- inc/lib/Twig/Test/IntegrationTestCase.php | 154 ++++ inc/lib/Twig/Test/Method.php | 15 +- inc/lib/Twig/Test/Node.php | 37 + inc/lib/Twig/Test/NodeTestCase.php | 58 ++ inc/lib/Twig/TestCallableInterface.php | 21 + inc/lib/Twig/TestInterface.php | 6 +- inc/lib/Twig/Token.php | 50 +- inc/lib/Twig/TokenParser.php | 6 +- inc/lib/Twig/TokenParser/AutoEscape.php | 36 +- inc/lib/Twig/TokenParser/Block.php | 10 +- inc/lib/Twig/TokenParser/Do.php | 42 + inc/lib/Twig/TokenParser/Embed.php | 66 ++ inc/lib/Twig/TokenParser/Extends.php | 8 +- inc/lib/Twig/TokenParser/Filter.php | 2 +- inc/lib/Twig/TokenParser/Flush.php | 42 + inc/lib/Twig/TokenParser/For.php | 66 +- inc/lib/Twig/TokenParser/From.php | 6 +- inc/lib/Twig/TokenParser/If.php | 15 +- inc/lib/Twig/TokenParser/Import.php | 4 +- inc/lib/Twig/TokenParser/Include.php | 29 +- inc/lib/Twig/TokenParser/Macro.php | 21 +- inc/lib/Twig/TokenParser/Sandbox.php | 15 +- inc/lib/Twig/TokenParser/Set.php | 6 +- inc/lib/Twig/TokenParser/Spaceless.php | 2 +- inc/lib/Twig/TokenParser/Use.php | 9 +- inc/lib/Twig/TokenParserBroker.php | 39 +- inc/lib/Twig/TokenParserBrokerInterface.php | 14 +- inc/lib/Twig/TokenParserInterface.php | 11 +- inc/lib/Twig/TokenStream.php | 12 +- 133 files changed, 5041 insertions(+), 1347 deletions(-) create mode 100644 inc/lib/Twig/ExistsLoaderInterface.php create mode 100644 inc/lib/Twig/Extension/Debug.php create mode 100644 inc/lib/Twig/Extension/Staging.php create mode 100644 inc/lib/Twig/Extension/StringLoader.php create mode 100644 inc/lib/Twig/Filter/Node.php create mode 100644 inc/lib/Twig/FilterCallableInterface.php create mode 100644 inc/lib/Twig/Function/Node.php create mode 100644 inc/lib/Twig/FunctionCallableInterface.php create mode 100644 inc/lib/Twig/Node/Body.php create mode 100644 inc/lib/Twig/Node/Do.php create mode 100644 inc/lib/Twig/Node/Embed.php create mode 100644 inc/lib/Twig/Node/Expression/Call.php create mode 100644 inc/lib/Twig/Node/Expression/Filter/Default.php create mode 100644 inc/lib/Twig/Node/Expression/MethodCall.php create mode 100644 inc/lib/Twig/Node/Expression/TempName.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Constant.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Defined.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Divisibleby.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Even.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Null.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Odd.php create mode 100644 inc/lib/Twig/Node/Expression/Test/Sameas.php create mode 100644 inc/lib/Twig/Node/Flush.php create mode 100644 inc/lib/Twig/Node/ForLoop.php create mode 100644 inc/lib/Twig/Node/SetTemp.php create mode 100644 inc/lib/Twig/SimpleFilter.php create mode 100644 inc/lib/Twig/SimpleFunction.php create mode 100644 inc/lib/Twig/SimpleTest.php create mode 100644 inc/lib/Twig/Test.php create mode 100644 inc/lib/Twig/Test/IntegrationTestCase.php create mode 100644 inc/lib/Twig/Test/Node.php create mode 100644 inc/lib/Twig/Test/NodeTestCase.php create mode 100644 inc/lib/Twig/TestCallableInterface.php create mode 100644 inc/lib/Twig/TokenParser/Do.php create mode 100644 inc/lib/Twig/TokenParser/Embed.php create mode 100644 inc/lib/Twig/TokenParser/Flush.php (limited to 'inc') diff --git a/inc/lib/Twig/Autoloader.php b/inc/lib/Twig/Autoloader.php index a93b8caf..7007d315 100644 --- a/inc/lib/Twig/Autoloader.php +++ b/inc/lib/Twig/Autoloader.php @@ -12,28 +12,30 @@ /** * Autoloads Twig classes. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Autoloader { /** * Registers Twig_Autoloader as an SPL autoloader. + * + * @param Boolean $prepend Whether to prepend the autoloader or not. */ - static public function register() + public static function register($prepend = false) { - ini_set('unserialize_callback_func', 'spl_autoload_call'); - spl_autoload_register(array(new self, 'autoload')); + if (version_compare(phpversion(), '5.3.0', '>=')) { + spl_autoload_register(array(new self, 'autoload'), true, $prepend); + } else { + spl_autoload_register(array(new self, 'autoload')); + } } /** * Handles autoloading of classes. * - * @param string $class A class name. - * - * @return boolean Returns true if the class has been loaded + * @param string $class A class name. */ - static public function autoload($class) + public static function autoload($class) { if (0 !== strpos($class, 'Twig')) { return; diff --git a/inc/lib/Twig/Compiler.php b/inc/lib/Twig/Compiler.php index db2e8de4..99aecbcc 100644 --- a/inc/lib/Twig/Compiler.php +++ b/inc/lib/Twig/Compiler.php @@ -13,8 +13,7 @@ /** * Compiles a node to PHP code. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Compiler implements Twig_CompilerInterface { @@ -22,6 +21,10 @@ class Twig_Compiler implements Twig_CompilerInterface protected $source; protected $indentation; protected $env; + protected $debugInfo; + protected $sourceOffset; + protected $sourceLine; + protected $filename; /** * Constructor. @@ -31,6 +34,12 @@ class Twig_Compiler implements Twig_CompilerInterface public function __construct(Twig_Environment $env) { $this->env = $env; + $this->debugInfo = array(); + } + + public function getFilename() + { + return $this->filename; } /** @@ -56,8 +65,8 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Compiles a node. * - * @param Twig_NodeInterface $node The node to compile - * @param integer $indent The current indentation + * @param Twig_NodeInterface $node The node to compile + * @param integer $indentation The current indentation * * @return Twig_Compiler The current compiler instance */ @@ -65,8 +74,15 @@ class Twig_Compiler implements Twig_CompilerInterface { $this->lastLine = null; $this->source = ''; + $this->sourceOffset = 0; + // source code starts at 1 (as we then increment it when we encounter new lines) + $this->sourceLine = 1; $this->indentation = $indentation; + if ($node instanceof Twig_Node_Module) { + $this->filename = $node->getAttribute('filename'); + } + $node->compile($this); return $this; @@ -86,7 +102,7 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Adds a raw string to the compiled code. * - * @param string $string The string + * @param string $string The string * * @return Twig_Compiler The current compiler instance */ @@ -113,6 +129,11 @@ class Twig_Compiler implements Twig_CompilerInterface return $this; } + /** + * Appends an indentation to the current PHP code after compilation. + * + * @return Twig_Compiler The current compiler instance + */ public function addIndentation() { $this->source .= str_repeat(' ', $this->indentation * 4); @@ -123,7 +144,7 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Adds a quoted string to the compiled code. * - * @param string $string The string + * @param string $value The string * * @return Twig_Compiler The current compiler instance */ @@ -137,19 +158,27 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Returns a PHP representation of a given value. * - * @param mixed $value The value to convert + * @param mixed $value The value to convert * * @return Twig_Compiler The current compiler instance */ public function repr($value) { if (is_int($value) || is_float($value)) { + if (false !== $locale = setlocale(LC_NUMERIC, 0)) { + setlocale(LC_NUMERIC, 'C'); + } + $this->raw($value); - } else if (null === $value) { + + if (false !== $locale) { + setlocale(LC_NUMERIC, $locale); + } + } elseif (null === $value) { $this->raw('null'); - } else if (is_bool($value)) { + } elseif (is_bool($value)) { $this->raw($value ? 'true' : 'false'); - } else if (is_array($value)) { + } elseif (is_array($value)) { $this->raw('array('); $i = 0; foreach ($value as $key => $value) { @@ -178,17 +207,35 @@ class Twig_Compiler implements Twig_CompilerInterface public function addDebugInfo(Twig_NodeInterface $node) { if ($node->getLine() != $this->lastLine) { - $this->lastLine = $node->getLine(); $this->write("// line {$node->getLine()}\n"); + + // when mbstring.func_overload is set to 2 + // mb_substr_count() replaces substr_count() + // but they have different signatures! + if (((int) ini_get('mbstring.func_overload')) & 2) { + // this is much slower than the "right" version + $this->sourceLine += mb_substr_count(mb_substr($this->source, $this->sourceOffset), "\n"); + } else { + $this->sourceLine += substr_count($this->source, "\n", $this->sourceOffset); + } + $this->sourceOffset = strlen($this->source); + $this->debugInfo[$this->sourceLine] = $node->getLine(); + + $this->lastLine = $node->getLine(); } return $this; } + public function getDebugInfo() + { + return $this->debugInfo; + } + /** * Indents the generated code. * - * @param integer $indent The number of indentation to add + * @param integer $step The number of indentation to add * * @return Twig_Compiler The current compiler instance */ @@ -202,18 +249,19 @@ class Twig_Compiler implements Twig_CompilerInterface /** * Outdents the generated code. * - * @param integer $indent The number of indentation to remove + * @param integer $step The number of indentation to remove * * @return Twig_Compiler The current compiler instance */ public function outdent($step = 1) { - $this->indentation -= $step; - - if ($this->indentation < 0) { - throw new Twig_Error('Unable to call outdent() as the indentation would become negative'); + // can't outdent by more steps than the current indentation level + if ($this->indentation < $step) { + throw new LogicException('Unable to call outdent() as the indentation would become negative'); } + $this->indentation -= $step; + return $this; } } diff --git a/inc/lib/Twig/CompilerInterface.php b/inc/lib/Twig/CompilerInterface.php index 0a13edf2..e293ec91 100644 --- a/inc/lib/Twig/CompilerInterface.php +++ b/inc/lib/Twig/CompilerInterface.php @@ -12,24 +12,24 @@ /** * Interface implemented by compiler classes. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_CompilerInterface { /** * Compiles a node. * - * @param Twig_NodeInterface $node The node to compile + * @param Twig_NodeInterface $node The node to compile * * @return Twig_CompilerInterface The current compiler instance */ - function compile(Twig_NodeInterface $node); + public function compile(Twig_NodeInterface $node); /** * Gets the current PHP code after compilation. * * @return string The PHP code */ - function getSource(); + public function getSource(); } diff --git a/inc/lib/Twig/Environment.php b/inc/lib/Twig/Environment.php index b91c80c5..3afa73d6 100644 --- a/inc/lib/Twig/Environment.php +++ b/inc/lib/Twig/Environment.php @@ -12,12 +12,11 @@ /** * Stores the Twig configuration. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Environment { - const VERSION = '1.2.0'; + const VERSION = '1.13.1'; protected $charset; protected $loader; @@ -36,6 +35,7 @@ class Twig_Environment protected $functions; protected $globals; protected $runtimeInitialized; + protected $extensionInitialized; protected $loadedTemplates; protected $strictVariables; protected $unaryOperators; @@ -43,23 +43,23 @@ class Twig_Environment protected $templateClassPrefix = '__TwigTemplate_'; protected $functionCallbacks; protected $filterCallbacks; + protected $staging; /** * Constructor. * * Available options: * - * * debug: When set to `true`, the generated templates have a __toString() - * method that you can use to display the generated nodes (default to - * false). + * * debug: When set to true, it automatically set "auto_reload" to true as + * well (default to false). * - * * charset: The charset used by the templates (default to utf-8). + * * charset: The charset used by the templates (default to UTF-8). * * * base_template_class: The base template class to use for generated * templates (default to Twig_Template). * * * cache: An absolute path where to store the compiled templates, or - * false to disable compilation cache (default) + * false to disable compilation cache (default). * * * auto_reload: Whether to reload the template is the original source changed. * If you don't provide the auto_reload option, it will be @@ -68,14 +68,18 @@ class Twig_Environment * * strict_variables: Whether to ignore invalid variables in templates * (default to false). * - * * autoescape: Whether to enable auto-escaping (default to true); + * * autoescape: Whether to enable auto-escaping (default to html): + * * false: disable auto-escaping + * * true: equivalent to html + * * html, js: set the autoescaping to one of the supported strategies + * * PHP callback: a PHP callback that returns an escaping strategy based on the template "filename" * * * optimizations: A flag that indicates which optimizations to apply * (default to -1 which means that all optimizations are enabled; - * set it to 0 to disable) + * set it to 0 to disable). * - * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance - * @param array $options An array of options + * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance + * @param array $options An array of options */ public function __construct(Twig_LoaderInterface $loader = null, $options = array()) { @@ -88,26 +92,27 @@ class Twig_Environment 'charset' => 'UTF-8', 'base_template_class' => 'Twig_Template', 'strict_variables' => false, - 'autoescape' => true, + 'autoescape' => 'html', 'cache' => false, 'auto_reload' => null, 'optimizations' => -1, ), $options); $this->debug = (bool) $options['debug']; - $this->charset = $options['charset']; + $this->charset = strtoupper($options['charset']); $this->baseTemplateClass = $options['base_template_class']; $this->autoReload = null === $options['auto_reload'] ? $this->debug : (bool) $options['auto_reload']; - $this->extensions = array( - 'core' => new Twig_Extension_Core(), - 'escaper' => new Twig_Extension_Escaper((bool) $options['autoescape']), - 'optimizer' => new Twig_Extension_Optimizer($options['optimizations']), - ); $this->strictVariables = (bool) $options['strict_variables']; $this->runtimeInitialized = false; $this->setCache($options['cache']); $this->functionCallbacks = array(); $this->filterCallbacks = array(); + + $this->addExtension(new Twig_Extension_Core()); + $this->addExtension(new Twig_Extension_Escaper($options['autoescape'])); + $this->addExtension(new Twig_Extension_Optimizer($options['optimizations'])); + $this->extensionInitialized = false; + $this->staging = new Twig_Extension_Staging(); } /** @@ -250,13 +255,14 @@ class Twig_Environment /** * Gets the template class associated with the given string. * - * @param string $name The name for which to calculate the template class name + * @param string $name The name for which to calculate the template class name + * @param integer $index The index if it is an embedded template * * @return string The template class name */ - public function getTemplateClass($name) + public function getTemplateClass($name, $index = null) { - return $this->templateClassPrefix.md5($this->loader->getCacheKey($name)); + return $this->templateClassPrefix.md5($this->getLoader()->getCacheKey($name)).(null === $index ? '' : '_'.$index); } /** @@ -282,16 +288,28 @@ class Twig_Environment return $this->loadTemplate($name)->render($context); } + /** + * Displays a template. + * + * @param string $name The template name + * @param array $context An array of parameters to pass to the template + */ + public function display($name, array $context = array()) + { + $this->loadTemplate($name)->display($context); + } + /** * Loads a template by name. * - * @param string $name The template name + * @param string $name The template name + * @param integer $index The index if it is an embedded template * * @return Twig_TemplateInterface A template instance representing the given template name */ - public function loadTemplate($name) + public function loadTemplate($name, $index = null) { - $cls = $this->getTemplateClass($name); + $cls = $this->getTemplateClass($name, $index); if (isset($this->loadedTemplates[$cls])) { return $this->loadedTemplates[$cls]; @@ -299,10 +317,10 @@ class Twig_Environment if (!class_exists($cls, false)) { if (false === $cache = $this->getCacheFilename($name)) { - eval('?>'.$this->compileSource($this->loader->getSource($name), $name)); + eval('?>'.$this->compileSource($this->getLoader()->getSource($name), $name)); } else { - if (!is_file($cache) || ($this->isAutoReload() && !$this->loader->isFresh($name, filemtime($cache)))) { - $this->writeCacheFile($cache, $this->compileSource($this->loader->getSource($name), $name)); + if (!is_file($cache) || ($this->isAutoReload() && !$this->isTemplateFresh($name, filemtime($cache)))) { + $this->writeCacheFile($cache, $this->compileSource($this->getLoader()->getSource($name), $name)); } require_once $cache; @@ -316,6 +334,30 @@ class Twig_Environment return $this->loadedTemplates[$cls] = new $cls($this); } + /** + * Returns true if the template is still fresh. + * + * Besides checking the loader for freshness information, + * this method also checks if the enabled extensions have + * not changed. + * + * @param string $name The template name + * @param timestamp $time The last modification time of the cached template + * + * @return Boolean true if the template is fresh, false otherwise + */ + public function isTemplateFresh($name, $time) + { + foreach ($this->extensions as $extension) { + $r = new ReflectionObject($extension); + if (filemtime($r->getFileName()) > $time) { + return false; + } + } + + return $this->getLoader()->isFresh($name, $time); + } + public function resolveTemplate($names) { if (!is_array($names)) { @@ -510,6 +552,10 @@ class Twig_Environment */ public function getLoader() { + if (null === $this->loader) { + throw new LogicException('You must set a loader first.'); + } + return $this->loader; } @@ -520,7 +566,7 @@ class Twig_Environment */ public function setCharset($charset) { - $this->charset = $charset; + $this->charset = strtoupper($charset); } /** @@ -580,16 +626,28 @@ class Twig_Environment */ public function addExtension(Twig_ExtensionInterface $extension) { + if ($this->extensionInitialized) { + throw new LogicException(sprintf('Unable to register extension "%s" as extensions have already been initialized.', $extension->getName())); + } + $this->extensions[$extension->getName()] = $extension; } /** * Removes an extension by name. * + * This method is deprecated and you should not use it. + * * @param string $name The extension name + * + * @deprecated since 1.12 (to be removed in 2.0) */ public function removeExtension($name) { + if ($this->extensionInitialized) { + throw new LogicException(sprintf('Unable to remove extension "%s" as extensions have already been initialized.', $name)); + } + unset($this->extensions[$name]); } @@ -622,39 +680,46 @@ class Twig_Environment */ public function addTokenParser(Twig_TokenParserInterface $parser) { - if (null === $this->parsers) { - $this->getTokenParsers(); + if ($this->extensionInitialized) { + throw new LogicException('Unable to add a token parser as extensions have already been initialized.'); } - $this->parsers->addTokenParser($parser); + $this->staging->addTokenParser($parser); } /** * Gets the registered Token Parsers. * - * @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances + * @return Twig_TokenParserBrokerInterface A broker containing token parsers */ public function getTokenParsers() { - if (null === $this->parsers) { - $this->parsers = new Twig_TokenParserBroker; - foreach ($this->getExtensions() as $extension) { - $parsers = $extension->getTokenParsers(); - foreach($parsers as $parser) { - if ($parser instanceof Twig_TokenParserInterface) { - $this->parsers->addTokenParser($parser); - } else if ($parser instanceof Twig_TokenParserBrokerInterface) { - $this->parsers->addTokenParserBroker($parser); - } else { - throw new Twig_Error_Runtime('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances'); - } - } - } + if (!$this->extensionInitialized) { + $this->initExtensions(); } return $this->parsers; } + /** + * Gets registered tags. + * + * Be warned that this method cannot return tags defined by Twig_TokenParserBrokerInterface classes. + * + * @return Twig_TokenParserInterface[] An array of Twig_TokenParserInterface instances + */ + public function getTags() + { + $tags = array(); + foreach ($this->getTokenParsers()->getParsers() as $parser) { + if ($parser instanceof Twig_TokenParserInterface) { + $tags[$parser->getTag()] = $parser; + } + } + + return $tags; + } + /** * Registers a Node Visitor. * @@ -662,11 +727,11 @@ class Twig_Environment */ public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) { - if (null === $this->visitors) { - $this->getNodeVisitors(); + if ($this->extensionInitialized) { + throw new LogicException('Unable to add a node visitor as extensions have already been initialized.', $extension->getName()); } - $this->visitors[] = $visitor; + $this->staging->addNodeVisitor($visitor); } /** @@ -676,11 +741,8 @@ class Twig_Environment */ public function getNodeVisitors() { - if (null === $this->visitors) { - $this->visitors = array(); - foreach ($this->getExtensions() as $extension) { - $this->visitors = array_merge($this->visitors, $extension->getNodeVisitors()); - } + if (!$this->extensionInitialized) { + $this->initExtensions(); } return $this->visitors; @@ -689,16 +751,25 @@ class Twig_Environment /** * Registers a Filter. * - * @param string $name The filter name - * @param Twig_FilterInterface $visitor A Twig_FilterInterface instance + * @param string|Twig_SimpleFilter $name The filter name or a Twig_SimpleFilter instance + * @param Twig_FilterInterface|Twig_SimpleFilter $filter A Twig_FilterInterface instance or a Twig_SimpleFilter instance */ - public function addFilter($name, Twig_FilterInterface $filter) + public function addFilter($name, $filter = null) { - if (null === $this->filters) { - $this->loadFilters(); + if (!$name instanceof Twig_SimpleFilter && !($filter instanceof Twig_SimpleFilter || $filter instanceof Twig_FilterInterface)) { + throw new LogicException('A filter must be an instance of Twig_FilterInterface or Twig_SimpleFilter'); } - $this->filters[$name] = $filter; + if ($name instanceof Twig_SimpleFilter) { + $filter = $name; + $name = $filter->getName(); + } + + if ($this->extensionInitialized) { + throw new LogicException(sprintf('Unable to add filter "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFilter($name, $filter); } /** @@ -709,18 +780,31 @@ class Twig_Environment * * @param string $name The filter name * - * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exists + * @return Twig_Filter|false A Twig_Filter instance or false if the filter does not exist */ public function getFilter($name) { - if (null === $this->filters) { - $this->loadFilters(); + if (!$this->extensionInitialized) { + $this->initExtensions(); } if (isset($this->filters[$name])) { return $this->filters[$name]; } + foreach ($this->filters as $pattern => $filter) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $filter->setArguments($matches); + + return $filter; + } + } + } + foreach ($this->filterCallbacks as $callback) { if (false !== $filter = call_user_func($callback, $name)) { return $filter; @@ -738,29 +822,43 @@ class Twig_Environment /** * Gets the registered Filters. * + * Be warned that this method cannot return filters defined with registerUndefinedFunctionCallback. + * * @return Twig_FilterInterface[] An array of Twig_FilterInterface instances + * + * @see registerUndefinedFilterCallback */ - protected function loadFilters() + public function getFilters() { - $this->filters = array(); - foreach ($this->getExtensions() as $extension) { - $this->filters = array_merge($this->filters, $extension->getFilters()); + if (!$this->extensionInitialized) { + $this->initExtensions(); } + + return $this->filters; } /** * Registers a Test. * - * @param string $name The test name - * @param Twig_TestInterface $visitor A Twig_TestInterface instance + * @param string|Twig_SimpleTest $name The test name or a Twig_SimpleTest instance + * @param Twig_TestInterface|Twig_SimpleTest $test A Twig_TestInterface instance or a Twig_SimpleTest instance */ - public function addTest($name, Twig_TestInterface $test) + public function addTest($name, $test = null) { - if (null === $this->tests) { - $this->getTests(); + if (!$name instanceof Twig_SimpleTest && !($test instanceof Twig_SimpleTest || $test instanceof Twig_TestInterface)) { + throw new LogicException('A test must be an instance of Twig_TestInterface or Twig_SimpleTest'); } - $this->tests[$name] = $test; + if ($name instanceof Twig_SimpleTest) { + $test = $name; + $name = $test->getName(); + } + + if ($this->extensionInitialized) { + throw new LogicException(sprintf('Unable to add test "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addTest($name, $test); } /** @@ -770,29 +868,55 @@ class Twig_Environment */ public function getTests() { - if (null === $this->tests) { - $this->tests = array(); - foreach ($this->getExtensions() as $extension) { - $this->tests = array_merge($this->tests, $extension->getTests()); - } + if (!$this->extensionInitialized) { + $this->initExtensions(); } return $this->tests; } + /** + * Gets a test by name. + * + * @param string $name The test name + * + * @return Twig_Test|false A Twig_Test instance or false if the test does not exist + */ + public function getTest($name) + { + if (!$this->extensionInitialized) { + $this->initExtensions(); + } + + if (isset($this->tests[$name])) { + return $this->tests[$name]; + } + + return false; + } + /** * Registers a Function. * - * @param string $name The function name - * @param Twig_FunctionInterface $function A Twig_FunctionInterface instance + * @param string|Twig_SimpleFunction $name The function name or a Twig_SimpleFunction instance + * @param Twig_FunctionInterface|Twig_SimpleFunction $function A Twig_FunctionInterface instance or a Twig_SimpleFunction instance */ - public function addFunction($name, Twig_FunctionInterface $function) + public function addFunction($name, $function = null) { - if (null === $this->functions) { - $this->loadFunctions(); + if (!$name instanceof Twig_SimpleFunction && !($function instanceof Twig_SimpleFunction || $function instanceof Twig_FunctionInterface)) { + throw new LogicException('A function must be an instance of Twig_FunctionInterface or Twig_SimpleFunction'); } - $this->functions[$name] = $function; + if ($name instanceof Twig_SimpleFunction) { + $function = $name; + $name = $function->getName(); + } + + if ($this->extensionInitialized) { + throw new LogicException(sprintf('Unable to add function "%s" as extensions have already been initialized.', $name)); + } + + $this->staging->addFunction($name, $function); } /** @@ -803,18 +927,31 @@ class Twig_Environment * * @param string $name function name * - * @return Twig_Function|false A Twig_Function instance or false if the function does not exists + * @return Twig_Function|false A Twig_Function instance or false if the function does not exist */ public function getFunction($name) { - if (null === $this->functions) { - $this->loadFunctions(); + if (!$this->extensionInitialized) { + $this->initExtensions(); } if (isset($this->functions[$name])) { return $this->functions[$name]; } + foreach ($this->functions as $pattern => $function) { + $pattern = str_replace('\\*', '(.*?)', preg_quote($pattern, '#'), $count); + + if ($count) { + if (preg_match('#^'.$pattern.'$#', $name, $matches)) { + array_shift($matches); + $function->setArguments($matches); + + return $function; + } + } + } + foreach ($this->functionCallbacks as $callback) { if (false !== $function = call_user_func($callback, $name)) { return $function; @@ -829,27 +966,53 @@ class Twig_Environment $this->functionCallbacks[] = $callable; } - protected function loadFunctions() + /** + * Gets registered functions. + * + * Be warned that this method cannot return functions defined with registerUndefinedFunctionCallback. + * + * @return Twig_FunctionInterface[] An array of Twig_FunctionInterface instances + * + * @see registerUndefinedFunctionCallback + */ + public function getFunctions() { - $this->functions = array(); - foreach ($this->getExtensions() as $extension) { - $this->functions = array_merge($this->functions, $extension->getFunctions()); + if (!$this->extensionInitialized) { + $this->initExtensions(); } + + return $this->functions; } /** * Registers a Global. * + * New globals can be added before compiling or rendering a template; + * but after, you can only update existing globals. + * * @param string $name The global name * @param mixed $value The global value */ public function addGlobal($name, $value) { - if (null === $this->globals) { - $this->getGlobals(); + if ($this->extensionInitialized || $this->runtimeInitialized) { + if (null === $this->globals) { + $this->globals = $this->initGlobals(); + } + + /* This condition must be uncommented in Twig 2.0 + if (!array_key_exists($name, $this->globals)) { + throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name)); + } + */ } - $this->globals[$name] = $value; + if ($this->extensionInitialized || $this->runtimeInitialized) { + // update the value + $this->globals[$name] = $value; + } else { + $this->staging->addGlobal($name, $value); + } } /** @@ -859,16 +1022,37 @@ class Twig_Environment */ public function getGlobals() { + if (!$this->runtimeInitialized && !$this->extensionInitialized) { + return $this->initGlobals(); + } + if (null === $this->globals) { - $this->globals = array(); - foreach ($this->getExtensions() as $extension) { - $this->globals = array_merge($this->globals, $extension->getGlobals()); - } + $this->globals = $this->initGlobals(); } return $this->globals; } + /** + * Merges a context with the defined globals. + * + * @param array $context An array representing the context + * + * @return array The context merged with the globals + */ + public function mergeGlobals(array $context) + { + // we don't use array_merge as the context being generally + // bigger than globals, this code is faster. + foreach ($this->getGlobals() as $key => $value) { + if (!array_key_exists($key, $context)) { + $context[$key] = $value; + } + } + + return $context; + } + /** * Gets the registered unary Operators. * @@ -876,8 +1060,8 @@ class Twig_Environment */ public function getUnaryOperators() { - if (null === $this->unaryOperators) { - $this->initOperators(); + if (!$this->extensionInitialized) { + $this->initExtensions(); } return $this->unaryOperators; @@ -890,24 +1074,121 @@ class Twig_Environment */ public function getBinaryOperators() { - if (null === $this->binaryOperators) { - $this->initOperators(); + if (!$this->extensionInitialized) { + $this->initExtensions(); } return $this->binaryOperators; } - protected function initOperators() + public function computeAlternatives($name, $items) + { + $alternatives = array(); + foreach ($items as $item) { + $lev = levenshtein($name, $item); + if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { + $alternatives[$item] = $lev; + } + } + asort($alternatives); + + return array_keys($alternatives); + } + + protected function initGlobals() + { + $globals = array(); + foreach ($this->extensions as $extension) { + $extGlob = $extension->getGlobals(); + if (!is_array($extGlob)) { + throw new UnexpectedValueException(sprintf('"%s::getGlobals()" must return an array of globals.', get_class($extension))); + } + + $globals[] = $extGlob; + } + + $globals[] = $this->staging->getGlobals(); + + return call_user_func_array('array_merge', $globals); + } + + protected function initExtensions() { + if ($this->extensionInitialized) { + return; + } + + $this->extensionInitialized = true; + $this->parsers = new Twig_TokenParserBroker(); + $this->filters = array(); + $this->functions = array(); + $this->tests = array(); + $this->visitors = array(); $this->unaryOperators = array(); $this->binaryOperators = array(); - foreach ($this->getExtensions() as $extension) { - $operators = $extension->getOperators(); - if (!$operators) { - continue; + foreach ($this->extensions as $extension) { + $this->initExtension($extension); + } + $this->initExtension($this->staging); + } + + protected function initExtension(Twig_ExtensionInterface $extension) + { + // filters + foreach ($extension->getFilters() as $name => $filter) { + if ($name instanceof Twig_SimpleFilter) { + $filter = $name; + $name = $filter->getName(); + } elseif ($filter instanceof Twig_SimpleFilter) { + $name = $filter->getName(); + } + + $this->filters[$name] = $filter; + } + + // functions + foreach ($extension->getFunctions() as $name => $function) { + if ($name instanceof Twig_SimpleFunction) { + $function = $name; + $name = $function->getName(); + } elseif ($function instanceof Twig_SimpleFunction) { + $name = $function->getName(); + } + + $this->functions[$name] = $function; + } + + // tests + foreach ($extension->getTests() as $name => $test) { + if ($name instanceof Twig_SimpleTest) { + $test = $name; + $name = $test->getName(); + } elseif ($test instanceof Twig_SimpleTest) { + $name = $test->getName(); } + $this->tests[$name] = $test; + } + + // token parsers + foreach ($extension->getTokenParsers() as $parser) { + if ($parser instanceof Twig_TokenParserInterface) { + $this->parsers->addTokenParser($parser); + } elseif ($parser instanceof Twig_TokenParserBrokerInterface) { + $this->parsers->addTokenParserBroker($parser); + } else { + throw new LogicException('getTokenParsers() must return an array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances'); + } + } + + // node visitors + foreach ($extension->getNodeVisitors() as $visitor) { + $this->visitors[] = $visitor; + } + + // operators + if ($operators = $extension->getOperators()) { if (2 !== count($operators)) { throw new InvalidArgumentException(sprintf('"%s::getOperators()" does not return a valid operators array.', get_class($extension))); } @@ -919,20 +1200,25 @@ class Twig_Environment protected function writeCacheFile($file, $content) { - if (!is_dir(dirname($file))) { - mkdir(dirname($file), 0777, true); + $dir = dirname($file); + if (!is_dir($dir)) { + if (false === @mkdir($dir, 0777, true) && !is_dir($dir)) { + throw new RuntimeException(sprintf("Unable to create the cache directory (%s).", $dir)); + } + } elseif (!is_writable($dir)) { + throw new RuntimeException(sprintf("Unable to write in the cache directory (%s).", $dir)); } $tmpFile = tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content)) { // rename does not work on Win32 before 5.2.6 if (@rename($tmpFile, $file) || (@copy($tmpFile, $file) && unlink($tmpFile))) { - chmod($file, 0644); + @chmod($file, 0666 & ~umask()); return; } } - throw new Twig_Error_Runtime(sprintf('Failed to write cache file "%s".', $file)); + throw new RuntimeException(sprintf('Failed to write cache file "%s".', $file)); } } diff --git a/inc/lib/Twig/Error.php b/inc/lib/Twig/Error.php index ed0836c4..72d91a98 100644 --- a/inc/lib/Twig/Error.php +++ b/inc/lib/Twig/Error.php @@ -12,8 +12,24 @@ /** * Twig base exception. * - * @package twig - * @author Fabien Potencier + * This exception class and its children must only be used when + * an error occurs during the loading of a template, when a syntax error + * is detected in a template, or when rendering a template. Other + * errors must use regular PHP exception classes (like when the template + * cache directory is not writable for instance). + * + * To help debugging template issues, this class tracks the original template + * name and line where the error occurred. + * + * Whenever possible, you must set these information (original template name + * and line number) yourself by passing them to the constructor. If some or all + * these information are not available from where you throw the exception, then + * this class will guess them automatically (when the line number is set to -1 + * and/or the filename is set to null). As this is a costly operation, this + * can be disabled by passing false for both the filename and the line number + * when creating a new instance of this class. + * + * @author Fabien Potencier */ class Twig_Error extends Exception { @@ -25,6 +41,15 @@ class Twig_Error extends Exception /** * Constructor. * + * Set both the line number and the filename to false to + * disable automatic guessing of the original template name + * and line number. + * + * Set the line number to -1 to enable its automatic guessing. + * Set the filename to null to enable its automatic guessing. + * + * By default, automatic guessing is enabled. + * * @param string $message The error message * @param integer $lineno The template line where the error occurred * @param string $filename The template file name where the error occurred @@ -32,22 +57,23 @@ class Twig_Error extends Exception */ public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) { - if (-1 === $lineno || null === $filename) { - list($lineno, $filename) = $this->findTemplateInfo(null !== $previous ? $previous : $this, $lineno, $filename); + if (version_compare(PHP_VERSION, '5.3.0', '<')) { + $this->previous = $previous; + parent::__construct(''); + } else { + parent::__construct('', 0, $previous); } $this->lineno = $lineno; $this->filename = $filename; + + if (-1 === $this->lineno || null === $this->filename) { + $this->guessTemplateInfo(); + } + $this->rawMessage = $message; $this->updateRepr(); - - if (version_compare(PHP_VERSION, '5.3.0', '<')) { - $this->previous = $previous; - parent::__construct($this->message); - } else { - parent::__construct($this->message, 0, $previous); - } } /** @@ -104,13 +130,21 @@ class Twig_Error extends Exception $this->updateRepr(); } + public function guess() + { + $this->guessTemplateInfo(); + $this->updateRepr(); + } + /** * For PHP < 5.3.0, provides access to the getPrevious() method. * - * @param string $method The method name - * @param array $arguments The parameters to be passed to the method + * @param string $method The method name + * @param array $arguments The parameters to be passed to the method * * @return Exception The previous exception or null + * + * @throws BadMethodCallException */ public function __call($method, $arguments) { @@ -131,11 +165,16 @@ class Twig_Error extends Exception $dot = true; } - if (null !== $this->filename) { - $this->message .= sprintf(' in %s', json_encode($this->filename)); + if ($this->filename) { + if (is_string($this->filename) || (is_object($this->filename) && method_exists($this->filename, '__toString'))) { + $filename = sprintf('"%s"', $this->filename); + } else { + $filename = json_encode($this->filename); + } + $this->message .= sprintf(' in %s', $filename); } - if ($this->lineno >= 0) { + if ($this->lineno && $this->lineno >= 0) { $this->message .= sprintf(' at line %d', $this->lineno); } @@ -144,52 +183,57 @@ class Twig_Error extends Exception } } - protected function findTemplateInfo(Exception $e, $currentLine, $currentFile) + protected function guessTemplateInfo() { - if (!function_exists('token_get_all')) { - return array($currentLine, $currentFile); + $template = null; + + if (version_compare(phpversion(), '5.3.6', '>=')) { + $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT); + } else { + $backtrace = debug_backtrace(); } - $traces = $e->getTrace(); - foreach ($traces as $i => $trace) { - if (!isset($trace['class']) || 'Twig_Template' === $trace['class']) { - continue; + foreach ($backtrace as $trace) { + if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { + if (null === $this->filename || $this->filename == $trace['object']->getTemplateName()) { + $template = $trace['object']; + } } + } - $r = new ReflectionClass($trace['class']); - if (!$r->implementsInterface('Twig_TemplateInterface')) { - continue; - } + // update template filename + if (null !== $template && null === $this->filename) { + $this->filename = $template->getTemplateName(); + } - if (!is_file($r->getFilename())) { - // probably an eval()'d code - return array($currentLine, $currentFile); - } + if (null === $template || $this->lineno > -1) { + return; + } - if (0 === $i) { - $line = $e->getLine(); - } else { - $line = isset($traces[$i - 1]['line']) ? $traces[$i - 1]['line'] : -log(0); - } + $r = new ReflectionObject($template); + $file = $r->getFileName(); - $tokens = token_get_all(file_get_contents($r->getFilename())); - $templateline = -1; - $template = null; - foreach ($tokens as $token) { - if (isset($token[2]) && $token[2] >= $line) { - return array($templateline, $template); + $exceptions = array($e = $this); + while (($e instanceof self || method_exists($e, 'getPrevious')) && $e = $e->getPrevious()) { + $exceptions[] = $e; + } + + while ($e = array_pop($exceptions)) { + $traces = $e->getTrace(); + while ($trace = array_shift($traces)) { + if (!isset($trace['file']) || !isset($trace['line']) || $file != $trace['file']) { + continue; } - if (T_COMMENT === $token[0] && null === $template && preg_match('#/\* +(.+) +\*/#', $token[1], $match)) { - $template = $match[1]; - } elseif (T_COMMENT === $token[0] && preg_match('#^//\s*line (\d+)\s*$#', $token[1], $match)) { - $templateline = $match[1]; + foreach ($template->getDebugInfo() as $codeLine => $templateLine) { + if ($codeLine <= $trace['line']) { + // update template line + $this->lineno = $templateLine; + + return; + } } } - - return array($currentLine, $template); } - - return array($currentLine, $currentFile); } } diff --git a/inc/lib/Twig/Error/Loader.php b/inc/lib/Twig/Error/Loader.php index 418a7760..68efb574 100644 --- a/inc/lib/Twig/Error/Loader.php +++ b/inc/lib/Twig/Error/Loader.php @@ -12,9 +12,20 @@ /** * Exception thrown when an error occurs during template loading. * - * @package twig - * @author Fabien Potencier + * Automatic template information guessing is always turned off as + * if a template cannot be loaded, there is nothing to guess. + * However, when a template is loaded from another one, then, we need + * to find the current context and this is automatically done by + * Twig_Template::displayWithErrorHandling(). + * + * This strategy makes Twig_Environment::resolveTemplate() much faster. + * + * @author Fabien Potencier */ class Twig_Error_Loader extends Twig_Error { + public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) + { + parent::__construct($message, false, false, $previous); + } } diff --git a/inc/lib/Twig/Error/Runtime.php b/inc/lib/Twig/Error/Runtime.php index 8a387fa8..8b6ceddb 100644 --- a/inc/lib/Twig/Error/Runtime.php +++ b/inc/lib/Twig/Error/Runtime.php @@ -13,8 +13,7 @@ /** * Exception thrown when an error occurs at runtime. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Error_Runtime extends Twig_Error { diff --git a/inc/lib/Twig/Error/Syntax.php b/inc/lib/Twig/Error/Syntax.php index a2650c36..0f5c5792 100644 --- a/inc/lib/Twig/Error/Syntax.php +++ b/inc/lib/Twig/Error/Syntax.php @@ -13,8 +13,7 @@ /** * Exception thrown when a syntax error occurs during lexing or parsing of a template. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Error_Syntax extends Twig_Error { diff --git a/inc/lib/Twig/ExistsLoaderInterface.php b/inc/lib/Twig/ExistsLoaderInterface.php new file mode 100644 index 00000000..ce434765 --- /dev/null +++ b/inc/lib/Twig/ExistsLoaderInterface.php @@ -0,0 +1,28 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +interface Twig_ExistsLoaderInterface +{ + /** + * Check if we have the source code of a template, given its name. + * + * @param string $name The name of the template to check if we can load + * + * @return boolean If the template source code is handled by this loader or not + */ + public function exists($name); +} diff --git a/inc/lib/Twig/ExpressionParser.php b/inc/lib/Twig/ExpressionParser.php index b4fc5d5d..9cf19344 100644 --- a/inc/lib/Twig/ExpressionParser.php +++ b/inc/lib/Twig/ExpressionParser.php @@ -18,8 +18,7 @@ * @see http://www.engr.mun.ca/~theo/Misc/exp_parsing.htm * @see http://en.wikipedia.org/wiki/Operator-precedence_parser * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_ExpressionParser { @@ -89,9 +88,19 @@ class Twig_ExpressionParser { while ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '?')) { $this->parser->getStream()->next(); - $expr2 = $this->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'The ternary operator must have a default value'); - $expr3 = $this->parseExpression(); + if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ':')) { + $expr2 = $this->parseExpression(); + if ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, ':')) { + $this->parser->getStream()->next(); + $expr3 = $this->parseExpression(); + } else { + $expr3 = new Twig_Node_Expression_Constant('', $this->parser->getCurrentToken()->getLine()); + } + } else { + $this->parser->getStream()->next(); + $expr2 = $expr; + $expr3 = $this->parseExpression(); + } $expr = new Twig_Node_Expression_Conditional($expr, $expr2, $expr3, $this->parser->getCurrentToken()->getLine()); } @@ -143,31 +152,67 @@ class Twig_ExpressionParser break; case Twig_Token::NUMBER_TYPE: - case Twig_Token::STRING_TYPE: $this->parser->getStream()->next(); $node = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); break; + case Twig_Token::STRING_TYPE: + case Twig_Token::INTERPOLATION_START_TYPE: + $node = $this->parseStringExpression(); + break; + default: if ($token->test(Twig_Token::PUNCTUATION_TYPE, '[')) { $node = $this->parseArrayExpression(); } elseif ($token->test(Twig_Token::PUNCTUATION_TYPE, '{')) { $node = $this->parseHashExpression(); } else { - throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($token->getType(), $token->getLine()), $token->getValue()), $token->getLine()); + throw new Twig_Error_Syntax(sprintf('Unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($token->getType(), $token->getLine()), $token->getValue()), $token->getLine(), $this->parser->getFilename()); } } return $this->parsePostfixExpression($node); } + public function parseStringExpression() + { + $stream = $this->parser->getStream(); + + $nodes = array(); + // a string cannot be followed by another string in a single expression + $nextCanBeString = true; + while (true) { + if ($stream->test(Twig_Token::STRING_TYPE) && $nextCanBeString) { + $token = $stream->next(); + $nodes[] = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); + $nextCanBeString = false; + } elseif ($stream->test(Twig_Token::INTERPOLATION_START_TYPE)) { + $stream->next(); + $nodes[] = $this->parseExpression(); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $nextCanBeString = true; + } else { + break; + } + } + + $expr = array_shift($nodes); + foreach ($nodes as $node) { + $expr = new Twig_Node_Expression_Binary_Concat($expr, $node, $node->getLine()); + } + + return $expr; + } + public function parseArrayExpression() { $stream = $this->parser->getStream(); $stream->expect(Twig_Token::PUNCTUATION_TYPE, '[', 'An array element was expected'); - $elements = array(); + + $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); + $first = true; while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { - if (!empty($elements)) { + if (!$first) { $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'An array element must be followed by a comma'); // trailing ,? @@ -175,21 +220,24 @@ class Twig_ExpressionParser break; } } + $first = false; - $elements[] = $this->parseExpression(); + $node->addElement($this->parseExpression()); } $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']', 'An opened array is not properly closed'); - return new Twig_Node_Expression_Array($elements, $stream->getCurrent()->getLine()); + return $node; } public function parseHashExpression() { $stream = $this->parser->getStream(); $stream->expect(Twig_Token::PUNCTUATION_TYPE, '{', 'A hash element was expected'); - $elements = array(); + + $node = new Twig_Node_Expression_Array(array(), $stream->getCurrent()->getLine()); + $first = true; while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, '}')) { - if (!empty($elements)) { + if (!$first) { $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'A hash value must be followed by a comma'); // trailing ,? @@ -197,19 +245,33 @@ class Twig_ExpressionParser break; } } - - if (!$stream->test(Twig_Token::STRING_TYPE) && !$stream->test(Twig_Token::NUMBER_TYPE)) { + $first = false; + + // a hash key can be: + // + // * a number -- 12 + // * a string -- 'a' + // * a name, which is equivalent to a string -- a + // * an expression, which must be enclosed in parentheses -- (1 + 2) + if ($stream->test(Twig_Token::STRING_TYPE) || $stream->test(Twig_Token::NAME_TYPE) || $stream->test(Twig_Token::NUMBER_TYPE)) { + $token = $stream->next(); + $key = new Twig_Node_Expression_Constant($token->getValue(), $token->getLine()); + } elseif ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { + $key = $this->parseExpression(); + } else { $current = $stream->getCurrent(); - throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string or a number (unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($current->getType(), $current->getLine()), $current->getValue()), $current->getLine()); + + throw new Twig_Error_Syntax(sprintf('A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "%s" of value "%s"', Twig_Token::typeToEnglish($current->getType(), $current->getLine()), $current->getValue()), $current->getLine(), $this->parser->getFilename()); } - $key = $stream->next()->getValue(); $stream->expect(Twig_Token::PUNCTUATION_TYPE, ':', 'A hash key must be followed by a colon (:)'); - $elements[$key] = $this->parseExpression(); + $value = $this->parseExpression(); + + $node->addElement($value, $key); } $stream->expect(Twig_Token::PUNCTUATION_TYPE, '}', 'An opened hash is not properly closed'); - return new Twig_Node_Expression_Array($elements, $stream->getCurrent()->getLine()); + return $node; } public function parsePostfixExpression($node) @@ -234,43 +296,56 @@ class Twig_ExpressionParser public function getFunctionNode($name, $line) { - $args = $this->parseArguments(); switch ($name) { case 'parent': + $args = $this->parseArguments(); if (!count($this->parser->getBlockStack())) { - throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden', $line); + throw new Twig_Error_Syntax('Calling "parent" outside a block is forbidden', $line, $this->parser->getFilename()); } - if (!$this->parser->getParent()) { - throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend another one is forbidden', $line); + if (!$this->parser->getParent() && !$this->parser->hasTraits()) { + throw new Twig_Error_Syntax('Calling "parent" on a template that does not extend nor "use" another template is forbidden', $line, $this->parser->getFilename()); } return new Twig_Node_Expression_Parent($this->parser->peekBlockStack(), $line); case 'block': - return new Twig_Node_Expression_BlockReference($args->getNode(0), false, $line); + return new Twig_Node_Expression_BlockReference($this->parseArguments()->getNode(0), false, $line); case 'attribute': + $args = $this->parseArguments(); if (count($args) < 2) { - throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attribute)', $line); + throw new Twig_Error_Syntax('The "attribute" function takes at least two arguments (the variable and the attributes)', $line, $this->parser->getFilename()); } return new Twig_Node_Expression_GetAttr($args->getNode(0), $args->getNode(1), count($args) > 2 ? $args->getNode(2) : new Twig_Node_Expression_Array(array(), $line), Twig_TemplateInterface::ANY_CALL, $line); default: - if (null !== $alias = $this->parser->getImportedFunction($name)) { - return new Twig_Node_Expression_GetAttr($alias['node'], new Twig_Node_Expression_Constant($alias['name'], $line), $args, Twig_TemplateInterface::METHOD_CALL, $line); + if (null !== $alias = $this->parser->getImportedSymbol('function', $name)) { + $arguments = new Twig_Node_Expression_Array(array(), $line); + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } + + $node = new Twig_Node_Expression_MethodCall($alias['node'], $alias['name'], $arguments, $line); + $node->setAttribute('safe', true); + + return $node; } - return new Twig_Node_Expression_Function($name, $args, $line); + $args = $this->parseArguments(true); + $class = $this->getFunctionNodeClass($name, $line); + + return new $class($name, $args, $line); } } public function parseSubscriptExpression($node) { - $token = $this->parser->getStream()->next(); + $stream = $this->parser->getStream(); + $token = $stream->next(); $lineno = $token->getLine(); - $arguments = new Twig_Node(); + $arguments = new Twig_Node_Expression_Array(array(), $lineno); $type = Twig_TemplateInterface::ANY_CALL; if ($token->getValue() == '.') { - $token = $this->parser->getStream()->next(); + $token = $stream->next(); if ( $token->getType() == Twig_Token::NAME_TYPE || @@ -280,20 +355,60 @@ class Twig_ExpressionParser ) { $arg = new Twig_Node_Expression_Constant($token->getValue(), $lineno); - if ($this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { + if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { $type = Twig_TemplateInterface::METHOD_CALL; - $arguments = $this->parseArguments(); - } else { - $arguments = new Twig_Node(); + foreach ($this->parseArguments() as $n) { + $arguments->addElement($n); + } } } else { - throw new Twig_Error_Syntax('Expected name or number', $lineno); + throw new Twig_Error_Syntax('Expected name or number', $lineno, $this->parser->getFilename()); + } + + if ($node instanceof Twig_Node_Expression_Name && null !== $this->parser->getImportedSymbol('template', $node->getAttribute('name'))) { + if (!$arg instanceof Twig_Node_Expression_Constant) { + throw new Twig_Error_Syntax(sprintf('Dynamic macro names are not supported (called on "%s")', $node->getAttribute('name')), $token->getLine(), $this->parser->getFilename()); + } + + $node = new Twig_Node_Expression_MethodCall($node, 'get'.$arg->getAttribute('value'), $arguments, $lineno); + $node->setAttribute('safe', true); + + return $node; } } else { $type = Twig_TemplateInterface::ARRAY_CALL; - $arg = $this->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::PUNCTUATION_TYPE, ']'); + // slice? + $slice = false; + if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + $arg = new Twig_Node_Expression_Constant(0, $token->getLine()); + } else { + $arg = $this->parseExpression(); + } + + if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ':')) { + $slice = true; + $stream->next(); + } + + if ($slice) { + if ($stream->test(Twig_Token::PUNCTUATION_TYPE, ']')) { + $length = new Twig_Node_Expression_Constant(null, $token->getLine()); + } else { + $length = $this->parseExpression(); + } + + $class = $this->getFilterNodeClass('slice', $token->getLine()); + $arguments = new Twig_Node(array($arg, $length)); + $filter = new $class($node, new Twig_Node_Expression_Constant('slice', $token->getLine()), $arguments, $token->getLine()); + + $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); + + return $filter; + } + + $stream->expect(Twig_Token::PUNCTUATION_TYPE, ']'); } return new Twig_Node_Expression_GetAttr($node, $arg, $arguments, $type, $lineno); @@ -315,10 +430,12 @@ class Twig_ExpressionParser if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '(')) { $arguments = new Twig_Node(); } else { - $arguments = $this->parseArguments(); + $arguments = $this->parseArguments(true); } - $node = new Twig_Node_Expression_Filter($node, $name, $arguments, $token->getLine(), $tag); + $class = $this->getFilterNodeClass($name->getAttribute('value'), $token->getLine()); + + $node = new $class($node, $name, $arguments, $token->getLine(), $tag); if (!$this->parser->getStream()->test(Twig_Token::PUNCTUATION_TYPE, '|')) { break; @@ -330,17 +447,62 @@ class Twig_ExpressionParser return $node; } - public function parseArguments() + /** + * Parses arguments. + * + * @param Boolean $namedArguments Whether to allow named arguments or not + * @param Boolean $definition Whether we are parsing arguments for a function definition + */ + public function parseArguments($namedArguments = false, $definition = false) { $args = array(); $stream = $this->parser->getStream(); - $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must be opened by a parenthesis'); + $stream->expect(Twig_Token::PUNCTUATION_TYPE, '(', 'A list of arguments must begin with an opening parenthesis'); while (!$stream->test(Twig_Token::PUNCTUATION_TYPE, ')')) { if (!empty($args)) { $stream->expect(Twig_Token::PUNCTUATION_TYPE, ',', 'Arguments must be separated by a comma'); } - $args[] = $this->parseExpression(); + + if ($definition) { + $token = $stream->expect(Twig_Token::NAME_TYPE, null, 'An argument must be a name'); + $value = new Twig_Node_Expression_Name($token->getValue(), $this->parser->getCurrentToken()->getLine()); + } else { + $value = $this->parseExpression(); + } + + $name = null; + if ($namedArguments && $stream->test(Twig_Token::OPERATOR_TYPE, '=')) { + $token = $stream->next(); + if (!$value instanceof Twig_Node_Expression_Name) { + throw new Twig_Error_Syntax(sprintf('A parameter name must be a string, "%s" given', get_class($value)), $token->getLine(), $this->parser->getFilename()); + } + $name = $value->getAttribute('name'); + + if ($definition) { + $value = $this->parsePrimaryExpression(); + + if (!$this->checkConstantExpression($value)) { + throw new Twig_Error_Syntax(sprintf('A default value for an argument must be a constant (a boolean, a string, a number, or an array).'), $token->getLine(), $this->parser->getFilename()); + } + } else { + $value = $this->parseExpression(); + } + } + + if ($definition) { + if (null === $name) { + $name = $value->getAttribute('name'); + $value = new Twig_Node_Expression_Constant(null, $this->parser->getCurrentToken()->getLine()); + } + $args[$name] = $value; + } else { + if (null === $name) { + $args[] = $value; + } else { + $args[$name] = $value; + } + } } $stream->expect(Twig_Token::PUNCTUATION_TYPE, ')', 'A list of arguments must be closed by a parenthesis'); @@ -353,7 +515,7 @@ class Twig_ExpressionParser while (true) { $token = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, null, 'Only variables can be assigned to'); if (in_array($token->getValue(), array('true', 'false', 'none'))) { - throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s"', $token->getValue()), $token->getLine()); + throw new Twig_Error_Syntax(sprintf('You cannot assign a value to "%s"', $token->getValue()), $token->getLine(), $this->parser->getFilename()); } $targets[] = new Twig_Node_Expression_AssignName($token->getValue(), $token->getLine()); @@ -379,4 +541,60 @@ class Twig_ExpressionParser return new Twig_Node($targets); } + + protected function getFunctionNodeClass($name, $line) + { + $env = $this->parser->getEnvironment(); + + if (false === $function = $env->getFunction($name)) { + $message = sprintf('The function "%s" does not exist', $name); + if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFunctions()))) { + $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); + } + + throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); + } + + if ($function instanceof Twig_SimpleFunction) { + return $function->getNodeClass(); + } + + return $function instanceof Twig_Function_Node ? $function->getClass() : 'Twig_Node_Expression_Function'; + } + + protected function getFilterNodeClass($name, $line) + { + $env = $this->parser->getEnvironment(); + + if (false === $filter = $env->getFilter($name)) { + $message = sprintf('The filter "%s" does not exist', $name); + if ($alternatives = $env->computeAlternatives($name, array_keys($env->getFilters()))) { + $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); + } + + throw new Twig_Error_Syntax($message, $line, $this->parser->getFilename()); + } + + if ($filter instanceof Twig_SimpleFilter) { + return $filter->getNodeClass(); + } + + return $filter instanceof Twig_Filter_Node ? $filter->getClass() : 'Twig_Node_Expression_Filter'; + } + + // checks that the node only contains "constant" elements + protected function checkConstantExpression(Twig_NodeInterface $node) + { + if (!($node instanceof Twig_Node_Expression_Constant || $node instanceof Twig_Node_Expression_Array)) { + return false; + } + + foreach ($node as $n) { + if (!$this->checkConstantExpression($n)) { + return false; + } + } + + return true; + } } diff --git a/inc/lib/Twig/Extension.php b/inc/lib/Twig/Extension.php index ac289cb4..931fc033 100644 --- a/inc/lib/Twig/Extension.php +++ b/inc/lib/Twig/Extension.php @@ -82,9 +82,9 @@ abstract class Twig_Extension implements Twig_ExtensionInterface } /** - * Returns a list of global functions to add to the existing list. + * Returns a list of global variables to add to the existing list. * - * @return array An array of global functions + * @return array An array of global variables */ public function getGlobals() { diff --git a/inc/lib/Twig/Extension/Core.php b/inc/lib/Twig/Extension/Core.php index a4153245..e68687b4 100644 --- a/inc/lib/Twig/Extension/Core.php +++ b/inc/lib/Twig/Extension/Core.php @@ -14,6 +14,83 @@ if (!defined('ENT_SUBSTITUTE')) { */ class Twig_Extension_Core extends Twig_Extension { + protected $dateFormats = array('F j, Y H:i', '%d days'); + protected $numberFormat = array(0, '.', ','); + protected $timezone = null; + + /** + * Sets the default format to be used by the date filter. + * + * @param string $format The default date format string + * @param string $dateIntervalFormat The default date interval format string + */ + public function setDateFormat($format = null, $dateIntervalFormat = null) + { + if (null !== $format) { + $this->dateFormats[0] = $format; + } + + if (null !== $dateIntervalFormat) { + $this->dateFormats[1] = $dateIntervalFormat; + } + } + + /** + * Gets the default format to be used by the date filter. + * + * @return array The default date format string and the default date interval format string + */ + public function getDateFormat() + { + return $this->dateFormats; + } + + /** + * Sets the default timezone to be used by the date filter. + * + * @param DateTimeZone|string $timezone The default timezone string or a DateTimeZone object + */ + public function setTimezone($timezone) + { + $this->timezone = $timezone instanceof DateTimeZone ? $timezone : new DateTimeZone($timezone); + } + + /** + * Gets the default timezone to be used by the date filter. + * + * @return DateTimeZone The default timezone currently in use + */ + public function getTimezone() + { + if (null === $this->timezone) { + $this->timezone = new DateTimeZone(date_default_timezone_get()); + } + + return $this->timezone; + } + + /** + * Sets the default format to be used by the number_format filter. + * + * @param integer $decimal The number of decimal places to use. + * @param string $decimalPoint The character(s) to use for the decimal point. + * @param string $thousandSep The character(s) to use for the thousands separator. + */ + public function setNumberFormat($decimal, $decimalPoint, $thousandSep) + { + $this->numberFormat = array($decimal, $decimalPoint, $thousandSep); + } + + /** + * Get the default format used by the number_format filter. + * + * @return array The arguments for number_format() + */ + public function getNumberFormat() + { + return $this->numberFormat; + } + /** * Returns the token parser instance to add to the existing list. * @@ -34,6 +111,9 @@ class Twig_Extension_Core extends Twig_Extension new Twig_TokenParser_From(), new Twig_TokenParser_Set(), new Twig_TokenParser_Spaceless(), + new Twig_TokenParser_Flush(), + new Twig_TokenParser_Do(), + new Twig_TokenParser_Embed(), ); } @@ -46,40 +126,53 @@ class Twig_Extension_Core extends Twig_Extension { $filters = array( // formatting filters - 'date' => new Twig_Filter_Function('twig_date_format_filter'), - 'format' => new Twig_Filter_Function('sprintf'), - 'replace' => new Twig_Filter_Function('twig_strtr'), + new Twig_SimpleFilter('date', 'twig_date_format_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('date_modify', 'twig_date_modify_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('format', 'sprintf'), + new Twig_SimpleFilter('replace', 'strtr'), + new Twig_SimpleFilter('number_format', 'twig_number_format_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('abs', 'abs'), // encoding - 'url_encode' => new Twig_Filter_Function('twig_urlencode_filter'), - 'json_encode' => new Twig_Filter_Function('twig_jsonencode_filter'), + new Twig_SimpleFilter('url_encode', 'twig_urlencode_filter'), + new Twig_SimpleFilter('json_encode', 'twig_jsonencode_filter'), + new Twig_SimpleFilter('convert_encoding', 'twig_convert_encoding'), // string filters - 'title' => new Twig_Filter_Function('twig_title_string_filter', array('needs_environment' => true)), - 'capitalize' => new Twig_Filter_Function('twig_capitalize_string_filter', array('needs_environment' => true)), - 'upper' => new Twig_Filter_Function('strtoupper'), - 'lower' => new Twig_Filter_Function('strtolower'), - 'striptags' => new Twig_Filter_Function('strip_tags'), + new Twig_SimpleFilter('title', 'twig_title_string_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('capitalize', 'twig_capitalize_string_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('upper', 'strtoupper'), + new Twig_SimpleFilter('lower', 'strtolower'), + new Twig_SimpleFilter('striptags', 'strip_tags'), + new Twig_SimpleFilter('trim', 'trim'), + new Twig_SimpleFilter('nl2br', 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), // array helpers - 'join' => new Twig_Filter_Function('twig_join_filter'), - 'reverse' => new Twig_Filter_Function('twig_reverse_filter'), - 'length' => new Twig_Filter_Function('twig_length_filter', array('needs_environment' => true)), - 'sort' => new Twig_Filter_Function('twig_sort_filter'), - 'merge' => new Twig_Filter_Function('twig_array_merge'), + new Twig_SimpleFilter('join', 'twig_join_filter'), + new Twig_SimpleFilter('split', 'twig_split_filter'), + new Twig_SimpleFilter('sort', 'twig_sort_filter'), + new Twig_SimpleFilter('merge', 'twig_array_merge'), + new Twig_SimpleFilter('batch', 'twig_array_batch'), + + // string/array filters + new Twig_SimpleFilter('reverse', 'twig_reverse_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('length', 'twig_length_filter', array('needs_environment' => true)), + new Twig_SimpleFilter('slice', 'twig_slice', array('needs_environment' => true)), + new Twig_SimpleFilter('first', 'twig_first', array('needs_environment' => true)), + new Twig_SimpleFilter('last', 'twig_last', array('needs_environment' => true)), // iteration and runtime - 'default' => new Twig_Filter_Function('twig_default_filter'), - 'keys' => new Twig_Filter_Function('twig_get_array_keys_filter'), + new Twig_SimpleFilter('default', '_twig_default_filter', array('node_class' => 'Twig_Node_Expression_Filter_Default')), + new Twig_SimpleFilter('keys', 'twig_get_array_keys_filter'), // escaping - 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), - 'e' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), + new Twig_SimpleFilter('escape', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), + new Twig_SimpleFilter('e', 'twig_escape_filter', array('needs_environment' => true, 'is_safe_callback' => 'twig_escape_filter_is_safe')), ); if (function_exists('mb_get_info')) { - $filters['upper'] = new Twig_Filter_Function('twig_upper_filter', array('needs_environment' => true)); - $filters['lower'] = new Twig_Filter_Function('twig_lower_filter', array('needs_environment' => true)); + $filters[] = new Twig_SimpleFilter('upper', 'twig_upper_filter', array('needs_environment' => true)); + $filters[] = new Twig_SimpleFilter('lower', 'twig_lower_filter', array('needs_environment' => true)); } return $filters; @@ -93,29 +186,33 @@ class Twig_Extension_Core extends Twig_Extension public function getFunctions() { return array( - 'range' => new Twig_Function_Function('range'), - 'constant' => new Twig_Function_Function('constant'), - 'cycle' => new Twig_Function_Function('twig_cycle'), + new Twig_SimpleFunction('range', 'range'), + new Twig_SimpleFunction('constant', 'twig_constant'), + new Twig_SimpleFunction('cycle', 'twig_cycle'), + new Twig_SimpleFunction('random', 'twig_random', array('needs_environment' => true)), + new Twig_SimpleFunction('date', 'twig_date_converter', array('needs_environment' => true)), + new Twig_SimpleFunction('include', 'twig_include', array('needs_environment' => true, 'needs_context' => true, 'is_safe' => array('all'))), ); } /** - * Returns a list of filters to add to the existing list. + * Returns a list of tests to add to the existing list. * - * @return array An array of filters + * @return array An array of tests */ public function getTests() { return array( - 'even' => new Twig_Test_Function('twig_test_even'), - 'odd' => new Twig_Test_Function('twig_test_odd'), - 'defined' => new Twig_Test_Function('twig_test_defined'), - 'sameas' => new Twig_Test_Function('twig_test_sameas'), - 'none' => new Twig_Test_Function('twig_test_none'), - 'null' => new Twig_Test_Function('twig_test_none'), - 'divisibleby' => new Twig_Test_Function('twig_test_divisibleby'), - 'constant' => new Twig_Test_Function('twig_test_constant'), - 'empty' => new Twig_Test_Function('twig_test_empty'), + new Twig_SimpleTest('even', null, array('node_class' => 'Twig_Node_Expression_Test_Even')), + new Twig_SimpleTest('odd', null, array('node_class' => 'Twig_Node_Expression_Test_Odd')), + new Twig_SimpleTest('defined', null, array('node_class' => 'Twig_Node_Expression_Test_Defined')), + new Twig_SimpleTest('sameas', null, array('node_class' => 'Twig_Node_Expression_Test_Sameas')), + new Twig_SimpleTest('none', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), + new Twig_SimpleTest('null', null, array('node_class' => 'Twig_Node_Expression_Test_Null')), + new Twig_SimpleTest('divisibleby', null, array('node_class' => 'Twig_Node_Expression_Test_Divisibleby')), + new Twig_SimpleTest('constant', null, array('node_class' => 'Twig_Node_Expression_Test_Constant')), + new Twig_SimpleTest('empty', 'twig_test_empty'), + new Twig_SimpleTest('iterable', 'twig_test_iterable'), ); } @@ -129,15 +226,15 @@ class Twig_Extension_Core extends Twig_Extension return array( array( 'not' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), - '-' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Neg'), - '+' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Pos'), + '-' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Neg'), + '+' => array('precedence' => 500, 'class' => 'Twig_Node_Expression_Unary_Pos'), ), array( - 'b-and' => array('precedence' => 5, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-xor' => array('precedence' => 5, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - 'b-or' => array('precedence' => 5, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'or' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'and' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-or' => array('precedence' => 16, 'class' => 'Twig_Node_Expression_Binary_BitwiseOr', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-xor' => array('precedence' => 17, 'class' => 'Twig_Node_Expression_Binary_BitwiseXor', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + 'b-and' => array('precedence' => 18, 'class' => 'Twig_Node_Expression_Binary_BitwiseAnd', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '==' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '!=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '<' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), @@ -146,6 +243,7 @@ class Twig_Extension_Core extends Twig_Extension '<=' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'not in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotIn', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'in' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_In', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '..' => array('precedence' => 25, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '+' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Add', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '-' => array('precedence' => 30, 'class' => 'Twig_Node_Expression_Binary_Sub', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '~' => array('precedence' => 40, 'class' => 'Twig_Node_Expression_Binary_Concat', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), @@ -155,7 +253,6 @@ class Twig_Extension_Core extends Twig_Extension '%' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'is' => array('precedence' => 100, 'callable' => array($this, 'parseTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), 'is not' => array('precedence' => 100, 'callable' => array($this, 'parseNotTestExpression'), 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), - '..' => array('precedence' => 110, 'class' => 'Twig_Node_Expression_Binary_Range', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), '**' => array('precedence' => 200, 'class' => 'Twig_Node_Expression_Binary_Power', 'associativity' => Twig_ExpressionParser::OPERATOR_RIGHT), ), ); @@ -169,13 +266,35 @@ class Twig_Extension_Core extends Twig_Extension public function parseTestExpression(Twig_Parser $parser, $node) { $stream = $parser->getStream(); - $name = $stream->expect(Twig_Token::NAME_TYPE); + $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); $arguments = null; if ($stream->test(Twig_Token::PUNCTUATION_TYPE, '(')) { - $arguments = $parser->getExpressionParser()->parseArguments(); + $arguments = $parser->getExpressionParser()->parseArguments(true); } - return new Twig_Node_Expression_Test($node, $name->getValue(), $arguments, $parser->getCurrentToken()->getLine()); + $class = $this->getTestNodeClass($parser, $name, $node->getLine()); + + return new $class($node, $name, $arguments, $parser->getCurrentToken()->getLine()); + } + + protected function getTestNodeClass(Twig_Parser $parser, $name, $line) + { + $env = $parser->getEnvironment(); + $testMap = $env->getTests(); + if (!isset($testMap[$name])) { + $message = sprintf('The test "%s" does not exist', $name); + if ($alternatives = $env->computeAlternatives($name, array_keys($env->getTests()))) { + $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); + } + + throw new Twig_Error_Syntax($message, $line, $parser->getFilename()); + } + + if ($testMap[$name] instanceof Twig_SimpleTest) { + return $testMap[$name]->getNodeClass(); + } + + return $testMap[$name] instanceof Twig_Test_Node ? $testMap[$name]->getClass() : 'Twig_Node_Expression_Test'; } /** @@ -192,18 +311,77 @@ class Twig_Extension_Core extends Twig_Extension /** * Cycles over a value. * - * @param ArrayAccess|array $values An array or an ArrayAccess instance - * @param integer $i The cycle value + * @param ArrayAccess|array $values An array or an ArrayAccess instance + * @param integer $position The cycle position * * @return string The next value in the cycle */ -function twig_cycle($values, $i) +function twig_cycle($values, $position) { if (!is_array($values) && !$values instanceof ArrayAccess) { return $values; } - return $values[$i % count($values)]; + return $values[$position % count($values)]; +} + +/** + * Returns a random value depending on the supplied parameter type: + * - a random item from a Traversable or array + * - a random character from a string + * - a random integer between 0 and the integer parameter + * + * @param Twig_Environment $env A Twig_Environment instance + * @param Traversable|array|integer|string $values The values to pick a random item from + * + * @throws Twig_Error_Runtime When $values is an empty array (does not apply to an empty string which is returned as is). + * + * @return mixed A random value from the given sequence + */ +function twig_random(Twig_Environment $env, $values = null) +{ + if (null === $values) { + return mt_rand(); + } + + if (is_int($values) || is_float($values)) { + return $values < 0 ? mt_rand($values, 0) : mt_rand(0, $values); + } + + if ($values instanceof Traversable) { + $values = iterator_to_array($values); + } elseif (is_string($values)) { + if ('' === $values) { + return ''; + } + if (null !== $charset = $env->getCharset()) { + if ('UTF-8' != $charset) { + $values = twig_convert_encoding($values, 'UTF-8', $charset); + } + + // unicode version of str_split() + // split at all positions, but not after the start and not before the end + $values = preg_split('/(? $value) { + $values[$i] = twig_convert_encoding($value, $charset, 'UTF-8'); + } + } + } else { + return $values[mt_rand(0, strlen($values) - 1)]; + } + } + + if (!is_array($values)) { + return $values; + } + + if (0 === count($values)) { + throw new Twig_Error_Runtime('The random function cannot pick from an empty array.'); + } + + return $values[array_rand($values, 1)]; } /** @@ -213,44 +391,143 @@ function twig_cycle($values, $i) * {{ post.published_at|date("m/d/Y") }} * * + * @param Twig_Environment $env A Twig_Environment instance + * @param DateTime|DateInterval|string $date A date + * @param string $format A format + * @param DateTimeZone|string $timezone A timezone + * + * @return string The formatted date + */ +function twig_date_format_filter(Twig_Environment $env, $date, $format = null, $timezone = null) +{ + if (null === $format) { + $formats = $env->getExtension('core')->getDateFormat(); + $format = $date instanceof DateInterval ? $formats[1] : $formats[0]; + } + + if ($date instanceof DateInterval) { + return $date->format($format); + } + + return twig_date_converter($env, $date, $timezone)->format($format); +} + +/** + * Returns a new date object modified + * + *
    + *   {{ post.published_at|date_modify("-1day")|date("m/d/Y") }}
    + * 
    + * + * @param Twig_Environment $env A Twig_Environment instance + * @param DateTime|string $date A date + * @param string $modifier A modifier string + * + * @return DateTime A new date object + */ +function twig_date_modify_filter(Twig_Environment $env, $date, $modifier) +{ + $date = twig_date_converter($env, $date, false); + $date->modify($modifier); + + return $date; +} + +/** + * Converts an input to a DateTime instance. + * + *
    + *    {% if date(user.created_at) < date('+2days') %}
    + *      {# do something #}
    + *    {% endif %}
    + * 
    + * + * @param Twig_Environment $env A Twig_Environment instance * @param DateTime|string $date A date - * @param string $format A format * @param DateTimeZone|string $timezone A timezone * - * @return string The formatter date + * @return DateTime A DateTime instance */ -function twig_date_format_filter($date, $format = 'F j, Y H:i', $timezone = null) +function twig_date_converter(Twig_Environment $env, $date = null, $timezone = null) { - if (!$date instanceof DateTime) { - if (ctype_digit((string) $date)) { - $date = new DateTime('@'.$date); - $date->setTimezone(new DateTimeZone(date_default_timezone_get())); - } else { - $date = new DateTime($date); - } + // determine the timezone + if (!$timezone) { + $defaultTimezone = $env->getExtension('core')->getTimezone(); + } elseif (!$timezone instanceof DateTimeZone) { + $defaultTimezone = new DateTimeZone($timezone); + } else { + $defaultTimezone = $timezone; } - if (null !== $timezone) { - if (!$timezone instanceof DateTimeZone) { - $timezone = new DateTimeZone($timezone); + if ($date instanceof DateTime) { + $date = clone $date; + if (false !== $timezone) { + $date->setTimezone($defaultTimezone); } - $date->setTimezone($timezone); + return $date; + } + + $asString = (string) $date; + if (ctype_digit($asString) || (!empty($asString) && '-' === $asString[0] && ctype_digit(substr($asString, 1)))) { + $date = '@'.$date; + } + + $date = new DateTime($date, $defaultTimezone); + if (false !== $timezone) { + $date->setTimezone($defaultTimezone); + } + + return $date; +} + +/** + * Number format filter. + * + * All of the formatting options can be left null, in that case the defaults will + * be used. Supplying any of the parameters will override the defaults set in the + * environment object. + * + * @param Twig_Environment $env A Twig_Environment instance + * @param mixed $number A float/int/string of the number to format + * @param integer $decimal The number of decimal points to display. + * @param string $decimalPoint The character(s) to use for the decimal point. + * @param string $thousandSep The character(s) to use for the thousands separator. + * + * @return string The formatted number + */ +function twig_number_format_filter(Twig_Environment $env, $number, $decimal = null, $decimalPoint = null, $thousandSep = null) +{ + $defaults = $env->getExtension('core')->getNumberFormat(); + if (null === $decimal) { + $decimal = $defaults[0]; + } + + if (null === $decimalPoint) { + $decimalPoint = $defaults[1]; + } + + if (null === $thousandSep) { + $thousandSep = $defaults[2]; } - return $date->format($format); + return number_format((float) $number, $decimal, $decimalPoint, $thousandSep); } /** - * URL encodes a string. + * URL encodes a string as a path segment or an array as a query string. * - * @param string $url A URL - * @param bool $raw true to use rawurlencode() instead of urlencode + * @param string|array $url A URL or an array of query parameters + * @param bool $raw true to use rawurlencode() instead of urlencode * * @return string The URL encoded value */ function twig_urlencode_filter($url, $raw = false) { + if (is_array($url)) { + return http_build_query($url, '', '&'); + } + if ($raw) { return rawurlencode($url); } @@ -260,7 +537,7 @@ function twig_urlencode_filter($url, $raw = false) if (version_compare(PHP_VERSION, '5.3.0', '<')) { /** - * JSON encodes a PHP variable. + * JSON encodes a variable. * * @param mixed $value The value to encode. * @param integer $options Not used on PHP 5.2.x @@ -279,7 +556,7 @@ if (version_compare(PHP_VERSION, '5.3.0', '<')) { } } else { /** - * JSON encodes a PHP variable. + * JSON encodes a variable. * * @param mixed $value The value to encode. * @param integer $options Bitmask consisting of JSON_HEX_QUOT, JSON_HEX_TAG, JSON_HEX_AMP, JSON_HEX_APOS, JSON_NUMERIC_CHECK, JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, JSON_FORCE_OBJECT @@ -324,12 +601,72 @@ function _twig_markup2string(&$value) function twig_array_merge($arr1, $arr2) { if (!is_array($arr1) || !is_array($arr2)) { - throw new Twig_Error_Runtime('The merge filter only work with arrays or hashes.'); + throw new Twig_Error_Runtime('The merge filter only works with arrays or hashes.'); } return array_merge($arr1, $arr2); } +/** + * Slices a variable. + * + * @param Twig_Environment $env A Twig_Environment instance + * @param mixed $item A variable + * @param integer $start Start of the slice + * @param integer $length Size of the slice + * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ +function twig_slice(Twig_Environment $env, $item, $start, $length = null, $preserveKeys = false) +{ + if ($item instanceof Traversable) { + $item = iterator_to_array($item, false); + } + + if (is_array($item)) { + return array_slice($item, $start, $length, $preserveKeys); + } + + $item = (string) $item; + + if (function_exists('mb_get_info') && null !== $charset = $env->getCharset()) { + return mb_substr($item, $start, null === $length ? mb_strlen($item, $charset) - $start : $length, $charset); + } + + return null === $length ? substr($item, $start) : substr($item, $start, $length); +} + +/** + * Returns the first element of the item. + * + * @param Twig_Environment $env A Twig_Environment instance + * @param mixed $item A variable + * + * @return mixed The first element of the item + */ +function twig_first(Twig_Environment $env, $item) +{ + $elements = twig_slice($env, $item, 0, 1, false); + + return is_string($elements) ? $elements[0] : current($elements); +} + +/** + * Returns the last element of the item. + * + * @param Twig_Environment $env A Twig_Environment instance + * @param mixed $item A variable + * + * @return mixed The last element of the item + */ +function twig_last(Twig_Environment $env, $item) +{ + $elements = twig_slice($env, $item, -1, 1, false); + + return is_string($elements) ? $elements[0] : current($elements); +} + /** * Joins the values to a string. * @@ -350,30 +687,55 @@ function twig_array_merge($arr1, $arr2) */ function twig_join_filter($value, $glue = '') { + if ($value instanceof Traversable) { + $value = iterator_to_array($value, false); + } + return implode($glue, (array) $value); } /** - * Returns the value or the default value when it is undefined or empty. + * Splits the string into an array. * *
    + *  {{ "one,two,three"|split(',') }}
    + *  {# returns [one, two, three] #}
    + *
    + *  {{ "one,two,three,four,five"|split(',', 3) }}
    + *  {# returns [one, two, "three,four,five"] #}
      *
    - *  {{ var.foo|default('foo item on var is not defined') }}
    + *  {{ "123"|split('') }}
    + *  {# returns [1, 2, 3] #}
      *
    + *  {{ "aabbcc"|split('', 2) }}
    + *  {# returns [aa, bb, cc] #}
      * 
    * - * @param mixed $value A value - * @param mixed $default The default value + * @param string $value A string + * @param string $delimiter The delimiter + * @param integer $limit The limit * - * @param mixed The value or the default value; + * @return array The split string as an array */ -function twig_default_filter($value, $default = '') +function twig_split_filter($value, $delimiter, $limit = null) +{ + if (empty($delimiter)) { + return str_split($value, null === $limit ? 1 : $limit); + } + + return null === $limit ? explode($delimiter, $value) : explode($delimiter, $value, $limit); +} + +// The '_default' filter is used internally to avoid using the ternary operator +// which costs a lot for big contexts (before PHP 5.4). So, on average, +// a function call is cheaper. +function _twig_default_filter($value, $default = '') { if (twig_test_empty($value)) { return $default; - } else { - return $value; } + + return $value; } /** @@ -405,23 +767,43 @@ function twig_get_array_keys_filter($array) } /** - * Reverses an array. + * Reverses a variable. * - * @param array|Traversable $array An array or a Traversable instance + * @param Twig_Environment $env A Twig_Environment instance + * @param array|Traversable|string $item An array, a Traversable instance, or a string + * @param Boolean $preserveKeys Whether to preserve key or not * - * return array The array reversed + * @return mixed The reversed input */ -function twig_reverse_filter($array) +function twig_reverse_filter(Twig_Environment $env, $item, $preserveKeys = false) { - if (is_object($array) && $array instanceof Traversable) { - return array_reverse(iterator_to_array($array)); + if (is_object($item) && $item instanceof Traversable) { + return array_reverse(iterator_to_array($item), $preserveKeys); } - if (!is_array($array)) { - return array(); + if (is_array($item)) { + return array_reverse($item, $preserveKeys); + } + + if (null !== $charset = $env->getCharset()) { + $string = (string) $item; + + if ('UTF-8' != $charset) { + $item = twig_convert_encoding($string, 'UTF-8', $charset); + } + + preg_match_all('/./us', $item, $matches); + + $string = implode('', array_reverse($matches[0])); + + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; } - return array_reverse($array); + return strrev((string) $item); } /** @@ -440,78 +822,151 @@ function twig_sort_filter($array) function twig_in_filter($value, $compare) { if (is_array($compare)) { - return in_array($value, $compare); + return in_array($value, $compare, is_object($value)); } elseif (is_string($compare)) { + if (!strlen($value)) { + return empty($compare); + } + return false !== strpos($compare, (string) $value); - } elseif (is_object($compare) && $compare instanceof Traversable) { - return in_array($value, iterator_to_array($compare, false)); + } elseif ($compare instanceof Traversable) { + return in_array($value, iterator_to_array($compare, false), is_object($value)); } return false; } -/** - * Replaces placeholders in a string. - * - *
    - *  {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }}
    - * 
    - * - * @param string $pattern A string - * @param string $replacements The values for the placeholders - * - * @return string The string where the placeholders have been replaced - */ -function twig_strtr($pattern, $replacements) -{ - return str_replace(array_keys($replacements), array_values($replacements), $pattern); -} - /** * Escapes a string. * - * @param Twig_Environment $env A Twig_Environment instance - * @param string $string The value to be escaped - * @param string $type The escaping strategy - * @param string $charset The charset + * @param Twig_Environment $env A Twig_Environment instance + * @param string $string The value to be escaped + * @param string $strategy The escaping strategy + * @param string $charset The charset + * @param Boolean $autoescape Whether the function is called by the auto-escaping feature (true) or by the developer (false) */ -function twig_escape_filter(Twig_Environment $env, $string, $type = 'html', $charset = null) +function twig_escape_filter(Twig_Environment $env, $string, $strategy = 'html', $charset = null, $autoescape = false) { - if (is_object($string) && $string instanceof Twig_Markup) { + if ($autoescape && $string instanceof Twig_Markup) { return $string; } - if (!is_string($string) && !(is_object($string) && method_exists($string, '__toString'))) { - return $string; + if (!is_string($string)) { + if (is_object($string) && method_exists($string, '__toString')) { + $string = (string) $string; + } else { + return $string; + } } if (null === $charset) { $charset = $env->getCharset(); } - switch ($type) { + switch ($strategy) { + case 'html': + // see http://php.net/htmlspecialchars + + // Using a static variable to avoid initializing the array + // each time the function is called. Moving the declaration on the + // top of the function slow downs other escaping strategies. + static $htmlspecialcharsCharsets = array( + 'ISO-8859-1' => true, 'ISO8859-1' => true, + 'ISO-8859-15' => true, 'ISO8859-15' => true, + 'utf-8' => true, 'UTF-8' => true, + 'CP866' => true, 'IBM866' => true, '866' => true, + 'CP1251' => true, 'WINDOWS-1251' => true, 'WIN-1251' => true, + '1251' => true, + 'CP1252' => true, 'WINDOWS-1252' => true, '1252' => true, + 'KOI8-R' => true, 'KOI8-RU' => true, 'KOI8R' => true, + 'BIG5' => true, '950' => true, + 'GB2312' => true, '936' => true, + 'BIG5-HKSCS' => true, + 'SHIFT_JIS' => true, 'SJIS' => true, '932' => true, + 'EUC-JP' => true, 'EUCJP' => true, + 'ISO8859-5' => true, 'ISO-8859-5' => true, 'MACROMAN' => true, + ); + + if (isset($htmlspecialcharsCharsets[$charset])) { + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + if (isset($htmlspecialcharsCharsets[strtoupper($charset)])) { + // cache the lowercase variant for future iterations + $htmlspecialcharsCharsets[$charset] = true; + + return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + } + + $string = twig_convert_encoding($string, 'UTF-8', $charset); + $string = htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8'); + + return twig_convert_encoding($string, $charset, 'UTF-8'); + case 'js': // escape all non-alphanumeric characters // into their \xHH or \uHHHH representations if ('UTF-8' != $charset) { - $string = _twig_convert_encoding($string, 'UTF-8', $charset); + $string = twig_convert_encoding($string, 'UTF-8', $charset); } - if (null === $string = preg_replace_callback('#[^\p{L}\p{N} ]#u', '_twig_escape_js_callback', $string)) { + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); } + $string = preg_replace_callback('#[^a-zA-Z0-9,\._]#Su', '_twig_escape_js_callback', $string); + if ('UTF-8' != $charset) { - $string = _twig_convert_encoding($string, $charset, 'UTF-8'); + $string = twig_convert_encoding($string, $charset, 'UTF-8'); } return $string; - case 'html': - return htmlspecialchars($string, ENT_QUOTES | ENT_SUBSTITUTE, $charset); + case 'css': + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { + throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9]#Su', '_twig_escape_css_callback', $string); + + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'html_attr': + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, 'UTF-8', $charset); + } + + if (0 == strlen($string) ? false : (1 == preg_match('/^./su', $string) ? false : true)) { + throw new Twig_Error_Runtime('The string to escape is not a valid UTF-8 string.'); + } + + $string = preg_replace_callback('#[^a-zA-Z0-9,\.\-_]#Su', '_twig_escape_html_attr_callback', $string); + + if ('UTF-8' != $charset) { + $string = twig_convert_encoding($string, $charset, 'UTF-8'); + } + + return $string; + + case 'url': + // hackish test to avoid version_compare that is much slower, this works unless PHP releases a 5.10.* + // at that point however PHP 5.2.* support can be removed + if (PHP_VERSION < '5.3.0') { + return str_replace('%7E', '~', rawurlencode($string)); + } + + return rawurlencode($string); default: - throw new Twig_Error_Runtime(sprintf('Invalid escape type "%s".', $type)); + throw new Twig_Error_Runtime(sprintf('Invalid escaping strategy "%s" (valid ones: html, js, url, css, and html_attr).', $strategy)); } } @@ -521,28 +976,26 @@ function twig_escape_filter_is_safe(Twig_Node $filterArgs) foreach ($filterArgs as $arg) { if ($arg instanceof Twig_Node_Expression_Constant) { return array($arg->getAttribute('value')); - } else { - return array(); } - break; + return array(); } return array('html'); } -if (function_exists('iconv')) { - function _twig_convert_encoding($string, $to, $from) +if (function_exists('mb_convert_encoding')) { + function twig_convert_encoding($string, $to, $from) { - return iconv($from, $to, $string); + return mb_convert_encoding($string, $to, $from); } -} elseif (function_exists('mb_convert_encoding')) { - function _twig_convert_encoding($string, $to, $from) +} elseif (function_exists('iconv')) { + function twig_convert_encoding($string, $to, $from) { - return mb_convert_encoding($string, $to, $from); + return iconv($from, $to, $string); } } else { - function _twig_convert_encoding($string, $to, $from) + function twig_convert_encoding($string, $to, $from) { throw new Twig_Error_Runtime('No suitable convert encoding function (use UTF-8 as your encoding or install the iconv or mbstring extension).'); } @@ -554,22 +1007,98 @@ function _twig_escape_js_callback($matches) // \xHH if (!isset($char[1])) { - return '\\x'.substr('00'.bin2hex($char), -2); + return '\\x'.strtoupper(substr('00'.bin2hex($char), -2)); + } + + // \uHHHH + $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); + + return '\\u'.strtoupper(substr('0000'.bin2hex($char), -4)); +} + +function _twig_escape_css_callback($matches) +{ + $char = $matches[0]; + + // \xHH + if (!isset($char[1])) { + $hex = ltrim(strtoupper(bin2hex($char)), '0'); + if (0 === strlen($hex)) { + $hex = '0'; + } + + return '\\'.$hex.' '; } // \uHHHH - $char = _twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); + $char = twig_convert_encoding($char, 'UTF-16BE', 'UTF-8'); - return '\\u'.substr('0000'.bin2hex($char), -4); + return '\\'.ltrim(strtoupper(bin2hex($char)), '0').' '; +} + +/** + * This function is adapted from code coming from Zend Framework. + * + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +function _twig_escape_html_attr_callback($matches) +{ + /* + * While HTML supports far more named entities, the lowest common denominator + * has become HTML5's XML Serialisation which is restricted to the those named + * entities that XML supports. Using HTML entities would result in this error: + * XML Parsing Error: undefined entity + */ + static $entityMap = array( + 34 => 'quot', /* quotation mark */ + 38 => 'amp', /* ampersand */ + 60 => 'lt', /* less-than sign */ + 62 => 'gt', /* greater-than sign */ + ); + + $chr = $matches[0]; + $ord = ord($chr); + + /** + * The following replaces characters undefined in HTML with the + * hex entity for the Unicode replacement character. + */ + if (($ord <= 0x1f && $chr != "\t" && $chr != "\n" && $chr != "\r") || ($ord >= 0x7f && $ord <= 0x9f)) { + return '�'; + } + + /** + * Check if the current character to escape has a name entity we should + * replace it with while grabbing the hex value of the character. + */ + if (strlen($chr) == 1) { + $hex = strtoupper(substr('00'.bin2hex($chr), -2)); + } else { + $chr = twig_convert_encoding($chr, 'UTF-16BE', 'UTF-8'); + $hex = strtoupper(substr('0000'.bin2hex($chr), -4)); + } + + $int = hexdec($hex); + if (array_key_exists($int, $entityMap)) { + return sprintf('&%s;', $entityMap[$int]); + } + + /** + * Per OWASP recommendations, we'll use hex entities for any other + * characters where a named entity does not exist. + */ + + return sprintf('&#x%s;', $hex); } // add multibyte extensions if possible if (function_exists('mb_get_info')) { /** - * Returns the length of a PHP variable. + * Returns the length of a variable. * * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $thing A PHP variable + * @param mixed $thing A variable * * @return integer The length of the value */ @@ -648,13 +1177,12 @@ if (function_exists('mb_get_info')) { } } // and byte fallback -else -{ +else { /** - * Returns the length of a PHP variable. + * Returns the length of a variable. * * @param Twig_Environment $env A Twig_Environment instance - * @param mixed $thing A PHP variable + * @param mixed $thing A variable * * @return integer The length of the value */ @@ -693,154 +1221,135 @@ else /* used internally */ function twig_ensure_traversable($seq) { - if (is_array($seq) || (is_object($seq) && $seq instanceof Traversable)) { + if ($seq instanceof Traversable || is_array($seq)) { return $seq; - } else { - return array(); } + + return array(); } /** - * Checks that a variable points to the same memory address than another one. + * Checks if a variable is empty. * *
    - * {% if foo.attribute is sameas(false) %}
    - *    the foo attribute really is the ``false`` PHP value
    + * {# evaluates to true if the foo variable is null, false, or the empty string #}
    + * {% if foo is empty %}
    + *     {# ... #}
      * {% endif %}
      * 
    * - * @param mixed $value A PHP variable - * @param mixed $test The PHP variable to test against + * @param mixed $value A variable * - * @return Boolean true if the values are the same, false otherwise + * @return Boolean true if the value is empty, false otherwise */ -function twig_test_sameas($value, $test) +function twig_test_empty($value) { - return $value === $test; -} + if ($value instanceof Countable) { + return 0 == count($value); + } -/** - * Checks that a variable is null. - * - *
    - *  {{ var is none }}
    - * 
    - * - * @param mixed $value a PHP variable. - * - * @return Boolean true if the value is null, false otherwise - */ -function twig_test_none($value) -{ - return null === $value; + return '' === $value || false === $value || null === $value || array() === $value; } /** - * Checks if a variable is divisible by a number. + * Checks if a variable is traversable. * *
    - *  {% if loop.index is divisibleby(3) %}
    + * {# evaluates to true if the foo variable is an array or a traversable object #}
    + * {% if foo is traversable %}
    + *     {# ... #}
    + * {% endif %}
      * 
    * - * @param integer $value A PHP value - * @param integer $num A number + * @param mixed $value A variable * - * @return Boolean true if the value is divisible by the number, false otherwise + * @return Boolean true if the value is traversable */ -function twig_test_divisibleby($value, $num) +function twig_test_iterable($value) { - return 0 == $value % $num; + return $value instanceof Traversable || is_array($value); } /** - * Checks if a number is even. - * - *
    - *  {{ var is even }}
    - * 
    + * Renders a template. * - * @param integer $value An integer + * @param string $template The template to render + * @param array $variables The variables to pass to the template + * @param Boolean $with_context Whether to pass the current context variables or not + * @param Boolean $ignore_missing Whether to ignore missing templates or not + * @param Boolean $sandboxed Whether to sandbox the template or not * - * @return Boolean true if the value is even, false otherwise + * @return string The rendered template */ -function twig_test_even($value) +function twig_include(Twig_Environment $env, $context, $template, $variables = array(), $withContext = true, $ignoreMissing = false, $sandboxed = false) { - return $value % 2 == 0; -} + if ($withContext) { + $variables = array_merge($context, $variables); + } -/** - * Checks if a number is odd. - * - *
    - *  {{ var is odd }}
    - * 
    - * - * @param integer $value An integer - * - * @return Boolean true if the value is odd, false otherwise - */ -function twig_test_odd($value) -{ - return $value % 2 == 1; -} + if ($isSandboxed = $sandboxed && $env->hasExtension('sandbox')) { + $sandbox = $env->getExtension('sandbox'); + if (!$alreadySandboxed = $sandbox->isSandboxed()) { + $sandbox->enableSandbox(); + } + } -/** - * Checks if a variable is the exact same value as a constant. - * - *
    - *  {% if post.status is constant('Post::PUBLISHED') %}
    - *    the status attribute is exactly the same as Post::PUBLISHED
    - *  {% endif %}
    - * 
    - * - * @param mixed $value A PHP value - * @param mixed $constant The constant to test against - * - * @return Boolean true if the value is the same as the constant, false otherwise - */ -function twig_test_constant($value, $constant) -{ - return constant($constant) === $value; + try { + return $env->resolveTemplate($template)->render($variables); + } catch (Twig_Error_Loader $e) { + if (!$ignoreMissing) { + throw $e; + } + } + + if ($isSandboxed && !$alreadySandboxed) { + $sandbox->disableSandbox(); + } } /** - * Checks if a variable is defined in the current context. - * - *
    - * {# defined works with variable names #}
    - * {% if foo is defined %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    + * Provides the ability to get constants from instances as well as class/global constants. * - * @param mixed $name A PHP variable - * @param array $context The current context + * @param string $constant The name of the constant + * @param null|object $object The object to get the constant from * - * @return Boolean true if the value is defined, false otherwise + * @return string */ -function twig_test_defined($name, $context) +function twig_constant($constant, $object = null) { - return array_key_exists($name, $context); + if (null !== $object) { + $constant = get_class($object).'::'.$constant; + } + + return constant($constant); } /** - * Checks if a variable is empty. - * - *
    - * {# evaluates to true if the foo variable is null, false, or the empty string #}
    - * {% if foo is empty %}
    - *     {# ... #}
    - * {% endif %}
    - * 
    + * Batches item. * - * @param mixed $value A PHP variable + * @param array $items An array of items + * @param integer $size The size of the batch + * @param string $fill A string to fill missing items * - * @return Boolean true if the value is empty, false otherwise + * @return array */ -function twig_test_empty($value) +function twig_array_batch($items, $size, $fill = null) { - if ($value instanceof Countable) { - return 0 == count($value); + if ($items instanceof Traversable) { + $items = iterator_to_array($items, false); } - return false === $value || (empty($value) && '0' != $value); + + $size = ceil($size); + + $result = array_chunk($items, $size, true); + + if (null !== $fill) { + $last = count($result) - 1; + $result[$last] = array_merge( + $result[$last], + array_fill(0, $size - count($result[$last]), $fill) + ); + } + + return $result; } diff --git a/inc/lib/Twig/Extension/Debug.php b/inc/lib/Twig/Extension/Debug.php new file mode 100644 index 00000000..e3a85bfe --- /dev/null +++ b/inc/lib/Twig/Extension/Debug.php @@ -0,0 +1,71 @@ + $isDumpOutputHtmlSafe ? array('html') : array(), 'needs_context' => true, 'needs_environment' => true)), + ); + } + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + public function getName() + { + return 'debug'; + } +} + +function twig_var_dump(Twig_Environment $env, $context) +{ + if (!$env->isDebug()) { + return; + } + + ob_start(); + + $count = func_num_args(); + if (2 === $count) { + $vars = array(); + foreach ($context as $key => $value) { + if (!$value instanceof Twig_Template) { + $vars[$key] = $value; + } + } + + var_dump($vars); + } else { + for ($i = 2; $i < $count; $i++) { + var_dump(func_get_arg($i)); + } + } + + return ob_get_clean(); +} diff --git a/inc/lib/Twig/Extension/Escaper.php b/inc/lib/Twig/Extension/Escaper.php index 43ae1113..c9a7f68e 100644 --- a/inc/lib/Twig/Extension/Escaper.php +++ b/inc/lib/Twig/Extension/Escaper.php @@ -10,11 +10,11 @@ */ class Twig_Extension_Escaper extends Twig_Extension { - protected $autoescape; + protected $defaultStrategy; - public function __construct($autoescape = true) + public function __construct($defaultStrategy = 'html') { - $this->autoescape = $autoescape; + $this->setDefaultStrategy($defaultStrategy); } /** @@ -45,13 +45,44 @@ class Twig_Extension_Escaper extends Twig_Extension public function getFilters() { return array( - 'raw' => new Twig_Filter_Function('twig_raw_filter', array('is_safe' => array('all'))), + new Twig_SimpleFilter('raw', 'twig_raw_filter', array('is_safe' => array('all'))), ); } - public function isGlobal() + /** + * Sets the default strategy to use when not defined by the user. + * + * The strategy can be a valid PHP callback that takes the template + * "filename" as an argument and returns the strategy to use. + * + * @param mixed $defaultStrategy An escaping strategy + */ + public function setDefaultStrategy($defaultStrategy) + { + // for BC + if (true === $defaultStrategy) { + $defaultStrategy = 'html'; + } + + $this->defaultStrategy = $defaultStrategy; + } + + /** + * Gets the default strategy to use when not defined by the user. + * + * @param string $filename The template "filename" + * + * @return string The default strategy to use for the template + */ + public function getDefaultStrategy($filename) { - return $this->autoescape; + // disable string callables to avoid calling a function named html or js, + // or any other upcoming escaping strategy + if (!is_string($this->defaultStrategy) && is_callable($this->defaultStrategy)) { + return call_user_func($this->defaultStrategy, $filename); + } + + return $this->defaultStrategy; } /** @@ -74,4 +105,3 @@ function twig_raw_filter($string) { return $string; } - diff --git a/inc/lib/Twig/Extension/Staging.php b/inc/lib/Twig/Extension/Staging.php new file mode 100644 index 00000000..8ab0f459 --- /dev/null +++ b/inc/lib/Twig/Extension/Staging.php @@ -0,0 +1,113 @@ + + */ +class Twig_Extension_Staging extends Twig_Extension +{ + protected $functions = array(); + protected $filters = array(); + protected $visitors = array(); + protected $tokenParsers = array(); + protected $globals = array(); + protected $tests = array(); + + public function addFunction($name, $function) + { + $this->functions[$name] = $function; + } + + /** + * {@inheritdoc} + */ + public function getFunctions() + { + return $this->functions; + } + + public function addFilter($name, $filter) + { + $this->filters[$name] = $filter; + } + + /** + * {@inheritdoc} + */ + public function getFilters() + { + return $this->filters; + } + + public function addNodeVisitor(Twig_NodeVisitorInterface $visitor) + { + $this->visitors[] = $visitor; + } + + /** + * {@inheritdoc} + */ + public function getNodeVisitors() + { + return $this->visitors; + } + + public function addTokenParser(Twig_TokenParserInterface $parser) + { + $this->tokenParsers[] = $parser; + } + + /** + * {@inheritdoc} + */ + public function getTokenParsers() + { + return $this->tokenParsers; + } + + public function addGlobal($name, $value) + { + $this->globals[$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function getGlobals() + { + return $this->globals; + } + + public function addTest($name, $test) + { + $this->tests[$name] = $test; + } + + /** + * {@inheritdoc} + */ + public function getTests() + { + return $this->tests; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'staging'; + } +} diff --git a/inc/lib/Twig/Extension/StringLoader.php b/inc/lib/Twig/Extension/StringLoader.php new file mode 100644 index 00000000..20f3f994 --- /dev/null +++ b/inc/lib/Twig/Extension/StringLoader.php @@ -0,0 +1,64 @@ + true)), + ); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'string_loader'; + } +} + +/** + * Loads a template from a string. + * + *
    + * {{ include(template_from_string("Hello {{ name }}")) }}
    + * 
    + * + * @param Twig_Environment $env A Twig_Environment instance + * @param string $template A template as a string + * + * @return Twig_Template A Twig_Template instance + */ +function twig_template_from_string(Twig_Environment $env, $template) +{ + static $loader; + + if (null === $loader) { + $loader = new Twig_Loader_String(); + } + + $current = $env->getLoader(); + $env->setLoader($loader); + try { + $template = $env->loadTemplate($template); + } catch (Exception $e) { + $env->setLoader($current); + + throw $e; + } + $env->setLoader($current); + + return $template; +} diff --git a/inc/lib/Twig/ExtensionInterface.php b/inc/lib/Twig/ExtensionInterface.php index f8b232a5..f189e9d9 100644 --- a/inc/lib/Twig/ExtensionInterface.php +++ b/inc/lib/Twig/ExtensionInterface.php @@ -12,8 +12,7 @@ /** * Interface implemented by extension classes. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_ExtensionInterface { @@ -24,61 +23,61 @@ interface Twig_ExtensionInterface * * @param Twig_Environment $environment The current Twig_Environment instance */ - function initRuntime(Twig_Environment $environment); + public function initRuntime(Twig_Environment $environment); /** * Returns the token parser instances to add to the existing list. * * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances */ - function getTokenParsers(); + public function getTokenParsers(); /** * Returns the node visitor instances to add to the existing list. * * @return array An array of Twig_NodeVisitorInterface instances */ - function getNodeVisitors(); + public function getNodeVisitors(); /** * Returns a list of filters to add to the existing list. * * @return array An array of filters */ - function getFilters(); + public function getFilters(); /** * Returns a list of tests to add to the existing list. * * @return array An array of tests */ - function getTests(); + public function getTests(); /** * Returns a list of functions to add to the existing list. * * @return array An array of functions */ - function getFunctions(); + public function getFunctions(); /** * Returns a list of operators to add to the existing list. * * @return array An array of operators */ - function getOperators(); + public function getOperators(); /** - * Returns a list of global functions to add to the existing list. + * Returns a list of global variables to add to the existing list. * - * @return array An array of global functions + * @return array An array of global variables */ - function getGlobals(); + public function getGlobals(); /** * Returns the name of the extension. * * @return string The extension name */ - function getName(); + public function getName(); } diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 58a98c40..8c8d9456 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -23,7 +23,6 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension 'count' => new Twig_Filter_Function('count'), 'ago' => new Twig_Filter_Function('ago'), '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') @@ -61,10 +60,6 @@ function twig_timezone_function() { return 'Z'; } -function twig_split_filter($str, $delim) { - return explode($delim, $str); -} - function twig_push_filter($array, $value) { array_push($array, $value); return $array; diff --git a/inc/lib/Twig/Filter.php b/inc/lib/Twig/Filter.php index 9595a1a8..5cfbb662 100644 --- a/inc/lib/Twig/Filter.php +++ b/inc/lib/Twig/Filter.php @@ -12,12 +12,15 @@ /** * Represents a template filter. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFilter instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -abstract class Twig_Filter implements Twig_FilterInterface +abstract class Twig_Filter implements Twig_FilterInterface, Twig_FilterCallableInterface { protected $options; + protected $arguments = array(); public function __construct(array $options = array()) { @@ -25,9 +28,21 @@ abstract class Twig_Filter implements Twig_FilterInterface 'needs_environment' => false, 'needs_context' => false, 'pre_escape' => null, + 'preserves_safety' => null, + 'callable' => null, ), $options); } + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + public function needsEnvironment() { return $this->options['needs_environment']; @@ -47,12 +62,20 @@ abstract class Twig_Filter implements Twig_FilterInterface if (isset($this->options['is_safe_callback'])) { return call_user_func($this->options['is_safe_callback'], $filterArgs); } + } - return array(); + public function getPreservesSafety() + { + return $this->options['preserves_safety']; } public function getPreEscape() { return $this->options['pre_escape']; } + + public function getCallable() + { + return $this->options['callable']; + } } diff --git a/inc/lib/Twig/Filter/Function.php b/inc/lib/Twig/Filter/Function.php index 1de078b2..ad374a55 100644 --- a/inc/lib/Twig/Filter/Function.php +++ b/inc/lib/Twig/Filter/Function.php @@ -12,8 +12,10 @@ /** * Represents a function template filter. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFilter instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ class Twig_Filter_Function extends Twig_Filter { @@ -21,6 +23,8 @@ class Twig_Filter_Function extends Twig_Filter public function __construct($function, array $options = array()) { + $options['callable'] = $function; + parent::__construct($options); $this->function = $function; diff --git a/inc/lib/Twig/Filter/Method.php b/inc/lib/Twig/Filter/Method.php index d831e0f2..63c8c3be 100644 --- a/inc/lib/Twig/Filter/Method.php +++ b/inc/lib/Twig/Filter/Method.php @@ -12,15 +12,20 @@ /** * Represents a method template filter. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFilter instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ class Twig_Filter_Method extends Twig_Filter { - protected $extension, $method; + protected $extension; + protected $method; public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) { + $options['callable'] = array($extension, $method); + parent::__construct($options); $this->extension = $extension; diff --git a/inc/lib/Twig/Filter/Node.php b/inc/lib/Twig/Filter/Node.php new file mode 100644 index 00000000..8744c5e0 --- /dev/null +++ b/inc/lib/Twig/Filter/Node.php @@ -0,0 +1,39 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Filter_Node extends Twig_Filter +{ + protected $class; + + public function __construct($class, array $options = array()) + { + parent::__construct($options); + + $this->class = $class; + } + + public function getClass() + { + return $this->class; + } + + public function compile() + { + } +} diff --git a/inc/lib/Twig/FilterCallableInterface.php b/inc/lib/Twig/FilterCallableInterface.php new file mode 100644 index 00000000..145534df --- /dev/null +++ b/inc/lib/Twig/FilterCallableInterface.php @@ -0,0 +1,23 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +interface Twig_FilterCallableInterface +{ + public function getCallable(); +} diff --git a/inc/lib/Twig/FilterInterface.php b/inc/lib/Twig/FilterInterface.php index 4ac19ceb..5319ecc9 100644 --- a/inc/lib/Twig/FilterInterface.php +++ b/inc/lib/Twig/FilterInterface.php @@ -12,8 +12,10 @@ /** * Represents a template filter. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFilter instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_FilterInterface { @@ -22,13 +24,19 @@ interface Twig_FilterInterface * * @return string The PHP code for the filter */ - function compile(); + public function compile(); + + public function needsEnvironment(); + + public function needsContext(); + + public function getSafe(Twig_Node $filterArgs); - function needsEnvironment(); + public function getPreservesSafety(); - function needsContext(); + public function getPreEscape(); - function getSafe(Twig_Node $filterArgs); + public function setArguments($arguments); - function getPreEscape(); + public function getArguments(); } diff --git a/inc/lib/Twig/Function.php b/inc/lib/Twig/Function.php index 1197924a..b5ffb2b0 100644 --- a/inc/lib/Twig/Function.php +++ b/inc/lib/Twig/Function.php @@ -12,21 +12,35 @@ /** * Represents a template function. * - * @package twig - * @author Fabien Potencier + * Use Twig_SimpleFunction instead. + * + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -abstract class Twig_Function implements Twig_FunctionInterface +abstract class Twig_Function implements Twig_FunctionInterface, Twig_FunctionCallableInterface { protected $options; + protected $arguments = array(); public function __construct(array $options = array()) { $this->options = array_merge(array( 'needs_environment' => false, 'needs_context' => false, + 'callable' => null, ), $options); } + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + public function needsEnvironment() { return $this->options['needs_environment']; @@ -49,4 +63,9 @@ abstract class Twig_Function implements Twig_FunctionInterface return array(); } + + public function getCallable() + { + return $this->options['callable']; + } } diff --git a/inc/lib/Twig/Function/Function.php b/inc/lib/Twig/Function/Function.php index 3237d8c5..d1e1b96a 100644 --- a/inc/lib/Twig/Function/Function.php +++ b/inc/lib/Twig/Function/Function.php @@ -13,8 +13,10 @@ /** * Represents a function template function. * - * @package twig - * @author Arnaud Le Blanc + * Use Twig_SimpleFunction instead. + * + * @author Arnaud Le Blanc + * @deprecated since 1.12 (to be removed in 2.0) */ class Twig_Function_Function extends Twig_Function { @@ -22,6 +24,8 @@ class Twig_Function_Function extends Twig_Function public function __construct($function, array $options = array()) { + $options['callable'] = $function; + parent::__construct($options); $this->function = $function; diff --git a/inc/lib/Twig/Function/Method.php b/inc/lib/Twig/Function/Method.php index 7328566e..67039a95 100644 --- a/inc/lib/Twig/Function/Method.php +++ b/inc/lib/Twig/Function/Method.php @@ -13,15 +13,20 @@ /** * Represents a method template function. * - * @package twig - * @author Arnaud Le Blanc + * Use Twig_SimpleFunction instead. + * + * @author Arnaud Le Blanc + * @deprecated since 1.12 (to be removed in 2.0) */ class Twig_Function_Method extends Twig_Function { - protected $extension, $method; + protected $extension; + protected $method; public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) { + $options['callable'] = array($extension, $method); + parent::__construct($options); $this->extension = $extension; diff --git a/inc/lib/Twig/Function/Node.php b/inc/lib/Twig/Function/Node.php new file mode 100644 index 00000000..06a0d0db --- /dev/null +++ b/inc/lib/Twig/Function/Node.php @@ -0,0 +1,39 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Function_Node extends Twig_Function +{ + protected $class; + + public function __construct($class, array $options = array()) + { + parent::__construct($options); + + $this->class = $class; + } + + public function getClass() + { + return $this->class; + } + + public function compile() + { + } +} diff --git a/inc/lib/Twig/FunctionCallableInterface.php b/inc/lib/Twig/FunctionCallableInterface.php new file mode 100644 index 00000000..0aab4f5e --- /dev/null +++ b/inc/lib/Twig/FunctionCallableInterface.php @@ -0,0 +1,23 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +interface Twig_FunctionCallableInterface +{ + public function getCallable(); +} diff --git a/inc/lib/Twig/FunctionInterface.php b/inc/lib/Twig/FunctionInterface.php index ccc9fd93..67f4f89c 100644 --- a/inc/lib/Twig/FunctionInterface.php +++ b/inc/lib/Twig/FunctionInterface.php @@ -13,8 +13,10 @@ /** * Represents a template function. * - * @package twig - * @author Arnaud Le Blanc + * Use Twig_SimpleFunction instead. + * + * @author Arnaud Le Blanc + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_FunctionInterface { @@ -23,11 +25,15 @@ interface Twig_FunctionInterface * * @return string The PHP code for the function */ - function compile(); + public function compile(); + + public function needsEnvironment(); + + public function needsContext(); - function needsEnvironment(); + public function getSafe(Twig_Node $filterArgs); - function needsContext(); + public function setArguments($arguments); - function getSafe(Twig_Node $filterArgs); + public function getArguments(); } diff --git a/inc/lib/Twig/Lexer.php b/inc/lib/Twig/Lexer.php index 868a814e..000b038e 100644 --- a/inc/lib/Twig/Lexer.php +++ b/inc/lib/Twig/Lexer.php @@ -13,8 +13,7 @@ /** * Lexes a template string. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Lexer implements Twig_LexerInterface { @@ -24,21 +23,28 @@ class Twig_Lexer implements Twig_LexerInterface protected $lineno; protected $end; protected $state; + protected $states; protected $brackets; - protected $env; protected $filename; protected $options; - protected $operatorRegex; - - const STATE_DATA = 0; - const STATE_BLOCK = 1; - const STATE_VAR = 2; - - const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; - const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; - const REGEX_STRING = '/"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; - const PUNCTUATION = '()[]{}?:.,|'; + protected $regexes; + protected $position; + protected $positions; + protected $currentVarBlockLine; + + const STATE_DATA = 0; + const STATE_BLOCK = 1; + const STATE_VAR = 2; + const STATE_STRING = 3; + const STATE_INTERPOLATION = 4; + + const REGEX_NAME = '/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/A'; + const REGEX_NUMBER = '/[0-9]+(?:\.[0-9]+)?/A'; + const REGEX_STRING = '/"([^#"\\\\]*(?:\\\\.[^#"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\'/As'; + const REGEX_DQ_STRING_DELIM = '/"/A'; + const REGEX_DQ_STRING_PART = '/[^#"\\\\]*(?:(?:\\\\.|#(?!\{))[^#"\\\\]*)*/As'; + const PUNCTUATION = '()[]{}?:.,|'; public function __construct(Twig_Environment $env, array $options = array()) { @@ -49,14 +55,28 @@ class Twig_Lexer implements Twig_LexerInterface 'tag_block' => array('{%', '%}'), 'tag_variable' => array('{{', '}}'), 'whitespace_trim' => '-', + 'interpolation' => array('#{', '}'), ), $options); + + $this->regexes = array( + 'lex_var' => '/\s*'.preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_variable'][1], '/').'/A', + 'lex_block' => '/\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')\n?/A', + 'lex_raw_data' => '/('.preg_quote($this->options['tag_block'][0].$this->options['whitespace_trim'], '/').'|'.preg_quote($this->options['tag_block'][0], '/').')\s*(?:end%s)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/s', + 'operator' => $this->getOperatorRegex(), + 'lex_comment' => '/(?:'.preg_quote($this->options['whitespace_trim'], '/').preg_quote($this->options['tag_comment'][1], '/').'\s*|'.preg_quote($this->options['tag_comment'][1], '/').')\n?/s', + 'lex_block_raw' => '/\s*(raw|verbatim)\s*(?:'.preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/').'\s*|\s*'.preg_quote($this->options['tag_block'][1], '/').')/As', + 'lex_block_line' => '/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', + 'lex_tokens_start' => '/('.preg_quote($this->options['tag_variable'][0], '/').'|'.preg_quote($this->options['tag_block'][0], '/').'|'.preg_quote($this->options['tag_comment'][0], '/').')('.preg_quote($this->options['whitespace_trim'], '/').')?/s', + 'interpolation_start' => '/'.preg_quote($this->options['interpolation'][0], '/').'\s*/A', + 'interpolation_end' => '/\s*'.preg_quote($this->options['interpolation'][1], '/').'/A', + ); } /** * Tokenizes a source code. * - * @param string $code The source code - * @param string $filename A unique identifier for the source code + * @param string $code The source code + * @param string $filename A unique identifier for the source code * * @return Twig_TokenStream A token stream instance */ @@ -74,7 +94,13 @@ class Twig_Lexer implements Twig_LexerInterface $this->end = strlen($this->code); $this->tokens = array(); $this->state = self::STATE_DATA; + $this->states = array(); $this->brackets = array(); + $this->position = -1; + + // find all token starts in one go + preg_match_all($this->regexes['lex_tokens_start'], $this->code, $matches, PREG_OFFSET_CAPTURE); + $this->positions = $matches; while ($this->cursor < $this->end) { // dispatch to the lexing functions depending @@ -91,6 +117,14 @@ class Twig_Lexer implements Twig_LexerInterface case self::STATE_VAR: $this->lexVar(); break; + + case self::STATE_STRING: + $this->lexString(); + break; + + case self::STATE_INTERPOLATION: + $this->lexInterpolation(); + break; } } @@ -110,77 +144,66 @@ class Twig_Lexer implements Twig_LexerInterface protected function lexData() { - $pos = $this->end; - $append = ''; - - // Find the first token after the cursor - foreach (array('tag_comment', 'tag_variable', 'tag_block') as $type) { - $tmpPos = strpos($this->code, $this->options[$type][0], $this->cursor); - if (false !== $tmpPos && $tmpPos < $pos) { - $trimBlock = false; - $append = ''; - $pos = $tmpPos; - $token = $this->options[$type][0]; - if (strpos($this->code, $this->options['whitespace_trim'], $pos) === ($pos + strlen($token))) { - $trimBlock = true; - $append = $this->options['whitespace_trim']; - } - } - } - // if no matches are left we return the rest of the template as simple text token - if ($pos === $this->end) { + if ($this->position == count($this->positions[0]) - 1) { $this->pushToken(Twig_Token::TEXT_TYPE, substr($this->code, $this->cursor)); $this->cursor = $this->end; + return; } + // Find the first token after the current cursor + $position = $this->positions[0][++$this->position]; + while ($position[1] < $this->cursor) { + if ($this->position == count($this->positions[0]) - 1) { + return; + } + $position = $this->positions[0][++$this->position]; + } + // push the template text first - $text = $textContent = substr($this->code, $this->cursor, $pos - $this->cursor); - if (true === $trimBlock) { + $text = $textContent = substr($this->code, $this->cursor, $position[1] - $this->cursor); + if (isset($this->positions[2][$this->position][0])) { $text = rtrim($text); } $this->pushToken(Twig_Token::TEXT_TYPE, $text); - $this->moveCursor($textContent.$token.$append); + $this->moveCursor($textContent.$position[0]); - switch ($token) { + switch ($this->positions[1][$this->position][0]) { case $this->options['tag_comment'][0]: $this->lexComment(); break; case $this->options['tag_block'][0]: // raw data? - if (preg_match('/\s*raw\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', $this->code, $match, null, $this->cursor)) { + if (preg_match($this->regexes['lex_block_raw'], $this->code, $match, null, $this->cursor)) { $this->moveCursor($match[0]); - $this->lexRawData(); - $this->state = self::STATE_DATA; + $this->lexRawData($match[1]); // {% line \d+ %} - } else if (preg_match('/\s*line\s+(\d+)\s*'.preg_quote($this->options['tag_block'][1], '/').'/As', $this->code, $match, null, $this->cursor)) { + } elseif (preg_match($this->regexes['lex_block_line'], $this->code, $match, null, $this->cursor)) { $this->moveCursor($match[0]); $this->lineno = (int) $match[1]; - $this->state = self::STATE_DATA; } else { $this->pushToken(Twig_Token::BLOCK_START_TYPE); - $this->state = self::STATE_BLOCK; + $this->pushState(self::STATE_BLOCK); + $this->currentVarBlockLine = $this->lineno; } break; case $this->options['tag_variable'][0]: $this->pushToken(Twig_Token::VAR_START_TYPE); - $this->state = self::STATE_VAR; + $this->pushState(self::STATE_VAR); + $this->currentVarBlockLine = $this->lineno; break; } } protected function lexBlock() { - $trimTag = preg_quote($this->options['whitespace_trim'].$this->options['tag_block'][1], '/'); - $endTag = preg_quote($this->options['tag_block'][1], '/'); - - if (empty($this->brackets) && preg_match('/\s*(?:'.$trimTag.'\s*|\s*'.$endTag.')\n?/A', $this->code, $match, null, $this->cursor)) { + if (empty($this->brackets) && preg_match($this->regexes['lex_block'], $this->code, $match, null, $this->cursor)) { $this->pushToken(Twig_Token::BLOCK_END_TYPE); $this->moveCursor($match[0]); - $this->state = self::STATE_DATA; + $this->popState(); } else { $this->lexExpression(); } @@ -188,13 +211,10 @@ class Twig_Lexer implements Twig_LexerInterface protected function lexVar() { - $trimTag = preg_quote($this->options['whitespace_trim'].$this->options['tag_variable'][1], '/'); - $endTag = preg_quote($this->options['tag_variable'][1], '/'); - - if (empty($this->brackets) && preg_match('/\s*'.$trimTag.'\s*|\s*'.$endTag.'/A', $this->code, $match, null, $this->cursor)) { + if (empty($this->brackets) && preg_match($this->regexes['lex_var'], $this->code, $match, null, $this->cursor)) { $this->pushToken(Twig_Token::VAR_END_TYPE); $this->moveCursor($match[0]); - $this->state = self::STATE_DATA; + $this->popState(); } else { $this->lexExpression(); } @@ -207,12 +227,12 @@ class Twig_Lexer implements Twig_LexerInterface $this->moveCursor($match[0]); if ($this->cursor >= $this->end) { - throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable')); + throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $this->state === self::STATE_BLOCK ? 'block' : 'variable'), $this->currentVarBlockLine, $this->filename); } } // operators - if (preg_match($this->getOperatorRegex(), $this->code, $match, null, $this->cursor)) { + if (preg_match($this->regexes['operator'], $this->code, $match, null, $this->cursor)) { $this->pushToken(Twig_Token::OPERATOR_TYPE, $match[0]); $this->moveCursor($match[0]); } @@ -223,7 +243,11 @@ class Twig_Lexer implements Twig_LexerInterface } // numbers elseif (preg_match(self::REGEX_NUMBER, $this->code, $match, null, $this->cursor)) { - $this->pushToken(Twig_Token::NUMBER_TYPE, ctype_digit($match[0]) ? (int) $match[0] : (float) $match[0]); + $number = (float) $match[0]; // floats + if (ctype_digit($match[0]) && $number <= PHP_INT_MAX) { + $number = (int) $match[0]; // integers lower than the maximum + } + $this->pushToken(Twig_Token::NUMBER_TYPE, $number); $this->moveCursor($match[0]); } // punctuation @@ -252,35 +276,80 @@ class Twig_Lexer implements Twig_LexerInterface $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes(substr($match[0], 1, -1))); $this->moveCursor($match[0]); } + // opening double quoted string + elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { + $this->brackets[] = array('"', $this->lineno); + $this->pushState(self::STATE_STRING); + $this->moveCursor($match[0]); + } // unlexable else { throw new Twig_Error_Syntax(sprintf('Unexpected character "%s"', $this->code[$this->cursor]), $this->lineno, $this->filename); } } - protected function lexRawData() + protected function lexRawData($tag) { - if (!preg_match('/'.preg_quote($this->options['tag_block'][0], '/').'\s*endraw\s*'.preg_quote($this->options['tag_block'][1], '/').'/s', $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { - throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "block"')); + if (!preg_match(str_replace('%s', $tag, $this->regexes['lex_raw_data']), $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + throw new Twig_Error_Syntax(sprintf('Unexpected end of file: Unclosed "%s" block', $tag), $this->lineno, $this->filename); } + $text = substr($this->code, $this->cursor, $match[0][1] - $this->cursor); - $this->pushToken(Twig_Token::TEXT_TYPE, $text); $this->moveCursor($text.$match[0][0]); + + if (false !== strpos($match[1][0], $this->options['whitespace_trim'])) { + $text = rtrim($text); + } + + $this->pushToken(Twig_Token::TEXT_TYPE, $text); } protected function lexComment() { - $commentEndRegex = '/(?:'.preg_quote($this->options['whitespace_trim'], '/') - .preg_quote($this->options['tag_comment'][1], '/').'\s*|' - .preg_quote($this->options['tag_comment'][1], '/').')\n?/s'; - - if (!preg_match($commentEndRegex, $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { + if (!preg_match($this->regexes['lex_comment'], $this->code, $match, PREG_OFFSET_CAPTURE, $this->cursor)) { throw new Twig_Error_Syntax('Unclosed comment', $this->lineno, $this->filename); } $this->moveCursor(substr($this->code, $this->cursor, $match[0][1] - $this->cursor).$match[0][0]); } + protected function lexString() + { + if (preg_match($this->regexes['interpolation_start'], $this->code, $match, null, $this->cursor)) { + $this->brackets[] = array($this->options['interpolation'][0], $this->lineno); + $this->pushToken(Twig_Token::INTERPOLATION_START_TYPE); + $this->moveCursor($match[0]); + $this->pushState(self::STATE_INTERPOLATION); + + } elseif (preg_match(self::REGEX_DQ_STRING_PART, $this->code, $match, null, $this->cursor) && strlen($match[0]) > 0) { + $this->pushToken(Twig_Token::STRING_TYPE, stripcslashes($match[0])); + $this->moveCursor($match[0]); + + } elseif (preg_match(self::REGEX_DQ_STRING_DELIM, $this->code, $match, null, $this->cursor)) { + + list($expect, $lineno) = array_pop($this->brackets); + if ($this->code[$this->cursor] != '"') { + throw new Twig_Error_Syntax(sprintf('Unclosed "%s"', $expect), $lineno, $this->filename); + } + + $this->popState(); + ++$this->cursor; + } + } + + protected function lexInterpolation() + { + $bracket = end($this->brackets); + if ($this->options['interpolation'][0] === $bracket[0] && preg_match($this->regexes['interpolation_end'], $this->code, $match, null, $this->cursor)) { + array_pop($this->brackets); + $this->pushToken(Twig_Token::INTERPOLATION_END_TYPE); + $this->moveCursor($match[0]); + $this->popState(); + } else { + $this->lexExpression(); + } + } + protected function pushToken($type, $value = '') { // do not push empty text tokens @@ -299,10 +368,6 @@ class Twig_Lexer implements Twig_LexerInterface protected function getOperatorRegex() { - if (null !== $this->operatorRegex) { - return $this->operatorRegex; - } - $operators = array_merge( array('='), array_keys($this->env->getUnaryOperators()), @@ -317,12 +382,27 @@ class Twig_Lexer implements Twig_LexerInterface // an operator that ends with a character must be followed by // a whitespace or a parenthesis if (ctype_alpha($operator[$length - 1])) { - $regex[] = preg_quote($operator, '/').'(?=[ ()])'; + $regex[] = preg_quote($operator, '/').'(?=[\s()])'; } else { $regex[] = preg_quote($operator, '/'); } } - return $this->operatorRegex = '/'.implode('|', $regex).'/A'; + return '/'.implode('|', $regex).'/A'; + } + + protected function pushState($state) + { + $this->states[] = $this->state; + $this->state = $state; + } + + protected function popState() + { + if (0 === count($this->states)) { + throw new Exception('Cannot pop state without a previous state'); + } + + $this->state = array_pop($this->states); } } diff --git a/inc/lib/Twig/LexerInterface.php b/inc/lib/Twig/LexerInterface.php index 02233849..4b83f81b 100644 --- a/inc/lib/Twig/LexerInterface.php +++ b/inc/lib/Twig/LexerInterface.php @@ -12,18 +12,18 @@ /** * Interface implemented by lexer classes. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_LexerInterface { /** * Tokenizes a source code. * - * @param string $code The source code - * @param string $filename A unique identifier for the source code + * @param string $code The source code + * @param string $filename A unique identifier for the source code * * @return Twig_TokenStream A token stream instance */ - function tokenize($code, $filename = null); + public function tokenize($code, $filename = null); } diff --git a/inc/lib/Twig/Loader/Array.php b/inc/lib/Twig/Loader/Array.php index e8dc1605..89087aea 100644 --- a/inc/lib/Twig/Loader/Array.php +++ b/inc/lib/Twig/Loader/Array.php @@ -17,10 +17,9 @@ * source code of the template). If you don't want to see your cache grows out of * control, you need to take care of clearing the old cache file by yourself. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Loader_Array implements Twig_LoaderInterface +class Twig_Loader_Array implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { protected $templates; @@ -47,18 +46,15 @@ class Twig_Loader_Array implements Twig_LoaderInterface */ public function setTemplate($name, $template) { - $this->templates[$name] = $template; + $this->templates[(string) $name] = $template; } /** - * Gets the source code of a template, given its name. - * - * @param string $name The name of the template to load - * - * @return string The template source code + * {@inheritdoc} */ public function getSource($name) { + $name = (string) $name; if (!isset($this->templates[$name])) { throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); } @@ -67,14 +63,19 @@ class Twig_Loader_Array implements Twig_LoaderInterface } /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key + * {@inheritdoc} + */ + public function exists($name) + { + return isset($this->templates[(string) $name]); + } + + /** + * {@inheritdoc} */ public function getCacheKey($name) { + $name = (string) $name; if (!isset($this->templates[$name])) { throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); } @@ -83,13 +84,15 @@ class Twig_Loader_Array implements Twig_LoaderInterface } /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template + * {@inheritdoc} */ public function isFresh($name, $time) { + $name = (string) $name; + if (!isset($this->templates[$name])) { + throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); + } + return true; } } diff --git a/inc/lib/Twig/Loader/Chain.php b/inc/lib/Twig/Loader/Chain.php index 48dd8b84..1f1cf065 100644 --- a/inc/lib/Twig/Loader/Chain.php +++ b/inc/lib/Twig/Loader/Chain.php @@ -12,11 +12,11 @@ /** * Loads templates from other loaders. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Loader_Chain implements Twig_LoaderInterface +class Twig_Loader_Chain implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { + private $hasSourceCache = array(); protected $loaders; /** @@ -40,61 +40,100 @@ class Twig_Loader_Chain implements Twig_LoaderInterface public function addLoader(Twig_LoaderInterface $loader) { $this->loaders[] = $loader; + $this->hasSourceCache = array(); } /** - * Gets the source code of a template, given its name. - * - * @param string $name The name of the template to load - * - * @return string The template source code + * {@inheritdoc} */ public function getSource($name) { + $exceptions = array(); foreach ($this->loaders as $loader) { + if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + try { return $loader->getSource($name); } catch (Twig_Error_Loader $e) { + $exceptions[] = $e->getMessage(); } } - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); + throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(', ', $exceptions))); } /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key + * {@inheritdoc} + */ + public function exists($name) + { + $name = (string) $name; + + if (isset($this->hasSourceCache[$name])) { + return $this->hasSourceCache[$name]; + } + + foreach ($this->loaders as $loader) { + if ($loader instanceof Twig_ExistsLoaderInterface) { + if ($loader->exists($name)) { + return $this->hasSourceCache[$name] = true; + } + + continue; + } + + try { + $loader->getSource($name); + + return $this->hasSourceCache[$name] = true; + } catch (Twig_Error_Loader $e) { + } + } + + return $this->hasSourceCache[$name] = false; + } + + /** + * {@inheritdoc} */ public function getCacheKey($name) { + $exceptions = array(); foreach ($this->loaders as $loader) { + if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + try { return $loader->getCacheKey($name); } catch (Twig_Error_Loader $e) { + $exceptions[] = get_class($loader).': '.$e->getMessage(); } } - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); + throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions))); } /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template + * {@inheritdoc} */ public function isFresh($name, $time) { + $exceptions = array(); foreach ($this->loaders as $loader) { + if ($loader instanceof Twig_ExistsLoaderInterface && !$loader->exists($name)) { + continue; + } + try { return $loader->isFresh($name, $time); } catch (Twig_Error_Loader $e) { + $exceptions[] = get_class($loader).': '.$e->getMessage(); } } - throw new Twig_Error_Loader(sprintf('Template "%s" is not defined.', $name)); + throw new Twig_Error_Loader(sprintf('Template "%s" is not defined (%s).', $name, implode(' ', $exceptions))); } } diff --git a/inc/lib/Twig/Loader/Filesystem.php b/inc/lib/Twig/Loader/Filesystem.php index be348aa3..f9211cbd 100644 --- a/inc/lib/Twig/Loader/Filesystem.php +++ b/inc/lib/Twig/Loader/Filesystem.php @@ -12,10 +12,9 @@ /** * Loads template from the filesystem. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Loader_Filesystem implements Twig_LoaderInterface +class Twig_Loader_Filesystem implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { protected $paths; protected $cache; @@ -25,44 +24,64 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface * * @param string|array $paths A path or an array of paths where to look for templates */ - public function __construct($paths) + public function __construct($paths = array()) { - $this->setPaths($paths); + if ($paths) { + $this->setPaths($paths); + } } /** * Returns the paths to the templates. * + * @param string $namespace A path namespace + * * @return array The array of paths where to look for templates */ - public function getPaths() + public function getPaths($namespace = '__main__') + { + return isset($this->paths[$namespace]) ? $this->paths[$namespace] : array(); + } + + /** + * Returns the path namespaces. + * + * The "__main__" namespace is always defined. + * + * @return array The array of defined namespaces + */ + public function getNamespaces() { - return $this->paths; + return array_keys($this->paths); } /** * Sets the paths where templates are stored. * - * @param string|array $paths A path or an array of paths where to look for templates + * @param string|array $paths A path or an array of paths where to look for templates + * @param string $namespace A path namespace */ - public function setPaths($paths) + public function setPaths($paths, $namespace = '__main__') { if (!is_array($paths)) { $paths = array($paths); } - $this->paths = array(); + $this->paths[$namespace] = array(); foreach ($paths as $path) { - $this->addPath($path); + $this->addPath($path, $namespace); } } /** * Adds a path where templates are stored. * - * @param string $path A path where to look for templates + * @param string $path A path where to look for templates + * @param string $namespace A path name + * + * @throws Twig_Error_Loader */ - public function addPath($path) + public function addPath($path, $namespace = '__main__') { // invalidate the cache $this->cache = array(); @@ -71,15 +90,37 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); } - $this->paths[] = $path; + $this->paths[$namespace][] = rtrim($path, '/\\'); } /** - * Gets the source code of a template, given its name. + * Prepends a path where templates are stored. * - * @param string $name The name of the template to load + * @param string $path A path where to look for templates + * @param string $namespace A path name * - * @return string The template source code + * @throws Twig_Error_Loader + */ + public function prependPath($path, $namespace = '__main__') + { + // invalidate the cache + $this->cache = array(); + + if (!is_dir($path)) { + throw new Twig_Error_Loader(sprintf('The "%s" directory does not exist.', $path)); + } + + $path = rtrim($path, '/\\'); + + if (!isset($this->paths[$namespace])) { + $this->paths[$namespace][] = $path; + } else { + array_unshift($this->paths[$namespace], $path); + } + } + + /** + * {@inheritdoc} */ public function getSource($name) { @@ -87,11 +128,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface } /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key + * {@inheritdoc} */ public function getCacheKey($name) { @@ -99,18 +136,36 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface } /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template + * {@inheritdoc} + */ + public function exists($name) + { + $name = (string) $name; + if (isset($this->cache[$name])) { + return true; + } + + try { + $this->findTemplate($name); + + return true; + } catch (Twig_Error_Loader $exception) { + return false; + } + } + + /** + * {@inheritdoc} */ public function isFresh($name, $time) { - return filemtime($this->findTemplate($name)) < $time; + return filemtime($this->findTemplate($name)) <= $time; } protected function findTemplate($name) { + $name = (string) $name; + // normalize name $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); @@ -120,13 +175,28 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface $this->validateName($name); - foreach ($this->paths as $path) { + $namespace = '__main__'; + if (isset($name[0]) && '@' == $name[0]) { + if (false === $pos = strpos($name, '/')) { + throw new Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "@namespace/template_name").', $name)); + } + + $namespace = substr($name, 1, $pos - 1); + + $name = substr($name, $pos + 1); + } + + if (!isset($this->paths[$namespace])) { + throw new Twig_Error_Loader(sprintf('There are no registered paths for namespace "%s".', $namespace)); + } + + foreach ($this->paths[$namespace] as $path) { if (is_file($path.'/'.$name)) { return $this->cache[$name] = $path.'/'.$name; } } - throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths))); + throw new Twig_Error_Loader(sprintf('Unable to find template "%s" (looked into: %s).', $name, implode(', ', $this->paths[$namespace]))); } protected function validateName($name) @@ -135,6 +205,7 @@ class Twig_Loader_Filesystem implements Twig_LoaderInterface throw new Twig_Error_Loader('A template name cannot contain NUL bytes.'); } + $name = ltrim($name, '/'); $parts = explode('/', $name); $level = 0; foreach ($parts as $part) { diff --git a/inc/lib/Twig/Loader/String.php b/inc/lib/Twig/Loader/String.php index 26eb0096..8ad9856c 100644 --- a/inc/lib/Twig/Loader/String.php +++ b/inc/lib/Twig/Loader/String.php @@ -12,22 +12,21 @@ /** * Loads a template from a string. * + * This loader should only be used for unit testing as it has many limitations + * (for instance, the include or extends tag does not make any sense for a string + * loader). + * * When using this loader with a cache mechanism, you should know that a new cache * key is generated each time a template content "changes" (the cache key being the * source code of the template). If you don't want to see your cache grows out of * control, you need to take care of clearing the old cache file by yourself. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Loader_String implements Twig_LoaderInterface +class Twig_Loader_String implements Twig_LoaderInterface, Twig_ExistsLoaderInterface { /** - * Gets the source code of a template, given its name. - * - * @param string $name The name of the template to load - * - * @return string The template source code + * {@inheritdoc} */ public function getSource($name) { @@ -35,11 +34,15 @@ class Twig_Loader_String implements Twig_LoaderInterface } /** - * Gets the cache key to use for the cache for a given template name. - * - * @param string $name The name of the template to load - * - * @return string The cache key + * {@inheritdoc} + */ + public function exists($name) + { + return true; + } + + /** + * {@inheritdoc} */ public function getCacheKey($name) { @@ -47,10 +50,7 @@ class Twig_Loader_String implements Twig_LoaderInterface } /** - * Returns true if the template is still fresh. - * - * @param string $name The template name - * @param timestamp $time The last modification time of the cached template + * {@inheritdoc} */ public function isFresh($name, $time) { diff --git a/inc/lib/Twig/LoaderInterface.php b/inc/lib/Twig/LoaderInterface.php index f0bd3a5b..927786d1 100644 --- a/inc/lib/Twig/LoaderInterface.php +++ b/inc/lib/Twig/LoaderInterface.php @@ -12,34 +12,41 @@ /** * Interface all loaders must implement. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_LoaderInterface { /** * Gets the source code of a template, given its name. * - * @param string $name The name of the template to load + * @param string $name The name of the template to load * * @return string The template source code + * + * @throws Twig_Error_Loader When $name is not found */ - function getSource($name); + public function getSource($name); /** * Gets the cache key to use for the cache for a given template name. * - * @param string $name The name of the template to load + * @param string $name The name of the template to load * * @return string The cache key + * + * @throws Twig_Error_Loader When $name is not found */ - function getCacheKey($name); + public function getCacheKey($name); /** * Returns true if the template is still fresh. * * @param string $name The template name * @param timestamp $time The last modification time of the cached template + * + * @return Boolean true if the template is fresh, false otherwise + * + * @throws Twig_Error_Loader When $name is not found */ - function isFresh($name, $time); + public function isFresh($name, $time); } diff --git a/inc/lib/Twig/Markup.php b/inc/lib/Twig/Markup.php index c1a1469c..69871fcb 100644 --- a/inc/lib/Twig/Markup.php +++ b/inc/lib/Twig/Markup.php @@ -12,20 +12,26 @@ /** * Marks a content as safe. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Markup +class Twig_Markup implements Countable { protected $content; + protected $charset; - public function __construct($content) + public function __construct($content, $charset) { $this->content = (string) $content; + $this->charset = $charset; } public function __toString() { return $this->content; } + + public function count() + { + return function_exists('mb_get_info') ? mb_strlen($this->content, $this->charset) : strlen($this->content); + } } diff --git a/inc/lib/Twig/Node.php b/inc/lib/Twig/Node.php index 22e65d45..931b4635 100644 --- a/inc/lib/Twig/Node.php +++ b/inc/lib/Twig/Node.php @@ -13,10 +13,9 @@ /** * Represents a node in the AST. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ -class Twig_Node implements Twig_NodeInterface, Countable, IteratorAggregate +class Twig_Node implements Twig_NodeInterface { protected $nodes; protected $attributes; @@ -134,12 +133,12 @@ class Twig_Node implements Twig_NodeInterface, Countable, IteratorAggregate * * @param string The attribute name * - * @return mixed The attribute value + * @return mixed The attribute value */ public function getAttribute($name) { if (!array_key_exists($name, $this->attributes)) { - throw new Twig_Error_Runtime(sprintf('Attribute "%s" does not exist for Node "%s".', $name, get_class($this))); + throw new LogicException(sprintf('Attribute "%s" does not exist for Node "%s".', $name, get_class($this))); } return $this->attributes[$name]; @@ -188,7 +187,7 @@ class Twig_Node implements Twig_NodeInterface, Countable, IteratorAggregate public function getNode($name) { if (!array_key_exists($name, $this->nodes)) { - throw new Twig_Error_Runtime(sprintf('Node "%s" does not exist for Node "%s".', $name, get_class($this))); + throw new LogicException(sprintf('Node "%s" does not exist for Node "%s".', $name, get_class($this))); } return $this->nodes[$name]; diff --git a/inc/lib/Twig/Node/AutoEscape.php b/inc/lib/Twig/Node/AutoEscape.php index a0c2ee6d..8f190e0b 100644 --- a/inc/lib/Twig/Node/AutoEscape.php +++ b/inc/lib/Twig/Node/AutoEscape.php @@ -18,8 +18,7 @@ * * If autoescaping is disabled, then the value is false. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_AutoEscape extends Twig_Node { diff --git a/inc/lib/Twig/Node/Block.php b/inc/lib/Twig/Node/Block.php index 5548ad06..50eb67ed 100644 --- a/inc/lib/Twig/Node/Block.php +++ b/inc/lib/Twig/Node/Block.php @@ -13,8 +13,7 @@ /** * Represents a block node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Block extends Twig_Node { diff --git a/inc/lib/Twig/Node/BlockReference.php b/inc/lib/Twig/Node/BlockReference.php index 53f6287c..013e369e 100644 --- a/inc/lib/Twig/Node/BlockReference.php +++ b/inc/lib/Twig/Node/BlockReference.php @@ -13,8 +13,7 @@ /** * Represents a block call node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_BlockReference extends Twig_Node implements Twig_NodeOutputInterface { diff --git a/inc/lib/Twig/Node/Body.php b/inc/lib/Twig/Node/Body.php new file mode 100644 index 00000000..3ffb1342 --- /dev/null +++ b/inc/lib/Twig/Node/Body.php @@ -0,0 +1,19 @@ + + */ +class Twig_Node_Body extends Twig_Node +{ +} diff --git a/inc/lib/Twig/Node/Do.php b/inc/lib/Twig/Node/Do.php new file mode 100644 index 00000000..c528066b --- /dev/null +++ b/inc/lib/Twig/Node/Do.php @@ -0,0 +1,38 @@ + + */ +class Twig_Node_Do extends Twig_Node +{ + public function __construct(Twig_Node_Expression $expr, $lineno, $tag = null) + { + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('') + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ; + } +} diff --git a/inc/lib/Twig/Node/Embed.php b/inc/lib/Twig/Node/Embed.php new file mode 100644 index 00000000..4c9456dc --- /dev/null +++ b/inc/lib/Twig/Node/Embed.php @@ -0,0 +1,38 @@ + + */ +class Twig_Node_Embed extends Twig_Node_Include +{ + // we don't inject the module to avoid node visitors to traverse it twice (as it will be already visited in the main module) + public function __construct($filename, $index, Twig_Node_Expression $variables = null, $only = false, $ignoreMissing = false, $lineno, $tag = null) + { + parent::__construct(new Twig_Node_Expression_Constant('not_used', $lineno), $variables, $only, $ignoreMissing, $lineno, $tag); + + $this->setAttribute('filename', $filename); + $this->setAttribute('index', $index); + } + + protected function addGetTemplate(Twig_Compiler $compiler) + { + $compiler + ->write("\$this->env->loadTemplate(") + ->string($this->getAttribute('filename')) + ->raw(', ') + ->string($this->getAttribute('index')) + ->raw(")") + ; + } +} diff --git a/inc/lib/Twig/Node/Expression.php b/inc/lib/Twig/Node/Expression.php index 13b170e5..a7382e7d 100644 --- a/inc/lib/Twig/Node/Expression.php +++ b/inc/lib/Twig/Node/Expression.php @@ -13,8 +13,7 @@ /** * Abstract class for all nodes that represents an expression. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ abstract class Twig_Node_Expression extends Twig_Node { diff --git a/inc/lib/Twig/Node/Expression/Array.php b/inc/lib/Twig/Node/Expression/Array.php index 2d860823..1da785fe 100644 --- a/inc/lib/Twig/Node/Expression/Array.php +++ b/inc/lib/Twig/Node/Expression/Array.php @@ -10,9 +10,54 @@ */ class Twig_Node_Expression_Array extends Twig_Node_Expression { + protected $index; + public function __construct(array $elements, $lineno) { parent::__construct($elements, array(), $lineno); + + $this->index = -1; + foreach ($this->getKeyValuePairs() as $pair) { + if ($pair['key'] instanceof Twig_Node_Expression_Constant && ctype_digit((string) $pair['key']->getAttribute('value')) && $pair['key']->getAttribute('value') > $this->index) { + $this->index = $pair['key']->getAttribute('value'); + } + } + } + + public function getKeyValuePairs() + { + $pairs = array(); + + foreach (array_chunk($this->nodes, 2) as $pair) { + $pairs[] = array( + 'key' => $pair[0], + 'value' => $pair[1], + ); + } + + return $pairs; + } + + public function hasElement(Twig_Node_Expression $key) + { + foreach ($this->getKeyValuePairs() as $pair) { + // we compare the string representation of the keys + // to avoid comparing the line numbers which are not relevant here. + if ((string) $key == (string) $pair['key']) { + return true; + } + } + + return false; + } + + public function addElement(Twig_Node_Expression $value, Twig_Node_Expression $key = null) + { + if (null === $key) { + $key = new Twig_Node_Expression_Constant(++$this->index, $value->getLine()); + } + + array_push($this->nodes, $key, $value); } /** @@ -24,16 +69,16 @@ class Twig_Node_Expression_Array extends Twig_Node_Expression { $compiler->raw('array('); $first = true; - foreach ($this->nodes as $name => $node) { + foreach ($this->getKeyValuePairs() as $pair) { if (!$first) { $compiler->raw(', '); } $first = false; $compiler - ->repr($name) + ->subcompile($pair['key']) ->raw(' => ') - ->subcompile($node) + ->subcompile($pair['value']) ; } $compiler->raw(')'); diff --git a/inc/lib/Twig/Node/Expression/AssignName.php b/inc/lib/Twig/Node/Expression/AssignName.php index 67f12509..2ddea78c 100644 --- a/inc/lib/Twig/Node/Expression/AssignName.php +++ b/inc/lib/Twig/Node/Expression/AssignName.php @@ -19,6 +19,10 @@ class Twig_Node_Expression_AssignName extends Twig_Node_Expression_Name */ public function compile(Twig_Compiler $compiler) { - $compiler->raw(sprintf('$context[\'%s\']', $this->getAttribute('name'))); + $compiler + ->raw('$context[') + ->string($this->getAttribute('name')) + ->raw(']') + ; } } diff --git a/inc/lib/Twig/Node/Expression/Binary/FloorDiv.php b/inc/lib/Twig/Node/Expression/Binary/FloorDiv.php index e86b1ea0..7fbd0556 100644 --- a/inc/lib/Twig/Node/Expression/Binary/FloorDiv.php +++ b/inc/lib/Twig/Node/Expression/Binary/FloorDiv.php @@ -17,9 +17,9 @@ class Twig_Node_Expression_Binary_FloorDiv extends Twig_Node_Expression_Binary */ public function compile(Twig_Compiler $compiler) { - $compiler->raw('floor('); + $compiler->raw('intval(floor('); parent::compile($compiler); - $compiler->raw(')'); + $compiler->raw('))'); } public function operator(Twig_Compiler $compiler) diff --git a/inc/lib/Twig/Node/Expression/BlockReference.php b/inc/lib/Twig/Node/Expression/BlockReference.php index 174d9097..647196eb 100644 --- a/inc/lib/Twig/Node/Expression/BlockReference.php +++ b/inc/lib/Twig/Node/Expression/BlockReference.php @@ -13,8 +13,7 @@ /** * Represents a block call node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Expression_BlockReference extends Twig_Node_Expression { diff --git a/inc/lib/Twig/Node/Expression/Call.php b/inc/lib/Twig/Node/Expression/Call.php new file mode 100644 index 00000000..87b62deb --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Call.php @@ -0,0 +1,178 @@ +getAttribute('callable'); + + $closingParenthesis = false; + if ($callable) { + if (is_string($callable)) { + $compiler->raw($callable); + } elseif (is_array($callable) && $callable[0] instanceof Twig_ExtensionInterface) { + $compiler->raw(sprintf('$this->env->getExtension(\'%s\')->%s', $callable[0]->getName(), $callable[1])); + } else { + $type = ucfirst($this->getAttribute('type')); + $compiler->raw(sprintf('call_user_func_array($this->env->get%s(\'%s\')->getCallable(), array', $type, $this->getAttribute('name'))); + $closingParenthesis = true; + } + } else { + $compiler->raw($this->getAttribute('thing')->compile()); + } + + $this->compileArguments($compiler); + + if ($closingParenthesis) { + $compiler->raw(')'); + } + } + + protected function compileArguments(Twig_Compiler $compiler) + { + $compiler->raw('('); + + $first = true; + + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + $compiler->raw('$this->env'); + $first = false; + } + + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->raw('$context'); + $first = false; + } + + if ($this->hasAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->string($argument); + $first = false; + } + } + + if ($this->hasNode('node')) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($this->getNode('node')); + $first = false; + } + + if ($this->hasNode('arguments') && null !== $this->getNode('arguments')) { + $callable = $this->hasAttribute('callable') ? $this->getAttribute('callable') : null; + + $arguments = $this->getArguments($callable, $this->getNode('arguments')); + + foreach ($arguments as $node) { + if (!$first) { + $compiler->raw(', '); + } + $compiler->subcompile($node); + $first = false; + } + } + + $compiler->raw(')'); + } + + protected function getArguments($callable, $arguments) + { + $parameters = array(); + $named = false; + foreach ($arguments as $name => $node) { + if (!is_int($name)) { + $named = true; + $name = $this->normalizeName($name); + } elseif ($named) { + throw new Twig_Error_Syntax(sprintf('Positional arguments cannot be used after named arguments for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name'))); + } + + $parameters[$name] = $node; + } + + if (!$named) { + return $parameters; + } + + if (!$callable) { + throw new LogicException(sprintf('Named arguments are not supported for %s "%s".', $this->getAttribute('type'), $this->getAttribute('name'))); + } + + // manage named arguments + if (is_array($callable)) { + $r = new ReflectionMethod($callable[0], $callable[1]); + } elseif (is_object($callable) && !$callable instanceof Closure) { + $r = new ReflectionObject($callable); + $r = $r->getMethod('__invoke'); + } else { + $r = new ReflectionFunction($callable); + } + + $definition = $r->getParameters(); + if ($this->hasNode('node')) { + array_shift($definition); + } + if ($this->hasAttribute('needs_environment') && $this->getAttribute('needs_environment')) { + array_shift($definition); + } + if ($this->hasAttribute('needs_context') && $this->getAttribute('needs_context')) { + array_shift($definition); + } + if ($this->hasAttribute('arguments') && null !== $this->getAttribute('arguments')) { + foreach ($this->getAttribute('arguments') as $argument) { + array_shift($definition); + } + } + + $arguments = array(); + $pos = 0; + foreach ($definition as $param) { + $name = $this->normalizeName($param->name); + + if (array_key_exists($name, $parameters)) { + if (array_key_exists($pos, $parameters)) { + throw new Twig_Error_Syntax(sprintf('Arguments "%s" is defined twice for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); + } + + $arguments[] = $parameters[$name]; + unset($parameters[$name]); + } elseif (array_key_exists($pos, $parameters)) { + $arguments[] = $parameters[$pos]; + unset($parameters[$pos]); + ++$pos; + } elseif ($param->isDefaultValueAvailable()) { + $arguments[] = new Twig_Node_Expression_Constant($param->getDefaultValue(), -1); + } elseif ($param->isOptional()) { + break; + } else { + throw new Twig_Error_Syntax(sprintf('Value for argument "%s" is required for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); + } + } + + foreach (array_keys($parameters) as $name) { + throw new Twig_Error_Syntax(sprintf('Unknown argument "%s" for %s "%s".', $name, $this->getAttribute('type'), $this->getAttribute('name'))); + } + + return $arguments; + } + + protected function normalizeName($name) + { + return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $name)); + } +} diff --git a/inc/lib/Twig/Node/Expression/ExtensionReference.php b/inc/lib/Twig/Node/Expression/ExtensionReference.php index cb4efad0..00ac6701 100644 --- a/inc/lib/Twig/Node/Expression/ExtensionReference.php +++ b/inc/lib/Twig/Node/Expression/ExtensionReference.php @@ -12,8 +12,7 @@ /** * Represents an extension call node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Expression_ExtensionReference extends Twig_Node_Expression { diff --git a/inc/lib/Twig/Node/Expression/Filter.php b/inc/lib/Twig/Node/Expression/Filter.php index 101e6df0..207b062a 100644 --- a/inc/lib/Twig/Node/Expression/Filter.php +++ b/inc/lib/Twig/Node/Expression/Filter.php @@ -9,7 +9,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Node_Expression_Filter extends Twig_Node_Expression +class Twig_Node_Expression_Filter extends Twig_Node_Expression_Call { public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) { @@ -19,54 +19,18 @@ class Twig_Node_Expression_Filter extends Twig_Node_Expression public function compile(Twig_Compiler $compiler) { $name = $this->getNode('filter')->getAttribute('value'); - if (false === $filter = $compiler->getEnvironment()->getFilter($name)) { - throw new Twig_Error_Syntax(sprintf('The filter "%s" does not exist', $name), $this->getLine()); + $filter = $compiler->getEnvironment()->getFilter($name); + + $this->setAttribute('name', $name); + $this->setAttribute('type', 'filter'); + $this->setAttribute('thing', $filter); + $this->setAttribute('needs_environment', $filter->needsEnvironment()); + $this->setAttribute('needs_context', $filter->needsContext()); + $this->setAttribute('arguments', $filter->getArguments()); + if ($filter instanceof Twig_FilterCallableInterface || $filter instanceof Twig_SimpleFilter) { + $this->setAttribute('callable', $filter->getCallable()); } - $node = $this->getNode('node'); - - // The default filter is intercepted when the filtered value - // is a name (like obj) or an attribute (like obj.attr) - // In such a case, it's compiled to {{ obj is defined ? obj|default('bar') : 'bar' }} - if ('default' === $name && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { - $compiler - ->raw('((') - ->subcompile(new Twig_Node_Expression_Test($node, 'defined', new Twig_Node(), $this->getLine())) - ->raw(') ? (') - ; - - $this->compileFilter($compiler, $filter); - - $compiler->raw(') : ('); - - if ($this->getNode('arguments')->hasNode(0)) { - $compiler->subcompile($this->getNode('arguments')->getNode(0)); - } else { - $compiler->string(''); - } - - $compiler->raw('))'); - } else { - $this->compileFilter($compiler, $filter); - } - } - - protected function compileFilter(Twig_Compiler $compiler, Twig_FilterInterface $filter) - { - $compiler - ->raw($filter->compile().'(') - ->raw($filter->needsEnvironment() ? '$this->env, ' : '') - ->raw($filter->needsContext() ? '$context, ' : '') - ->subcompile($this->getNode('node')) - ; - - foreach ($this->getNode('arguments') as $node) { - $compiler - ->raw(', ') - ->subcompile($node) - ; - } - - $compiler->raw(')'); + $this->compileCallable($compiler); } } diff --git a/inc/lib/Twig/Node/Expression/Filter/Default.php b/inc/lib/Twig/Node/Expression/Filter/Default.php new file mode 100644 index 00000000..1827c888 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Filter/Default.php @@ -0,0 +1,43 @@ + + * {{ var.foo|default('foo item on var is not defined') }} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Filter_Default extends Twig_Node_Expression_Filter +{ + public function __construct(Twig_NodeInterface $node, Twig_Node_Expression_Constant $filterName, Twig_NodeInterface $arguments, $lineno, $tag = null) + { + $default = new Twig_Node_Expression_Filter($node, new Twig_Node_Expression_Constant('default', $node->getLine()), $arguments, $node->getLine()); + + if ('default' === $filterName->getAttribute('value') && ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr)) { + $test = new Twig_Node_Expression_Test_Defined(clone $node, 'defined', new Twig_Node(), $node->getLine()); + $false = count($arguments) ? $arguments->getNode(0) : new Twig_Node_Expression_Constant('', $node->getLine()); + + $node = new Twig_Node_Expression_Conditional($test, $default, $false, $node->getLine()); + } else { + $node = $default; + } + + parent::__construct($node, $filterName, $arguments, $lineno, $tag); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler->subcompile($this->getNode('node')); + } +} diff --git a/inc/lib/Twig/Node/Expression/Function.php b/inc/lib/Twig/Node/Expression/Function.php index 3f457199..3e1f6b55 100644 --- a/inc/lib/Twig/Node/Expression/Function.php +++ b/inc/lib/Twig/Node/Expression/Function.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Node_Expression_Function extends Twig_Node_Expression +class Twig_Node_Expression_Function extends Twig_Node_Expression_Call { public function __construct($name, Twig_NodeInterface $arguments, $lineno) { @@ -17,33 +17,19 @@ class Twig_Node_Expression_Function extends Twig_Node_Expression public function compile(Twig_Compiler $compiler) { - $function = $compiler->getEnvironment()->getFunction($this->getAttribute('name')); - if (false === $function) { - throw new Twig_Error_Syntax(sprintf('The function "%s" does not exist', $this->getAttribute('name')), $this->getLine()); - } - - $compiler - ->raw($function->compile().'(') - ->raw($function->needsEnvironment() ? '$this->env' : '') - ; - - if ($function->needsContext()) { - $compiler->raw($function->needsEnvironment() ? ', $context' : '$context'); - } + $name = $this->getAttribute('name'); + $function = $compiler->getEnvironment()->getFunction($name); - $first = true; - foreach ($this->getNode('arguments') as $node) { - if (!$first) { - $compiler->raw(', '); - } else { - if ($function->needsEnvironment() || $function->needsContext()) { - $compiler->raw(', '); - } - $first = false; - } - $compiler->subcompile($node); + $this->setAttribute('name', $name); + $this->setAttribute('type', 'function'); + $this->setAttribute('thing', $function); + $this->setAttribute('needs_environment', $function->needsEnvironment()); + $this->setAttribute('needs_context', $function->needsContext()); + $this->setAttribute('arguments', $function->getArguments()); + if ($function instanceof Twig_FunctionCallableInterface || $function instanceof Twig_SimpleFunction) { + $this->setAttribute('callable', $function->getCallable()); } - $compiler->raw(')'); + $this->compileCallable($compiler); } } diff --git a/inc/lib/Twig/Node/Expression/GetAttr.php b/inc/lib/Twig/Node/Expression/GetAttr.php index eb9e6050..81a9b137 100644 --- a/inc/lib/Twig/Node/Expression/GetAttr.php +++ b/inc/lib/Twig/Node/Expression/GetAttr.php @@ -11,43 +11,43 @@ */ class Twig_Node_Expression_GetAttr extends Twig_Node_Expression { - public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_NodeInterface $arguments, $type, $lineno) + public function __construct(Twig_Node_Expression $node, Twig_Node_Expression $attribute, Twig_Node_Expression_Array $arguments, $type, $lineno) { - parent::__construct(array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type), $lineno); + parent::__construct(array('node' => $node, 'attribute' => $attribute, 'arguments' => $arguments), array('type' => $type, 'is_defined_test' => false, 'ignore_strict_check' => false, 'disable_c_ext' => false), $lineno); } public function compile(Twig_Compiler $compiler) { - $compiler->raw('$this->getAttribute('); - - if ($this->hasAttribute('is_defined_test') && $compiler->getEnvironment()->isStrictVariables()) { - $compiler->subcompile(new Twig_Node_Expression_Filter( - $this->getNode('node'), - new Twig_Node_Expression_Constant('default', $this->getLine()), - new Twig_Node(), - $this->getLine() - )); + if (function_exists('twig_template_get_attributes') && !$this->getAttribute('disable_c_ext')) { + $compiler->raw('twig_template_get_attributes($this, '); } else { - $compiler->subcompile($this->getNode('node')); + $compiler->raw('$this->getAttribute('); } - $compiler - ->raw(', ') - ->subcompile($this->getNode('attribute')) - ->raw(', array(') - ; - - foreach ($this->getNode('arguments') as $node) { - $compiler - ->subcompile($node) - ->raw(', ') - ; + if ($this->getAttribute('ignore_strict_check')) { + $this->getNode('node')->setAttribute('ignore_strict_check', true); } - $compiler - ->raw('), ') - ->repr($this->getAttribute('type')) - ->raw($this->hasAttribute('is_defined_test') ? ', true' : ', false') - ->raw(')'); + $compiler->subcompile($this->getNode('node')); + + $compiler->raw(', ')->subcompile($this->getNode('attribute')); + + if (count($this->getNode('arguments')) || Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { + $compiler->raw(', ')->subcompile($this->getNode('arguments')); + + if (Twig_TemplateInterface::ANY_CALL !== $this->getAttribute('type') || $this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { + $compiler->raw(', ')->repr($this->getAttribute('type')); + } + + if ($this->getAttribute('is_defined_test') || $this->getAttribute('ignore_strict_check')) { + $compiler->raw(', '.($this->getAttribute('is_defined_test') ? 'true' : 'false')); + } + + if ($this->getAttribute('ignore_strict_check')) { + $compiler->raw(', '.($this->getAttribute('ignore_strict_check') ? 'true' : 'false')); + } + } + + $compiler->raw(')'); } } diff --git a/inc/lib/Twig/Node/Expression/MethodCall.php b/inc/lib/Twig/Node/Expression/MethodCall.php new file mode 100644 index 00000000..620b02bf --- /dev/null +++ b/inc/lib/Twig/Node/Expression/MethodCall.php @@ -0,0 +1,41 @@ + $node, 'arguments' => $arguments), array('method' => $method, 'safe' => false), $lineno); + + if ($node instanceof Twig_Node_Expression_Name) { + $node->setAttribute('always_defined', true); + } + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->subcompile($this->getNode('node')) + ->raw('->') + ->raw($this->getAttribute('method')) + ->raw('(') + ; + $first = true; + foreach ($this->getNode('arguments')->getKeyValuePairs() as $pair) { + if (!$first) { + $compiler->raw(', '); + } + $first = false; + + $compiler->subcompile($pair['value']); + } + $compiler->raw(')'); + } +} diff --git a/inc/lib/Twig/Node/Expression/Name.php b/inc/lib/Twig/Node/Expression/Name.php index fceda2b7..3b8fae01 100644 --- a/inc/lib/Twig/Node/Expression/Name.php +++ b/inc/lib/Twig/Node/Expression/Name.php @@ -11,31 +11,78 @@ */ class Twig_Node_Expression_Name extends Twig_Node_Expression { + protected $specialVars = array( + '_self' => '$this', + '_context' => '$context', + '_charset' => '$this->env->getCharset()', + ); + public function __construct($name, $lineno) { - parent::__construct(array(), array('name' => $name), $lineno); + parent::__construct(array(), array('name' => $name, 'is_defined_test' => false, 'ignore_strict_check' => false, 'always_defined' => false), $lineno); } public function compile(Twig_Compiler $compiler) { - static $specialVars = array( - '_self' => '$this', - '_context' => '$context', - '_charset' => '$this->env->getCharset()', - ); - $name = $this->getAttribute('name'); - if ($this->hasAttribute('is_defined_test')) { - if (isset($specialVars[$name])) { + if ($this->getAttribute('is_defined_test')) { + if ($this->isSpecial()) { $compiler->repr(true); } else { $compiler->raw('array_key_exists(')->repr($name)->raw(', $context)'); } - } elseif (isset($specialVars[$name])) { - $compiler->raw($specialVars[$name]); + } elseif ($this->isSpecial()) { + $compiler->raw($this->specialVars[$name]); + } elseif ($this->getAttribute('always_defined')) { + $compiler + ->raw('$context[') + ->string($name) + ->raw(']') + ; } else { - $compiler->raw(sprintf('$this->getContext($context, \'%s\')', $name)); + // remove the non-PHP 5.4 version when PHP 5.3 support is dropped + // as the non-optimized version is just a workaround for slow ternary operator + // when the context has a lot of variables + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + // PHP 5.4 ternary operator performance was optimized + $compiler + ->raw('(isset($context[') + ->string($name) + ->raw(']) ? $context[') + ->string($name) + ->raw('] : ') + ; + + if ($this->getAttribute('ignore_strict_check') || !$compiler->getEnvironment()->isStrictVariables()) { + $compiler->raw('null)'); + } else { + $compiler->raw('$this->getContext($context, ')->string($name)->raw('))'); + } + } else { + $compiler + ->raw('$this->getContext($context, ') + ->string($name) + ; + + if ($this->getAttribute('ignore_strict_check')) { + $compiler->raw(', true'); + } + + $compiler + ->raw(')') + ; + } } } + + public function isSpecial() + { + return isset($this->specialVars[$this->getAttribute('name')]); + } + + public function isSimple() + { + return !$this->isSpecial() && !$this->getAttribute('is_defined_test'); + } } diff --git a/inc/lib/Twig/Node/Expression/Parent.php b/inc/lib/Twig/Node/Expression/Parent.php index 5689fe45..dcf618c0 100644 --- a/inc/lib/Twig/Node/Expression/Parent.php +++ b/inc/lib/Twig/Node/Expression/Parent.php @@ -13,14 +13,13 @@ /** * Represents a parent node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Expression_Parent extends Twig_Node_Expression { public function __construct($name, $lineno, $tag = null) { - parent::__construct(array(), array('name' => $name), $lineno, $tag); + parent::__construct(array(), array('output' => false, 'name' => $name), $lineno, $tag); } /** @@ -30,10 +29,19 @@ class Twig_Node_Expression_Parent extends Twig_Node_Expression */ public function compile(Twig_Compiler $compiler) { - $compiler - ->raw("\$this->renderParentBlock(") - ->string($this->getAttribute('name')) - ->raw(", \$context, \$blocks)") - ; + if ($this->getAttribute('output')) { + $compiler + ->addDebugInfo($this) + ->write("\$this->displayParentBlock(") + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks);\n") + ; + } else { + $compiler + ->raw("\$this->renderParentBlock(") + ->string($this->getAttribute('name')) + ->raw(", \$context, \$blocks)") + ; + } } } diff --git a/inc/lib/Twig/Node/Expression/TempName.php b/inc/lib/Twig/Node/Expression/TempName.php new file mode 100644 index 00000000..e6b058e8 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/TempName.php @@ -0,0 +1,26 @@ + $name), $lineno); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('$_') + ->raw($this->getAttribute('name')) + ->raw('_') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test.php b/inc/lib/Twig/Node/Expression/Test.php index ef35df6b..639f501a 100644 --- a/inc/lib/Twig/Node/Expression/Test.php +++ b/inc/lib/Twig/Node/Expression/Test.php @@ -8,7 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ -class Twig_Node_Expression_Test extends Twig_Node_Expression +class Twig_Node_Expression_Test extends Twig_Node_Expression_Call { public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) { @@ -17,44 +17,16 @@ class Twig_Node_Expression_Test extends Twig_Node_Expression public function compile(Twig_Compiler $compiler) { - $testMap = $compiler->getEnvironment()->getTests(); - if (!isset($testMap[$this->getAttribute('name')])) { - throw new Twig_Error_Syntax(sprintf('The test "%s" does not exist', $this->getAttribute('name')), $this->getLine()); - } - $name = $this->getAttribute('name'); - $node = $this->getNode('node'); - - // defined is a special case - if ('defined' === $name) { - if ($node instanceof Twig_Node_Expression_Name || $node instanceof Twig_Node_Expression_GetAttr) { - $node->setAttribute('is_defined_test', true); - $compiler->subcompile($node); - $node->removeAttribute('is_defined_test'); - } else { - throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine()); - } - return; - } - - $compiler - ->raw($testMap[$name]->compile().'(') - ->subcompile($node) - ; - - if (null !== $this->getNode('arguments')) { - $compiler->raw(', '); - - $max = count($this->getNode('arguments')) - 1; - foreach ($this->getNode('arguments') as $i => $arg) { - $compiler->subcompile($arg); + $test = $compiler->getEnvironment()->getTest($name); - if ($i != $max) { - $compiler->raw(', '); - } - } + $this->setAttribute('name', $name); + $this->setAttribute('type', 'test'); + $this->setAttribute('thing', $test); + if ($test instanceof Twig_TestCallableInterface || $test instanceof Twig_SimpleTest) { + $this->setAttribute('callable', $test->getCallable()); } - $compiler->raw(')'); + $this->compileCallable($compiler); } } diff --git a/inc/lib/Twig/Node/Expression/Test/Constant.php b/inc/lib/Twig/Node/Expression/Test/Constant.php new file mode 100644 index 00000000..de55f5f5 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Constant.php @@ -0,0 +1,46 @@ + + * {% if post.status is constant('Post::PUBLISHED') %} + * the status attribute is exactly the same as Post::PUBLISHED + * {% endif %} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Constant extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === constant(') + ; + + if ($this->getNode('arguments')->hasNode(1)) { + $compiler + ->raw('get_class(') + ->subcompile($this->getNode('arguments')->getNode(1)) + ->raw(')."::".') + ; + } + + $compiler + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw('))') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Defined.php b/inc/lib/Twig/Node/Expression/Test/Defined.php new file mode 100644 index 00000000..247b2e23 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Defined.php @@ -0,0 +1,54 @@ + + * {# defined works with variable names and variable attributes #} + * {% if foo is defined %} + * {# ... #} + * {% endif %} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Defined extends Twig_Node_Expression_Test +{ + public function __construct(Twig_NodeInterface $node, $name, Twig_NodeInterface $arguments = null, $lineno) + { + parent::__construct($node, $name, $arguments, $lineno); + + if ($node instanceof Twig_Node_Expression_Name) { + $node->setAttribute('is_defined_test', true); + } elseif ($node instanceof Twig_Node_Expression_GetAttr) { + $node->setAttribute('is_defined_test', true); + + $this->changeIgnoreStrictCheck($node); + } else { + throw new Twig_Error_Syntax('The "defined" test only works with simple variables', $this->getLine()); + } + } + + protected function changeIgnoreStrictCheck(Twig_Node_Expression_GetAttr $node) + { + $node->setAttribute('ignore_strict_check', true); + + if ($node->getNode('node') instanceof Twig_Node_Expression_GetAttr) { + $this->changeIgnoreStrictCheck($node->getNode('node')); + } + } + + public function compile(Twig_Compiler $compiler) + { + $compiler->subcompile($this->getNode('node')); + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Divisibleby.php b/inc/lib/Twig/Node/Expression/Test/Divisibleby.php new file mode 100644 index 00000000..0aceb530 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Divisibleby.php @@ -0,0 +1,33 @@ + + * {% if loop.index is divisibleby(3) %} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Divisibleby extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(0 == ') + ->subcompile($this->getNode('node')) + ->raw(' % ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Even.php b/inc/lib/Twig/Node/Expression/Test/Even.php new file mode 100644 index 00000000..d7853e89 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Even.php @@ -0,0 +1,32 @@ + + * {{ var is even }} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Even extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 0') + ->raw(')') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Null.php b/inc/lib/Twig/Node/Expression/Test/Null.php new file mode 100644 index 00000000..1c83825a --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Null.php @@ -0,0 +1,31 @@ + + * {{ var is none }} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Null extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(null === ') + ->subcompile($this->getNode('node')) + ->raw(')') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Odd.php b/inc/lib/Twig/Node/Expression/Test/Odd.php new file mode 100644 index 00000000..421c19e8 --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Odd.php @@ -0,0 +1,32 @@ + + * {{ var is odd }} + * + * + * @author Fabien Potencier + */ +class Twig_Node_Expression_Test_Odd extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' % 2 == 1') + ->raw(')') + ; + } +} diff --git a/inc/lib/Twig/Node/Expression/Test/Sameas.php b/inc/lib/Twig/Node/Expression/Test/Sameas.php new file mode 100644 index 00000000..b48905ee --- /dev/null +++ b/inc/lib/Twig/Node/Expression/Test/Sameas.php @@ -0,0 +1,29 @@ + + */ +class Twig_Node_Expression_Test_Sameas extends Twig_Node_Expression_Test +{ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->raw('(') + ->subcompile($this->getNode('node')) + ->raw(' === ') + ->subcompile($this->getNode('arguments')->getNode(0)) + ->raw(')') + ; + } +} diff --git a/inc/lib/Twig/Node/Flush.php b/inc/lib/Twig/Node/Flush.php new file mode 100644 index 00000000..0467ddce --- /dev/null +++ b/inc/lib/Twig/Node/Flush.php @@ -0,0 +1,36 @@ + + */ +class Twig_Node_Flush extends Twig_Node +{ + public function __construct($lineno, $tag) + { + parent::__construct(array(), array(), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write("flush();\n") + ; + } +} diff --git a/inc/lib/Twig/Node/For.php b/inc/lib/Twig/Node/For.php index eb204e28..d1ff371d 100644 --- a/inc/lib/Twig/Node/For.php +++ b/inc/lib/Twig/Node/For.php @@ -13,14 +13,21 @@ /** * Represents a for node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_For extends Twig_Node { + protected $loop; + public function __construct(Twig_Node_Expression_AssignName $keyTarget, Twig_Node_Expression_AssignName $valueTarget, Twig_Node_Expression $seq, Twig_Node_Expression $ifexpr = null, Twig_NodeInterface $body, Twig_NodeInterface $else = null, $lineno, $tag = null) { - parent::__construct(array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'ifexpr' => $ifexpr, 'body' => $body, 'else' => $else), array('with_loop' => true), $lineno, $tag); + $body = new Twig_Node(array($body, $this->loop = new Twig_Node_ForLoop($lineno, $tag))); + + if (null !== $ifexpr) { + $body = new Twig_Node_If(new Twig_Node(array($ifexpr, $body)), null, $lineno, $tag); + } + + parent::__construct(array('key_target' => $keyTarget, 'value_target' => $valueTarget, 'seq' => $seq, 'body' => $body, 'else' => $else), array('with_loop' => true, 'ifexpr' => null !== $ifexpr), $lineno, $tag); } /** @@ -53,7 +60,7 @@ class Twig_Node_For extends Twig_Node ->write(");\n") ; - if (null === $this->getNode('ifexpr')) { + if (!$this->getAttribute('ifexpr')) { $compiler ->write("if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) {\n") ->indent() @@ -68,6 +75,10 @@ class Twig_Node_For extends Twig_Node } } + $this->loop->setAttribute('else', null !== $this->getNode('else')); + $this->loop->setAttribute('with_loop', $this->getAttribute('with_loop')); + $this->loop->setAttribute('ifexpr', $this->getAttribute('ifexpr')); + $compiler ->write("foreach (\$context['_seq'] as ") ->subcompile($this->getNode('key_target')) @@ -75,47 +86,7 @@ class Twig_Node_For extends Twig_Node ->subcompile($this->getNode('value_target')) ->raw(") {\n") ->indent() - ; - - if (null !== $this->getNode('ifexpr')) { - $compiler - ->write("if (!(") - ->subcompile($this->getNode('ifexpr')) - ->raw(")) {\n") - ->indent() - ->write("continue;\n") - ->outdent() - ->write("}\n\n") - ; - } - - $compiler->subcompile($this->getNode('body')); - - if (null !== $this->getNode('else')) { - $compiler->write("\$context['_iterated'] = true;\n"); - } - - if ($this->getAttribute('with_loop')) { - $compiler - ->write("++\$context['loop']['index0'];\n") - ->write("++\$context['loop']['index'];\n") - ->write("\$context['loop']['first'] = false;\n") - ; - - if (null === $this->getNode('ifexpr')) { - $compiler - ->write("if (isset(\$context['loop']['length'])) {\n") - ->indent() - ->write("--\$context['loop']['revindex0'];\n") - ->write("--\$context['loop']['revindex'];\n") - ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") - ->outdent() - ->write("}\n") - ; - } - } - - $compiler + ->subcompile($this->getNode('body')) ->outdent() ->write("}\n") ; @@ -136,6 +107,6 @@ class Twig_Node_For extends Twig_Node $compiler->write('unset($context[\'_seq\'], $context[\'_iterated\'], $context[\''.$this->getNode('key_target')->getAttribute('name').'\'], $context[\''.$this->getNode('value_target')->getAttribute('name').'\'], $context[\'_parent\'], $context[\'loop\']);'."\n"); // keep the values set in the inner context for variables defined in the outer context - $compiler->write("\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent));\n"); + $compiler->write("\$context = array_intersect_key(\$context, \$_parent) + \$_parent;\n"); } } diff --git a/inc/lib/Twig/Node/ForLoop.php b/inc/lib/Twig/Node/ForLoop.php new file mode 100644 index 00000000..b8841583 --- /dev/null +++ b/inc/lib/Twig/Node/ForLoop.php @@ -0,0 +1,55 @@ + + */ +class Twig_Node_ForLoop extends Twig_Node +{ + public function __construct($lineno, $tag = null) + { + parent::__construct(array(), array('with_loop' => false, 'ifexpr' => false, 'else' => false), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param Twig_Compiler A Twig_Compiler instance + */ + public function compile(Twig_Compiler $compiler) + { + if ($this->getAttribute('else')) { + $compiler->write("\$context['_iterated'] = true;\n"); + } + + if ($this->getAttribute('with_loop')) { + $compiler + ->write("++\$context['loop']['index0'];\n") + ->write("++\$context['loop']['index'];\n") + ->write("\$context['loop']['first'] = false;\n") + ; + + if (!$this->getAttribute('ifexpr')) { + $compiler + ->write("if (isset(\$context['loop']['length'])) {\n") + ->indent() + ->write("--\$context['loop']['revindex0'];\n") + ->write("--\$context['loop']['revindex'];\n") + ->write("\$context['loop']['last'] = 0 === \$context['loop']['revindex0'];\n") + ->outdent() + ->write("}\n") + ; + } + } + } +} diff --git a/inc/lib/Twig/Node/If.php b/inc/lib/Twig/Node/If.php index aa12efbe..4296a8d6 100644 --- a/inc/lib/Twig/Node/If.php +++ b/inc/lib/Twig/Node/If.php @@ -13,8 +13,7 @@ /** * Represents an if node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_If extends Twig_Node { diff --git a/inc/lib/Twig/Node/Import.php b/inc/lib/Twig/Node/Import.php index a327411d..99efc091 100644 --- a/inc/lib/Twig/Node/Import.php +++ b/inc/lib/Twig/Node/Import.php @@ -12,8 +12,7 @@ /** * Represents an import node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Import extends Twig_Node { diff --git a/inc/lib/Twig/Node/Include.php b/inc/lib/Twig/Node/Include.php index 467749b5..ed4a3751 100644 --- a/inc/lib/Twig/Node/Include.php +++ b/inc/lib/Twig/Node/Include.php @@ -13,8 +13,7 @@ /** * Represents an include node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface { @@ -39,21 +38,46 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface ; } + $this->addGetTemplate($compiler); + + $compiler->raw('->display('); + + $this->addTemplateArguments($compiler); + + $compiler->raw(");\n"); + + if ($this->getAttribute('ignore_missing')) { + $compiler + ->outdent() + ->write("} catch (Twig_Error_Loader \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n\n") + ; + } + } + + protected function addGetTemplate(Twig_Compiler $compiler) + { if ($this->getNode('expr') instanceof Twig_Node_Expression_Constant) { $compiler ->write("\$this->env->loadTemplate(") ->subcompile($this->getNode('expr')) - ->raw(")->display(") + ->raw(")") ; } else { $compiler ->write("\$template = \$this->env->resolveTemplate(") ->subcompile($this->getNode('expr')) ->raw(");\n") - ->write('$template->display(') + ->write('$template') ; } + } + protected function addTemplateArguments(Twig_Compiler $compiler) + { if (false === $this->getAttribute('only')) { if (null === $this->getNode('variables')) { $compiler->raw('$context'); @@ -71,18 +95,5 @@ class Twig_Node_Include extends Twig_Node implements Twig_NodeOutputInterface $compiler->subcompile($this->getNode('variables')); } } - - $compiler->raw(");\n"); - - if ($this->getAttribute('ignore_missing')) { - $compiler - ->outdent() - ->write("} catch (Twig_Error_Loader \$e) {\n") - ->indent() - ->write("// ignore missing template\n") - ->outdent() - ->write("}\n\n") - ; - } } } diff --git a/inc/lib/Twig/Node/Macro.php b/inc/lib/Twig/Node/Macro.php index 9f95570f..89910618 100644 --- a/inc/lib/Twig/Node/Macro.php +++ b/inc/lib/Twig/Node/Macro.php @@ -12,8 +12,7 @@ /** * Represents a macro node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Macro extends Twig_Node { @@ -29,43 +28,67 @@ class Twig_Node_Macro extends Twig_Node */ public function compile(Twig_Compiler $compiler) { - $arguments = array(); - foreach ($this->getNode('arguments') as $argument) { - $arguments[] = '$'.$argument->getAttribute('name').' = null'; + $compiler + ->addDebugInfo($this) + ->write(sprintf("public function get%s(", $this->getAttribute('name'))) + ; + + $count = count($this->getNode('arguments')); + $pos = 0; + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->raw('$_'.$name.' = ') + ->subcompile($default) + ; + + if (++$pos < $count) { + $compiler->raw(', '); + } } $compiler - ->addDebugInfo($this) - ->write(sprintf("public function get%s(%s)\n", $this->getAttribute('name'), implode(', ', $arguments)), "{\n") - ->indent() - ->write("\$context = array_merge(\$this->env->getGlobals(), array(\n") + ->raw(")\n") + ->write("{\n") ->indent() ; - foreach ($this->getNode('arguments') as $argument) { + if (!count($this->getNode('arguments'))) { + $compiler->write("\$context = \$this->env->getGlobals();\n\n"); + } else { $compiler - ->write('') - ->string($argument->getAttribute('name')) - ->raw(' => $'.$argument->getAttribute('name')) - ->raw(",\n") + ->write("\$context = \$this->env->mergeGlobals(array(\n") + ->indent() + ; + + foreach ($this->getNode('arguments') as $name => $default) { + $compiler + ->write('') + ->string($name) + ->raw(' => $_'.$name) + ->raw(",\n") + ; + } + + $compiler + ->outdent() + ->write("));\n\n") ; } $compiler - ->outdent() - ->write("));\n\n") + ->write("\$blocks = array();\n\n") ->write("ob_start();\n") ->write("try {\n") ->indent() ->subcompile($this->getNode('body')) ->outdent() - ->write("} catch(Exception \$e) {\n") + ->write("} catch (Exception \$e) {\n") ->indent() ->write("ob_end_clean();\n\n") ->write("throw \$e;\n") ->outdent() ->write("}\n\n") - ->write("return ob_get_clean();\n") + ->write("return ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset());\n") ->outdent() ->write("}\n\n") ; diff --git a/inc/lib/Twig/Node/Module.php b/inc/lib/Twig/Node/Module.php index 9b8c55e3..585048b8 100644 --- a/inc/lib/Twig/Node/Module.php +++ b/inc/lib/Twig/Node/Module.php @@ -13,14 +13,19 @@ /** * Represents a module node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Module extends Twig_Node { - public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $filename) + public function __construct(Twig_NodeInterface $body, Twig_Node_Expression $parent = null, Twig_NodeInterface $blocks, Twig_NodeInterface $macros, Twig_NodeInterface $traits, $embeddedTemplates, $filename) { - parent::__construct(array('parent' => $parent, 'body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits), array('filename' => $filename), 1); + // embedded templates are set as attributes so that they are only visited once by the visitors + parent::__construct(array('parent' => $parent, 'body' => $body, 'blocks' => $blocks, 'macros' => $macros, 'traits' => $traits), array('filename' => $filename, 'index' => null, 'embedded_templates' => $embeddedTemplates), 1); + } + + public function setIndex($index) + { + $this->setAttribute('index', $index); } /** @@ -31,13 +36,21 @@ class Twig_Node_Module extends Twig_Node public function compile(Twig_Compiler $compiler) { $this->compileTemplate($compiler); + + foreach ($this->getAttribute('embedded_templates') as $template) { + $compiler->subcompile($template); + } } protected function compileTemplate(Twig_Compiler $compiler) { + if (!$this->getAttribute('index')) { + $compiler->write('compileClassHeader($compiler); - if (count($this->getNode('blocks')) || count($this->getNode('traits'))) { + if (count($this->getNode('blocks')) || count($this->getNode('traits')) || null === $this->getNode('parent') || $this->getNode('parent') instanceof Twig_Node_Expression_Constant) { $this->compileConstructor($compiler); } @@ -57,29 +70,31 @@ class Twig_Node_Module extends Twig_Node $this->compileIsTraitable($compiler); + $this->compileDebugInfo($compiler); + $this->compileClassFooter($compiler); } protected function compileGetParent(Twig_Compiler $compiler) { + if (null === $this->getNode('parent')) { + return; + } + $compiler ->write("protected function doGetParent(array \$context)\n", "{\n") ->indent() ->write("return ") ; - if (null === $this->getNode('parent')) { - $compiler->raw("false"); + if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { + $compiler->subcompile($this->getNode('parent')); } else { - if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { - $compiler->subcompile($this->getNode('parent')); - } else { - $compiler - ->raw("\$this->env->resolveTemplate(") - ->subcompile($this->getNode('parent')) - ->raw(")") - ; - } + $compiler + ->raw("\$this->env->resolveTemplate(") + ->subcompile($this->getNode('parent')) + ->raw(")") + ; } $compiler @@ -91,21 +106,25 @@ class Twig_Node_Module extends Twig_Node protected function compileDisplayBody(Twig_Compiler $compiler) { - $compiler->write("\$context = array_merge(\$this->env->getGlobals(), \$context);\n\n"); $compiler->subcompile($this->getNode('body')); if (null !== $this->getNode('parent')) { - $compiler->write("\$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); + if ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { + $compiler->write("\$this->parent"); + } else { + $compiler->write("\$this->getParent(\$context)"); + } + $compiler->raw("->display(\$context, array_merge(\$this->blocks, \$blocks));\n"); } } protected function compileClassHeader(Twig_Compiler $compiler) { $compiler - ->write("write("\n\n") // if the filename contains */, add a blank to avoid a PHP parse error ->write("/* ".str_replace('*/', '* /', $this->getAttribute('filename'))." */\n") - ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'))) + ->write('class '.$compiler->getEnvironment()->getTemplateClass($this->getAttribute('filename'), $this->getAttribute('index'))) ->raw(sprintf(" extends %s\n", $compiler->getEnvironment()->getBaseTemplateClass())) ->write("{\n") ->indent() @@ -120,6 +139,17 @@ class Twig_Node_Module extends Twig_Node ->write("parent::__construct(\$env);\n\n") ; + // parent + if (null === $this->getNode('parent')) { + $compiler->write("\$this->parent = false;\n\n"); + } elseif ($this->getNode('parent') instanceof Twig_Node_Expression_Constant) { + $compiler + ->write("\$this->parent = \$this->env->loadTemplate(") + ->subcompile($this->getNode('parent')) + ->raw(");\n\n") + ; + } + $countTraits = count($this->getNode('traits')); if ($countTraits) { // traits @@ -151,18 +181,32 @@ class Twig_Node_Module extends Twig_Node } } - $compiler - ->write("\$this->blocks = array_merge(\n") - ->indent() - ; + if ($countTraits > 1) { + $compiler + ->write("\$this->traits = array_merge(\n") + ->indent() + ; + + for ($i = 0; $i < $countTraits; $i++) { + $compiler + ->write(sprintf("\$_trait_%s_blocks".($i == $countTraits - 1 ? '' : ',')."\n", $i)) + ; + } - for ($i = 0; $i < $countTraits; $i++) { $compiler - ->write(sprintf("\$_trait_%s_blocks,\n", $i)) + ->outdent() + ->write(");\n\n") + ; + } else { + $compiler + ->write("\$this->traits = \$_trait_0_blocks;\n\n") ; } $compiler + ->write("\$this->blocks = array_merge(\n") + ->indent() + ->write("\$this->traits,\n") ->write("array(\n") ; } else { @@ -250,11 +294,21 @@ class Twig_Node_Module extends Twig_Node // only contains blocks and use statements. $traitable = null === $this->getNode('parent') && 0 === count($this->getNode('macros')); if ($traitable) { - if (!count($nodes = $this->getNode('body'))) { - $nodes = new Twig_Node(array($this->getNode('body'))); + if ($this->getNode('body') instanceof Twig_Node_Body) { + $nodes = $this->getNode('body')->getNode(0); + } else { + $nodes = $this->getNode('body'); + } + + if (!count($nodes)) { + $nodes = new Twig_Node(array($nodes)); } foreach ($nodes as $node) { + if (!count($node)) { + continue; + } + if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { continue; } @@ -268,16 +322,31 @@ class Twig_Node_Module extends Twig_Node } } + if ($traitable) { + return; + } + $compiler ->write("public function isTraitable()\n", "{\n") ->indent() ->write(sprintf("return %s;\n", $traitable ? 'true' : 'false')) ->outdent() + ->write("}\n\n") + ; + } + + protected function compileDebugInfo(Twig_Compiler $compiler) + { + $compiler + ->write("public function getDebugInfo()\n", "{\n") + ->indent() + ->write(sprintf("return %s;\n", str_replace("\n", '', var_export(array_reverse($compiler->getDebugInfo(), true), true)))) + ->outdent() ->write("}\n") ; } - public function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) + protected function compileLoadTemplate(Twig_Compiler $compiler, $node, $var) { if ($node instanceof Twig_Node_Expression_Constant) { $compiler diff --git a/inc/lib/Twig/Node/Print.php b/inc/lib/Twig/Node/Print.php index 766725ff..b0c41d1d 100644 --- a/inc/lib/Twig/Node/Print.php +++ b/inc/lib/Twig/Node/Print.php @@ -13,8 +13,7 @@ /** * Represents a node that outputs an expression. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Print extends Twig_Node implements Twig_NodeOutputInterface { diff --git a/inc/lib/Twig/Node/Sandbox.php b/inc/lib/Twig/Node/Sandbox.php index cbfcb411..8cf3ed44 100644 --- a/inc/lib/Twig/Node/Sandbox.php +++ b/inc/lib/Twig/Node/Sandbox.php @@ -12,8 +12,7 @@ /** * Represents a sandbox node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Sandbox extends Twig_Node { diff --git a/inc/lib/Twig/Node/SandboxedModule.php b/inc/lib/Twig/Node/SandboxedModule.php index 36d9f198..be1f5daa 100644 --- a/inc/lib/Twig/Node/SandboxedModule.php +++ b/inc/lib/Twig/Node/SandboxedModule.php @@ -13,8 +13,7 @@ /** * Represents a module node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_SandboxedModule extends Twig_Node_Module { @@ -24,7 +23,9 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module public function __construct(Twig_Node_Module $node, array $usedFilters, array $usedTags, array $usedFunctions) { - parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag()); + parent::__construct($node->getNode('body'), $node->getNode('parent'), $node->getNode('blocks'), $node->getNode('macros'), $node->getNode('traits'), $node->getAttribute('embedded_templates'), $node->getAttribute('filename'), $node->getLine(), $node->getNodeTag()); + + $this->setAttribute('index', $node->getAttribute('index')); $this->usedFilters = $usedFilters; $this->usedTags = $usedTags; @@ -33,9 +34,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module protected function compileDisplayBody(Twig_Compiler $compiler) { - if (null === $this->getNode('parent')) { - $compiler->write("\$this->checkSecurity();\n"); - } + $compiler->write("\$this->checkSecurity();\n"); parent::compileDisplayBody($compiler); } @@ -45,7 +44,7 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module parent::compileDisplayFooter($compiler); $compiler - ->write("protected function checkSecurity() {\n") + ->write("protected function checkSecurity()\n", "{\n") ->indent() ->write("\$this->env->getExtension('sandbox')->checkSecurity(\n") ->indent() @@ -54,16 +53,6 @@ class Twig_Node_SandboxedModule extends Twig_Node_Module ->write(!$this->usedFunctions ? "array()\n" : "array('".implode('\', \'', $this->usedFunctions)."')\n") ->outdent() ->write(");\n") - ; - - if (null !== $this->getNode('parent')) { - $compiler - ->raw("\n") - ->write("\$this->parent->checkSecurity();\n") - ; - } - - $compiler ->outdent() ->write("}\n\n") ; diff --git a/inc/lib/Twig/Node/SandboxedPrint.php b/inc/lib/Twig/Node/SandboxedPrint.php index 77730d8c..73dfaa96 100644 --- a/inc/lib/Twig/Node/SandboxedPrint.php +++ b/inc/lib/Twig/Node/SandboxedPrint.php @@ -17,8 +17,7 @@ * and if the sandbox is enabled, we need to check that the __toString() * method is allowed if 'article' is an object. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_SandboxedPrint extends Twig_Node_Print { diff --git a/inc/lib/Twig/Node/Set.php b/inc/lib/Twig/Node/Set.php index 9913664f..4c9c16ce 100644 --- a/inc/lib/Twig/Node/Set.php +++ b/inc/lib/Twig/Node/Set.php @@ -12,8 +12,7 @@ /** * Represents a set node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Set extends Twig_Node { @@ -67,7 +66,7 @@ class Twig_Node_Set extends Twig_Node $compiler->subcompile($this->getNode('names'), false); if ($this->getAttribute('capture')) { - $compiler->raw(" = new Twig_Markup(ob_get_clean())"); + $compiler->raw(" = ('' === \$tmp = ob_get_clean()) ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())"); } } @@ -87,9 +86,9 @@ class Twig_Node_Set extends Twig_Node } else { if ($this->getAttribute('safe')) { $compiler - ->raw("new Twig_Markup(") + ->raw("('' === \$tmp = ") ->subcompile($this->getNode('values')) - ->raw(")") + ->raw(") ? '' : new Twig_Markup(\$tmp, \$this->env->getCharset())") ; } else { $compiler->subcompile($this->getNode('values')); diff --git a/inc/lib/Twig/Node/SetTemp.php b/inc/lib/Twig/Node/SetTemp.php new file mode 100644 index 00000000..3bdd1cb7 --- /dev/null +++ b/inc/lib/Twig/Node/SetTemp.php @@ -0,0 +1,35 @@ + $name), $lineno); + } + + public function compile(Twig_Compiler $compiler) + { + $name = $this->getAttribute('name'); + $compiler + ->addDebugInfo($this) + ->write('if (isset($context[') + ->string($name) + ->raw('])) { $_') + ->raw($name) + ->raw('_ = $context[') + ->repr($name) + ->raw(']; } else { $_') + ->raw($name) + ->raw("_ = null; }\n") + ; + } +} diff --git a/inc/lib/Twig/Node/Spaceless.php b/inc/lib/Twig/Node/Spaceless.php index 46013466..7555fa0f 100644 --- a/inc/lib/Twig/Node/Spaceless.php +++ b/inc/lib/Twig/Node/Spaceless.php @@ -14,8 +14,7 @@ * * It removes spaces between HTML tags. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Spaceless extends Twig_Node { diff --git a/inc/lib/Twig/Node/Text.php b/inc/lib/Twig/Node/Text.php index 0c1c0928..21bdcea1 100644 --- a/inc/lib/Twig/Node/Text.php +++ b/inc/lib/Twig/Node/Text.php @@ -13,8 +13,7 @@ /** * Represents a text node. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Node_Text extends Twig_Node implements Twig_NodeOutputInterface { diff --git a/inc/lib/Twig/NodeInterface.php b/inc/lib/Twig/NodeInterface.php index 165aed4d..f0ef7258 100644 --- a/inc/lib/Twig/NodeInterface.php +++ b/inc/lib/Twig/NodeInterface.php @@ -12,19 +12,19 @@ /** * Represents a node in the AST. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -interface Twig_NodeInterface +interface Twig_NodeInterface extends Countable, IteratorAggregate { /** * Compiles the node to PHP. * * @param Twig_Compiler A Twig_Compiler instance */ - function compile(Twig_Compiler $compiler); + public function compile(Twig_Compiler $compiler); - function getLine(); + public function getLine(); - function getNodeTag(); + public function getNodeTag(); } diff --git a/inc/lib/Twig/NodeOutputInterface.php b/inc/lib/Twig/NodeOutputInterface.php index 71839569..22172c09 100644 --- a/inc/lib/Twig/NodeOutputInterface.php +++ b/inc/lib/Twig/NodeOutputInterface.php @@ -12,8 +12,7 @@ /** * Represents a displayable node in the AST. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_NodeOutputInterface { diff --git a/inc/lib/Twig/NodeTraverser.php b/inc/lib/Twig/NodeTraverser.php index 1e82b032..28cba1ad 100644 --- a/inc/lib/Twig/NodeTraverser.php +++ b/inc/lib/Twig/NodeTraverser.php @@ -14,8 +14,7 @@ * * It visits all nodes and their children and call the given visitor for each. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_NodeTraverser { diff --git a/inc/lib/Twig/NodeVisitor/Escaper.php b/inc/lib/Twig/NodeVisitor/Escaper.php index 049ce96a..cc4b3d71 100644 --- a/inc/lib/Twig/NodeVisitor/Escaper.php +++ b/inc/lib/Twig/NodeVisitor/Escaper.php @@ -12,18 +12,18 @@ /** * Twig_NodeVisitor_Escaper implements output escaping. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface { protected $statusStack = array(); protected $blocks = array(); - protected $safeAnalysis; protected $traverser; + protected $defaultStrategy = false; + protected $safeVars = array(); - function __construct() + public function __construct() { $this->safeAnalysis = new Twig_NodeVisitor_SafeAnalysis(); } @@ -34,14 +34,21 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface The modified node */ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) { - if ($node instanceof Twig_Node_AutoEscape) { + if ($node instanceof Twig_Node_Module) { + if ($env->hasExtension('escaper') && $defaultStrategy = $env->getExtension('escaper')->getDefaultStrategy($node->getAttribute('filename'))) { + $this->defaultStrategy = $defaultStrategy; + } + $this->safeVars = array(); + } elseif ($node instanceof Twig_Node_AutoEscape) { $this->statusStack[] = $node->getAttribute('value'); } elseif ($node instanceof Twig_Node_Block) { $this->statusStack[] = isset($this->blocks[$node->getAttribute('name')]) ? $this->blocks[$node->getAttribute('name')] : $this->needEscaping($env); + } elseif ($node instanceof Twig_Node_Import) { + $this->safeVars[] = $node->getNode('var')->getAttribute('name'); } return $node; @@ -53,11 +60,14 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface The modified node */ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) { - if ($node instanceof Twig_Node_Expression_Filter) { + if ($node instanceof Twig_Node_Module) { + $this->defaultStrategy = false; + $this->safeVars = array(); + } elseif ($node instanceof Twig_Node_Expression_Filter) { return $this->preEscapeFilterNode($node, $env); } elseif ($node instanceof Twig_Node_Print) { return $this->escapePrintNode($node, $env, $this->needEscaping($env)); @@ -96,22 +106,18 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface { $name = $filter->getNode('filter')->getAttribute('value'); - if (false !== $f = $env->getFilter($name)) { - $type = $f->getPreEscape(); - if (null === $type) { - return $filter; - } - - $node = $filter->getNode('node'); - if ($this->isSafeFor($type, $node, $env)) { - return $filter; - } - - $filter->setNode('node', $this->getEscaperFilter($type, $node)); + $type = $env->getFilter($name)->getPreEscape(); + if (null === $type) { + return $filter; + } + $node = $filter->getNode('node'); + if ($this->isSafeFor($type, $node, $env)) { return $filter; } + $filter->setNode('node', $this->getEscaperFilter($type, $node)); + return $filter; } @@ -123,6 +129,9 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface if (null === $this->traverser) { $this->traverser = new Twig_NodeTraverser($env, array($this->safeAnalysis)); } + + $this->safeAnalysis->setSafeVars($this->safeVars); + $this->traverser->traverse($expression); $safe = $this->safeAnalysis->getSafe($expression); } @@ -136,18 +145,15 @@ class Twig_NodeVisitor_Escaper implements Twig_NodeVisitorInterface return $this->statusStack[count($this->statusStack) - 1]; } - if ($env->hasExtension('escaper') && $env->getExtension('escaper')->isGlobal()) { - return 'html'; - } - - return false; + return $this->defaultStrategy ? $this->defaultStrategy : false; } protected function getEscaperFilter($type, Twig_NodeInterface $node) { $line = $node->getLine(); $name = new Twig_Node_Expression_Constant('escape', $line); - $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line))); + $args = new Twig_Node(array(new Twig_Node_Expression_Constant((string) $type, $line), new Twig_Node_Expression_Constant(null, $line), new Twig_Node_Expression_Constant(true, $line))); + return new Twig_Node_Expression_Filter($node, $name, $args, $line); } diff --git a/inc/lib/Twig/NodeVisitor/Optimizer.php b/inc/lib/Twig/NodeVisitor/Optimizer.php index 3679746e..a254def7 100644 --- a/inc/lib/Twig/NodeVisitor/Optimizer.php +++ b/inc/lib/Twig/NodeVisitor/Optimizer.php @@ -17,8 +17,7 @@ * You can configure which optimizations you want to activate via the * optimizer mode. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface { @@ -26,9 +25,12 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface const OPTIMIZE_NONE = 0; const OPTIMIZE_FOR = 2; const OPTIMIZE_RAW_FILTER = 4; + const OPTIMIZE_VAR_ACCESS = 8; protected $loops = array(); protected $optimizers; + protected $prependedNodes = array(); + protected $inABody = false; /** * Constructor. @@ -53,6 +55,20 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface $this->enterOptimizeFor($node, $env); } + if (!version_compare(phpversion(), '5.4.0RC1', '>=') && self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('sandbox')) { + if ($this->inABody) { + if (!$node instanceof Twig_Node_Expression) { + if (get_class($node) !== 'Twig_Node') { + array_unshift($this->prependedNodes, array()); + } + } else { + $node = $this->optimizeVariables($node, $env); + } + } elseif ($node instanceof Twig_Node_Body) { + $this->inABody = true; + } + } + return $node; } @@ -61,6 +77,8 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface */ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) { + $expression = $node instanceof Twig_Node_Expression; + if (self::OPTIMIZE_FOR === (self::OPTIMIZE_FOR & $this->optimizers)) { $this->leaveOptimizeFor($node, $env); } @@ -69,20 +87,58 @@ class Twig_NodeVisitor_Optimizer implements Twig_NodeVisitorInterface $node = $this->optimizeRawFilter($node, $env); } - $node = $this->optimizeRenderBlock($node, $env); + $node = $this->optimizePrintNode($node, $env); + + if (self::OPTIMIZE_VAR_ACCESS === (self::OPTIMIZE_VAR_ACCESS & $this->optimizers) && !$env->isStrictVariables() && !$env->hasExtension('sandbox')) { + if ($node instanceof Twig_Node_Body) { + $this->inABody = false; + } elseif ($this->inABody) { + if (!$expression && get_class($node) !== 'Twig_Node' && $prependedNodes = array_shift($this->prependedNodes)) { + $nodes = array(); + foreach (array_unique($prependedNodes) as $name) { + $nodes[] = new Twig_Node_SetTemp($name, $node->getLine()); + } + + $nodes[] = $node; + $node = new Twig_Node($nodes); + } + } + } + + return $node; + } + + protected function optimizeVariables($node, $env) + { + if ('Twig_Node_Expression_Name' === get_class($node) && $node->isSimple()) { + $this->prependedNodes[0][] = $node->getAttribute('name'); + + return new Twig_Node_Expression_TempName($node->getAttribute('name'), $node->getLine()); + } return $node; } /** - * Replaces "echo $this->renderBlock()" with "$this->displayBlock()". + * Optimizes print nodes. + * + * It replaces: + * + * * "echo $this->render(Parent)Block()" with "$this->display(Parent)Block()" * * @param Twig_NodeInterface $node A Node * @param Twig_Environment $env The current Twig environment */ - protected function optimizeRenderBlock($node, $env) + protected function optimizePrintNode($node, $env) { - if ($node instanceof Twig_Node_Print && $node->getNode('expr') instanceof Twig_Node_Expression_BlockReference) { + if (!$node instanceof Twig_Node_Print) { + return $node; + } + + if ( + $node->getNode('expr') instanceof Twig_Node_Expression_BlockReference || + $node->getNode('expr') instanceof Twig_Node_Expression_Parent + ) { $node->getNode('expr')->setAttribute('output', true); return $node->getNode('expr'); diff --git a/inc/lib/Twig/NodeVisitor/SafeAnalysis.php b/inc/lib/Twig/NodeVisitor/SafeAnalysis.php index 5961ba29..c4bbd812 100644 --- a/inc/lib/Twig/NodeVisitor/SafeAnalysis.php +++ b/inc/lib/Twig/NodeVisitor/SafeAnalysis.php @@ -3,27 +3,33 @@ class Twig_NodeVisitor_SafeAnalysis implements Twig_NodeVisitorInterface { protected $data = array(); + protected $safeVars = array(); + + public function setSafeVars($safeVars) + { + $this->safeVars = $safeVars; + } public function getSafe(Twig_NodeInterface $node) { $hash = spl_object_hash($node); if (isset($this->data[$hash])) { - foreach($this->data[$hash] as $bucket) { + foreach ($this->data[$hash] as $bucket) { if ($bucket['key'] === $node) { return $bucket['value']; } } } - return null; } protected function setSafe(Twig_NodeInterface $node, array $safe) { $hash = spl_object_hash($node); if (isset($this->data[$hash])) { - foreach($this->data[$hash] as &$bucket) { + foreach ($this->data[$hash] as &$bucket) { if ($bucket['key'] === $node) { $bucket['value'] = $safe; + return; } } @@ -59,7 +65,11 @@ class Twig_NodeVisitor_SafeAnalysis implements Twig_NodeVisitorInterface $name = $node->getNode('filter')->getAttribute('value'); $args = $node->getNode('arguments'); if (false !== $filter = $env->getFilter($name)) { - $this->setSafe($node, $filter->getSafe($args)); + $safe = $filter->getSafe($args); + if (null === $safe) { + $safe = $this->intersectSafe($this->getSafe($node->getNode('node')), $filter->getPreservesSafety()); + } + $this->setSafe($node, $safe); } else { $this->setSafe($node, array()); } @@ -73,6 +83,20 @@ class Twig_NodeVisitor_SafeAnalysis implements Twig_NodeVisitorInterface } else { $this->setSafe($node, array()); } + } elseif ($node instanceof Twig_Node_Expression_MethodCall) { + if ($node->getAttribute('safe')) { + $this->setSafe($node, array('all')); + } else { + $this->setSafe($node, array()); + } + } elseif ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name) { + $name = $node->getNode('node')->getAttribute('name'); + // attributes on template instances are safe + if ('_self' == $name || in_array($name, $this->safeVars)) { + $this->setSafe($node, array('all')); + } else { + $this->setSafe($node, array()); + } } else { $this->setSafe($node, array()); } diff --git a/inc/lib/Twig/NodeVisitor/Sandbox.php b/inc/lib/Twig/NodeVisitor/Sandbox.php index 356b661f..fb27045b 100644 --- a/inc/lib/Twig/NodeVisitor/Sandbox.php +++ b/inc/lib/Twig/NodeVisitor/Sandbox.php @@ -12,8 +12,7 @@ /** * Twig_NodeVisitor_Sandbox implements sandboxing. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface { @@ -28,7 +27,7 @@ class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface The modified node */ public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) { @@ -70,7 +69,7 @@ class Twig_NodeVisitor_Sandbox implements Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface The modified node */ public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env) { diff --git a/inc/lib/Twig/NodeVisitorInterface.php b/inc/lib/Twig/NodeVisitorInterface.php index d44e510c..f33c13fc 100644 --- a/inc/lib/Twig/NodeVisitorInterface.php +++ b/inc/lib/Twig/NodeVisitorInterface.php @@ -12,8 +12,7 @@ /** * Twig_NodeVisitorInterface is the interface the all node visitor classes must implement. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_NodeVisitorInterface { @@ -23,9 +22,9 @@ interface Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface The modified node */ - function enterNode(Twig_NodeInterface $node, Twig_Environment $env); + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env); /** * Called after child nodes are visited. @@ -33,9 +32,9 @@ interface Twig_NodeVisitorInterface * @param Twig_NodeInterface $node The node to visit * @param Twig_Environment $env The Twig environment instance * - * @param Twig_NodeInterface The modified node + * @return Twig_NodeInterface|false The modified node or false if the node must be removed */ - function leaveNode(Twig_NodeInterface $node, Twig_Environment $env); + public function leaveNode(Twig_NodeInterface $node, Twig_Environment $env); /** * Returns the priority for this visitor. @@ -44,5 +43,5 @@ interface Twig_NodeVisitorInterface * * @return integer The priority level */ - function getPriority(); + public function getPriority(); } diff --git a/inc/lib/Twig/Parser.php b/inc/lib/Twig/Parser.php index 8c982887..958e46b3 100644 --- a/inc/lib/Twig/Parser.php +++ b/inc/lib/Twig/Parser.php @@ -13,11 +13,11 @@ /** * Default parser implementation. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Parser implements Twig_ParserInterface { + protected $stack = array(); protected $stream; protected $parent; protected $handlers; @@ -28,9 +28,9 @@ class Twig_Parser implements Twig_ParserInterface protected $macros; protected $env; protected $reservedMacroNames; - protected $importedFunctions; - protected $tmpVarCount; + protected $importedSymbols; protected $traits; + protected $embeddedTemplates = array(); /** * Constructor. @@ -42,28 +42,45 @@ class Twig_Parser implements Twig_ParserInterface $this->env = $env; } + public function getEnvironment() + { + return $this->env; + } + public function getVarName() { - return sprintf('__internal_%s_%d', substr($this->env->getTemplateClass($this->stream->getFilename()), strlen($this->env->getTemplateClassPrefix())), ++$this->tmpVarCount); + return sprintf('__internal_%s', hash('sha1', uniqid(mt_rand(), true), false)); + } + + public function getFilename() + { + return $this->stream->getFilename(); } /** * Converts a token stream to a node tree. * - * @param Twig_TokenStream $stream A token stream instance + * @param Twig_TokenStream $stream A token stream instance * * @return Twig_Node_Module A node tree */ - public function parse(Twig_TokenStream $stream) + public function parse(Twig_TokenStream $stream, $test = null, $dropNeedle = false) { - $this->tmpVarCount = 0; + // push all variables into the stack to keep the current state of the parser + $vars = get_object_vars($this); + unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser']); + $this->stack[] = $vars; // tag handlers - $this->handlers = $this->env->getTokenParsers(); - $this->handlers->setParser($this); + if (null === $this->handlers) { + $this->handlers = $this->env->getTokenParsers(); + $this->handlers->setParser($this); + } // node visitors - $this->visitors = $this->env->getNodeVisitors(); + if (null === $this->visitors) { + $this->visitors = $this->env->getNodeVisitors(); + } if (null === $this->expressionParser) { $this->expressionParser = new Twig_ExpressionParser($this, $this->env->getUnaryOperators(), $this->env->getBinaryOperators()); @@ -75,10 +92,11 @@ class Twig_Parser implements Twig_ParserInterface $this->macros = array(); $this->traits = array(); $this->blockStack = array(); - $this->importedFunctions = array(array()); + $this->importedSymbols = array(array()); + $this->embeddedTemplates = array(); try { - $body = $this->subparse(null); + $body = $this->subparse($test, $dropNeedle); if (null !== $this->parent) { if (null === $body = $this->filterBodyNodes($body)) { @@ -86,18 +104,29 @@ class Twig_Parser implements Twig_ParserInterface } } } catch (Twig_Error_Syntax $e) { - if (null === $e->getTemplateFile()) { - $e->setTemplateFile($this->stream->getFilename()); + if (!$e->getTemplateFile()) { + $e->setTemplateFile($this->getFilename()); + } + + if (!$e->getTemplateLine()) { + $e->setTemplateLine($this->stream->getCurrent()->getLine()); } throw $e; } - $node = new Twig_Node_Module($body, $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->stream->getFilename()); + $node = new Twig_Node_Module(new Twig_Node_Body(array($body)), $this->parent, new Twig_Node($this->blocks), new Twig_Node($this->macros), new Twig_Node($this->traits), $this->embeddedTemplates, $this->getFilename()); $traverser = new Twig_NodeTraverser($this->env, $this->visitors); - return $traverser->traverse($node); + $node = $traverser->traverse($node); + + // restore previous stack so previous parse() call can resume working + foreach (array_pop($this->stack) as $key => $val) { + $this->$key = $val; + } + + return $node; } public function subparse($test, $dropNeedle = false) @@ -123,7 +152,7 @@ class Twig_Parser implements Twig_ParserInterface $token = $this->getCurrentToken(); if ($token->getType() !== Twig_Token::NAME_TYPE) { - throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine(), $this->stream->getFilename()); + throw new Twig_Error_Syntax('A block must start with a tag name', $token->getLine(), $this->getFilename()); } if (null !== $test && call_user_func($test, $token)) { @@ -141,10 +170,20 @@ class Twig_Parser implements Twig_ParserInterface $subparser = $this->handlers->getTokenParser($token->getValue()); if (null === $subparser) { if (null !== $test) { - throw new Twig_Error_Syntax(sprintf('Unexpected tag name "%s" (expecting closing tag for the "%s" tag defined near line %s)', $token->getValue(), $test[0]->getTag(), $lineno), $token->getLine(), $this->stream->getFilename()); + $error = sprintf('Unexpected tag name "%s"', $token->getValue()); + if (is_array($test) && isset($test[0]) && $test[0] instanceof Twig_TokenParserInterface) { + $error .= sprintf(' (expecting closing tag for the "%s" tag defined near line %s)', $test[0]->getTag(), $lineno); + } + + throw new Twig_Error_Syntax($error, $token->getLine(), $this->getFilename()); } - throw new Twig_Error_Syntax(sprintf('Unknown tag name "%s"', $token->getValue()), $token->getLine(), $this->stream->getFilename()); + $message = sprintf('Unknown tag name "%s"', $token->getValue()); + if ($alternatives = $this->env->computeAlternatives($token->getValue(), array_keys($this->env->getTags()))) { + $message = sprintf('%s. Did you mean "%s"', $message, implode('", "', $alternatives)); + } + + throw new Twig_Error_Syntax($message, $token->getLine(), $this->getFilename()); } $this->stream->next(); @@ -156,7 +195,7 @@ class Twig_Parser implements Twig_ParserInterface break; default: - throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', -1, $this->stream->getFilename()); + throw new Twig_Error_Syntax('Lexer or parser ended up in unsupported state.', 0, $this->getFilename()); } } @@ -202,9 +241,14 @@ class Twig_Parser implements Twig_ParserInterface return isset($this->blocks[$name]); } + public function getBlock($name) + { + return $this->blocks[$name]; + } + public function setBlock($name, $value) { - $this->blocks[$name] = $value; + $this->blocks[$name] = new Twig_Node_Body(array($value), array(), $value->getLine()); } public function hasMacro($name) @@ -223,7 +267,7 @@ class Twig_Parser implements Twig_ParserInterface } if (in_array($name, $this->reservedMacroNames)) { - throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine()); + throw new Twig_Error_Syntax(sprintf('"%s" cannot be used as a macro name as it is a reserved keyword', $name), $node->getLine(), $this->getFilename()); } $this->macros[$name] = $node; @@ -234,33 +278,45 @@ class Twig_Parser implements Twig_ParserInterface $this->traits[] = $trait; } - public function addImportedFunction($alias, $name, Twig_Node_Expression $node) + public function hasTraits() + { + return count($this->traits) > 0; + } + + public function embedTemplate(Twig_Node_Module $template) { - $this->importedFunctions[0][$alias] = array('name' => $name, 'node' => $node); + $template->setIndex(mt_rand()); + + $this->embeddedTemplates[] = $template; } - public function getImportedFunction($alias) + public function addImportedSymbol($type, $alias, $name = null, Twig_Node_Expression $node = null) { - foreach ($this->importedFunctions as $functions) { - if (isset($functions[$alias])) { - return $functions[$alias]; + $this->importedSymbols[0][$type][$alias] = array('name' => $name, 'node' => $node); + } + + public function getImportedSymbol($type, $alias) + { + foreach ($this->importedSymbols as $functions) { + if (isset($functions[$type][$alias])) { + return $functions[$type][$alias]; } } } public function isMainScope() { - return 1 === count($this->importedFunctions); + return 1 === count($this->importedSymbols); } public function pushLocalScope() { - array_unshift($this->importedFunctions, array()); + array_unshift($this->importedSymbols, array()); } public function popLocalScope() { - array_shift($this->importedFunctions); + array_shift($this->importedSymbols); } /** @@ -311,7 +367,11 @@ class Twig_Parser implements Twig_ParserInterface || (!$node instanceof Twig_Node_Text && !$node instanceof Twig_Node_BlockReference && $node instanceof Twig_NodeOutputInterface) ) { - throw new Twig_Error_Syntax('A template that extends another one cannot have a body.', $node->getLine(), $this->stream->getFilename()); + if (false !== strpos((string) $node, chr(0xEF).chr(0xBB).chr(0xBF))) { + throw new Twig_Error_Syntax('A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed.', $node->getLine(), $this->getFilename()); + } + + throw new Twig_Error_Syntax('A template that extends another one cannot have a body.', $node->getLine(), $this->getFilename()); } // bypass "set" nodes as they "capture" the output diff --git a/inc/lib/Twig/ParserInterface.php b/inc/lib/Twig/ParserInterface.php index c7a34418..f0d79009 100644 --- a/inc/lib/Twig/ParserInterface.php +++ b/inc/lib/Twig/ParserInterface.php @@ -12,17 +12,17 @@ /** * Interface implemented by parser classes. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_ParserInterface { /** * Converts a token stream to a node tree. * - * @param Twig_TokenStream $stream A token stream instance + * @param Twig_TokenStream $stream A token stream instance * * @return Twig_Node_Module A node tree */ - function parse(Twig_TokenStream $code); + public function parse(Twig_TokenStream $stream); } diff --git a/inc/lib/Twig/Sandbox/SecurityError.php b/inc/lib/Twig/Sandbox/SecurityError.php index debabb79..015bfaea 100644 --- a/inc/lib/Twig/Sandbox/SecurityError.php +++ b/inc/lib/Twig/Sandbox/SecurityError.php @@ -12,8 +12,7 @@ /** * Exception thrown when a security error occurs at runtime. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Sandbox_SecurityError extends Twig_Error { diff --git a/inc/lib/Twig/Sandbox/SecurityPolicy.php b/inc/lib/Twig/Sandbox/SecurityPolicy.php index ba912ef4..66ee2332 100644 --- a/inc/lib/Twig/Sandbox/SecurityPolicy.php +++ b/inc/lib/Twig/Sandbox/SecurityPolicy.php @@ -12,8 +12,7 @@ /** * Represents a security policy which need to be enforced when sandbox mode is enabled. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Sandbox_SecurityPolicy implements Twig_Sandbox_SecurityPolicyInterface { diff --git a/inc/lib/Twig/Sandbox/SecurityPolicyInterface.php b/inc/lib/Twig/Sandbox/SecurityPolicyInterface.php index d5015aff..6ab48e3c 100644 --- a/inc/lib/Twig/Sandbox/SecurityPolicyInterface.php +++ b/inc/lib/Twig/Sandbox/SecurityPolicyInterface.php @@ -12,14 +12,13 @@ /** * Interfaces that all security policy classes must implements. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_Sandbox_SecurityPolicyInterface { - function checkSecurity($tags, $filters, $functions); + public function checkSecurity($tags, $filters, $functions); - function checkMethodAllowed($obj, $method); + public function checkMethodAllowed($obj, $method); - function checkPropertyAllowed($obj, $method); + public function checkPropertyAllowed($obj, $method); } diff --git a/inc/lib/Twig/SimpleFilter.php b/inc/lib/Twig/SimpleFilter.php new file mode 100644 index 00000000..d35c5633 --- /dev/null +++ b/inc/lib/Twig/SimpleFilter.php @@ -0,0 +1,94 @@ + + */ +class Twig_SimpleFilter +{ + protected $name; + protected $callable; + protected $options; + protected $arguments = array(); + + public function __construct($name, $callable, array $options = array()) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge(array( + 'needs_environment' => false, + 'needs_context' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'pre_escape' => null, + 'preserves_safety' => null, + 'node_class' => 'Twig_Node_Expression_Filter', + ), $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } + + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + + public function needsEnvironment() + { + return $this->options['needs_environment']; + } + + public function needsContext() + { + return $this->options['needs_context']; + } + + public function getSafe(Twig_Node $filterArgs) + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return call_user_func($this->options['is_safe_callback'], $filterArgs); + } + } + + public function getPreservesSafety() + { + return $this->options['preserves_safety']; + } + + public function getPreEscape() + { + return $this->options['pre_escape']; + } +} diff --git a/inc/lib/Twig/SimpleFunction.php b/inc/lib/Twig/SimpleFunction.php new file mode 100644 index 00000000..8ef6aca2 --- /dev/null +++ b/inc/lib/Twig/SimpleFunction.php @@ -0,0 +1,84 @@ + + */ +class Twig_SimpleFunction +{ + protected $name; + protected $callable; + protected $options; + protected $arguments = array(); + + public function __construct($name, $callable, array $options = array()) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge(array( + 'needs_environment' => false, + 'needs_context' => false, + 'is_safe' => null, + 'is_safe_callback' => null, + 'node_class' => 'Twig_Node_Expression_Function', + ), $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } + + public function setArguments($arguments) + { + $this->arguments = $arguments; + } + + public function getArguments() + { + return $this->arguments; + } + + public function needsEnvironment() + { + return $this->options['needs_environment']; + } + + public function needsContext() + { + return $this->options['needs_context']; + } + + public function getSafe(Twig_Node $functionArgs) + { + if (null !== $this->options['is_safe']) { + return $this->options['is_safe']; + } + + if (null !== $this->options['is_safe_callback']) { + return call_user_func($this->options['is_safe_callback'], $functionArgs); + } + + return array(); + } +} diff --git a/inc/lib/Twig/SimpleTest.php b/inc/lib/Twig/SimpleTest.php new file mode 100644 index 00000000..225459c9 --- /dev/null +++ b/inc/lib/Twig/SimpleTest.php @@ -0,0 +1,46 @@ + + */ +class Twig_SimpleTest +{ + protected $name; + protected $callable; + protected $options; + + public function __construct($name, $callable, array $options = array()) + { + $this->name = $name; + $this->callable = $callable; + $this->options = array_merge(array( + 'node_class' => 'Twig_Node_Expression_Test', + ), $options); + } + + public function getName() + { + return $this->name; + } + + public function getCallable() + { + return $this->callable; + } + + public function getNodeClass() + { + return $this->options['node_class']; + } +} diff --git a/inc/lib/Twig/Template.php b/inc/lib/Twig/Template.php index a129fd73..a001ca03 100644 --- a/inc/lib/Twig/Template.php +++ b/inc/lib/Twig/Template.php @@ -13,16 +13,17 @@ /** * Default base class for compiled templates. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ abstract class Twig_Template implements Twig_TemplateInterface { - static protected $cache = array(); + protected static $cache = array(); + protected $parent; protected $parents; protected $env; protected $blocks; + protected $traits; /** * Constructor. @@ -33,6 +34,7 @@ abstract class Twig_Template implements Twig_TemplateInterface { $this->env = $env; $this->blocks = array(); + $this->traits = array(); } /** @@ -43,9 +45,7 @@ abstract class Twig_Template implements Twig_TemplateInterface abstract public function getTemplateName(); /** - * Returns the Twig environment. - * - * @return Twig_Environment The Twig environment + * {@inheritdoc} */ public function getEnvironment() { @@ -55,10 +55,17 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Returns the parent template. * + * This method is for internal use only and should never be called + * directly. + * * @return Twig_TemplateInterface|false The parent template or false if there is no parent */ public function getParent(array $context) { + if (null !== $this->parent) { + return $this->parent; + } + $parent = $this->doGetParent($context); if (false === $parent) { return false; @@ -73,33 +80,53 @@ abstract class Twig_Template implements Twig_TemplateInterface return $this->parents[$parent]; } - abstract protected function doGetParent(array $context); + protected function doGetParent(array $context) + { + return false; + } + + public function isTraitable() + { + return true; + } /** * Displays a parent block. * + * This method is for internal use only and should never be called + * directly. + * * @param string $name The block name to display from the parent * @param array $context The context * @param array $blocks The current set of blocks */ public function displayParentBlock($name, array $context, array $blocks = array()) { - if (false !== $parent = $this->getParent($context)) { + $name = (string) $name; + + if (isset($this->traits[$name])) { + $this->traits[$name][0]->displayBlock($name, $context, $blocks); + } elseif (false !== $parent = $this->getParent($context)) { $parent->displayBlock($name, $context, $blocks); } else { - throw new Twig_Error_Runtime('This template has no parent', -1, $this->getTemplateName()); + throw new Twig_Error_Runtime(sprintf('The template has no parent and no traits defining the "%s" block', $name), -1, $this->getTemplateName()); } } /** * Displays a block. * + * This method is for internal use only and should never be called + * directly. + * * @param string $name The block name to display * @param array $context The context * @param array $blocks The current set of blocks */ public function displayBlock($name, array $context, array $blocks = array()) { + $name = (string) $name; + if (isset($blocks[$name])) { $b = $blocks; unset($b[$name]); @@ -114,6 +141,9 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Renders a parent block. * + * This method is for internal use only and should never be called + * directly. + * * @param string $name The block name to render from the parent * @param array $context The context * @param array $blocks The current set of blocks @@ -131,6 +161,9 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Renders a block. * + * This method is for internal use only and should never be called + * directly. + * * @param string $name The block name to render * @param array $context The context * @param array $blocks The current set of blocks @@ -148,19 +181,34 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Returns whether a block exists or not. * + * This method is for internal use only and should never be called + * directly. + * + * This method does only return blocks defined in the current template + * or defined in "used" traits. + * + * It does not return blocks from parent templates as the parent + * template name can be dynamic, which is only known based on the + * current context. + * * @param string $name The block name * * @return Boolean true if the block exists, false otherwise */ public function hasBlock($name) { - return isset($this->blocks[$name]); + return isset($this->blocks[(string) $name]); } /** * Returns all block names. * + * This method is for internal use only and should never be called + * directly. + * * @return array An array of block names + * + * @see hasBlock */ public function getBlockNames() { @@ -170,7 +218,12 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Returns all blocks. * + * This method is for internal use only and should never be called + * directly. + * * @return array An array of blocks + * + * @see hasBlock */ public function getBlocks() { @@ -178,28 +231,15 @@ abstract class Twig_Template implements Twig_TemplateInterface } /** - * Displays the template with the given context. - * - * @param array $context An array of parameters to pass to the template - * @param array $blocks An array of blocks to pass to the template + * {@inheritdoc} */ public function display(array $context, array $blocks = array()) { - try { - $this->doDisplay($context, $blocks); - } catch (Twig_Error $e) { - throw $e; - } catch (Exception $e) { - throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e); - } + $this->displayWithErrorHandling($this->env->mergeGlobals($context), $blocks); } /** - * Renders the template with the given context and returns it as string. - * - * @param array $context An array of parameters to pass to the template - * - * @return string The rendered template + * {@inheritdoc} */ public function render(array $context) { @@ -218,6 +258,28 @@ abstract class Twig_Template implements Twig_TemplateInterface return ob_get_clean(); } + protected function displayWithErrorHandling(array $context, array $blocks = array()) + { + try { + $this->doDisplay($context, $blocks); + } catch (Twig_Error $e) { + if (!$e->getTemplateFile()) { + $e->setTemplateFile($this->getTemplateName()); + } + + // this is mostly useful for Twig_Error_Loader exceptions + // see Twig_Error_Loader + if (false === $e->getTemplateLine()) { + $e->setTemplateLine(-1); + $e->guess(); + } + + throw $e; + } catch (Exception $e) { + throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e); + } + } + /** * Auto-generated method to display the template with the given context. * @@ -229,21 +291,30 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Returns a variable from the context. * - * @param array $context The context - * @param string $item The variable to return from the context + * This method is for internal use only and should never be called + * directly. + * + * This method should not be overridden in a sub-class as this is an + * implementation detail that has been introduced to optimize variable + * access for versions of PHP before 5.4. This is not a way to override + * the way to get a variable value. + * + * @param array $context The context + * @param string $item The variable to return from the context + * @param Boolean $ignoreStrictCheck Whether to ignore the strict variable check or not * * @return The content of the context variable * * @throws Twig_Error_Runtime if the variable does not exist and Twig is running in strict mode */ - protected function getContext($context, $item) + final protected function getContext($context, $item, $ignoreStrictCheck = false) { if (!array_key_exists($item, $context)) { - if (!$this->env->isStrictVariables()) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { return null; } - throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist', $item)); + throw new Twig_Error_Runtime(sprintf('Variable "%s" does not exist', $item), -1, $this->getTemplateName()); } return $context[$item]; @@ -252,40 +323,50 @@ abstract class Twig_Template implements Twig_TemplateInterface /** * Returns the attribute value for a given array/object. * - * @param mixed $object The object or array from where to get the item - * @param mixed $item The item to get from the array or object - * @param array $arguments An array of arguments to pass if the item is an object method - * @param string $type The type of attribute (@see Twig_TemplateInterface) - * @param Boolean $isDefinedTest Whether this is only a defined check + * @param mixed $object The object or array from where to get the item + * @param mixed $item The item to get from the array or object + * @param array $arguments An array of arguments to pass if the item is an object method + * @param string $type The type of attribute (@see Twig_TemplateInterface) + * @param Boolean $isDefinedTest Whether this is only a defined check + * @param Boolean $ignoreStrictCheck Whether to ignore the strict attribute check or not + * + * @return mixed The attribute value, or a Boolean when $isDefinedTest is true, or null when the attribute is not set and $ignoreStrictCheck is true + * + * @throws Twig_Error_Runtime if the attribute does not exist and Twig is running in strict mode and $isDefinedTest is false */ - protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false) + protected function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) { // array if (Twig_TemplateInterface::METHOD_CALL !== $type) { - if ((is_array($object) && array_key_exists($item, $object)) - || ($object instanceof ArrayAccess && isset($object[$item])) + $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item; + + if ((is_array($object) && array_key_exists($arrayItem, $object)) + || ($object instanceof ArrayAccess && isset($object[$arrayItem])) ) { if ($isDefinedTest) { return true; } - return $object[$item]; + return $object[$arrayItem]; } - if (Twig_TemplateInterface::ARRAY_CALL === $type) { + if (Twig_TemplateInterface::ARRAY_CALL === $type || !is_object($object)) { if ($isDefinedTest) { return false; } - if (!$this->env->isStrictVariables()) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { return null; } if (is_object($object)) { - throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $item, get_class($object))); - // array + throw new Twig_Error_Runtime(sprintf('Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $arrayItem, get_class($object)), -1, $this->getTemplateName()); + } elseif (is_array($object)) { + throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(', ', array_keys($object))), -1, $this->getTemplateName()); + } elseif (Twig_TemplateInterface::ARRAY_CALL === $type) { + throw new Twig_Error_Runtime(sprintf('Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName()); } else { - throw new Twig_Error_Runtime(sprintf('Key "%s" for array with keys "%s" does not exist', $item, implode(', ', array_keys($object)))); + throw new Twig_Error_Runtime(sprintf('Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName()); } } } @@ -295,32 +376,18 @@ abstract class Twig_Template implements Twig_TemplateInterface return false; } - if (!$this->env->isStrictVariables()) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { return null; } - throw new Twig_Error_Runtime(sprintf('Item "%s" for "%s" does not exist', $item, $object)); + throw new Twig_Error_Runtime(sprintf('Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->getTemplateName()); } - // get some information about the object $class = get_class($object); - if (!isset(self::$cache[$class])) { - $r = new ReflectionClass($class); - self::$cache[$class] = array('methods' => array(), 'properties' => array()); - foreach ($r->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { - self::$cache[$class]['methods'][strtolower($method->getName())] = true; - } - - foreach ($r->getProperties(ReflectionProperty::IS_PUBLIC) as $property) { - self::$cache[$class]['properties'][$property->getName()] = true; - } - } // object property if (Twig_TemplateInterface::METHOD_CALL !== $type) { - if (isset(self::$cache[$class]['properties'][$item]) - || isset($object->$item) || array_key_exists($item, $object) - ) { + if (isset($object->$item) || array_key_exists((string) $item, $object)) { if ($isDefinedTest) { return true; } @@ -334,25 +401,29 @@ abstract class Twig_Template implements Twig_TemplateInterface } // object method + if (!isset(self::$cache[$class]['methods'])) { + self::$cache[$class]['methods'] = array_change_key_case(array_flip(get_class_methods($object))); + } + $lcItem = strtolower($item); if (isset(self::$cache[$class]['methods'][$lcItem])) { - $method = $item; + $method = (string) $item; } elseif (isset(self::$cache[$class]['methods']['get'.$lcItem])) { $method = 'get'.$item; } elseif (isset(self::$cache[$class]['methods']['is'.$lcItem])) { $method = 'is'.$item; } elseif (isset(self::$cache[$class]['methods']['__call'])) { - $method = $item; + $method = (string) $item; } else { if ($isDefinedTest) { return false; } - if (!$this->env->isStrictVariables()) { + if ($ignoreStrictCheck || !$this->env->isStrictVariables()) { return null; } - throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object))); + throw new Twig_Error_Runtime(sprintf('Method "%s" for object "%s" does not exist', $item, get_class($object)), -1, $this->getTemplateName()); } if ($isDefinedTest) { @@ -365,10 +436,20 @@ abstract class Twig_Template implements Twig_TemplateInterface $ret = call_user_func_array(array($object, $method), $arguments); + // useful when calling a template method from a template + // this is not supported but unfortunately heavily used in the Symfony profiler if ($object instanceof Twig_TemplateInterface) { - return new Twig_Markup($ret); + return $ret === '' ? '' : new Twig_Markup($ret, $this->env->getCharset()); } return $ret; } + + /** + * This method is only useful when testing Twig. Do not use it. + */ + public static function clearCache() + { + self::$cache = array(); + } } diff --git a/inc/lib/Twig/TemplateInterface.php b/inc/lib/Twig/TemplateInterface.php index 08da1163..879f503e 100644 --- a/inc/lib/Twig/TemplateInterface.php +++ b/inc/lib/Twig/TemplateInterface.php @@ -12,8 +12,8 @@ /** * Interface implemented by all compiled templates. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_TemplateInterface { @@ -28,7 +28,7 @@ interface Twig_TemplateInterface * * @return string The rendered template */ - function render(array $context); + public function render(array $context); /** * Displays the template with the given context. @@ -36,12 +36,12 @@ interface Twig_TemplateInterface * @param array $context An array of parameters to pass to the template * @param array $blocks An array of blocks to pass to the template */ - function display(array $context, array $blocks = array()); + public function display(array $context, array $blocks = array()); /** * Returns the bound environment for this template. * * @return Twig_Environment The current environment */ - function getEnvironment(); + public function getEnvironment(); } diff --git a/inc/lib/Twig/Test.php b/inc/lib/Twig/Test.php new file mode 100644 index 00000000..3baff885 --- /dev/null +++ b/inc/lib/Twig/Test.php @@ -0,0 +1,34 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +abstract class Twig_Test implements Twig_TestInterface, Twig_TestCallableInterface +{ + protected $options; + protected $arguments = array(); + + public function __construct(array $options = array()) + { + $this->options = array_merge(array( + 'callable' => null, + ), $options); + } + + public function getCallable() + { + return $this->options['callable']; + } +} diff --git a/inc/lib/Twig/Test/Function.php b/inc/lib/Twig/Test/Function.php index 1240a0f1..4be6b9b9 100644 --- a/inc/lib/Twig/Test/Function.php +++ b/inc/lib/Twig/Test/Function.php @@ -12,15 +12,19 @@ /** * Represents a function template test. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -class Twig_Test_Function implements Twig_TestInterface +class Twig_Test_Function extends Twig_Test { protected $function; - public function __construct($function) + public function __construct($function, array $options = array()) { + $options['callable'] = $function; + + parent::__construct($options); + $this->function = $function; } diff --git a/inc/lib/Twig/Test/IntegrationTestCase.php b/inc/lib/Twig/Test/IntegrationTestCase.php new file mode 100644 index 00000000..724f0941 --- /dev/null +++ b/inc/lib/Twig/Test/IntegrationTestCase.php @@ -0,0 +1,154 @@ + + * @author Karma Dordrak + */ +abstract class Twig_Test_IntegrationTestCase extends PHPUnit_Framework_TestCase +{ + abstract protected function getExtensions(); + abstract protected function getFixturesDir(); + + /** + * @dataProvider getTests + */ + public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) + { + $this->doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs); + } + + public function getTests() + { + $fixturesDir = realpath($this->getFixturesDir()); + $tests = array(); + + foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($fixturesDir), RecursiveIteratorIterator::LEAVES_ONLY) as $file) { + if (!preg_match('/\.test$/', $file)) { + continue; + } + + $test = file_get_contents($file->getRealpath()); + + if (preg_match('/ + --TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)\s*(?:--DATA--\s*(.*))?\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = $match[5]; + $outputs = array(array(null, $match[4], null, '')); + } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = false; + preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); + } else { + throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); + } + + $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); + } + + return $tests; + } + + protected function doIntegrationTest($file, $message, $condition, $templates, $exception, $outputs) + { + if ($condition) { + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + $loader = new Twig_Loader_Array($templates); + + foreach ($outputs as $match) { + $config = array_merge(array( + 'cache' => false, + 'strict_variables' => true, + ), $match[2] ? eval($match[2].';') : array()); + $twig = new Twig_Environment($loader, $config); + $twig->addGlobal('global', 'global'); + foreach ($this->getExtensions() as $extension) { + $twig->addExtension($extension); + } + + try { + $template = $twig->loadTemplate('index.twig'); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + + return; + } + + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + + throw $e; + } + + throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + try { + $output = trim($template->render(eval($match[1].';')), "\n "); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + + return; + } + + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + } else { + $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); + } + + if (false !== $exception) { + list($class, ) = explode(':', $exception); + $this->assertThat(NULL, new PHPUnit_Framework_Constraint_Exception($class)); + } + + $expected = trim($match[3], "\n "); + + if ($expected != $output) { + echo 'Compiled template that failed:'; + + foreach (array_keys($templates) as $name) { + echo "Template: $name\n"; + $source = $loader->getSource($name); + echo $twig->compile($twig->parse($twig->tokenize($source, $name))); + } + } + $this->assertEquals($expected, $output, $message.' (in '.$file.')'); + } + } + + protected static function parseTemplates($test) + { + $templates = array(); + preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); + foreach ($matches as $match) { + $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; + } + + return $templates; + } +} diff --git a/inc/lib/Twig/Test/Method.php b/inc/lib/Twig/Test/Method.php index a3b39483..17c6c041 100644 --- a/inc/lib/Twig/Test/Method.php +++ b/inc/lib/Twig/Test/Method.php @@ -12,15 +12,20 @@ /** * Represents a method template test. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ -class Twig_Test_Method implements Twig_TestInterface +class Twig_Test_Method extends Twig_Test { - protected $extension, $method; + protected $extension; + protected $method; - public function __construct(Twig_ExtensionInterface $extension, $method) + public function __construct(Twig_ExtensionInterface $extension, $method, array $options = array()) { + $options['callable'] = array($extension, $method); + + parent::__construct($options); + $this->extension = $extension; $this->method = $method; } diff --git a/inc/lib/Twig/Test/Node.php b/inc/lib/Twig/Test/Node.php new file mode 100644 index 00000000..c832a57b --- /dev/null +++ b/inc/lib/Twig/Test/Node.php @@ -0,0 +1,37 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +class Twig_Test_Node extends Twig_Test +{ + protected $class; + + public function __construct($class, array $options = array()) + { + parent::__construct($options); + + $this->class = $class; + } + + public function getClass() + { + return $this->class; + } + + public function compile() + { + } +} diff --git a/inc/lib/Twig/Test/NodeTestCase.php b/inc/lib/Twig/Test/NodeTestCase.php new file mode 100644 index 00000000..b15c85ff --- /dev/null +++ b/inc/lib/Twig/Test/NodeTestCase.php @@ -0,0 +1,58 @@ +assertNodeCompilation($source, $node, $environment); + } + + public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) + { + $compiler = $this->getCompiler($environment); + $compiler->compile($node); + + $this->assertEquals($source, trim($compiler->getSource())); + } + + protected function getCompiler(Twig_Environment $environment = null) + { + return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); + } + + protected function getEnvironment() + { + return new Twig_Environment(); + } + + protected function getVariableGetter($name) + { + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + } + + return sprintf('$this->getContext($context, "%s")', $name); + } + + protected function getAttributeGetter() + { + if (function_exists('twig_template_get_attributes')) { + return 'twig_template_get_attributes($this, '; + } + + return '$this->getAttribute('; + } +} diff --git a/inc/lib/Twig/TestCallableInterface.php b/inc/lib/Twig/TestCallableInterface.php new file mode 100644 index 00000000..0db43682 --- /dev/null +++ b/inc/lib/Twig/TestCallableInterface.php @@ -0,0 +1,21 @@ + + * @deprecated since 1.12 (to be removed in 2.0) + */ +interface Twig_TestCallableInterface +{ + public function getCallable(); +} diff --git a/inc/lib/Twig/TestInterface.php b/inc/lib/Twig/TestInterface.php index c2ff7258..30d8a2c4 100644 --- a/inc/lib/Twig/TestInterface.php +++ b/inc/lib/Twig/TestInterface.php @@ -12,8 +12,8 @@ /** * Represents a template test. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_TestInterface { @@ -22,5 +22,5 @@ interface Twig_TestInterface * * @return string The PHP code for the test */ - function compile(); + public function compile(); } diff --git a/inc/lib/Twig/Token.php b/inc/lib/Twig/Token.php index 79a10030..bbca90db 100644 --- a/inc/lib/Twig/Token.php +++ b/inc/lib/Twig/Token.php @@ -13,8 +13,7 @@ /** * Represents a Token. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_Token { @@ -22,17 +21,19 @@ class Twig_Token protected $type; protected $lineno; - const EOF_TYPE = -1; - const TEXT_TYPE = 0; - const BLOCK_START_TYPE = 1; - const VAR_START_TYPE = 2; - const BLOCK_END_TYPE = 3; - const VAR_END_TYPE = 4; - const NAME_TYPE = 5; - const NUMBER_TYPE = 6; - const STRING_TYPE = 7; - const OPERATOR_TYPE = 8; - const PUNCTUATION_TYPE = 9; + const EOF_TYPE = -1; + const TEXT_TYPE = 0; + const BLOCK_START_TYPE = 1; + const VAR_START_TYPE = 2; + const BLOCK_END_TYPE = 3; + const VAR_END_TYPE = 4; + const NAME_TYPE = 5; + const NUMBER_TYPE = 6; + const STRING_TYPE = 7; + const OPERATOR_TYPE = 8; + const PUNCTUATION_TYPE = 9; + const INTERPOLATION_START_TYPE = 10; + const INTERPOLATION_END_TYPE = 11; /** * Constructor. @@ -120,10 +121,11 @@ class Twig_Token * * @param integer $type The type as an integer * @param Boolean $short Whether to return a short representation or not + * @param integer $line The code line * * @return string The string representation */ - static public function typeToString($type, $short = false, $line = -1) + public static function typeToString($type, $short = false, $line = -1) { switch ($type) { case self::EOF_TYPE: @@ -159,8 +161,14 @@ class Twig_Token case self::PUNCTUATION_TYPE: $name = 'PUNCTUATION_TYPE'; break; + case self::INTERPOLATION_START_TYPE: + $name = 'INTERPOLATION_START_TYPE'; + break; + case self::INTERPOLATION_END_TYPE: + $name = 'INTERPOLATION_END_TYPE'; + break; default: - throw new Twig_Error_Syntax(sprintf('Token of type "%s" does not exist.', $type), $line); + throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); } return $short ? $name : 'Twig_Token::'.$name; @@ -169,12 +177,12 @@ class Twig_Token /** * Returns the english representation of a given type. * - * @param integer $type The type as an integer - * @param Boolean $short Whether to return a short representation or not + * @param integer $type The type as an integer + * @param integer $line The code line * * @return string The string representation */ - static public function typeToEnglish($type, $line = -1) + public static function typeToEnglish($type, $line = -1) { switch ($type) { case self::EOF_TYPE: @@ -199,8 +207,12 @@ class Twig_Token return 'operator'; case self::PUNCTUATION_TYPE: return 'punctuation'; + case self::INTERPOLATION_START_TYPE: + return 'begin of string interpolation'; + case self::INTERPOLATION_END_TYPE: + return 'end of string interpolation'; default: - throw new Twig_Error_Syntax(sprintf('Token of type "%s" does not exist.', $type), $line); + throw new LogicException(sprintf('Token of type "%s" does not exist.', $type)); } } } diff --git a/inc/lib/Twig/TokenParser.php b/inc/lib/Twig/TokenParser.php index 6c9e6935..decebd5e 100644 --- a/inc/lib/Twig/TokenParser.php +++ b/inc/lib/Twig/TokenParser.php @@ -12,11 +12,13 @@ /** * Base class for all token parsers. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ abstract class Twig_TokenParser implements Twig_TokenParserInterface { + /** + * @var Twig_Parser + */ protected $parser; /** diff --git a/inc/lib/Twig/TokenParser/AutoEscape.php b/inc/lib/Twig/TokenParser/AutoEscape.php index 3b4b96e3..27560288 100644 --- a/inc/lib/Twig/TokenParser/AutoEscape.php +++ b/inc/lib/Twig/TokenParser/AutoEscape.php @@ -39,23 +39,35 @@ class Twig_TokenParser_AutoEscape extends Twig_TokenParser public function parse(Twig_Token $token) { $lineno = $token->getLine(); - $value = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); - if (!in_array($value, array('true', 'false'))) { - throw new Twig_Error_Syntax("Autoescape value must be 'true' or 'false'", $lineno); - } - $value = 'true' === $value ? 'html' : false; + $stream = $this->parser->getStream(); + + if ($stream->test(Twig_Token::BLOCK_END_TYPE)) { + $value = 'html'; + } else { + $expr = $this->parser->getExpressionParser()->parseExpression(); + if (!$expr instanceof Twig_Node_Expression_Constant) { + throw new Twig_Error_Syntax('An escaping strategy must be a string or a Boolean.', $stream->getCurrent()->getLine(), $stream->getFilename()); + } + $value = $expr->getAttribute('value'); - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE)) { - if (false === $value) { - throw new Twig_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $lineno); + $compat = true === $value || false === $value; + + if (true === $value) { + $value = 'html'; } - $value = $this->parser->getStream()->next()->getValue(); + if ($compat && $stream->test(Twig_Token::NAME_TYPE)) { + if (false === $value) { + throw new Twig_Error_Syntax('Unexpected escaping strategy as you set autoescaping to false.', $stream->getCurrent()->getLine(), $stream->getFilename()); + } + + $value = $stream->next()->getValue(); + } } - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); return new Twig_Node_AutoEscape($value, $body, $lineno, $this->getTag()); } @@ -68,7 +80,7 @@ class Twig_TokenParser_AutoEscape extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Block.php b/inc/lib/Twig/TokenParser/Block.php index b31f7ed6..a2e017f3 100644 --- a/inc/lib/Twig/TokenParser/Block.php +++ b/inc/lib/Twig/TokenParser/Block.php @@ -35,8 +35,9 @@ class Twig_TokenParser_Block extends Twig_TokenParser $stream = $this->parser->getStream(); $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); if ($this->parser->hasBlock($name)) { - throw new Twig_Error_Syntax("The block '$name' has already been defined", $lineno); + throw new Twig_Error_Syntax(sprintf("The block '$name' has already been defined line %d", $this->parser->getBlock($name)->getLine()), $stream->getCurrent()->getLine(), $stream->getFilename()); } + $this->parser->setBlock($name, $block = new Twig_Node_Block($name, new Twig_Node(array()), $lineno)); $this->parser->pushLocalScope(); $this->parser->pushBlockStack($name); @@ -48,7 +49,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser $value = $stream->next()->getValue(); if ($value != $name) { - throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $lineno); + throw new Twig_Error_Syntax(sprintf("Expected endblock for block '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename()); } } } else { @@ -58,8 +59,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser } $stream->expect(Twig_Token::BLOCK_END_TYPE); - $block = new Twig_Node_Block($name, $body, $lineno); - $this->parser->setBlock($name, $block); + $block->setNode('body', $body); $this->parser->popBlockStack(); $this->parser->popLocalScope(); @@ -74,7 +74,7 @@ class Twig_TokenParser_Block extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Do.php b/inc/lib/Twig/TokenParser/Do.php new file mode 100644 index 00000000..f50939dd --- /dev/null +++ b/inc/lib/Twig/TokenParser/Do.php @@ -0,0 +1,42 @@ +parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Do($expr, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'do'; + } +} diff --git a/inc/lib/Twig/TokenParser/Embed.php b/inc/lib/Twig/TokenParser/Embed.php new file mode 100644 index 00000000..69cb5f35 --- /dev/null +++ b/inc/lib/Twig/TokenParser/Embed.php @@ -0,0 +1,66 @@ +parser->getStream(); + + $parent = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + // inject a fake parent to make the parent() function work + $stream->injectTokens(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', $token->getLine()), + new Twig_Token(Twig_Token::NAME_TYPE, 'extends', $token->getLine()), + new Twig_Token(Twig_Token::STRING_TYPE, '__parent__', $token->getLine()), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', $token->getLine()), + )); + + $module = $this->parser->parse($stream, array($this, 'decideBlockEnd'), true); + + // override the parent with the correct one + $module->setNode('parent', $parent); + + $this->parser->embedTemplate($module); + + $stream->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Embed($module->getAttribute('filename'), $module->getAttribute('index'), $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + public function decideBlockEnd(Twig_Token $token) + { + return $token->test('endembed'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'embed'; + } +} diff --git a/inc/lib/Twig/TokenParser/Extends.php b/inc/lib/Twig/TokenParser/Extends.php index 67eacda0..f5ecee21 100644 --- a/inc/lib/Twig/TokenParser/Extends.php +++ b/inc/lib/Twig/TokenParser/Extends.php @@ -29,23 +29,21 @@ class Twig_TokenParser_Extends extends Twig_TokenParser public function parse(Twig_Token $token) { if (!$this->parser->isMainScope()) { - throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine()); + throw new Twig_Error_Syntax('Cannot extend from a block', $token->getLine(), $this->parser->getFilename()); } if (null !== $this->parser->getParent()) { - throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine()); + throw new Twig_Error_Syntax('Multiple extends tags are forbidden', $token->getLine(), $this->parser->getFilename()); } $this->parser->setParent($this->parser->getExpressionParser()->parseExpression()); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); - - return null; } /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Filter.php b/inc/lib/Twig/TokenParser/Filter.php index 0969ab1e..2b97475a 100644 --- a/inc/lib/Twig/TokenParser/Filter.php +++ b/inc/lib/Twig/TokenParser/Filter.php @@ -52,7 +52,7 @@ class Twig_TokenParser_Filter extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Flush.php b/inc/lib/Twig/TokenParser/Flush.php new file mode 100644 index 00000000..4e15e785 --- /dev/null +++ b/inc/lib/Twig/TokenParser/Flush.php @@ -0,0 +1,42 @@ +parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Flush($token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'flush'; + } +} diff --git a/inc/lib/Twig/TokenParser/For.php b/inc/lib/Twig/TokenParser/For.php index 5ce82979..98a6d079 100644 --- a/inc/lib/Twig/TokenParser/For.php +++ b/inc/lib/Twig/TokenParser/For.php @@ -33,32 +33,41 @@ class Twig_TokenParser_For extends Twig_TokenParser public function parse(Twig_Token $token) { $lineno = $token->getLine(); + $stream = $this->parser->getStream(); $targets = $this->parser->getExpressionParser()->parseAssignmentExpression(); - $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, 'in'); + $stream->expect(Twig_Token::OPERATOR_TYPE, 'in'); $seq = $this->parser->getExpressionParser()->parseExpression(); $ifexpr = null; - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'if')) { - $this->parser->getStream()->next(); + if ($stream->test(Twig_Token::NAME_TYPE, 'if')) { + $stream->next(); $ifexpr = $this->parser->getExpressionParser()->parseExpression(); } - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideForFork')); - if ($this->parser->getStream()->next()->getValue() == 'else') { - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + if ($stream->next()->getValue() == 'else') { + $stream->expect(Twig_Token::BLOCK_END_TYPE); $else = $this->parser->subparse(array($this, 'decideForEnd'), true); } else { $else = null; } - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); if (count($targets) > 1) { $keyTarget = $targets->getNode(0); + $keyTarget = new Twig_Node_Expression_AssignName($keyTarget->getAttribute('name'), $keyTarget->getLine()); $valueTarget = $targets->getNode(1); + $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine()); } else { $keyTarget = new Twig_Node_Expression_AssignName('_key', $lineno); $valueTarget = $targets->getNode(0); + $valueTarget = new Twig_Node_Expression_AssignName($valueTarget->getAttribute('name'), $valueTarget->getLine()); + } + + if ($ifexpr) { + $this->checkLoopUsageCondition($stream, $ifexpr); + $this->checkLoopUsageBody($stream, $body); } return new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, $lineno, $this->getTag()); @@ -74,10 +83,51 @@ class Twig_TokenParser_For extends Twig_TokenParser return $token->test('endfor'); } + // the loop variable cannot be used in the condition + protected function checkLoopUsageCondition(Twig_TokenStream $stream, Twig_NodeInterface $node) + { + if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { + throw new Twig_Error_Syntax('The "loop" variable cannot be used in a looping condition', $node->getLine(), $stream->getFilename()); + } + + foreach ($node as $n) { + if (!$n) { + continue; + } + + $this->checkLoopUsageCondition($stream, $n); + } + } + + // check usage of non-defined loop-items + // it does not catch all problems (for instance when a for is included into another or when the variable is used in an include) + protected function checkLoopUsageBody(Twig_TokenStream $stream, Twig_NodeInterface $node) + { + if ($node instanceof Twig_Node_Expression_GetAttr && $node->getNode('node') instanceof Twig_Node_Expression_Name && 'loop' == $node->getNode('node')->getAttribute('name')) { + $attribute = $node->getNode('attribute'); + if ($attribute instanceof Twig_Node_Expression_Constant && in_array($attribute->getAttribute('value'), array('length', 'revindex0', 'revindex', 'last'))) { + throw new Twig_Error_Syntax(sprintf('The "loop.%s" variable is not defined when looping with a condition', $attribute->getAttribute('value')), $node->getLine(), $stream->getFilename()); + } + } + + // should check for parent.loop.XXX usage + if ($node instanceof Twig_Node_For) { + return; + } + + foreach ($node as $n) { + if (!$n) { + continue; + } + + $this->checkLoopUsageBody($stream, $n); + } + } + /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/From.php b/inc/lib/Twig/TokenParser/From.php index 87aceb4d..a54054db 100644 --- a/inc/lib/Twig/TokenParser/From.php +++ b/inc/lib/Twig/TokenParser/From.php @@ -55,8 +55,8 @@ class Twig_TokenParser_From extends Twig_TokenParser $node = new Twig_Node_Import($macro, new Twig_Node_Expression_AssignName($this->parser->getVarName(), $token->getLine()), $token->getLine(), $this->getTag()); - foreach($targets as $name => $alias) { - $this->parser->addImportedFunction($alias, $name, $node->getNode('var')); + foreach ($targets as $name => $alias) { + $this->parser->addImportedSymbol('function', $alias, 'get'.$name, $node->getNode('var')); } return $node; @@ -65,7 +65,7 @@ class Twig_TokenParser_From extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/If.php b/inc/lib/Twig/TokenParser/If.php index 65a1a8b2..3d7d1f51 100644 --- a/inc/lib/Twig/TokenParser/If.php +++ b/inc/lib/Twig/TokenParser/If.php @@ -36,22 +36,23 @@ class Twig_TokenParser_If extends Twig_TokenParser { $lineno = $token->getLine(); $expr = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream = $this->parser->getStream(); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideIfFork')); $tests = array($expr, $body); $else = null; $end = false; while (!$end) { - switch ($this->parser->getStream()->next()->getValue()) { + switch ($stream->next()->getValue()) { case 'else': - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $else = $this->parser->subparse(array($this, 'decideIfEnd')); break; case 'elseif': $expr = $this->parser->getExpressionParser()->parseExpression(); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $body = $this->parser->subparse(array($this, 'decideIfFork')); $tests[] = $expr; $tests[] = $body; @@ -62,11 +63,11 @@ class Twig_TokenParser_If extends Twig_TokenParser break; default: - throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d)', $lineno), -1); + throw new Twig_Error_Syntax(sprintf('Unexpected end of template. Twig was looking for the following tags "else", "elseif", or "endif" to close the "if" block started at line %d)', $lineno), $stream->getCurrent()->getLine(), $stream->getFilename()); } } - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); return new Twig_Node_If(new Twig_Node($tests), $else, $lineno, $this->getTag()); } @@ -84,7 +85,7 @@ class Twig_TokenParser_If extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Import.php b/inc/lib/Twig/TokenParser/Import.php index d0a88cde..e7050c70 100644 --- a/inc/lib/Twig/TokenParser/Import.php +++ b/inc/lib/Twig/TokenParser/Import.php @@ -32,13 +32,15 @@ class Twig_TokenParser_Import extends Twig_TokenParser $var = new Twig_Node_Expression_AssignName($this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(), $token->getLine()); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $this->parser->addImportedSymbol('template', $var->getAttribute('name')); + return new Twig_Node_Import($macro, $var, $token->getLine(), $this->getTag()); } /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Include.php b/inc/lib/Twig/TokenParser/Include.php index 54154559..4a317868 100644 --- a/inc/lib/Twig/TokenParser/Include.php +++ b/inc/lib/Twig/TokenParser/Include.php @@ -32,37 +32,46 @@ class Twig_TokenParser_Include extends Twig_TokenParser { $expr = $this->parser->getExpressionParser()->parseExpression(); + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + protected function parseArguments() + { + $stream = $this->parser->getStream(); + $ignoreMissing = false; - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'ignore')) { - $this->parser->getStream()->next(); - $this->parser->getStream()->expect(Twig_Token::NAME_TYPE, 'missing'); + if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) { + $stream->next(); + $stream->expect(Twig_Token::NAME_TYPE, 'missing'); $ignoreMissing = true; } $variables = null; - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'with')) { - $this->parser->getStream()->next(); + if ($stream->test(Twig_Token::NAME_TYPE, 'with')) { + $stream->next(); $variables = $this->parser->getExpressionParser()->parseExpression(); } $only = false; - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE, 'only')) { - $this->parser->getStream()->next(); + if ($stream->test(Twig_Token::NAME_TYPE, 'only')) { + $stream->next(); $only = true; } - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - return new Twig_Node_Include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + return array($variables, $only, $ignoreMissing); } /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Macro.php b/inc/lib/Twig/TokenParser/Macro.php index da1ac55c..82b4fa6d 100644 --- a/inc/lib/Twig/TokenParser/Macro.php +++ b/inc/lib/Twig/TokenParser/Macro.php @@ -30,26 +30,25 @@ class Twig_TokenParser_Macro extends Twig_TokenParser public function parse(Twig_Token $token) { $lineno = $token->getLine(); - $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); + $stream = $this->parser->getStream(); + $name = $stream->expect(Twig_Token::NAME_TYPE)->getValue(); - $arguments = $this->parser->getExpressionParser()->parseArguments(); + $arguments = $this->parser->getExpressionParser()->parseArguments(true, true); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); $this->parser->pushLocalScope(); $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); - if ($this->parser->getStream()->test(Twig_Token::NAME_TYPE)) { - $value = $this->parser->getStream()->next()->getValue(); + if ($stream->test(Twig_Token::NAME_TYPE)) { + $value = $stream->next()->getValue(); if ($value != $name) { - throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $lineno); + throw new Twig_Error_Syntax(sprintf("Expected endmacro for macro '$name' (but %s given)", $value), $stream->getCurrent()->getLine(), $stream->getFilename()); } } $this->parser->popLocalScope(); - $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); - $this->parser->setMacro($name, new Twig_Node_Macro($name, $body, $arguments, $lineno, $this->getTag())); - - return null; + $this->parser->setMacro($name, new Twig_Node_Macro($name, new Twig_Node_Body(array($body)), $arguments, $lineno, $this->getTag())); } public function decideBlockEnd(Twig_Token $token) @@ -60,7 +59,7 @@ class Twig_TokenParser_Macro extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Sandbox.php b/inc/lib/Twig/TokenParser/Sandbox.php index 62e7f8f7..9457325a 100644 --- a/inc/lib/Twig/TokenParser/Sandbox.php +++ b/inc/lib/Twig/TokenParser/Sandbox.php @@ -35,6 +35,19 @@ class Twig_TokenParser_Sandbox extends Twig_TokenParser $body = $this->parser->subparse(array($this, 'decideBlockEnd'), true); $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + // in a sandbox tag, only include tags are allowed + if (!$body instanceof Twig_Node_Include) { + foreach ($body as $node) { + if ($node instanceof Twig_Node_Text && ctype_space($node->getAttribute('data'))) { + continue; + } + + if (!$node instanceof Twig_Node_Include) { + throw new Twig_Error_Syntax('Only "include" tags are allowed within a "sandbox" section', $node->getLine(), $this->parser->getFilename()); + } + } + } + return new Twig_Node_Sandbox($body, $token->getLine(), $this->getTag()); } @@ -46,7 +59,7 @@ class Twig_TokenParser_Sandbox extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Set.php b/inc/lib/Twig/TokenParser/Set.php index 489e1d30..70e0b41b 100644 --- a/inc/lib/Twig/TokenParser/Set.php +++ b/inc/lib/Twig/TokenParser/Set.php @@ -49,13 +49,13 @@ class Twig_TokenParser_Set extends Twig_TokenParser $stream->expect(Twig_Token::BLOCK_END_TYPE); if (count($names) !== count($values)) { - throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignements.", $lineno); + throw new Twig_Error_Syntax("When using set, you must have the same number of variables and assignments.", $stream->getCurrent()->getLine(), $stream->getFilename()); } } else { $capture = true; if (count($names) > 1) { - throw new Twig_Error_Syntax("When using set with a block, you cannot have a multi-target.", $lineno); + throw new Twig_Error_Syntax("When using set with a block, you cannot have a multi-target.", $stream->getCurrent()->getLine(), $stream->getFilename()); } $stream->expect(Twig_Token::BLOCK_END_TYPE); @@ -75,7 +75,7 @@ class Twig_TokenParser_Set extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Spaceless.php b/inc/lib/Twig/TokenParser/Spaceless.php index aa7ffbc4..1e3fa8f3 100644 --- a/inc/lib/Twig/TokenParser/Spaceless.php +++ b/inc/lib/Twig/TokenParser/Spaceless.php @@ -50,7 +50,7 @@ class Twig_TokenParser_Spaceless extends Twig_TokenParser /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParser/Use.php b/inc/lib/Twig/TokenParser/Use.php index 16c47e3e..bc0e09ef 100644 --- a/inc/lib/Twig/TokenParser/Use.php +++ b/inc/lib/Twig/TokenParser/Use.php @@ -35,13 +35,12 @@ class Twig_TokenParser_Use extends Twig_TokenParser public function parse(Twig_Token $token) { $template = $this->parser->getExpressionParser()->parseExpression(); + $stream = $this->parser->getStream(); if (!$template instanceof Twig_Node_Expression_Constant) { - throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $token->getLine()); + throw new Twig_Error_Syntax('The template references in a "use" statement must be a string.', $stream->getCurrent()->getLine(), $stream->getFilename()); } - $stream = $this->parser->getStream(); - $targets = array(); if ($stream->test('with')) { $stream->next(); @@ -69,14 +68,12 @@ class Twig_TokenParser_Use extends Twig_TokenParser $stream->expect(Twig_Token::BLOCK_END_TYPE); $this->parser->addTrait(new Twig_Node(array('template' => $template, 'targets' => new Twig_Node($targets)))); - - return null; } /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ public function getTag() { diff --git a/inc/lib/Twig/TokenParserBroker.php b/inc/lib/Twig/TokenParserBroker.php index 34fcdfbf..ec3fba67 100644 --- a/inc/lib/Twig/TokenParserBroker.php +++ b/inc/lib/Twig/TokenParserBroker.php @@ -13,8 +13,8 @@ /** * Default implementation of a token parser broker. * - * @package twig - * @author Arnaud Le Blanc + * @author Arnaud Le Blanc + * @deprecated since 1.12 (to be removed in 2.0) */ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface { @@ -32,13 +32,13 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface { foreach ($parsers as $parser) { if (!$parser instanceof Twig_TokenParserInterface) { - throw new Twig_Error('$parsers must a an array of Twig_TokenParserInterface'); + throw new LogicException('$parsers must a an array of Twig_TokenParserInterface'); } $this->parsers[$parser->getTag()] = $parser; } foreach ($brokers as $broker) { if (!$broker instanceof Twig_TokenParserBrokerInterface) { - throw new Twig_Error('$brokers must a an array of Twig_TokenParserBrokerInterface'); + throw new LogicException('$brokers must a an array of Twig_TokenParserBrokerInterface'); } $this->brokers[] = $broker; } @@ -54,6 +54,19 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface $this->parsers[$parser->getTag()] = $parser; } + /** + * Removes a TokenParser. + * + * @param Twig_TokenParserInterface $parser A Twig_TokenParserInterface instance + */ + public function removeTokenParser(Twig_TokenParserInterface $parser) + { + $name = $parser->getTag(); + if (isset($this->parsers[$name]) && $parser === $this->parsers[$name]) { + unset($this->parsers[$name]); + } + } + /** * Adds a TokenParserBroker. * @@ -64,6 +77,18 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface $this->brokers[] = $broker; } + /** + * Removes a TokenParserBroker. + * + * @param Twig_TokenParserBroker $broker A Twig_TokenParserBroker instance + */ + public function removeTokenParserBroker(Twig_TokenParserBroker $broker) + { + if (false !== $pos = array_search($broker, $this->brokers)) { + unset($this->brokers[$pos]); + } + } + /** * Gets a suitable TokenParser for a tag. * @@ -86,7 +111,11 @@ class Twig_TokenParserBroker implements Twig_TokenParserBrokerInterface } $broker = prev($this->brokers); } - return null; + } + + public function getParsers() + { + return $this->parsers; } public function getParser() diff --git a/inc/lib/Twig/TokenParserBrokerInterface.php b/inc/lib/Twig/TokenParserBrokerInterface.php index 3ce8ca26..3f006e33 100644 --- a/inc/lib/Twig/TokenParserBrokerInterface.php +++ b/inc/lib/Twig/TokenParserBrokerInterface.php @@ -15,31 +15,31 @@ * * Token parser brokers allows to implement custom logic in the process of resolving a token parser for a given tag name. * - * @package twig - * @author Arnaud Le Blanc + * @author Arnaud Le Blanc + * @deprecated since 1.12 (to be removed in 2.0) */ interface Twig_TokenParserBrokerInterface { /** * Gets a TokenParser suitable for a tag. * - * @param string $tag A tag name + * @param string $tag A tag name * * @return null|Twig_TokenParserInterface A Twig_TokenParserInterface or null if no suitable TokenParser was found */ - function getTokenParser($tag); + public function getTokenParser($tag); /** * Calls Twig_TokenParserInterface::setParser on all parsers the implementation knows of. * * @param Twig_ParserInterface $parser A Twig_ParserInterface interface */ - function setParser(Twig_ParserInterface $parser); + public function setParser(Twig_ParserInterface $parser); /** * Gets the Twig_ParserInterface. * - * @return null|Twig_ParserInterface A Twig_ParserInterface instance of null + * @return null|Twig_ParserInterface A Twig_ParserInterface instance or null */ - function getParser(); + public function getParser(); } diff --git a/inc/lib/Twig/TokenParserInterface.php b/inc/lib/Twig/TokenParserInterface.php index 114a939e..bbde7714 100644 --- a/inc/lib/Twig/TokenParserInterface.php +++ b/inc/lib/Twig/TokenParserInterface.php @@ -12,8 +12,7 @@ /** * Interface implemented by token parsers. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ interface Twig_TokenParserInterface { @@ -22,7 +21,7 @@ interface Twig_TokenParserInterface * * @param $parser A Twig_Parser instance */ - function setParser(Twig_Parser $parser); + public function setParser(Twig_Parser $parser); /** * Parses a token and returns a node. @@ -31,12 +30,12 @@ interface Twig_TokenParserInterface * * @return Twig_NodeInterface A Twig_NodeInterface instance */ - function parse(Twig_Token $token); + public function parse(Twig_Token $token); /** * Gets the tag name associated with this token parser. * - * @param string The tag name + * @return string The tag name */ - function getTag(); + public function getTag(); } diff --git a/inc/lib/Twig/TokenStream.php b/inc/lib/Twig/TokenStream.php index a2002b42..a78189f6 100644 --- a/inc/lib/Twig/TokenStream.php +++ b/inc/lib/Twig/TokenStream.php @@ -13,8 +13,7 @@ /** * Represents a token stream. * - * @package twig - * @author Fabien Potencier + * @author Fabien Potencier */ class Twig_TokenStream { @@ -45,6 +44,11 @@ class Twig_TokenStream return implode("\n", $this->tokens); } + public function injectTokens(array $tokens) + { + $this->tokens = array_merge(array_slice($this->tokens, 0, $this->current), $tokens, array_slice($this->tokens, $this->current)); + } + /** * Sets the pointer to the next token and returns the old one. * @@ -53,7 +57,7 @@ class Twig_TokenStream public function next() { if (!isset($this->tokens[++$this->current])) { - throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename); + throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current - 1]->getLine(), $this->filename); } return $this->tokens[$this->current - 1]; @@ -92,7 +96,7 @@ class Twig_TokenStream public function look($number = 1) { if (!isset($this->tokens[$this->current + $number])) { - throw new Twig_Error_Syntax('Unexpected end of template', -1, $this->filename); + throw new Twig_Error_Syntax('Unexpected end of template', $this->tokens[$this->current + $number - 1]->getLine(), $this->filename); } return $this->tokens[$this->current + $number]; -- cgit v1.3 From 6b6f32949df7be58c7a9125711aeab2c34cd1d54 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 15:20:25 -0400 Subject: Web config editor: Use a + {% elseif var.type == 'integer' and var.name.0 == 'mod' and (var.default in ['JANITOR', 'MOD', 'ADMIN', 'DISABLED'] or var.default|slice(0, 14) == "$config['mod']") and var.value <= constant('DISABLED') %} + {% elseif var.type == 'integer' %} {% elseif var.type == 'boolean' %} -- cgit v1.3 From 157dcf9fb13f83d3d7ec8e2ab6cd566e92efea97 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 15:55:28 -0400 Subject: Continue upgrading Twig --- inc/lib/Twig/Extensions/Extension/I18n.php | 2 +- inc/lib/Twig/Extensions/Extension/Tinyboard.php | 46 ++++++++++++------------- inc/lib/Twig/Extensions/Node/Trans.php | 11 +++--- inc/lib/Twig/Extensions/TokenParser/Trans.php | 6 ++-- 4 files changed, 34 insertions(+), 31 deletions(-) (limited to 'inc') diff --git a/inc/lib/Twig/Extensions/Extension/I18n.php b/inc/lib/Twig/Extensions/Extension/I18n.php index 1f795490..bc6a05bd 100644 --- a/inc/lib/Twig/Extensions/Extension/I18n.php +++ b/inc/lib/Twig/Extensions/Extension/I18n.php @@ -28,7 +28,7 @@ class Twig_Extensions_Extension_I18n extends Twig_Extension public function getFilters() { return array( - 'trans' => new Twig_Filter_Function('gettext'), + new Twig_SimpleFilter('trans', 'gettext'), ); } diff --git a/inc/lib/Twig/Extensions/Extension/Tinyboard.php b/inc/lib/Twig/Extensions/Extension/Tinyboard.php index 8c8d9456..727d5d2c 100644 --- a/inc/lib/Twig/Extensions/Extension/Tinyboard.php +++ b/inc/lib/Twig/Extensions/Extension/Tinyboard.php @@ -9,23 +9,23 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension */ public function getFilters() { - return Array( - 'filesize' => new Twig_Filter_Function('format_bytes'), - 'truncate' => new Twig_Filter_Function('twig_truncate_filter'), - 'truncate_body' => new Twig_Filter_Function('truncate'), - 'extension' => new Twig_Filter_Function('twig_extension_filter'), - 'sprintf' => new Twig_Filter_Function('sprintf'), - 'capcode' => new Twig_Filter_Function('capcode'), - 'hasPermission' => new Twig_Filter_Function('twig_hasPermission_filter'), - 'date' => new Twig_Filter_Function('twig_date_filter'), - 'poster_id' => new Twig_Filter_Function('poster_id'), - 'remove_whitespace' => new Twig_Filter_Function('twig_remove_whitespace_filter'), - 'count' => new Twig_Filter_Function('count'), - 'ago' => new Twig_Filter_Function('ago'), - 'until' => new Twig_Filter_Function('until'), - 'push' => new Twig_Filter_Function('twig_push_filter'), - 'bidi_cleanup' => new Twig_Filter_Function('bidi_cleanup'), - 'addslashes' => new Twig_Filter_Function('addslashes') + return array( + new Twig_SimpleFilter('filesize', 'format_bytes'), + new Twig_SimpleFilter('truncate', 'twig_truncate_filter'), + new Twig_SimpleFilter('truncate_body', 'truncate'), + new Twig_SimpleFilter('extension', 'twig_extension_filter'), + new Twig_SimpleFilter('sprintf', 'sprintf'), + new Twig_SimpleFilter('capcode', 'capcode'), + new Twig_SimpleFilter('hasPermission', 'twig_hasPermission_filter'), + new Twig_SimpleFilter('date', 'twig_date_filter'), + new Twig_SimpleFilter('poster_id', 'poster_id'), + new Twig_SimpleFilter('remove_whitespace', 'twig_remove_whitespace_filter'), + new Twig_SimpleFilter('count', 'count'), + new Twig_SimpleFilter('ago', 'ago'), + new Twig_SimpleFilter('until', 'until'), + new Twig_SimpleFilter('push', 'twig_push_filter'), + new Twig_SimpleFilter('bidi_cleanup', 'bidi_cleanup'), + new Twig_SimpleFilter('addslashes', 'addslashes') ); } @@ -36,12 +36,12 @@ class Twig_Extensions_Extension_Tinyboard extends Twig_Extension */ public function getFunctions() { - return Array( - 'time' => new Twig_Filter_Function('time'), - 'floor' => new Twig_Filter_Function('floor'), - 'timezone' => new Twig_Filter_Function('twig_timezone_function'), - 'hiddenInputs' => new Twig_Filter_Function('hiddenInputs'), - 'hiddenInputsHash' => new Twig_Filter_Function('hiddenInputsHash'), + return array( + new Twig_SimpleFunction('time', 'time'), + new Twig_SimpleFunction('floor', 'floor'), + new Twig_SimpleFunction('timezone', 'twig_timezone_function'), + new Twig_SimpleFunction('hiddenInputs', 'hiddenInputs'), + new Twig_SimpleFunction('hiddenInputsHash', 'hiddenInputsHash'), ); } diff --git a/inc/lib/Twig/Extensions/Node/Trans.php b/inc/lib/Twig/Extensions/Node/Trans.php index 18087e77..e7dc1ca8 100644 --- a/inc/lib/Twig/Extensions/Node/Trans.php +++ b/inc/lib/Twig/Extensions/Node/Trans.php @@ -94,22 +94,25 @@ class Twig_Extensions_Node_Trans extends Twig_Node ; } - $compiler->raw(');'); + $compiler->raw(");\n"); } } protected function compileString(Twig_NodeInterface $body) { - if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant) { + if ($body instanceof Twig_Node_Expression_Name || $body instanceof Twig_Node_Expression_Constant || $body instanceof Twig_Node_Expression_TempName) { return array($body, array()); } $vars = array(); - if (count($body)) { $msg = ''; foreach ($body as $node) { + if (get_class($node) === 'Twig_Node' && $node->getNode(0) instanceof Twig_Node_SetTemp) { + $node = $node->getNode(1); + } + if ($node instanceof Twig_Node_Print) { $n = $node->getNode('expr'); while ($n instanceof Twig_Node_Expression_Filter) { @@ -127,4 +130,4 @@ class Twig_Extensions_Node_Trans extends Twig_Node return array(new Twig_Node(array(new Twig_Node_Expression_Constant(trim($msg), $body->getLine()))), $vars); } -} +} \ No newline at end of file diff --git a/inc/lib/Twig/Extensions/TokenParser/Trans.php b/inc/lib/Twig/Extensions/TokenParser/Trans.php index 5b2d93b6..4a0fad41 100644 --- a/inc/lib/Twig/Extensions/TokenParser/Trans.php +++ b/inc/lib/Twig/Extensions/TokenParser/Trans.php @@ -43,12 +43,12 @@ class Twig_Extensions_TokenParser_Trans extends Twig_TokenParser return new Twig_Extensions_Node_Trans($body, $plural, $count, $lineno, $this->getTag()); } - public function decideForFork($token) + public function decideForFork(Twig_Token $token) { return $token->test(array('plural', 'endtrans')); } - public function decideForEnd($token) + public function decideForEnd(Twig_Token $token) { return $token->test('endtrans'); } @@ -77,4 +77,4 @@ class Twig_Extensions_TokenParser_Trans extends Twig_TokenParser throw new Twig_Error_Syntax(sprintf('The text to be translated with "trans" can only contain references to simple variables'), $lineno); } } -} +} \ No newline at end of file -- cgit v1.3 From 5a44c50811ba9a927add4d54604307692492df8a Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 17:18:10 -0400 Subject: Simple file editor replacement for ?/config (optional). Issue #127 --- inc/config.php | 7 +++--- inc/mod/pages.php | 29 ++++++++++++++++++----- templates/mod/config-editor-php.html | 45 ++++++++++++++++++++++++++++++++++++ templates/mod/dashboard.html | 2 +- templates/mod/edit_post_form.html | 2 +- 5 files changed, 74 insertions(+), 11 deletions(-) create mode 100644 templates/mod/config-editor-php.html (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index d82ebfc6..bddb9e4c 100644 --- a/inc/config.php +++ b/inc/config.php @@ -929,6 +929,9 @@ // Automatically dismiss all reports regarding a thread when it is locked $config['mod']['dismiss_reports_on_lock'] = true; + // Replace ?/config with a simple text editor for editing inc/instance-config.php + $config['mod']['config_editor_php'] = false; + // Probably best not to change these: if (!defined('JANITOR')) { define('JANITOR', 0, true); @@ -999,7 +1002,7 @@ // Bypass flood check $config['mod']['flood'] = ADMIN; // Raw HTML posting - $config['mod']['rawhtml'] = DISABLED; + $config['mod']['rawhtml'] = ADMIN; /* Administration */ // View the report queue @@ -1077,8 +1080,6 @@ // Delete news entries $config['mod']['news_delete'] = ADMIN; - // View the current configuration - $config['mod']['show_config'] = ADMIN; // Edit the current configuration (via web interface) $config['mod']['edit_config'] = ADMIN; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 1e0dc7c9..615e85c7 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1304,13 +1304,12 @@ function mod_edit_post($board, $edit_raw_html, $postID) { header('Location: ?/' . sprintf($config['board_path'], $board) . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $postID) . '#' . $postID, true, $config['redirect_http']); } else { if ($config['minify_html']) { - // $post['body_nomarkup'] = str_replace("\n", ' ', $post['body_nomarkup']); - // $post['body'] = str_replace("\n", ' ', $post['body']); + $post['body_nomarkup'] = str_replace("\n", ' ', utf8tohtml($post['body_nomarkup'])); + $post['body'] = str_replace("\n", ' ', utf8tohtml($post['body'])); + $post['body_nomarkup'] = str_replace("\r", '', $post['body_nomarkup']); + $post['body'] = str_replace("\r", '', $post['body']); } - - // Minifying this page causes an issue with newlines in the textarea. This is a temporary solution. - $config['minify_html'] = false; - + mod_page(_('Edit post'), 'mod/edit_post_form.html', array('token' => $security_token, 'board' => $board, 'raw' => $edit_raw_html, 'post' => $post)); } } @@ -1948,6 +1947,24 @@ function mod_config() { if (!hasPermission($config['mod']['edit_config'])) error($config['error']['noaccess']); + if ($config['mod']['config_editor_php']) { + $readonly = !is_writable('inc/instance-config.php'); + + if (!$readonly && isset($_POST['code'])) { + $code = $_POST['code']; + file_put_contents('inc/instance-config.php', $code); + header('Location: ?/config', true, $config['redirect_http']); + return; + } + + $instance_config = file_get_contents('inc/instance-config.php'); + $instance_config = str_replace("\n", ' ', utf8tohtml($instance_config)); + + mod_page(_('Config editor'), 'mod/config-editor-php.html', array('php' => $instance_config, 'readonly' => $readonly)); + return; + } + + require_once 'inc/mod/config-editor.php'; $conf = config_vars(); diff --git a/templates/mod/config-editor-php.html b/templates/mod/config-editor-php.html new file mode 100644 index 00000000..54c398e4 --- /dev/null +++ b/templates/mod/config-editor-php.html @@ -0,0 +1,45 @@ +{% if readonly %} +

    Tinyboard does not have the required permissions to edit inc/instance-config.php. To make changes, you will need to change the file's permissions first or manually edit the code.

    +{% endif %} + + +{% if not readonly %}
    {% endif %} + + +
      +
    • +
    +{% if not readonly %}
    {% endif %} + + \ No newline at end of file diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index 5f6585fc..e9fb7c9c 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -94,7 +94,7 @@ {% if mod|hasPermission(config.mod.rebuild) %}
  • {% trans 'Rebuild' %}
  • {% endif %} - {% if mod|hasPermission(config.mod.show_config) %} + {% if mod|hasPermission(config.mod.edit_config) %}
  • {% trans 'Configuration' %}
  • {% endif %} diff --git a/templates/mod/edit_post_form.html b/templates/mod/edit_post_form.html index b9359c68..a2980d35 100644 --- a/templates/mod/edit_post_form.html +++ b/templates/mod/edit_post_form.html @@ -32,7 +32,7 @@ {% trans %}Comment{% endtrans %} - + -- cgit v1.3 From 40ab2e0c1728fab613bc16a19ab8fcb3fa78c1d4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Thu, 1 Aug 2013 21:28:16 -0400 Subject: Don't redraw image again after correcting image orientation; Correct image orientation with convert+gifsicle too --- inc/image.php | 4 ++-- post.php | 10 ++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 5910cb85..51db2f83 100644 --- a/inc/image.php +++ b/inc/image.php @@ -251,9 +251,9 @@ class ImageConvert extends ImageBase { if (!$this->temp) { if ($config['strip_exif']) { - shell_exec('convert ' . escapeshellarg($this->src) . ' -strip ' . escapeshellarg($src)); + shell_exec('convert ' . escapeshellarg($this->src) . ' -auto-orient -strip ' . escapeshellarg($src)); } else { - shell_exec('convert ' . escapeshellarg($this->src) . ' ' . escapeshellarg($src)); + shell_exec('convert ' . escapeshellarg($this->src) . ' -auto-orient ' . escapeshellarg($src)); } } else { rename($this->temp, $src); diff --git a/post.php b/post.php index 22782ca7..5031830f 100644 --- a/post.php +++ b/post.php @@ -450,10 +450,12 @@ if (isset($_POST['delete'])) { if ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg') { // The following code corrects the image orientation. // Currently only works with the 'convert' option selected but it could easily be expanded to work with the rest if you can be bothered. - if ($config['thumb_method'] == 'convert') { - $exif = exif_read_data($upload); - if (isset($exif['Orientation']) && $exif['Orientation'] != 1) { - shell_exec('convert ' . escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload)); + if (!($config['redraw_image'] || ($config['strip_exif'] && ($post['extension'] == 'jpg' || $post['extension'] == 'jpeg')))) { + if ($config['thumb_method'] == 'convert' || $config['thumb_method'] == 'convert+gifsicle') { + $exif = exif_read_data($upload); + if (isset($exif['Orientation']) && $exif['Orientation'] != 1) { + shell_exec('convert ' . escapeshellarg($upload) . ' -auto-orient ' . escapeshellarg($upload)); + } } } } -- cgit v1.3 From f06978659b4ff4e18e9547ebd4af514d56123cfb Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 00:08:37 -0400 Subject: Installer: Nicer pre-installation test --- inc/config.php | 19 +-- install.php | 191 +++++++++++++++++++++------- templates/installer/check-requirements.html | 54 ++++++++ 3 files changed, 211 insertions(+), 53 deletions(-) create mode 100644 templates/installer/check-requirements.html (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index bddb9e4c..fe771358 100644 --- a/inc/config.php +++ b/inc/config.php @@ -418,16 +418,17 @@ $config['thumb_keep_animation_frames'] = 1; // Thumbnailing method: - // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). - // This is a prerequisite for Tinyboard no matter what method you choose. - // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. - // A few minor bugs. http://pecl.php.net/package/imagick - // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in - // PHP Imagick. - // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) - // instead of `convert` for resizing gifs. It's faster and resulting animated gifs - // have less artifacts than if resized with ImageMagick. + // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). + // This is a prerequisite for Tinyboard no matter what method you choose. + // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. + // A few minor bugs. http://pecl.php.net/package/imagick + // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in + // PHP Imagick. `convert` produces the best still thumbnails and is highly recommended. + // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) + // instead of `convert` for resizing GIFs. It's faster and resulting animated thumbnails + // have less artifacts than if resized with ImageMagick. $config['thumb_method'] = 'gd'; + // $config['thumb_method'] = 'convert'; // Strip EXIF metadata from JPEG files $config['strip_exif'] = false; diff --git a/install.php b/install.php index 6bb161dc..fa41ad2d 100644 --- a/install.php +++ b/install.php @@ -388,53 +388,156 @@ if ($step == 0) { } elseif ($step == 1) { $page['title'] = 'Pre-installation test'; - $page['body'] = ''; - - function rheader($item) { - global $page, $config; - - $page['body'] .= ''; - } - - function row($item, $result) { - global $page, $config, $__is_error; - if (!$result) - $__is_error = true; - $page['body'] .= ''; + $can_exec = true; + if (!function_exists('shell_exec')) + $can_exec = false; + elseif (in_array('shell_exec', array_map('trim', explode(', ', ini_get('disable_functions'))))) + $can_exec = false; + elseif (ini_get('safe_mode')) + $can_exec = false; + elseif (trim(shell_exec('echo "TEST"')) !== 'TEST') + $can_exec = false; + + if (!defined('PHP_VERSION_ID')) { + $version = explode('.', PHP_VERSION); + define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); } - // Required extensions - rheader('PHP extensions'); - row('PDO', extension_loaded('pdo')); - row('GD', extension_loaded('gd')); - - // GD tests - rheader('GD tests'); - row('JPEG', function_exists('imagecreatefromjpeg')); - row('PNG', function_exists('imagecreatefrompng')); - row('GIF', function_exists('imagecreatefromgif')); - - // Database drivers - $drivers = PDO::getAvailableDrivers(); - - rheader('PDO drivers (currently installed drivers)'); - foreach ($drivers as &$driver) { - row($driver, true); - } - - // Permissions - rheader('File permissions'); - row('root directory (' . getcwd() . ')', is_writable('.')); - - $page['body'] .= '
    ' . $item . '
    ' . $item . '
    -

    - Continue' . (isset($__is_error) ? ' anyway' : '') . ' -

    '; - - echo Element('page.html', $page); + $extensions = array( + 'PDO' => array( + 'installed' => extension_loaded('pdo'), + 'required' => true + ), + 'PDO' => array( + 'installed' => extension_loaded('gd'), + 'required' => true + ), + 'Imagick' => array( + 'installed' => extension_loaded('imagick'), + 'required' => false + ) + ); + + $tests = array( + array( + 'category' => 'PHP', + 'name' => 'PHP ≥ 5.2.5', + 'result' => PHP_VERSION_ID >= 50205, + 'required' => true, + 'message' => 'Tinyboard requires PHP 5.2.5 or better.', + ), + array( + 'category' => 'PHP', + 'name' => 'PHP ≥ 5.3', + 'result' => PHP_VERSION_ID >= 50300, + 'required' => false, + 'message' => 'PHP ≥ 5.3, though not required, is recommended to make the most out of Tinyboard configuration files.', + ), + array( + 'category' => 'PHP', + 'name' => 'mbstring extension installed', + 'result' => extension_loaded('mbstring'), + 'required' => true, + 'message' => 'You must install the PHP mbstring extension.', + ), + array( + 'category' => 'Database', + 'name' => 'PDO extension installed', + 'result' => extension_loaded('pdo'), + 'required' => true, + 'message' => 'You must install the PHP PDO extension.', + ), + array( + 'category' => 'Database', + 'name' => 'MySQL PDO driver installed', + 'result' => extension_loaded('pdo') && in_array('mysql1', PDO::getAvailableDrivers()), + 'required' => true, + 'message' => 'The required PDO MySQL driver is not installed.', + ), + array( + 'category' => 'Image processing', + 'name' => 'GD extension installed', + 'result' => extension_loaded('gd'), + 'required' => true, + 'message' => 'You must install the PHP GD extension. GD is a requirement even if you have chosen another image processor for thumbnailing.', + ), + array( + 'category' => 'Image processing', + 'name' => 'GD: JPEG', + 'result' => function_exists('imagecreatefromjpeg'), + 'required' => true, + 'message' => 'imagecreatefromjpeg() does not exist. This is a problem.', + ), + array( + 'category' => 'Image processing', + 'name' => 'GD: PNG', + 'result' => function_exists('imagecreatefrompng'), + 'required' => true, + 'message' => 'imagecreatefrompng() does not exist. This is a problem.', + ), + array( + 'category' => 'Image processing', + 'name' => 'GD: GIF', + 'result' => function_exists('imagecreatefromgif'), + 'required' => true, + 'message' => 'imagecreatefromgif() does not exist. This is a problem.', + ), + array( + 'category' => 'Image processing', + 'name' => 'Imagick extension installed', + 'result' => extension_loaded('imagick1'), + 'required' => false, + 'message' => '(Optional) The PHP Imagick (ImageMagick) extension is not installed. You may not use Imagick for better (and faster) image processing.', + ), + array( + 'category' => 'Image processing', + 'name' => '`convert` (command-line ImageMagick)', + 'result' => $can_exec && shell_exec('which convert'), + 'required' => false, + 'message' => '(Optional) `convert` was not found or executable; command-line ImageMagick image processing cannot be enabled.', + ), + array( + 'category' => 'Image processing', + 'name' => '`identify` (command-line ImageMagick)', + 'result' => $can_exec && shell_exec('which identify'), + 'required' => false, + 'message' => '(Optional) `identify` was not found or executable; command-line ImageMagick image processing cannot be enabled.', + ), + array( + 'category' => 'Image processing', + 'name' => '`gifsicle` (command-line animted GIF thumbnailing)', + 'result' => $can_exec && shell_exec('which gifsicle1'), + 'required' => false, + 'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.', + ), + array( + 'category' => 'File permissions', + 'name' => getcwd(), + 'result' => is_writable('.'), + 'required' => true, + 'message' => 'Tinyboard does not have permission to create directories (boards) here. You will need to chmod (or operating system equivalent) appropriately.' + ), + array( + 'category' => 'File permissions', + 'name' => getcwd() . '/inc/instance-config.php', + 'result' => is_writable('inc/instance-config.php'), + 'required' => false, + 'message' => 'Tinyboard does not have permission to make changes to inc/instance-config.php. To complete the installation, you will be asked to manually copy and paste code into the file instead.' + ) + ); + + $config['font_awesome'] = true; + + echo Element('page.html', array( + 'body' => Element('installer/check-requirements.html', array( + 'extensions' => $extensions, + 'tests' => $tests, + 'config' => $config + )), + 'title' => 'Checking environment', + 'config' => $config + )); } elseif ($step == 2) { // Basic config $page['title'] = 'Configuration'; diff --git a/templates/installer/check-requirements.html b/templates/installer/check-requirements.html new file mode 100644 index 00000000..fea6fed8 --- /dev/null +++ b/templates/installer/check-requirements.html @@ -0,0 +1,54 @@ +
    +

    Pre-installation tests

    + + + + + + + {% set errors = 0 %} + {% set warnings = 0 %} + {% for test in tests %} + + + + + + {% endfor %} +
    CategoryTestResult
    {{ test.category }}{{ test.name }} + {% if test.result %} + + {% else %} + {% if test.required %} + {% set errors = errors + 1 %} + + {% else %} + {% set warnings = warnings + 1 %} + + {% endif %} + {% endif %} +
    + {% if errors or warnings %} +

    There were {{ errors }} error(s) and {{ warnings }} warning(s).

    +
      + {% for test in tests if not test.result%} +
    • + {% if test.required %} + Error: + {% else %} + Warning: + {% endif %} + {{ test.message }} +
    • + {% endfor %} +
    + {% if errors %} +

    Clik here to ignore errors and attempt installing anyway (not recommended).

    + {% else %} +

    Clik here to proceed with installation.

    + {% endif %} + {% else %} +

    There were no errors or warnings. Good!

    +

    Clik here to proceed with installation.

    + {% endif %} +
    -- cgit v1.3 From 4fce9b63aee89c04ea0d833992e72ab75585f630 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 20:52:58 -0400 Subject: Major config.php cleanup and a few minor misc fixes. --- inc/config.php | 1040 +++++++++++++++++++++++-------------------- inc/display.php | 42 +- inc/filters.php | 4 +- inc/functions.php | 13 +- inc/image.php | 14 +- mod.php | 11 +- post.php | 2 +- templates/generic_page.html | 2 +- templates/index.html | 2 +- templates/thread.html | 2 +- 10 files changed, 605 insertions(+), 527 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index fe771358..c181c0c5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -29,45 +29,49 @@ * General/misc settings * ======================= */ - // Blotter -- the simple version. - //$config['blotter'] = 'This is an important announcement!'; - - // Automatically check if a newer version of Tinyboard is available when an administrator logs in + + // Global announcement -- the very simple version. + // This used to be wrongly named $config['blotter'] (still exists as an alias). + // $config['global_message'] = 'This is an important announcement!'; + $config['blotter'] = &$config['global_message']; + + // Automatically check if a newer version of Tinyboard is available when an administrator logs in. $config['check_updates'] = true; // How often to check for updates $config['check_updates_time'] = 43200; // 12 hours - - // Shows some extra information at the bottom of pages. Good for debugging development. + + // Shows some extra information at the bottom of pages. Good for development/debugging. $config['debug'] = false; - // For development purposes. Turns 'display_errors' on. Not recommended for production. + // For development purposes. All this does is turn 'display_errors' on. $config['verbose_errors'] = true; - - // Directory where temporary files will be created. Not really used much yet except for some experimental stuff. + + // Directory where temporary files will be created. $config['tmp'] = sys_get_temp_dir(); - + // The HTTP status code to use when redirecting. http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html // Can be either 303 "See Other" or 302 "Found". (303 is more correct but both should work.) + // There is really no reason for you to ever need to change this. $config['redirect_http'] = 303; - - // A small file in the main directory indicating that the script has been ran and the board(s) have been generated. - // This keeps the script from querying the database and causing strain when not needed. + + // A tiny text file in the main directory indicating that the script has been ran and the board(s) have + // been generated. This keeps the script from querying the database and causing strain when not needed. $config['has_installed'] = '.installed'; - + // Use syslog() for logging all error messages and unauthorized login attempts. $config['syslog'] = false; - + // Use `host` via shell_exec() to lookup hostnames, avoiding query timeouts. May not work on your system. // Requires safe_mode to be disabled. $config['dns_system'] = false; - + /* * ==================== * Database settings * ==================== */ - - // SQL driver ("mysql", "pgsql", "sqlite", "dblib", etc) - // http://www.php.net/manual/en/pdo.drivers.php + + // Database driver (http://www.php.net/manual/en/pdo.drivers.php) + // Only MySQL is supported by Tinyboard at the moment, sorry. $config['db']['type'] = 'mysql'; // Hostname or IP address $config['db']['server'] = 'localhost'; @@ -81,60 +85,72 @@ // Use a persistent connection (experimental) $config['db']['persistent'] = false; // Anything more to add to the DSN string (eg. port=xxx;foo=bar) - $config['db']['dsn'] = 'charset=UTF8'; + $config['db']['dsn'] = ''; // Timeout duration in seconds (not all drivers support this) $config['db']['timeout'] = 5; - + /* * ==================== * Cache settings * ==================== */ - - $config['cache']['enabled'] = false; - // $config['cache']['enabled'] = 'memcached'; - // $config['cache']['enabled'] = 'redis'; - // $config['cache']['enabled'] = 'apc'; - // $config['cache']['enabled'] = 'xcache'; - - // Timeout for cached objects such as posts and HTML - $config['cache']['timeout'] = 43200; // 12 hours - - // Optional prefix if you're running multiple Tinyboard instances on the same machine + + /* + * On top of the static file caching system, you can enable the additional caching system which is + * designed to minimize SQL queries and can significantly increase speed when posting or using the + * moderator interface. APC is the recommended method of caching. + * + * http://tinyboard.org/docs/index.php?p=Config/Cache + */ + + $config['cache']['enabled'] = false; + // $config['cache']['enabled'] = 'xcache'; + // $config['cache']['enabled'] = 'apc'; + // $config['cache']['enabled'] = 'memcached'; + // $config['cache']['enabled'] = 'redis'; + + // Timeout for cached objects such as posts and HTML. + $config['cache']['timeout'] = 60 * 60 * 48; // 48 hours + + // Optional prefix if you're running multiple Tinyboard instances on the same machine. $config['cache']['prefix'] = ''; - - // Memcached servers to use - http://www.php.net/manual/en/memcached.addservers.php + + // Memcached servers to use. Read more: http://www.php.net/manual/en/memcached.addservers.php $config['cache']['memcached'] = array( array('localhost', 11211) ); // Redis server to use. Location, port, password, database id. - // Note that Tinyboard may clear the database at times, so you may want to pick a - // database id just for Tinyboard to use. + // Note that Tinyboard may clear the database at times, so you may want to pick a database id just for + // Tinyboard to use. $config['cache']['redis'] = array('localhost', 6379, '', 1); - + /* * ==================== * Cookie settings * ==================== */ - - // Used for moderation login + + // Used for moderation login. $config['cookies']['mod'] = 'mod'; + // Used for communicating with Javascript; telling it when posts were successful. - // Rebuild Javascript file after changing this value or it won't work. $config['cookies']['js'] = 'serv'; - // Cookies "path". Defaults to $config['root']. If $config['root'] is a URL, you need to set this. Should be '/' or '/board/', depending on your installation. + + // Cookies path. Defaults to $config['root']. If $config['root'] is a URL, you need to set this. Should + // be '/' or '/board/', depending on your installation. // $config['cookies']['path'] = '/'; // Where to set the 'path' parameter to $config['cookies']['path'] when creating cookies. Recommended. $config['cookies']['jail'] = true; - // How long should the cookies last (in seconds) - $config['cookies']['expire'] = 15778463; //6 months - // Make this something long and random for security + + // How long should the cookies last (in seconds). Defines how long should moderators should remain logged + // in (0 = browser session). + $config['cookies']['expire'] = 60 * 60 * 24 * 30 * 6; // ~6 months + + // Make this something long and random for security. $config['cookies']['salt'] = 'abcdefghijklmnopqrstuvwxyz09123456789!@#$%^&*()'; - // How long should moderators should remain logged in (0=browser session) (in seconds) - $config['mod']['expire'] = 15778463; //6 months - // Used to salt secure tripcodes (##trip) and poster IDs (if enabled) + + // Used to salt secure tripcodes ("##trip") and poster IDs (if enabled). $config['secure_trip_salt'] = ')(*&^%$#@!98765432190zyxwvutsrqponmlkjihgfedcba'; /* @@ -142,22 +158,29 @@ * Flood/spam settings * ==================== */ - - // How many seconds between each post + + // Minimum time between between each post by the same IP address. $config['flood_time'] = 10; - // How many seconds between each post with exactly the same content and same IP + // Minimum time between between each post with the exact same content AND same IP address. $config['flood_time_ip'] = 120; - // Same as above but different IP address + // Same as above but by a different IP address. (Same content, not necessarily same IP address.) $config['flood_time_same'] = 30; - - // DNS blacklists (DNSBL) http://tinyboard.org/docs/?p=Config/DNSBL - - // http://www.sectoor.de/tor.php - $config['dnsbl'][] = array('tor.dnsbl.sectoor.de', 1); // Tor exit servers - + + /* + * To further prevent spam and abuse, you can use DNS blacklists (DNSBL). A DNSBL is a list of IP + * addresses published through the Internet Domain Name Service (DNS) either as a zone file that can be + * used by DNS server software, or as a live DNS zone that can be queried in real-time. + * + * Read more: http://tinyboard.org/docs/?p=Config/DNSBL + */ + + // Prevents most Tor exit nodes from making posts. Recommended, as a lot of abuse comes from Tor because + // of the strong anonymity associated with it. + $config['dnsbl'][] = array('tor.dnsbl.sectoor.de', 1); + // http://www.sorbs.net/using.shtml // $config['dnsbl'][] = array('dnsbl.sorbs.net', array(2, 3, 4, 5, 6, 7, 8, 9)); - + // http://www.projecthoneypot.org/httpbl.php // $config['dnsbl'][] = array('.%.dnsbl.httpbl.org', function($ip) { // $octets = explode('.', $ip); @@ -172,11 +195,10 @@ // // return true; // }, 'dnsbl.httpbl.org'); // hide our access key - - + // Skip checking certain IP addresses against blacklists (for troubleshooting or whatever) $config['dnsbl_exceptions'][] = '127.0.0.1'; - + /* * Introduction to Tinyboard's spam filter: * @@ -196,14 +218,17 @@ * See also: http://tinyboard.org/docs/?p=Your_request_looks_automated * */ - - // Number of hidden fields to generate + + // Number of hidden fields to generate. $config['spam']['hidden_inputs_min'] = 4; $config['spam']['hidden_inputs_max'] = 12; + // How many times can a "hash" be used to post? $config['spam']['hidden_inputs_max_pass'] = 12; + // How soon after regeneration do hashes expire (in seconds)? $config['spam']['hidden_inputs_expire'] = 60 * 60 * 3; // three hours + // These are fields used to confuse the bots. Make sure they aren't actually used by Tinyboard, or it won't work. $config['spam']['hidden_input_names'] = array( 'user', @@ -217,6 +242,7 @@ 'text', 'message' ); + // Always update this when adding new valid fields to the post form, or EVERYTHING WILL BE DETECTED AS SPAM! $config['spam']['valid_inputs'] = array( 'hash', @@ -238,38 +264,14 @@ 'spoiler', 'quick-reply' ); - - // Custom flood filters. Detect flood attacks and reject new posts if there's a positive match. - // See http://tinyboard.org/wiki/index.php?title=Flood_filters for more information. - //$config['flood_filters'][] = array( - // 'condition' => array( - // // 100 posts in the past 5 minutes (~20 p/m) - // 'posts_in_past_x_minutes' => array(100, 5) - // ), - // // Don't allow the user to post - // 'action' => 'reject', - // // Display this message - // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board.' - //); - - // Another filter - //$config['flood_filters'][] = array( - // 'condition' => array( - // // 10 new empty threads in the past 2 minutes - // 'threads_with_no_replies_in_past_x_minutes' => array(10, 2), - // // Allow replies, but not new threads (ie. reject topics only). - // 'OP' => true - // ), - // 'action' => 'reject', - // 'message' => 'Your post has been rejected on the suspicion of a flood attack on this board (too many new threads); post a reply instead.' - //); - - // Enable reCaptcha to make spam even harder + + // Enable reCaptcha to make spam even harder. Rarely necessary. $config['recaptcha'] = false; + // Public and private key pair from https://www.google.com/recaptcha/admin/create $config['recaptcha_public'] = '6LcXTcUSAAAAAKBxyFWIt2SO8jwx4W7wcSMRoN3f'; $config['recaptcha_private'] = '6LcXTcUSAAAAAOGVbVdhmEM1_SyRF4xTKe8jbzf_'; - + /* * ==================== * Post settings @@ -279,103 +281,155 @@ // Do you need a body for your reply posts? $config['force_body'] = false; // Do you need a body for new threads? - $config['force_body_op'] = true; - // Strip superfluous new lines at the end of a post - $config['strip_superfluous_returns'] = true; + $config['force_body_op'] = true; // Require an image for threads? $config['force_image_op'] = true; - // Strip combining characters from Unicode strings (eg. "Zalgo") + + // Strip superfluous new lines at the end of a post. + $config['strip_superfluous_returns'] = true; + // Strip combining characters from Unicode strings (eg. "Zalgo"). $config['strip_combining_chars'] = true; - - // Max body length + + // Maximum post body length. $config['max_body'] = 1800; - // Amount of post lines to show on the index page + // Maximum number of post body lines to show on the index page. $config['body_truncate'] = 15; - // Amount of characters to show on the index page + // Maximum number of characters to show on the index page. $config['body_truncate_char'] = 2500; - - // Typically spambots try to post a lot of links. Refuse a post with X standalone links? + + // Typically spambots try to post many links. Refuse a post with X links? $config['max_links'] = 20; - // Maximum number of cites per post (protects against abuse) + // Maximum number of cites per post (prevents abuse, as more citations mean more database queries). $config['max_cites'] = 45; - // Maximum number of cross-board links/cites per post + // Maximum number of cross-board links/citations per post. $config['max_cross'] = $config['max_cites']; - + // Track post citations (>>XX). Rebuilds posts after a cited post is deleted, removing broken links. - // A little more database load. + // Puts a little more load on the database. $config['track_cites'] = true; - - // Maximum filename length (will be truncated) + + // Maximum filename length (will be truncated). $config['max_filename_len'] = 255; - // Maximum filename length to display (the rest can be viewed upon mouseover) + // Maximum filename length to display (the rest can be viewed upon mouseover). $config['max_filename_display'] = 30; - - // How long before you can delete a post after posting, in seconds. + + // How long after posting should you have to wait before being able to delete that post? (In seconds.) $config['delete_time'] = 10; - // Reply limit (stops bumping thread when this is reached) + // 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) + + // 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) + // 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; + // Strip repeating characters when making hashes. $config['robot_strip_repeating'] = true; - - // Enable mutes - // Tinyboard uses ROBOT9000's original 2^x implementation + // Enabled mutes? Tinyboard uses ROBOT9000's original 2^x implementation where x is the number of times + // you have been muted in the past. $config['robot_mute'] = true; - // How many mutes x hours ago to include in the algorithm + // How long before Tinyboard forgets about a mute? $config['robot_mute_hour'] = 336; // 2 weeks - // If you want to alter the algorithm a bit. Default value is 2. n^x - $config['robot_mute_multiplier'] = 2; + // If you want to alter the algorithm a bit. Default value is 2. + $config['robot_mute_multiplier'] = 2; // (n^x where x is the number of previous mutes) $config['robot_mute_descritpion'] = _('You have been muted for unoriginal content.'); - - // Automatically convert things like "..." to Unicode characters ("…") + + // Automatically convert things like "..." to Unicode characters ("…"). $config['auto_unicode'] = true; - // Whether to turn URLs into functional links + // Whether to turn URLs into functional links. $config['markup_urls'] = true; - // Optional URL prefix for links (eg. "http://anonym.to/?") + // Optional URL prefix for links (eg. "http://anonym.to/?"). $config['link_prefix'] = ''; - - - // Wordfilters are used to automatically replace certain words/phrases with something else. + + + // 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. + // For a normal string replacement: - // $config['wordfilters'][] = array('cat', 'dog'); - + // $config['wordfilters'][] = array('cat', 'dog'); // Advanced raplcement (regular expressions): - // $config['wordfilters'][] = array('/cat/', 'dog', true); // 'true' means it's a regular expression - - // Always act as if they had typed "noko" in the email field no mattter what + // $config['wordfilters'][] = array('/ca[rt]/', 'dog', true); // 'true' means it's a regular expression + + // Always act as if the user had typed "noko" into the email field. $config['always_noko'] = false; - - // Custom tripcodes. The below example makes a tripcode - // of "#test123" evaluate to "!HelloWorld" + + // Custom tripcodes. The below example makes a tripcode of "#test123" evaluate to "!HelloWorld". // $config['custom_tripcode']['#test123'] = '!HelloWorld'; // $config['custom_tripcode']['##securetrip'] = '!!somethingelse'; - - // Optional spoiler images + + // Allow users to mark their image as a "spoiler" when posting. The thumbnail will be replaced with a + // static spoiler image instead (see $config['spoiler_image']). $config['spoiler_images'] = false; - - + // With the following, you can disable certain superfluous fields or enable "forced anonymous". - + // When true, all names will be set to $config['anonymous']. $config['field_disable_name'] = false; - // When true, no email will be able to be set. + // When true, there will be no email field. $config['field_disable_email'] = false; - // When true, no subject will be able to be set. + // When true, there will be no subject field. $config['field_disable_subject'] = false; - // When true, no subject will be able to be set in replies. + // When true, there will be no subject field for replies. $config['field_disable_reply_subject'] = false; // 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; - + + // Require users to see the ban page at least once for a ban even if it has since expired. + $config['require_ban_view'] = true; + + /* + * Custom filters detect certain posts and reject/ban accordingly. They are made up of a + * condition and an action (for when ALL conditions are met). As every single post has to + * be put through each filter, having hundreds probably isn’t ideal as it could slow things down. + * + * Read more: http://tinyboard.org/docs/index.php?p=Config/Filters + * + * This used to be named $config['flood_filters'] (still exists as an alias). + */ + + // An example of blocking an imaginary known spammer, who keeps posting a reply with the name "surgeon", + // ending his posts with "regards, the surgeon" or similar. + // $config['filters'][] = array( + // 'condition' => array( + // 'name' => '/^surgeon$/', + // 'body' => '/regards,\s+(the )?surgeon$/i', + // 'OP' => false + // ), + // 'action' => 'reject', + // 'message' => 'Go away, spammer.' + // ); + + // Same as above, but issuing a 3-hour ban instead of just reject the post. + // $config['filters'][] = array( + // 'condition' => array( + // 'name' => '/^surgeon$/', + // 'body' => '/regards,\s+(the )?surgeon$/i', + // 'OP' => false + // ), + // 'action' => 'ban', + // 'expires' => 60 * 60 * 3, // 3 hours + // 'reason' => 'Go away, spammer.' + // ); + + // PHP 5.3+ (anonymous functions) + // There is also a "custom" condition, making the possibilities of this feature pretty much endless. + // This is a bad example, because there is already a "name" condition built-in. + // $config['filters'][] = array( + // 'condition' => array( + // 'body' => '/h$/i', + // 'OP' => false, + // 'custom' => function($post) { + // if($post['name'] == 'Anonymous') + // return true; + // else + // return false; + // } + // ), + // 'action' => 'reject' + // ); + /* * ==================== * Markup settings @@ -386,122 +440,136 @@ $config['markup'][] = array("/'''([^<]+?)'''/", "\$1"); $config['markup'][] = array("/''([^<]+?)''/", "\$1"); $config['markup'][] = array("/\*\*([^<]+?)\*\*/", "\$1"); - $config['markup'][] = array("/^[ |\t]*==([^<]+?)==[ |\t]*$/m", "\$1"); - - // Highlight PHP code wrapped in tags (PHP 5.3.0+) + // $config['markup'][] = array("/^[ |\t]*==([^<]+?)==[ |\t]*$/m", "\$1"); + + // Highlight PHP code wrapped in tags (PHP 5.3+) // $config['markup'][] = array( // '/^<code>(.+)<\/code>/ms', // function($matches) { // return highlight_string(html_entity_decode($matches[1]), true); // } // ); - + /* * ==================== * Image settings * ==================== */ - - // For resizing, max thumbnail size + + // For resizing, maximum thumbnail dimensions. $config['thumb_width'] = 255; $config['thumb_height'] = 255; - // Max thumbnail size for thread images + // Maximum thumbnail dimensions for thread (OP) images. $config['thumb_op_width'] = 255; $config['thumb_op_height'] = 255; - - // Thumbnail extension, empty for inherited (png recommended) + + // Thumbnail extension ("png" recommended). Leave this empty if you want the extension to be inherited + // from the uploaded file. $config['thumb_ext'] = 'png'; - - // Maximum amount of frames to resize (more frames means more processing power). "1" means no animated thumbnails. - // Requires $config['thumb_ext'] to be 'gif' and $config['thumb_method'] to be 'imagick', 'convert', or 'convert+gifsicle'. - // Not respected by 'convert'; will just resize all frames if this is > 1. + + // Maximum amount of animated GIF frames to resize (more frames can mean more processing power). A value + // of "1" means thumbnails will not be animated. Requires $config['thumb_ext'] to be 'gif' (or blank) and + // $config['thumb_method'] to be 'imagick', 'convert', or 'convert+gifsicle'. This value is not respected + // by 'convert'; will just resize all frames if this is > 1. $config['thumb_keep_animation_frames'] = 1; - - // Thumbnailing method: - // - 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). - // This is a prerequisite for Tinyboard no matter what method you choose. - // - 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. - // A few minor bugs. http://pecl.php.net/package/imagick - // - 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in - // PHP Imagick. `convert` produces the best still thumbnails and is highly recommended. - // - 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) - // instead of `convert` for resizing GIFs. It's faster and resulting animated thumbnails - // have less artifacts than if resized with ImageMagick. + + /* + * Thumbnailing method: + * + * 'gd' PHP GD (default). Only handles the most basic image formats (GIF, JPEG, PNG). + * GD is a prerequisite for Tinyboard no matter what method you choose. + * + * 'imagick' PHP's ImageMagick bindings. Fast and efficient, supporting many image formats. + * A few minor bugs. http://pecl.php.net/package/imagick + * + * 'convert' The command line version of ImageMagick (`convert`). Fixes most of the bugs in + * PHP Imagick. `convert` produces the best still thumbnails and is highly recommended. + * + * 'convert+gifsicle' Same as above, with the exception of using `gifsicle` (command line application) + * instead of `convert` for resizing GIFs. It's faster and resulting animated + * thumbnails have less artifacts than if resized with ImageMagick. + */ $config['thumb_method'] = 'gd'; // $config['thumb_method'] = 'convert'; - - // Strip EXIF metadata from JPEG files + + // Command-line options passed to ImageMagick when using `convert` for thumbnailing. + // http://www.imagemagick.org/ImageMagick-7.0.0/script/command-line-options.php + $config['convert_args'] = '-background transparent -filter Point -sample %dx%d +antialias -quality 50'; + + // Strip EXIF metadata from JPEG files. $config['strip_exif'] = false; - - // Regular expression to check for IE MIME type detection XSS exploit. To disable, comment the line out - // https://github.com/savetheinternet/Tinyboard/issues/20 + + // Regular expression to check for an XSS exploit with IE 6 and 7. To disable, set to false. + // Details: https://github.com/savetheinternet/Tinyboard/issues/20 $config['ie_mime_type_detection'] = '/<(?:body|head|html|img|plaintext|pre|script|table|title|a href|channel|scriptlet)/i'; - - // Allowed image file extensions + + // Allowed image file extensions. $config['allowed_ext'][] = 'jpg'; $config['allowed_ext'][] = 'jpeg'; $config['allowed_ext'][] = 'bmp'; $config['allowed_ext'][] = 'gif'; $config['allowed_ext'][] = 'png'; // $config['allowed_ext'][] = 'svg'; - - // Allowed additional file extensions (not images; downloadable files) + + // Allowed additional file extensions (not images; downloadable files). // $config['allowed_ext_files'][] = 'txt'; // $config['allowed_ext_files'][] = 'zip'; - - // An alternative function for generating a filename, instead of the default UNIX timestamp. - // http://tinyboard.org/wiki/index.php?title=Filenames - // $config['filename_func'] = 'some_function_you_have_created'; - - // Non-image file icons + + // An alternative function for generating image filenames, instead of the default UNIX timestamp. + // $config['filename_func'] = function($post) { + // return sprintf("%s", time() . substr(microtime(), 2, 3)); + // }; + + // Thumbnail to use for the non-image file uploads. $config['file_icons']['default'] = 'file.png'; $config['file_icons']['zip'] = 'zip.png'; - - // Thumbnail to use for the downloadable files (not images) + // $config['file_icons']['extension'] = 'some_file.png'; + + // Location of above images. $config['file_thumb'] = 'static/%s'; - // Thumbnail to use for spoiler images + // Location of thumbnail to use for spoiler images. $config['spoiler_image'] = 'static/spoiler.png'; - - // Thumbnail quality (compression level), from 0 to 9 - $config['thumb_quality'] = 8; - - // When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use that as a thumbnail instead of resizing/redrawing + // Location of thumbnail to use for deleted images. + $config['image_deleted'] = $config['dir']['static'] . 'deleted.png'; + + // When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use + // that as a thumbnail instead of resizing/redrawing. $config['minimum_copy_resize'] = false; - - // Store image hash in the database for r9k-like boards implementation soon - // Function name for hashing + + // Image hashing function. There's really no reason to change this. // sha1_file, md5_file, etc. You can also define your own similar function. $config['file_hash'] = 'sha1_file'; - - // Maximum image upload size in bytes - $config['max_filesize'] = 10*1024*1024; // 10MB - // Maximum image dimensions + + // Maximum image upload size in bytes. + $config['max_filesize'] = 10 * 1024 * 1024; // 10MB + // Maximum image dimensions. $config['max_width'] = 10000; - $config['max_height'] = $config['max_width']; // 1:1 - // Reject duplicate image uploads + $config['max_height'] = $config['max_width']; + // Reject duplicate image uploads. $config['image_reject_repost'] = true; - // Reject duplicate image uploads within the same thread. Doesn't change anything if image_reject_repost is true. + // Reject duplicate image uploads within the same thread. Doesn't change anything if + // $config['image_reject_repost'] is true. $config['image_reject_repost_in_thread'] = false; - - // Display the aspect ratio in a post's file info + + // Display the aspect ratio of uploaded files. $config['show_ratio'] = false; - // Display the file's original filename + // Display the file's original filename. $config['show_filename']= true; - // Image identification links using regex.info/exif, TinEye and Google Images + // Display image identification links using regex.info/exif, TinEye and Google Images. $config['image_identification'] = false; - - // Redraw the image using GD functions to strip any excess data (commonly ZIP archives) - // WARNING: Currently strips animated GIFs too + + // Redraw the image to strip any excess data (commonly ZIP archives) WARNING: This might strip the + // animation of GIFs, depending on the chosen thumbnailing method. $config['redraw_image'] = false; - + /* * ==================== * Board settings * ==================== */ - // Maximum amount of threads to display on a given page. + // Maximum amount of threads to display per page. $config['threads_per_page'] = 10; // Maximum number of pages. Content past the last page is automatically purged. $config['max_pages'] = 10; @@ -510,106 +578,111 @@ // Same as above, but for stickied threads. $config['threads_preview_sticky'] = 1; - // Name of the boards. Usually '/%s/' (/b/, /mu/, etc) - // $config['board_abbreviation'] - BOARD_TITLE + // How to display the URI of boards. Usually '/%s/' (/b/, /mu/, etc). This doesn't change the URL. Find + // $config['board_path'] if you wish to change the URL. $config['board_abbreviation'] = '/%s/'; - - // The default name (ie. Anonymous) + + // The default name (ie. Anonymous). $config['anonymous'] = 'Anonymous'; - - // How many reports you can create in the same request. + + // Number of reports you can create at once. $config['report_limit'] = 3; - + /* * ==================== * Display settings * ==================== */ - - // Locale (en, ru_RU.UTF-8, fi_FI.UTF-8, pl_PL.UTF-8) - $config['locale'] = 'en'; - - // Timezone + + // Tinyboard has been translated into a few langauges. See inc/locale for available translations. + $config['locale'] = 'en'; // (en, ru_RU.UTF-8, fi_FI.UTF-8, pl_PL.UTF-8) + + // Timezone to use for displaying dates/tiems. $config['timezone'] = 'America/Los_Angeles'; - - // The format string passed to strftime() for post times + // The format string passed to strftime() for displaying dates. // http://www.php.net/manual/en/function.strftime.php $config['post_date'] = '%m/%d/%y (%a) %H:%M:%S'; - // Same as above, but used for "you are banned' pages. $config['ban_date'] = '%A %e %B, %Y'; - - // The names on the post buttons. (On most imageboards, these are both "Post") + + // The names on the post buttons. (On most imageboards, these are both just "Post"). $config['button_newtopic'] = _('New Topic'); $config['button_reply'] = _('New Reply'); - - // Assign each poster in a thread a unique ID, shown by "ID: {id}" before the post number. + + // Assign each poster in a thread a unique ID, shown by "ID: xxxxx" before the post number. $config['poster_ids'] = false; - // Number of characters in the poster ID (maximum is 40) + // Number of characters in the poster ID (maximum is 40). $config['poster_id_length'] = 5; - - // Show thread subject in page title? + + // Show thread subject in page title. $config['thread_subject_in_title'] = false; - - // Page footer + + // Additional lines added to the footer of all pages. $config['footer'][] = _('All trademarks, copyrights, comments, and images on this page are owned by and are the responsibility of their respective parties.'); - - // Characters used to generate a random password (with Javascript) + + // Characters used to generate a random password (with Javascript). $config['genpassword_chars'] = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+'; - - // Optional banner at the top of every page. + + // Optional banner image at the top of every page. // $config['url_banner'] = '/banner.php'; - // Banner dimensions are also optional. As the banner loads after the rest of the page, everything - // may be shifted down a few pixels when it does. Making the banner a fixed size will prevent this. + // Banner dimensions are also optional. As the banner loads after the rest of the page, everything may be + // shifted down a few pixels when it does. Making the banner a fixed size will prevent this. // $config['banner_width'] = 300; // $config['banner_height'] = 100; - - // Custom stylesheets available. The prefix for each stylesheet URI is defined below. - $config['stylesheets']['Yotsuba B'] = ''; // default + + // Custom stylesheets available for the user to choose. See the "stylesheets/" folder for a list of + // available stylesheets (or create your own). + $config['stylesheets']['Yotsuba B'] = ''; // Default; there is no additional/custom stylesheet for this. $config['stylesheets']['Yotsuba'] = 'yotsuba.css'; // $config['stylesheets']['Futaba'] = 'futaba.css'; - + // $config['stylesheets']['Dark'] = 'dark.css'; + // The prefix for each stylesheet URI. Defaults to $config['root']/stylesheets/ // $config['uri_stylesheets'] = 'http://static.example.org/stylesheets/'; - - // The default stylesheet to use + + // The default stylesheet to use. $config['default_stylesheet'] = array('Yotsuba B', $config['stylesheets']['Yotsuba B']); - - // Make stylesheet selections board-specific + + // Make stylesheet selections board-specific. $config['stylesheets_board'] = false; - + // Use Font-Awesome for displaying lock and pin icons, instead of the images in static/. // http://fortawesome.github.io/Font-Awesome/icon/pushpin/ // http://fortawesome.github.io/Font-Awesome/icon/lock/ $config['font_awesome'] = true; $config['font_awesome_css'] = 'stylesheets/font-awesome/css/font-awesome.min.css'; - - // Boardlinks - // You can group, order and place the boardlist at the top of every page, using the following template. - //$config['boards'] = array( - // array('a', 'b'), - // array('c', 'd', 'e', 'f', 'g'), - // array('h', 'i', 'j'), - // array('k', array('l', 'm')), - // array('status' => 'http://status.example.org/') - //); - - // Categories - // Required for the Categories theme. - //$config['categories'] = array( - // 'Group Name' => array('a', 'b', 'c'), - // 'Another Group' => array('d') - //); - - // Custom_categories - // Optional for the Categories theme. array of name => (title, url) groups for categories with non-board links. - //$config['custom_categories'] = array( - // 'Links' => array( - // 'Tinyboard' => 'http://tinyboard.org', - // 'Donate' => 'donate.html' - // ) - //); - + + /* + * For lack of a better name, “boardlinks” are those sets of navigational links that appear at the top + * and bottom of board pages. They can be a list of links to boards and/or other pages such as status + * blogs and social network profiles/pages. + * + * "Groups" in the boardlinks are marked with square brackets. Tinyboard allows for infinite recursion + * with groups. Each array() in $config['boards'] represents a new square bracket group. + */ + + // $config['boards'] = array( + // array('a', 'b'), + // array('c', 'd', 'e', 'f', 'g'), + // array('h', 'i', 'j'), + // array('k', array('l', 'm')), + // array('status' => 'http://status.example.org/') + // ); + + // Board categories. Only used in the "Categories" theme. + // $config['categories'] = array( + // 'Group Name' => array('a', 'b', 'c'), + // 'Another Group' => array('d') + // ); + // Optional for the Categories theme. This is an array of name => (title, url) groups for categories + // with non-board links. + // $config['custom_categories'] = array( + // 'Links' => array( + // 'Tinyboard' => 'http://tinyboard.org', + // 'Donate' => 'donate.html' + // ) + // ); + // Automatically remove unnecessary whitespace when compiling HTML files from templates. $config['minify_html'] = true; @@ -619,25 +692,31 @@ * ==================== */ - // Additional Javascript files to include on board index and thread pages. + // Additional Javascript files to include on board index and thread pages. See js/ for available scripts. $config['additional_javascript'][] = 'js/inline-expanding.js'; // $config['additional_javascript'][] = 'js/local-time.js'; - - // Some scripts require jQuery. Check the comments in script files to see what's needed. + + // Some scripts require jQuery. Check the comments in script files to see what's needed. When enabling + // jQuery, you should first empty the array so that "js/query.min.js" can be the first, and then re-add + // "js/inline-expanding.js" or else the inline-expanding script might not interact properly with other + // scripts. + // $config['additional_javascript'] = array(); // $config['additional_javascript'][] = 'js/jquery.min.js'; + // $config['additional_javascript'][] = 'js/inline-expanding.js'; // $config['additional_javascript'][] = 'js/auto-reload.js'; - - // Where these script files are located on the web (defaults to $config['root']). - // $config['additional_javascript_url'] = '/js/'; - + // $config['additional_javascript'][] = 'js/post-hover.js'; + // $config['additional_javascript'][] = 'js/style-select.js'; + + // Where these script files are located on the web. Defaults to $config['root']. + // $config['additional_javascript_url'] = 'http://static.example.org/tinyboard-javascript-stuff/'; + // Compile all additional scripts into one file ($config['file_script']) instead of including them seperately. $config['additional_javascript_compile'] = false; - - // Minify Javascript using http://code.google.com/p/minify/ + + // Minify Javascript using http://code.google.com/p/minify/. $config['minify_js'] = false; - // Allows js/quick-reply.js to work - // This will make your imageboard more vulnerable to flood attacks. + // Allows js/quick-reply.js to work. This could make your imageboard more vulnerable to flood attacks. $config['quick_reply'] = false; /* @@ -645,12 +724,12 @@ * Video embedding * ==================== */ - - // Enable embedding (see below) + + // Enable embedding (see below). $config['enable_embedding'] = false; - + // Custom embedding (YouTube, vimeo, etc.) - // It's very important that you match the full string (with ^ and $) or things will not work correctly. + // It's very important that you match the entire input (with ^ and $) or things will not work correctly. $config['embedding'] = array( array( '/^https?:\/\/(\w+\.)?youtube\.com\/watch\?v=([a-zA-Z0-9\-_]{10,11})(&.+)?$/i', @@ -677,39 +756,39 @@ '' ) ); - - // Embedding width and height + + // Embedding width and height. $config['embed_width'] = 300; $config['embed_height'] = 246; - + /* * ==================== * Error messages * ==================== */ - + // Error messages - $config['error']['lurk'] = _('Lurk some more before posting.'); - $config['error']['bot'] = _('You look like a bot.'); - $config['error']['referer'] = _('Your browser sent an invalid or no HTTP referer.'); - $config['error']['toolong'] = _('The %s field was too long.'); + $config['error']['lurk'] = _('Lurk some more before posting.'); + $config['error']['bot'] = _('You look like a bot.'); + $config['error']['referer'] = _('Your browser sent an invalid or no HTTP referer.'); + $config['error']['toolong'] = _('The %s field was too long.'); $config['error']['toolong_body'] = _('The body was too long.'); $config['error']['tooshort_body'] = _('The body was too short or empty.'); - $config['error']['noimage'] = _('You must upload an image.'); - $config['error']['nomove'] = _('The server failed to handle your upload.'); - $config['error']['fileext'] = _('Unsupported image format.'); - $config['error']['noboard'] = _('Invalid board!'); + $config['error']['noimage'] = _('You must upload an image.'); + $config['error']['nomove'] = _('The server failed to handle your upload.'); + $config['error']['fileext'] = _('Unsupported image format.'); + $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']['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.'); + $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.'); $config['error']['unoriginal'] = _('Unoriginal content!'); - $config['error']['muted'] = _('Unoriginal content! You have been muted for %d seconds.'); + $config['error']['muted'] = _('Unoriginal content! You have been muted for %d seconds.'); $config['error']['youaremuted'] = _('You are muted! Expires in %d seconds.'); - $config['error']['dnsbl'] = _('Your IP address is listed in %s.'); + $config['error']['dnsbl'] = _('Your IP address is listed in %s.'); $config['error']['toomanylinks'] = _('Too many links; flood detected.'); $config['error']['toomanycites'] = _('Too many cites; post discarded.'); $config['error']['toomanycross'] = _('Too many cross-board links; post discarded.'); @@ -720,19 +799,19 @@ $config['error']['invalidimg'] = _('Invalid image.'); $config['error']['unknownext'] = _('Unknown file extension.'); $config['error']['filesize'] = _('Maximum file size: %maxsz% bytes
    Your file\'s size: %filesz% bytes'); - $config['error']['maxsize'] = _('The file was too big.'); + $config['error']['maxsize'] = _('The file was too big.'); $config['error']['invalidzip'] = _('Invalid archive!'); $config['error']['fileexists'] = _('That file already exists!'); $config['error']['fileexistsinthread'] = _('That file already exists in this thread!'); $config['error']['delete_too_soon'] = _('You\'ll have to wait another %s before deleting that.'); $config['error']['mime_exploit'] = _('MIME type detection XSS exploit (IE) detected; post discarded.'); $config['error']['invalid_embed'] = _('Couldn\'t make sense of the URL of the video you tried to embed.'); - $config['error']['captcha'] = _('You seem to have mistyped the verification.'); - + $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']['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.'); $config['error']['malformed'] = _('Invalid/malformed cookies.'); $config['error']['missedafield'] = _('Your browser didn\'t submit an input when it should have.'); @@ -741,98 +820,96 @@ $config['error']['boardexists'] = _('There is already a %s board.'); $config['error']['noaccess'] = _('You don\'t have permission to do that.'); $config['error']['invalidpost'] = _('That post doesn\'t exist…'); - $config['error']['404'] = _('Page not found.'); + $config['error']['404'] = _('Page not found.'); $config['error']['modexists'] = _('That mod already exists!'); $config['error']['invalidtheme'] = _('That theme doesn\'t exist!'); - $config['error']['csrf'] = _('Invalid security token! Please go back and try again.'); + $config['error']['csrf'] = _('Invalid security token! Please go back and try again.'); /* * ========================= * Directory/file settings * ========================= */ - + // The root directory, including the trailing slash, for Tinyboard. - // examples: '/', 'http://boards.chan.org/', '/chan/' + // Examples: '/', 'http://boards.chan.org/', '/chan/'. if (isset($_SERVER['REQUEST_URI'])) - $config['root'] = (str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/'); + $config['root'] = str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) == '/' ? '/' : str_replace('\\', '/', dirname($_SERVER['REQUEST_URI'])) . '/'; else $config['root'] = '/'; // CLI mode // The scheme and domain. This is used to get the site's absolute URL (eg. for image identification links). // If you use the CLI tools, it would be wise to override this setting. - $config['domain'] = (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? "https://" : "http://"; - $config['domain'] .= isset ($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; - + $config['domain'] = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://'; + $config['domain'] .= isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost'; + // If for some reason the folders and static HTML index files aren't in the current working direcotry, // enter the directory path here. Otherwise, keep it false. $config['root_file'] = false; - + + // Location of files. $config['file_index'] = 'index.html'; $config['file_page'] = '%d.html'; $config['file_mod'] = 'mod.php'; $config['file_post'] = 'post.php'; $config['file_script'] = 'main.js'; - - // Board directory, followed by a forward-slash (/). (%s is board abbreviation) + + // Board directory, followed by a forward-slash (/). $config['board_path'] = '%s/'; - + // Misc directories. $config['dir']['img'] = 'src/'; $config['dir']['thumb'] = 'thumb/'; $config['dir']['res'] = 'res/'; - // For load balancing, having a seperate server (and domain/subdomain) for serving static content is possible. - // This can either be a directory or a URL (eg. http://static.example.org/) - //$config['dir']['static'] = $config['root'] . 'static/'; - // Where to store the .html templates. This folder and templates must exist or fatal errors will be thrown. + + // For load balancing, having a seperate server (and domain/subdomain) for serving static content is + // possible. This can either be a directory or a URL. Defaults to $config['root'] . 'static/'. + // $config['dir']['static'] = 'http://static.example.org/'; + + // Where to store the .html templates. This folder and the template files must exist. $config['dir']['template'] = getcwd() . '/templates'; - // For the themes (homepages, etc.) + // Location of Tinyboard "themes". $config['dir']['themes'] = getcwd() . '/templates/themes'; - // Same as above, but a URI (accessable by web interface, not locally) + // Same as above, but a URI (accessable by web interface). $config['dir']['themes_uri'] = 'templates/themes'; - // Homepage directory + // Home directory. Used by themes. $config['dir']['home'] = ''; - - // Static images - // These can be URLs OR base64 (data URI scheme) - //$config['image_sticky'] = $config['dir']['static'] . 'sticky.gif'; - //$config['image_locked'] = $config['dir']['static'] . 'locked.gif'; - //$config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif'; - //$config['image_deleted'] = $config['dir']['static'] . 'deleted.'; - //$config['image_zip'] = $config['dir']['static'] . 'zip.'; - - // If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain, you can use this: - // This will override $config['root'] and $config['dir']['...'] directives. - // "%s" will get replaced with $board['dir'], which usually includes a trailing slash. To avoid double slashes, you don't need - // to put a slash after %s + + // Static images. These can be URLs OR base64 (data URI scheme). These are only used if + // $config['font_awesome'] is false (default). + // $config['image_sticky'] = $config['dir']['static'] . 'sticky.gif'; + // $config['image_locked'] = $config['dir']['static'] . 'locked.gif'; + // $config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif'. + + // If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain. + // This will override $config['root'] and $config['dir']['...'] directives. "%s" will get replaced with + // $board['dir'], which includes a trailing slash. // $config['uri_thumb'] = 'http://images.example.org/%sthumb/'; // $config['uri_img'] = 'http://images.example.org/%ssrc/'; - - // Set custom locations for stylesheets, scripts and maybe a banner. - // This can be good for load balancing across multiple servers or hostnames. + + // Set custom locations for stylesheets and the main script file. This can be used for load balancing + // across multiple servers or hostnames. // $config['url_stylesheet'] = 'http://static.example.org/style.css'; // main/base stylesheet // $config['url_javascript'] = 'http://static.example.org/main.js'; + + // Website favicon. // $config['url_favicon'] = '/favicon.gif'; - + /* * ==================== * 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. + + // Limit how many bans can be removed via the ban list. Set to -1 for no limit. + $config['mod']['unban_limit'] = -1; + + // Whether or not to lock moderator sessions to IP addresses. This makes cookie theft ineffective. $config['mod']['lock_ip'] = true; - - // The page that is first shown when a moderator logs in. Defaults to the dashboard. + + // The page that is first shown when a moderator logs in. Defaults to the dashboard (?/). $config['mod']['default'] = '/'; - - // Don't even display MySQL password to administrators (in the configuration page). - $config['mod']['never_reveal_password'] = true; - - // Mod links (full HTML) - // Correspond to above permission directives + + // Mod links (full HTML). $config['mod']['link_delete'] = '[D]'; $config['mod']['link_ban'] = '[B]'; $config['mod']['link_bandelete'] = '[B&D]'; @@ -847,92 +924,94 @@ $config['mod']['link_bumpunlock'] = '[-Sage]'; $config['mod']['link_editpost'] = '[Edit]'; $config['mod']['link_move'] = '[Move]'; - - // Moderator capcodes + + // Moderator capcodes. $config['capcode'] = ' ## %s'; - - // Custom capcodes, by example: - // "## Custom" becomes lightgreen, italic and bold + + // "## Custom" becomes lightgreen, italic and bold: //$config['custom_capcode']['Custom'] =' ## %s'; - - // "## Mod" makes everything purple, including the name and tripcode + + // "## Mod" makes everything purple, including the name and tripcode: //$config['custom_capcode']['Mod'] = array( // ' ## %s', // 'color:purple', // Change name style; optional // 'color:purple' // Change tripcode style; optional //); - - // "## Admin" makes everything red and bold, including the name and tripcode + + // "## Admin" makes everything red and bold, including the name and tripcode: //$config['custom_capcode']['Admin'] = array( // ' ## %s', // 'color:red;font-weight:bold', // Change name style; optional // 'color:red;font-weight:bold' // Change tripcode style; optional //); - - // Enable IP range bans (eg. "127.*.0.1", "127.0.0.*", and "12*.0.0.1" all match "127.0.0.1"). - // A little more load on the database + + // Enable IP range bans (eg. "127.*.0.1", "127.0.0.*", and "12*.0.0.1" all match "127.0.0.1"). Puts a + // little more load on the database $config['ban_range'] = true; - - // Enable CDIR netmask bans (eg. "10.0.0.0/8" for 10.0.0.0.0 - 10.255.255.255). Useful for stopping persistent spammers. - // Again, a little more database load. + + // Enable CDIR netmask bans (eg. "10.0.0.0/8" for 10.0.0.0.0 - 10.255.255.255). Useful for stopping + // persistent spammers and ban evaders. Again, a little more database load. $config['ban_cidr'] = true; - - // Do a DNS lookup on IP addresses to get their hostname on the IP summary page + + // Do DNS lookups on IP addresses to get their hostname for the moderator IP pages (?/IP/x.x.x.x). $config['mod']['dns_lookup'] = true; - // How many recent posts, per board, to show in the IP summary page + // How many recent posts, per board, to show in ?/IP/x.x.x.x. $config['mod']['ip_recentposts'] = 5; - - // How many posts to display on the reports page + + // Number of posts to display on the reports page. $config['mod']['recent_reports'] = 10; - - // How many actions to show per page in the moderation log + // Number of actions to show per page in the moderation log. $config['mod']['modlog_page'] = 350; - // How many bans to show per page in the ban list + // Number of bans to show per page in the ban list. $config['mod']['banlist_page'] = 350; - - // Number of news entries to display per page + // Number of news entries to display per page. $config['mod']['news_page'] = 40; - - // Number of results to display per page + // Number of results to display per page. $config['mod']['search_page'] = 200; - - // How many entries to show per page in the moderator noticeboard + // Number of entries to show per page in the moderator noticeboard. $config['mod']['noticeboard_page'] = 50; - // Number of entries to summarize and display on the dashboard + // Number of entries to summarize and display on the dashboard. $config['mod']['noticeboard_dashboard'] = 5; - - // Check public ban message by default + + // Check public ban message by default. $config['mod']['check_ban_message'] = false; - // Default public ban message. - // In public ban messages, %length% is replaced with "for x days" or "permanently" (with %LENGTH% being the uppercase equivalent). + // Default public ban message. In public ban messages, %length% is replaced with "for x days" or + // "permanently" (with %LENGTH% being the uppercase equivalent). $config['mod']['default_ban_message'] = _('USER WAS BANNED FOR THIS POST'); - // $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; // Include length in ban message - // What to append to the post for public bans ("%s" is the message) + // $config['mod']['default_ban_message'] = 'USER WAS BANNED %LENGTH% FOR THIS POST'; + // HTML to append to post bodies for public bans messages (where "%s" is the message). $config['mod']['ban_message'] = '(%s)'; - - // When moving a thread to another board and choosing to keep a "shadow thread", an automated post (with a capcode) will - // be made, linking to the new location for the thread. "%s" will be replaced with a standard cross-board post citation (>>>/board/xxx) + + // When moving a thread to another board and choosing to keep a "shadow thread", an automated post (with + // a capcode) will be made, linking to the new location for the thread. "%s" will be replaced with a + // standard cross-board post citation (>>>/board/xxx) $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. If false, the default board name will be used. If something else, that will be used. + // Name to use when posting the above message. If false, $config['anonymous'] will be used. $config['mod']['shadow_name'] = false; - - // Wait indefinitely when rebuilding everything + + // PHP time limit for ?/rebuild. A value of 0 should cause PHP to wait indefinitely. $config['mod']['rebuild_timelimit'] = 0; - - // PM snippet (for ?/inbox) length in characters + + // PM snippet (for ?/inbox) length in characters. $config['mod']['snippet_length'] = 75; - - // Edit raw HTML in posts by default + + // Edit raw HTML in posts by default. $config['mod']['raw_html_default'] = false; - - // Automatically dismiss all reports regarding a thread when it is locked + + // Automatically dismiss all reports regarding a thread when it is locked. $config['mod']['dismiss_reports_on_lock'] = true; - - // Replace ?/config with a simple text editor for editing inc/instance-config.php + + // Replace ?/config with a simple text editor for editing inc/instance-config.php. $config['mod']['config_editor_php'] = false; - + +/* + * ==================== + * Mod permissions + * ==================== + */ + // Probably best not to change these: if (!defined('JANITOR')) { define('JANITOR', 0, true); @@ -940,31 +1019,24 @@ define('ADMIN', 2, true); define('DISABLED', 3, true); } - -/* - * ==================== - * Mod permissions - * ==================== - */ - - // Capcode permissions + + // Capcode permissions. $config['mod']['capcode'] = array( // JANITOR => array('Janitor'), - MOD => array('Mod'), + MOD => array('Mod'), ADMIN => true ); - + // Example: Allow mods to post with "## Moderator" as well // $config['mod']['capcode'][MOD][] = 'Moderator'; - // Example: Allow janitors to post with any capcode // $config['mod']['capcode'][JANITOR] = true; - - // Set any of the below to "DISABLED" to make them unavailable for everyone. - + + // Set any of the below to "DISABLED" to make them unavailable for everyone. + // Don't worry about per-board moderators. Let all mods moderate any board. $config['mod']['skip_per_board'] = false; - + /* Post Controls */ // View IP addresses $config['mod']['show_ip'] = MOD; @@ -1004,7 +1076,7 @@ $config['mod']['flood'] = ADMIN; // Raw HTML posting $config['mod']['rawhtml'] = ADMIN; - + /* Administration */ // View the report queue $config['mod']['reports'] = JANITOR; @@ -1016,8 +1088,8 @@ $config['mod']['view_banlist'] = MOD; // View the username of the mod who made a ban $config['mod']['view_banstaff'] = MOD; - // If the moderator doesn't fit the $config['mod']['view_banstaff''] (previous) permission, - // show him just a "?" instead. Otherwise, it will be "Mod" or "Admin" + // If the moderator doesn't fit the $config['mod']['view_banstaff''] (previous) permission, show him just + // a "?" instead. Otherwise, it will be "Mod" or "Admin". $config['mod']['view_banquestionmark'] = false; // Show expired bans in the ban list (they are kept in cache until the culprit returns) $config['mod']['view_banexpired'] = true; @@ -1051,8 +1123,8 @@ $config['mod']['modlog'] = ADMIN; // View IP addresses of other mods in ?/log $config['mod']['show_ip_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. + // View relevant moderation log entries on IP address pages (ie. ban history, etc.) Warning: Can be + // pretty resource intensive if your mod logs are huge. $config['mod']['modlog_ip'] = MOD; // Create a PM (viewing mod usernames) $config['mod']['create_pm'] = JANITOR; @@ -1062,7 +1134,8 @@ $config['mod']['rebuild'] = ADMIN; // Search through posts, IP address notes and bans $config['mod']['search'] = JANITOR; - // Allow searching posts (can be used with board configuration file to disallow searching through a certain board) + // Allow searching posts (can be used with board configuration file to disallow searching through a + // certain board) $config['mod']['search_posts'] = JANITOR; // Read the moderator noticeboard $config['mod']['noticeboard'] = JANITOR; @@ -1080,13 +1153,13 @@ $config['mod']['news_custom'] = ADMIN; // Delete news entries $config['mod']['news_delete'] = ADMIN; - + // Edit the current configuration (via web interface) $config['mod']['edit_config'] = ADMIN; - + // Execute un-filtered SQL queries on the database (?/debug/sql) $config['mod']['debug_sql'] = DISABLED; - + /* * ==================== * Events (PHP 5.3.0+) @@ -1098,7 +1171,7 @@ // event_handler('post', function($post) { // // do something // }); - + // event_handler('post', function($post) { // // do something else // @@ -1111,51 +1184,50 @@ * Other/uncategorized * ==================== */ - - // Meta keywords. It's probably best to include these in per-board configurations. - //$config['meta_keywords'] = 'chan,anonymous discussion,imageboard,tinyboard'; - - // Link imageboard to your Google Analytics account to track users and provide marketing insights. + + // Meta keywords. It's probably best to include these in per-board configurations. + // $config['meta_keywords'] = 'chan,anonymous discussion,imageboard,tinyboard'; + + // Link imageboard to your Google Analytics account to track users and provide traffic insights. // $config['google_analytics'] = 'UA-xxxxxxx-yy'; // Keep the Google Analytics cookies to one domain -- ga._setDomainName() // $config['google_analytics_domain'] = 'www.example.org'; - - // If you use Varnish, Squid, or any similar caching reverse-proxy in front of Tinyboard, - // you can configure Tinyboard to PURGE files when they're written to - //$config['purge'] = array( - // array('127.0.0.1', 80) - // array('127.0.0.1', 80, 'example.org') - //); - // Connection timeout, in seconds + + // If you use Varnish, Squid, or any similar caching reverse-proxy in front of Tinyboard, you can + // configure Tinyboard to PURGE files when they're written to. + // $config['purge'] = array( + // array('127.0.0.1', 80) + // array('127.0.0.1', 80, 'example.org') + // ); + // Connection timeout, in seconds. $config['purge_timeout'] = 3; - - // Additional mod.php?/ pages (for developers). Look in inc/mod/pages.php for help. - //$config['mod']['custom_pages']['/something/(\d+)'] = function($id) { - // global $config; - // if (!hasPermission($config['mod']['something'])) - // error($config['error']['noaccess']); - // // ... - //}; - - // Add links to dashboard (will all be in "Other" category) - $config['mod']['dashboard_links'] = array(); + + // Additional mod.php?/ pages. Look in inc/mod/pages.php for help. + // $config['mod']['custom_pages']['/something/(\d+)'] = function($id) { + // global $config; + // if (!hasPermission($config['mod']['something'])) + // error($config['error']['noaccess']); + // // ... + // }; + + // Add links to dashboard (will all be in a new "Other" category). // $config['mod']['dashboard_links']['Something'] = '?/something'; - - // Remote servers - // http://tinyboard.org/wiki/index.php?title=Multiple_Servers - //$config['remote']['static'] = array( - // 'host' => 'static.example.org', - // 'auth' => array( - // 'method' => 'plain', - // 'username' => 'username', - // 'password' => 'password!123' - // ), - // 'type' => 'scp' - //); - - // Regex for board URIs + + // Remote servers. I'm not even sure if this code works anymore. It might. Haven't tried it in a while. + // $config['remote']['static'] = array( + // 'host' => 'static.example.org', + // 'auth' => array( + // 'method' => 'plain', + // 'username' => 'username', + // 'password' => 'password!123' + // ), + // 'type' => 'scp' + // ); + + // Regex for board URIs. Don't add "`" character or any Unicode that MySQL can't handle. 58 characters + // is the absolute maximum, because MySQL cannot handle table names greater than 64 characters. $config['board_regex'] = '[0-9a-zA-Z$_\x{0080}-\x{FFFF}]{1,58}'; - - // Complex regular expression to catch URLs + + // Complex regular expression to catch URLs. $config['url_regex'] = '/' . '(https?|ftp):\/\/' . '(([\w\-]+\.)+[a-zA-Z]{2,6}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' . '(:\d+)?' . '(\/([\w\-~.#\/?=&;:+%!*\[\]@$\'()+,|\^]+)?)?' . '/'; diff --git a/inc/display.php b/inc/display.php index 5da2f302..7c2665e1 100644 --- a/inc/display.php +++ b/inc/display.php @@ -319,31 +319,31 @@ class Post { // Delete if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['uri'] . '/delete/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['dir'] . 'delete/' . $this->id); // Delete all posts by IP if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['uri'] . '/deletebyip/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['dir'] . 'deletebyip/' . $this->id); // Delete all posts by IP (global) if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['uri'] . '/deletebyip/' . $this->id . '/global'); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['dir'] . 'deletebyip/' . $this->id . '/global'); // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id); // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; @@ -420,54 +420,54 @@ class Thread { // Mod controls (on posts) // Delete if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], _('Delete'), _('Are you sure you want to delete this?'), $board['uri'] . '/delete/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], _('Delete'), _('Are you sure you want to delete this?'), $board['dir'] . 'delete/' . $this->id); // Delete all posts by IP if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], _('Delete all posts by IP'), _('Are you sure you want to delete all posts by this IP address?'), $board['uri'] . '/deletebyip/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], _('Delete all posts by IP'), _('Are you sure you want to delete all posts by this IP address?'), $board['dir'] . 'deletebyip/' . $this->id); // Delete all posts by IP (global) if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], _('Delete all posts by IP across all boards'), _('Are you sure you want to delete all posts by this IP address, across all boards?'), $board['uri'] . '/deletebyip/' . $this->id . '/global'); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], _('Delete all posts by IP across all boards'), _('Are you sure you want to delete all posts by this IP address, across all boards?'), $board['dir'] . 'deletebyip/' . $this->id . '/global'); // Ban if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; + $built .= ' ' . $config['mod']['link_ban'] . ''; // Ban & Delete if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; + $built .= ' ' . $config['mod']['link_bandelete'] . ''; // Delete file (keep post) if (!empty($this->file) && $this->file != 'deleted' && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['uri'] . '/deletefile/' . $this->id); + $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id); // Sticky if (hasPermission($config['mod']['sticky'], $board['uri'], $this->mod)) if ($this->sticky) - $built .= ' ' . $config['mod']['link_desticky'] . ''; + $built .= ' ' . $config['mod']['link_desticky'] . ''; else - $built .= ' ' . $config['mod']['link_sticky'] . ''; + $built .= ' ' . $config['mod']['link_sticky'] . ''; if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod)) if ($this->bumplocked) - $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; + $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; else - $built .= ' ' . $config['mod']['link_bumplock'] . ''; + $built .= ' ' . $config['mod']['link_bumplock'] . ''; // Lock if (hasPermission($config['mod']['lock'], $board['uri'], $this->mod)) if ($this->locked) - $built .= ' ' . $config['mod']['link_unlock'] . ''; + $built .= ' ' . $config['mod']['link_unlock'] . ''; else - $built .= ' ' . $config['mod']['link_lock'] . ''; + $built .= ' ' . $config['mod']['link_lock'] . ''; if (hasPermission($config['mod']['move'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_move'] . ''; + $built .= ' ' . $config['mod']['link_move'] . ''; // Edit post if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; + $built .= ' ' . $config['mod']['link_editpost'] . ''; if (!empty($built)) $built = '' . $built . ''; diff --git a/inc/filters.php b/inc/filters.php index 9f03154d..cd512821 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -132,10 +132,10 @@ class Filter { function do_filters(array $post) { global $config; - if (!isset($config['flood_filters'])) + if (!isset($config['filters'])) return; - foreach ($config['flood_filters'] as $arr) { + foreach ($config['filters'] as $arr) { $filter = new Filter($arr); if ($filter->check($post)) $filter->action(); diff --git a/inc/functions.php b/inc/functions.php index e871fee0..f000dc3c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -40,7 +40,7 @@ function loadConfig() { 'dir', 'mod', 'spam', - 'flood_filters', + 'filters', 'wordfilters', 'custom_capcode', 'custom_tripcode', @@ -54,7 +54,8 @@ function loadConfig() { 'stylesheets', 'additional_javascript', 'markup', - 'custom_pages' + 'custom_pages', + 'dashboard_links' ); $config = array(); @@ -85,8 +86,8 @@ function loadConfig() { date_default_timezone_set($config['timezone']); - if (!isset($config['blotter'])) - $config['blotter'] = false; + if (!isset($config['global_message'])) + $config['global_message'] = false; if (!isset($config['post_url'])) $config['post_url'] = $config['root'] . $config['file_post']; @@ -128,8 +129,6 @@ function loadConfig() { $config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif'; if (!isset($config['image_deleted'])) $config['image_deleted'] = $config['dir']['static'] . 'deleted.png'; - if (!isset($config['image_zip'])) - $config['image_zip'] = $config['dir']['static'] . 'zip.png'; if (!isset($config['uri_thumb'])) $config['uri_thumb'] = $config['root'] . $board['dir'] . $config['dir']['thumb']; @@ -1704,7 +1703,7 @@ function buildThread($id, $return = false, $mod = false) { 'mod' => $mod, 'antibot' => $mod ? false : create_antibot($board['uri'], $id), 'boardlist' => createBoardlist($mod), - 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['uri'] . '/' . $config['file_index']) + 'return' => ($mod ? '?' . $board['url'] . $config['file_index'] : $config['root'] . $board['dir'] . $config['file_index']) )); if ($return) diff --git a/inc/image.php b/inc/image.php index 51db2f83..bfb77d30 100644 --- a/inc/image.php +++ b/inc/image.php @@ -279,10 +279,8 @@ class ImageConvert extends ImageBase { } $this->temp = tempnam($config['tmp'], 'imagick'); - - $quality = $config['thumb_quality'] * 10; - - $config['thumb_keep_animation_frames'] = (int) $config['thumb_keep_animation_frames']; + + $config['thumb_keep_animation_frames'] = (int)$config['thumb_keep_animation_frames']; if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->gifsicle) { @@ -291,12 +289,12 @@ class ImageConvert extends ImageBase { escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } else { - if (shell_exec("convert -background transparent -filter Point -sample {$this->width}x{$this->height} +antialias -quality {$quality} " . + if (shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } } else { - if (shell_exec("convert -background transparent -flatten -filter Point -scale {$this->width}x{$this->height} +antialias -quality {$quality} " . + if (shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } @@ -309,7 +307,7 @@ class ImagePNG extends ImageBase { } public function to($src) { global $config; - imagepng($this->image, $src, $config['thumb_quality']); + imagepng($this->image, $src); } public function resize() { $this->GD_create(); @@ -322,7 +320,7 @@ class ImagePNG extends ImageBase { class ImageGIF extends ImageBase { public function from() { - $this->image = @imagecreatefromgif ($this->src); + $this->image = @imagecreatefromgif($this->src); } public function to($src) { imagegif ($this->image, $src); diff --git a/mod.php b/mod.php index cd4d17d4..ee05c349 100644 --- a/mod.php +++ b/mod.php @@ -109,7 +109,7 @@ $new_pages = array(); foreach ($pages as $key => $callback) { if (is_string($callback) && preg_match('/^secure /', $callback)) $key .= '(/(?P[a-f0-9]{8}))?'; - $key = str_replace('\%b', $config['board_regex'], $key); + $key = str_replace('\%b', '?P' . sprintf(substr($config['board_path'], 0, -1), $config['board_regex']), $key); $new_pages[@$key[0] == '!' ? $key : '!^' . $key . '(?:&[^&=]+=[^&]*)*$!u'] = $callback; } $pages = $new_pages; @@ -118,6 +118,15 @@ foreach ($pages as $uri => $handler) { if (preg_match($uri, $query, $matches)) { $matches = array_slice($matches, 1); + if (isset($matches['board'])) { + $board_match = $matches['board']; + unset($matches['board']); + $key = array_search($board_match, $matches); + if (preg_match('/^' . sprintf(substr($config['board_path'], 0, -1), '(' . $config['board_regex'] . ')') . '$/u', $matches[$key], $board_match)) { + $matches[$key] = $board_match[1]; + } + } + if (is_string($handler) && preg_match('/^secure(_POST)? /', $handler, $m)) { $secure_post_only = isset($m[1]); if (!$secure_post_only || $_SERVER['REQUEST_METHOD'] == 'POST') { diff --git a/post.php b/post.php index 5031830f..103894db 100644 --- a/post.php +++ b/post.php @@ -428,7 +428,7 @@ if (isset($_POST['delete'])) { $post['filehash'] = $config['file_hash']($upload); $post['filesize'] = filesize($upload); - if ($is_an_image) { + if ($is_an_image && $config['ie_mime_type_detection'] !== false) { // Check IE MIME type detection XSS exploit $buffer = file_get_contents($upload, null, null, null, 255); if (preg_match($config['ie_mime_type_detection'], $buffer)) { diff --git a/templates/generic_page.html b/templates/generic_page.html index 0c8f9867..8f608a6a 100644 --- a/templates/generic_page.html +++ b/templates/generic_page.html @@ -22,7 +22,7 @@ {% include 'post_form.html' %} - {% if config.blotter %}
    {{ config.blotter }}
    {% endif %} + {% if config.global_message %}
    {{ config.global_message }}
    {% endif %}
    diff --git a/templates/index.html b/templates/index.html index 1cde9882..e32ac253 100644 --- a/templates/index.html +++ b/templates/index.html @@ -21,7 +21,7 @@ {% include 'post_form.html' %} - {% if config.blotter %}
    {{ config.blotter }}
    {% endif %} + {% if config.global_message %}
    {{ config.global_message }}
    {% endif %}
    diff --git a/templates/thread.html b/templates/thread.html index a6b8793f..97f8a3db 100644 --- a/templates/thread.html +++ b/templates/thread.html @@ -23,7 +23,7 @@ {% include 'post_form.html' %} - {% if config.blotter %}
    {{ config.blotter }}
    {% endif %} + {% if config.global_message %}
    {{ config.global_message }}
    {% endif %}
    -- cgit v1.3 From 169dc7493806997aa6498875914f5d682a073310 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 20:56:30 -0400 Subject: Fix last commit --- inc/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index bfb77d30..94267db2 100644 --- a/inc/image.php +++ b/inc/image.php @@ -294,7 +294,7 @@ class ImageConvert extends ImageBase { error('Failed to resize image!'); } } else { - if (shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . + if (shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) error('Failed to resize image!'); } -- cgit v1.3 From 934c00f488dffa602bf6362de5ac9e1e625d2124 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 21:01:04 -0400 Subject: $config['dir']['static'] doesn't exist. --- inc/config.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index c181c0c5..ca6f7b69 100644 --- a/inc/config.php +++ b/inc/config.php @@ -530,7 +530,7 @@ // Location of thumbnail to use for spoiler images. $config['spoiler_image'] = 'static/spoiler.png'; // Location of thumbnail to use for deleted images. - $config['image_deleted'] = $config['dir']['static'] . 'deleted.png'; + $config['image_deleted'] = 'static/deleted.png'; // When a thumbnailed image is going to be the same (in dimension), just copy the entire file and use // that as a thumbnail instead of resizing/redrawing. @@ -876,9 +876,9 @@ // Static images. These can be URLs OR base64 (data URI scheme). These are only used if // $config['font_awesome'] is false (default). - // $config['image_sticky'] = $config['dir']['static'] . 'sticky.gif'; - // $config['image_locked'] = $config['dir']['static'] . 'locked.gif'; - // $config['image_bumplocked'] = $config['dir']['static'] . 'sage.gif'. + // $config['image_sticky'] = 'static/sticky.gif'; + // $config['image_locked'] = 'static/locked.gif'; + // $config['image_bumplocked'] = 'static/sage.gif'. // If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain. // This will override $config['root'] and $config['dir']['...'] directives. "%s" will get replaced with -- cgit v1.3 From 1d7de12281f983cc8135abf9fcb00d9cd7e4972a Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 21:23:18 -0400 Subject: Fix bug --- inc/image.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 94267db2..34e8404f 100644 --- a/inc/image.php +++ b/inc/image.php @@ -284,18 +284,18 @@ class ImageConvert extends ImageBase { if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->gifsicle) { - if (shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . + if (trim(shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " . - escapeshellarg($this->temp)) || !file_exists($this->temp)) + escapeshellarg($this->temp) . ';echo $?' !== '0') || !file_exists($this->temp)) error('Failed to resize image!'); } else { - if (shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . - escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + if (trim(shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . + escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) . ';echo $?') !== '0' || !file_exists($this->temp)) error('Failed to resize image!'); } } else { - if (shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . - escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp)) || !file_exists($this->temp)) + if (trim(shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . + escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ';echo $?')) !== '0' || !file_exists($this->temp)) error('Failed to resize image!'); } } -- cgit v1.3 From d99eba2c1890969dc69a0509e17381b5299e3898 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 21:37:44 -0400 Subject: syntax error in last commit --- inc/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 34e8404f..e30c6919 100644 --- a/inc/image.php +++ b/inc/image.php @@ -286,7 +286,7 @@ class ImageConvert extends ImageBase { if ($this->gifsicle) { if (trim(shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " . - escapeshellarg($this->temp) . ';echo $?' !== '0') || !file_exists($this->temp)) + escapeshellarg($this->temp) . ';echo $?') !== '0') || !file_exists($this->temp)) error('Failed to resize image!'); } else { if (trim(shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . -- cgit v1.3 From 62f8ea4813092b42a2cd390a8358ce798d103f40 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Fri, 2 Aug 2013 23:18:25 -0400 Subject: Better command-line ImageMagick image processing --- inc/config.php | 6 +++--- inc/image.php | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index ca6f7b69..337d92cb 100644 --- a/inc/config.php +++ b/inc/config.php @@ -492,9 +492,9 @@ $config['thumb_method'] = 'gd'; // $config['thumb_method'] = 'convert'; - // Command-line options passed to ImageMagick when using `convert` for thumbnailing. - // http://www.imagemagick.org/ImageMagick-7.0.0/script/command-line-options.php - $config['convert_args'] = '-background transparent -filter Point -sample %dx%d +antialias -quality 50'; + // Command-line options passed to ImageMagick when using `convert` for thumbnailing. Don't touch the + // placement of "%s" and "%d". + $config['convert_args'] = '-background transparent %s -strip -thumbnail %dx%d -quality 65'; // Strip EXIF metadata from JPEG files. $config['strip_exif'] = false; diff --git a/inc/image.php b/inc/image.php index e30c6919..141973ee 100644 --- a/inc/image.php +++ b/inc/image.php @@ -284,19 +284,19 @@ class ImageConvert extends ImageBase { if ($this->format == 'gif' && ($config['thumb_ext'] == 'gif' || $config['thumb_ext'] == '') && $config['thumb_keep_animation_frames'] > 1) { if ($this->gifsicle) { - if (trim(shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . + if (trim($error = shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " . - escapeshellarg($this->temp) . ';echo $?') !== '0') || !file_exists($this->temp)) - error('Failed to resize image!'); + escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp)) + error($error); } else { - if (trim(shell_exec('convert ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . - escapeshellarg($this->src . '') . " " . escapeshellarg($this->temp)) . ';echo $?') !== '0' || !file_exists($this->temp)) - error('Failed to resize image!'); + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . + escapeshellarg($this->src) . ' ' . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) + error($error); } } else { - if (trim(shell_exec('convert -flatten ' . sprintf($config['convert_args'], $this->width, $this->height) . ' ' . - escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ';echo $?')) !== '0' || !file_exists($this->temp)) - error('Failed to resize image!'); + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . + escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) + error($error); } } } -- cgit v1.3 From 1d37e81adeea9b2a1bc1028f2bf45b47ac045ec4 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 00:22:28 -0400 Subject: Better error handling/displaying with $config['debug'] and $config['verbose_errors'] --- inc/config.php | 2 +- inc/display.php | 22 +++++++++++----------- inc/functions.php | 16 ++++++++++++++-- inc/image.php | 10 +++++----- templates/error.html | 18 ++++++++++++++++++ 5 files changed, 49 insertions(+), 19 deletions(-) create mode 100644 templates/error.html (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 337d92cb..8d1c05d7 100644 --- a/inc/config.php +++ b/inc/config.php @@ -42,7 +42,7 @@ // Shows some extra information at the bottom of pages. Good for development/debugging. $config['debug'] = false; - // For development purposes. All this does is turn 'display_errors' on. + // For development purposes. Displays (and "dies" on) all errors and warnings. Turn on with the above. $config['verbose_errors'] = true; // Directory where temporary files will be created. diff --git a/inc/display.php b/inc/display.php index 7c2665e1..4972d563 100644 --- a/inc/display.php +++ b/inc/display.php @@ -57,7 +57,7 @@ function createBoardlist($mod=false) { ); } -function error($message, $priority = true) { +function error($message, $priority = true, $debug_stuff = false) { global $board, $mod, $config; if ($config['syslog'] && $priority !== false) { @@ -71,16 +71,16 @@ function error($message, $priority = true) { } die(Element('page.html', array( - 'config'=>$config, - 'title'=>_('Error'), - 'subtitle'=>_('An error has occured.'), - 'body'=>'
    ' . - '

    ' . _($message) . '

    ' . - (isset($board) ? - "

    "._("Go back").".

    " : '') . - '
    ' + 'config' => $config, + 'title' => _('Error'), + 'subtitle' => _('An error has occured.'), + 'body' => Element('error.html', array( + 'config' => $config, + 'message' => $message, + 'mod' => $mod, + 'board' => isset($board) ? $board : false, + 'debug' => is_array($debug_stuff) ? str_replace("\n", ' ', utf8tohtml(print_r($debug_stuff, true))) : utf8tohtml($debug_stuff) + )) ))); } diff --git a/inc/functions.php b/inc/functions.php index f000dc3c..b6bdd809 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -155,10 +155,22 @@ function loadConfig() { } if ($config['verbose_errors']) { + set_error_handler(function($errno, $errstr, $errfile, $errline) { + if (error_reporting() == 0) + return false; // Looks like this warning was suppressed by the @ operator. + error(utf8tohtml($errstr), true, array( + 'file' => $errfile, + 'line' => $errline, + 'errno' => $errno, + 'error' => $errstr, + 'backtrace' => array_slice(debug_backtrace(), 1) + )); + }); error_reporting(E_ALL); - ini_set('display_errors', 1); + ini_set('display_errors', true); + ini_set('html_errors', false); } - + // Keep the original address to properly comply with other board configurations if (!isset($__ip)) $__ip = $_SERVER['REMOTE_ADDR']; diff --git a/inc/image.php b/inc/image.php index 141973ee..4fc9d018 100644 --- a/inc/image.php +++ b/inc/image.php @@ -287,16 +287,16 @@ class ImageConvert extends ImageBase { if (trim($error = shell_exec("gifsicle --unoptimize -O2 --resize {$this->width}x{$this->height} < " . escapeshellarg($this->src . '') . " \"#0-{$config['thumb_keep_animation_frames']}\" > " . escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp)) - error($error); + error('Failed to resize image!', null, $error); } else { - if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . + if (trim($error = shell_exec('aconvert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . escapeshellarg($this->src) . ' ' . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) - error($error); + error('Failed to resize image!', null, $error); } } else { - if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . + if (trim($error = shell_exec('aconvert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) - error($error); + error('Failed to resize image!', null, $error); } } } diff --git a/templates/error.html b/templates/error.html new file mode 100644 index 00000000..3b8eb693 --- /dev/null +++ b/templates/error.html @@ -0,0 +1,18 @@ +
    +

    {{ message }}

    + {% if board %} +

    + + {% trans 'Go back' %} + +

    + {% endif %} +
    +{% if debug and config.debug %} +
    +

    {% trans 'Error information' %}

    +
    +		{{ debug }}
    +	
    +
    +{% endif %} \ No newline at end of file -- cgit v1.3 From 784c3ffadbc28b7f6d6a1808a1f1d71e957cb089 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 00:28:54 -0400 Subject: Accidentally commit'd debug stuff/errors --- inc/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/image.php b/inc/image.php index 4fc9d018..88f735dd 100644 --- a/inc/image.php +++ b/inc/image.php @@ -289,12 +289,12 @@ class ImageConvert extends ImageBase { escapeshellarg($this->temp) . '2>&1 &&echo $?') !== '0') || !file_exists($this->temp)) error('Failed to resize image!', null, $error); } else { - if (trim($error = shell_exec('aconvert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '', $this->width, $this->height) . ' ' . escapeshellarg($this->src) . ' ' . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) error('Failed to resize image!', null, $error); } } else { - if (trim($error = shell_exec('aconvert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . + if (trim($error = shell_exec('convert ' . sprintf($config['convert_args'], '-flatten', $this->width, $this->height) . ' ' . escapeshellarg($this->src . '[0]') . " " . escapeshellarg($this->temp) . ' 2>&1 &&echo $?')) !== '0' || !file_exists($this->temp)) error('Failed to resize image!', null, $error); } -- cgit v1.3 From 056a6001aceddcf707974577d3566b1a166f01ec Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 02:01:52 -0400 Subject: Erorr handling update --- inc/database.php | 12 ++++++------ inc/display.php | 6 +++++- inc/functions.php | 25 +++++++++++++------------ mod.php | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) (limited to 'inc') diff --git a/inc/database.php b/inc/database.php index 95dfc775..24959d0c 100644 --- a/inc/database.php +++ b/inc/database.php @@ -121,14 +121,14 @@ function query($query) { return $pdo->query($query); } -function db_error($PDOStatement=null) { - global $pdo; +function db_error($PDOStatement = null) { + global $pdo, $db_error; if (isset($PDOStatement)) { - $err = $PDOStatement->errorInfo(); - return $err[2]; + $db_error = $PDOStatement->errorInfo(); + return $db_error[2]; } - $err = $pdo->errorInfo(); - return $err[2]; + $db_error = $pdo->errorInfo(); + return $db_error[2]; } diff --git a/inc/display.php b/inc/display.php index 4972d563..dddb6559 100644 --- a/inc/display.php +++ b/inc/display.php @@ -58,7 +58,7 @@ function createBoardlist($mod=false) { } function error($message, $priority = true, $debug_stuff = false) { - global $board, $mod, $config; + global $board, $mod, $config, $db_error; if ($config['syslog'] && $priority !== false) { // Use LOG_NOTICE instead of LOG_ERR or LOG_WARNING because most error message are not significant. @@ -70,6 +70,10 @@ function error($message, $priority = true, $debug_stuff = false) { die('Error: ' . $message . "\n"); } + if ($config['debug'] && isset($db_error)) { + $debug_stuff = array_combine(array('SQLSTATE', 'Error code', 'Error message'), $db_error); + } + die(Element('page.html', array( 'config' => $config, 'title' => _('Error'), diff --git a/inc/functions.php b/inc/functions.php index b6bdd809..6c903663 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -155,19 +155,9 @@ function loadConfig() { } if ($config['verbose_errors']) { - set_error_handler(function($errno, $errstr, $errfile, $errline) { - if (error_reporting() == 0) - return false; // Looks like this warning was suppressed by the @ operator. - error(utf8tohtml($errstr), true, array( - 'file' => $errfile, - 'line' => $errline, - 'errno' => $errno, - 'error' => $errstr, - 'backtrace' => array_slice(debug_backtrace(), 1) - )); - }); + set_error_handler('verbose_error_handler'); error_reporting(E_ALL); - ini_set('display_errors', true); + ini_set('display_errors', false); ini_set('html_errors', false); } @@ -244,6 +234,17 @@ function _syslog($priority, $message) { } } +function verbose_error_handler($errno, $errstr, $errfile, $errline) { + if (error_reporting() == 0) + return false; // Looks like this warning was suppressed by the @ operator. + error(utf8tohtml($errstr), true, array( + 'file' => $errfile . ':' . $errline, + 'errno' => $errno, + 'error' => $errstr, + 'backtrace' => array_slice(debug_backtrace(), 1) + )); +} + function create_antibot($board, $thread = null) { require_once dirname(__FILE__) . '/anti-bot.php'; diff --git a/mod.php b/mod.php index ee05c349..bdc89b87 100644 --- a/mod.php +++ b/mod.php @@ -23,7 +23,7 @@ $query = isset($_SERVER['QUERY_STRING']) ? urldecode($_SERVER['QUERY_STRING']) : $pages = array( '' => ':?/', // redirect to dashboard '/' => 'dashboard', // dashboard - '/confirm/(.+)' => 'confirm', // confirm action (if javascript didn't work) + '/confir(m/(.+)' => 'confirm', // confirm action (if javascript didn't work) '/logout' => 'logout', // logout '/users' => 'users', // manage users -- cgit v1.3 From ea1fe528a44d066e82d1bbb07f6ecefc52ec4e18 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 02:06:58 -0400 Subject: Fix ordering of notes and bans --- inc/mod/pages.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 615e85c7..5b74cc1c 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -800,21 +800,21 @@ function mod_page_ip($ip) { $args['token'] = make_secure_link_token('ban'); if (hasPermission($config['mod']['view_ban'])) { - $query = prepare("SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip"); + $query = prepare("SELECT ``bans``.*, `username` FROM ``bans`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip ORDER BY `set` DESC"); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); $args['bans'] = $query->fetchAll(PDO::FETCH_ASSOC); } if (hasPermission($config['mod']['view_notes'])) { - $query = prepare("SELECT ``ip_notes``.*, `username` FROM ``ip_notes`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip"); + $query = prepare("SELECT ``ip_notes``.*, `username` FROM ``ip_notes`` LEFT JOIN ``mods`` ON `mod` = ``mods``.`id` WHERE `ip` = :ip ORDER BY `time` DESC"); $query->bindValue(':ip', $ip); $query->execute() or error(db_error($query)); $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 = 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 50"); $query->bindValue(':search', '%' . $ip . '%'); $query->execute() or error(db_error($query)); $args['logs'] = $query->fetchAll(PDO::FETCH_ASSOC); -- cgit v1.3 From 3ed15565b079680aa3c042cf0b7db0d2508c0838 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 03:36:20 -0400 Subject: Why is this escaped? --- inc/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/functions.php b/inc/functions.php index 6c903663..4ca98dd6 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1769,7 +1769,7 @@ function generate_tripcode($name) { // generate salt $salt = substr($trip . 'H..', 1, 2); - $salt = preg_replace('/[^\.-z]/', '.', $salt); + $salt = preg_replace('/[^.-z]/', '.', $salt); $salt = strtr($salt, ':;<=>?@[\]^_`', 'ABCDEFGabcdef'); if ($secure) { -- cgit v1.3 From c9684fc0001ceaa521e80a50d353ecbfe3fafe9b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 05:21:02 -0400 Subject: Better/working web config editor --- inc/config.php | 9 ++++++--- inc/functions.php | 2 +- inc/mod/config-editor.php | 47 ++++++++++++++++++++++++++++++++++------------- inc/mod/pages.php | 2 +- 4 files changed, 42 insertions(+), 18 deletions(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 8d1c05d7..2c164ef5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -355,8 +355,9 @@ // Always act as if the user had typed "noko" into the email field. $config['always_noko'] = false; - // Custom tripcodes. The below example makes a tripcode of "#test123" evaluate to "!HelloWorld". + // Example: Custom tripcodes. The below example makes a tripcode of "#test123" evaluate to "!HelloWorld". // $config['custom_tripcode']['#test123'] = '!HelloWorld'; + // Example: Custom secure tripcode. // $config['custom_tripcode']['##securetrip'] = '!!somethingelse'; // Allow users to mark their image as a "spoiler" when posting. The thumbnail will be replaced with a @@ -523,6 +524,7 @@ // Thumbnail to use for the non-image file uploads. $config['file_icons']['default'] = 'file.png'; $config['file_icons']['zip'] = 'zip.png'; + // Example: Custom thumbnail for certain file extension. // $config['file_icons']['extension'] = 'some_file.png'; // Location of above images. @@ -1199,7 +1201,8 @@ // array('127.0.0.1', 80) // array('127.0.0.1', 80, 'example.org') // ); - // Connection timeout, in seconds. + + // Connection timeout for $config['purge'], in seconds. $config['purge_timeout'] = 3; // Additional mod.php?/ pages. Look in inc/mod/pages.php for help. @@ -1210,7 +1213,7 @@ // // ... // }; - // Add links to dashboard (will all be in a new "Other" category). + // Example: Add links to dashboard (will all be in a new "Other" category). // $config['mod']['dashboard_links']['Something'] = '?/something'; // Remote servers. I'm not even sure if this code works anymore. It might. Haven't tried it in a while. diff --git a/inc/functions.php b/inc/functions.php index 4ca98dd6..dc814a2f 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -157,7 +157,7 @@ function loadConfig() { if ($config['verbose_errors']) { set_error_handler('verbose_error_handler'); error_reporting(E_ALL); - ini_set('display_errors', false); + ini_set('display_errors', true); ini_set('html_errors', false); } diff --git a/inc/mod/config-editor.php b/inc/mod/config-editor.php index 484bd908..d6cad8f0 100644 --- a/inc/mod/config-editor.php +++ b/inc/mod/config-editor.php @@ -13,13 +13,14 @@ function config_vars() { 'default_temp' => false ); $temp_comment = false; + $line_no = 0; foreach ($config_file as $line) { if ($temp_comment) { $var['comment'][] = $temp_comment; $temp_comment = false; } - if (preg_match('!^\s*// (.*)$!', $line, $matches)) { + if (preg_match('!^\s*// ([^$].*)$!', $line, $matches)) { if ($var['default'] !== false) { $line = ''; $temp_comment = $matches[1]; @@ -28,7 +29,10 @@ function config_vars() { } } else if ($var['default_temp'] !== false) { $var['default_temp'] .= "\n" . $line; - } elseif (preg_match('!^\s*\$config\[(.+?)\] = (.+?)(;( //.+)?)?$!', $line, $matches)) { + } elseif (preg_match('!^[\s/]*\$config\[(.+?)\] = (.+?)(;( //.+)?)?$!', $line, $matches)) { + if (preg_match('!^\s*//\s*!', $line)) { + $var['commented'] = true; + } $var['name'] = explode('][', $matches[1]); if (count($var['name']) == 1) { $var['name'] = preg_replace('/^\'(.*)\'$/', '$1', end($var['name'])); @@ -43,20 +47,30 @@ function config_vars() { $var['default_temp'] = $matches[2]; } - if (trim($line) === '') { - if ($var['name'] !== false) { - if ($var['default_temp']) - $var['default'] = $var['default_temp']; - - $temp = eval('return ' . $var['default'] . ';'); - if (!isset($temp)) + if ($var['name'] !== false) { + if ($var['default_temp']) + $var['default'] = $var['default_temp']; + if ($var['default'][0] == '&') + continue; // This is just an alias. + if (!preg_match('/^array|\[\]|function/', $var['default']) && !preg_match('/^Example: /', trim(implode(' ', $var['comment'])))) { + $syntax_error = true; + $temp = eval('$syntax_error = false;return ' . $var['default'] . ';'); + if ($syntax_error && $temp === false) { + error('Error parsing config.php (line ' . $line_no . ')!', null, $var); + } elseif (!isset($temp)) { $var['type'] = 'unknown'; - else + } else { $var['type'] = gettype($temp); - + } unset($var['default_temp']); - if (!is_array($var['name']) || (end($var['name']) != '' && !in_array(reset($var['name']), array('stylesheets')))) { + $already_exists = false; + foreach ($conf as $_var) { + if ($var['name'] == $_var['name']) + $already_exists = true; + + } + if (!$already_exists) $conf[] = $var; } } @@ -65,9 +79,16 @@ function config_vars() { 'name' => false, 'comment' => array(), 'default' => false, - 'default_temp' => false + 'default_temp' => false, + 'commented' => false ); } + + if (trim($line) === '') { + $var['comment'] = array(); + } + + $line_no++; } return $conf; diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 5b74cc1c..6c46a84f 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -1975,7 +1975,7 @@ function mod_config() { foreach ($var['name'] as $n) $c = &$c[$n]; } else { - $c = $config[$var['name']]; + $c = @$config[$var['name']]; } $var['value'] = $c; -- cgit v1.3 From d4ad874e09f026de2ade18f49797dcac4e65f67b Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 05:25:41 -0400 Subject: no --- inc/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/config.php b/inc/config.php index 2c164ef5..e8422a75 100644 --- a/inc/config.php +++ b/inc/config.php @@ -281,7 +281,7 @@ // Do you need a body for your reply posts? $config['force_body'] = false; // Do you need a body for new threads? - $config['force_body_op'] = true; + $config['force_body_op'] = true; // Require an image for threads? $config['force_image_op'] = true; -- cgit v1.3 From 0d1bfa47f1f459b4893426e752ce2d3e9b2de030 Mon Sep 17 00:00:00 2001 From: Michael Foster Date: Sat, 3 Aug 2013 05:41:01 -0400 Subject: Web config editor: Write "MOD", "JANITOR", etc. to instance-config instead of just int representations --- inc/mod/config-editor.php | 10 +++++++++- inc/mod/pages.php | 15 ++++++++++++++- templates/mod/config-editor.html | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) (limited to 'inc') diff --git a/inc/mod/config-editor.php b/inc/mod/config-editor.php index d6cad8f0..caca5a0e 100644 --- a/inc/mod/config-editor.php +++ b/inc/mod/config-editor.php @@ -62,6 +62,13 @@ function config_vars() { } else { $var['type'] = gettype($temp); } + + if ($var['type'] == 'integer' && $var['name'][0] == 'mod' && + (in_array($var['default'], array('JANITOR', 'MOD', 'ADMIN', 'DISABLED')) || mb_strpos($var['default'], "\$config['mod']") === 0)) { + // Permissions variable + $var['permissions'] = true; + } + unset($var['default_temp']); if (!is_array($var['name']) || (end($var['name']) != '' && !in_array(reset($var['name']), array('stylesheets')))) { $already_exists = false; @@ -80,7 +87,8 @@ function config_vars() { 'comment' => array(), 'default' => false, 'default_temp' => false, - 'commented' => false + 'commented' => false, + 'permissions' => false, ); } diff --git a/inc/mod/pages.php b/inc/mod/pages.php index 6c46a84f..13520871 100644 --- a/inc/mod/pages.php +++ b/inc/mod/pages.php @@ -2010,7 +2010,20 @@ function mod_config() { $config_append .= '[' . var_export($var['name'], true) . ']'; } - $config_append .= ' = ' . var_export($value, true) . ";\n"; + + $config_append .= ' = '; + if ($var['permissions'] && in_array($value, array(JANITOR, MOD, ADMIN, DISABLED))) { + $perm_array = array( + JANITOR => 'JANITOR', + MOD => 'MOD', + ADMIN => 'ADMIN', + DISABLED => 'DISABLED' + ); + $config_append .= $perm_array[$value]; + } else { + $config_append .= var_export($value, true); + } + $config_append .= ";\n"; } } diff --git a/templates/mod/config-editor.html b/templates/mod/config-editor.html index 41e01dad..d333e9a2 100644 --- a/templates/mod/config-editor.html +++ b/templates/mod/config-editor.html @@ -25,7 +25,7 @@ {% if var.type == 'string' %} - {% elseif var.type == 'integer' and var.name.0 == 'mod' and (var.default in ['JANITOR', 'MOD', 'ADMIN', 'DISABLED'] or var.default|slice(0, 14) == "$config['mod']") and var.value <= constant('DISABLED') %} + {% elseif var.permissions %} '; echo Element('page.html', $page); @@ -2048,12 +2062,18 @@ function mod_config() { } } - header('Location: ?/', true, $config['redirect_http']); + header('Location: ?/config', true, $config['redirect_http']); exit; } - mod_page(_('Config editor'), 'mod/config-editor.html', array('conf' => $conf)); + mod_page(_('Config editor') . ($board_config ? ': ' . sprintf($config['board_abbreviation'], $board_config) : ''), + 'mod/config-editor.html', array( + 'boards' => listBoards(), + 'board' => $board_config, + 'conf' => $conf, + 'file' => $config_file + )); } function mod_themes_list() { diff --git a/mod.php b/mod.php index ee05c349..742eeefb 100644 --- a/mod.php +++ b/mod.php @@ -21,64 +21,65 @@ if (get_magic_quotes_gpc()) { $query = isset($_SERVER['QUERY_STRING']) ? urldecode($_SERVER['QUERY_STRING']) : ''; $pages = array( - '' => ':?/', // redirect to dashboard - '/' => 'dashboard', // dashboard + '' => ':?/', // redirect to dashboard + '/' => 'dashboard', // dashboard '/confirm/(.+)' => 'confirm', // confirm action (if javascript didn't work) - '/logout' => 'logout', // logout + '/logout' => 'logout', // logout - '/users' => 'users', // manage users - '/users/(\d+)' => 'user', // edit user - '/users/(\d+)/(promote|demote)' => 'user_promote', // prmote/demote user + '/users' => 'users', // manage users + '/users/(\d+)' => 'user', // edit user + '/users/(\d+)/(promote|demote)' => 'user_promote', // prmote/demote user '/users/new' => 'user_new', // create a new user '/new_PM/([^/]+)' => 'new_pm', // create a new pm - '/PM/(\d+)(/reply)?' => 'pm', // read a pm - '/inbox' => 'inbox', // pm inbox + '/PM/(\d+)(/reply)?' => 'pm', // read a pm + '/inbox' => 'inbox', // pm inbox '/noticeboard' => 'noticeboard', // view noticeboard - '/noticeboard/(\d+)' => 'noticeboard', // view noticeboard - '/noticeboard/delete/(\d+)' => 'noticeboard_delete',// delete from noticeboard - '/log' => 'log', // modlog - '/log/(\d+)' => 'log', // modlog + '/noticeboard/(\d+)' => 'noticeboard', // view noticeboard + '/noticeboard/delete/(\d+)' => 'noticeboard_delete', // delete from noticeboard + '/log' => 'log', // modlog + '/log/(\d+)' => 'log', // modlog '/log:([^/]+)' => 'user_log', // modlog - '/log:([^/]+)/(\d+)' => 'user_log', // modlog - '/news' => 'news', // view news - '/news/(\d+)' => 'news', // view news - '/news/delete/(\d+)' => 'news_delete', // delete from news + '/log:([^/]+)/(\d+)' => 'user_log', // modlog + '/news' => 'news', // view news + '/news/(\d+)' => 'news', // view news + '/news/delete/(\d+)' => 'news_delete', // delete from news '/edit/(\%b)' => 'edit_board', // edit board details '/new-board' => 'new_board', // create a new board - '/rebuild' => 'rebuild', // rebuild static files - '/reports' => 'reports', // report queue - '/reports/(\d+)/dismiss(all)?' => 'report_dismiss', // dismiss a report + '/rebuild' => 'rebuild', // rebuild static files + '/reports' => 'reports', // report queue + '/reports/(\d+)/dismiss(all)?' => 'report_dismiss', // dismiss a report - '/IP/([\w.:]+)' => 'ip', // view ip address + '/IP/([\w.:]+)' => 'ip', // view ip address '/IP/([\w.:]+)/remove_note/(\d+)' => 'ip_remove_note', // remove note from ip address - '/bans' => 'bans', // ban list - '/bans/(\d+)' => 'bans', // ban list + '/bans' => 'bans', // ban list + '/bans/(\d+)' => 'bans', // ban list - '/search' => 'search_redirect', // search + '/search' => 'search_redirect', // search '/search/(posts|IP_notes|bans|log)/(.+)/(\d+)' => 'search', // search - '/search/(posts|IP_notes|bans|log)/(.+)' => 'search', // search + '/search/(posts|IP_notes|bans|log)/(.+)' => 'search', // search // CSRF-protected moderator actions - '/ban' => 'secure_POST ban', // new ban - '/(\%b)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster - '/(\%b)/move/(\d+)' => 'secure_POST move', // move thread + '/ban' => 'secure_POST ban', // new ban + '/(\%b)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster + '/(\%b)/move/(\d+)' => 'secure_POST move', // move thread '/(\%b)/edit(_raw)?/(\d+)' => 'secure_POST edit_post', // edit post - '/(\%b)/delete/(\d+)' => 'secure delete', // delete post - '/(\%b)/deletefile/(\d+)' => 'secure deletefile', // delete file from post + '/(\%b)/delete/(\d+)' => 'secure delete', // delete post + '/(\%b)/deletefile/(\d+)' => 'secure deletefile', // delete file from post '/(\%b)/deletebyip/(\d+)(/global)?' => 'secure deletebyip', // delete all posts by IP address - '/(\%b)/(un)?lock/(\d+)' => 'secure lock', // lock thread - '/(\%b)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread - '/(\%b)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread + '/(\%b)/(un)?lock/(\d+)' => 'secure lock', // lock thread + '/(\%b)/(un)?sticky/(\d+)' => 'secure sticky', // sticky thread + '/(\%b)/bump(un)?lock/(\d+)' => 'secure bumplock', // "bumplock" thread - '/themes' => 'themes_list', // manage themes + '/themes' => 'themes_list', // manage themes '/themes/(\w+)' => 'theme_configure', // configure/reconfigure theme - '/themes/(\w+)/rebuild' => 'theme_rebuild', // rebuild theme - '/themes/(\w+)/uninstall' => 'theme_uninstall', // uninstall theme + '/themes/(\w+)/rebuild' => 'theme_rebuild', // rebuild theme + '/themes/(\w+)/uninstall' => 'theme_uninstall', // uninstall theme - '/config' => 'config', // config editor + '/config' => 'config', // config editor + '/config/(\%b)' => 'config', // config editor // these pages aren't listed in the dashboard without $config['debug'] '/debug/antispam' => 'debug_antispam', diff --git a/templates/mod/config-editor-php.html b/templates/mod/config-editor-php.html index 54c398e4..4f76b5dd 100644 --- a/templates/mod/config-editor-php.html +++ b/templates/mod/config-editor-php.html @@ -1,17 +1,35 @@ -{% if readonly %} -

    Tinyboard does not have the required permissions to edit inc/instance-config.php. To make changes, you will need to change the file's permissions first or manually edit the code.

    -{% endif %} - - -{% if not readonly %}{% endif %} - +
    +

    + Any changes you make here will simply be appended to {{ file }}. If you wish to make the most of Tinyboard's customizability, you can instead edit the file directly. This page is intended for making quick changes and for those who don't have a basic understanding of PHP code. +

    + {% if boards|count %} + + {% endif %} + + {% if readonly %} +

    Tinyboard does not have the required permissions to edit {{ file }}. To make changes, you will need to change the file's permissions first or manually edit the code.

    + {% endif %} + -
      -
    • -
    -{% if not readonly %}{% endif %} + {% if not readonly %}
    {% endif %} + + +
      +
    • +
    + {% if not readonly %}
    {% endif %} +