Skip to content

Commit

Permalink
Limit pasta in Kilos.
Browse files Browse the repository at this point in the history
  • Loading branch information
chr committed Dec 26, 2010
1 parent b2ef306 commit a2b12f0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions README
Expand Up @@ -58,6 +58,7 @@ CUSTOMIZATION
is the name of a directory in the root of the website.
* header_content and footer_content: Insert strings in header and footer.
http://qbnz.com/highlighter/geshi-doc.html#keyword-substitution
* limit: Maximum size of paste in kilobytes. Default is 20K.

==== [template] ====

Expand Down
6 changes: 6 additions & 0 deletions pasta.php
Expand Up @@ -37,6 +37,12 @@
}

if ( $_POST['pasta'] != '' ) {
$limit = isset($config['main']['limit']) ? $config['main']['limit'] : 20;
$limit *= 1024;
if (mb_strlen($_POST['pasta'], '8bit') >= 20480) {
die('Please, don\'t. Keep it below 20K.');
}

$source = $_POST['pasta'];
$lang = ( $_POST['lang'] ) ? $_POST['lang'] : 'txt';
if ( $_POST['title'] ) {
Expand Down
1 change: 1 addition & 0 deletions pasta_config.ini
Expand Up @@ -6,6 +6,7 @@ tabs = 8
;footer_content = 'Computed in {TIME} seconds'
directory = p
geshi = geshi
limit = 20

[template]
header = pasta.header.template
Expand Down

0 comments on commit a2b12f0

Please sign in to comment.