diff --git a/cfg/conf.ini b/cfg/conf.ini index fd0078f..427488f 100644 --- a/cfg/conf.ini +++ b/cfg/conf.ini @@ -8,8 +8,11 @@ ; @version 0.19 [main] -; enable or disable discussions, defaults to true -opendiscussion = true +; enable or disable the discussion feature, defaults to true +discussion = true + +; preselect the discussion feature, defaults to false +opendiscussion = false ; enable or disable syntax highlighting, defaults to true syntaxhighlighting = true @@ -20,6 +23,9 @@ syntaxhighlighting = true ; preselect the burn-after-reading feature, defaults to false burnafterreadingselected = false +; enable or disable the password feature, defaults to true +password = true + ; size limit per paste or comment in bytes, defaults to 2 Mibibytes sizelimit = 2097152 @@ -72,9 +78,9 @@ dir = PATH "data" [model] ; name of data model class to load and directory for storage ; the default model "zerobin_data" stores everything in the filesystem -;class = zerobin_data -;[model_options] -;dir = PATH "data" +class = zerobin_data +[model_options] +dir = PATH "data" ;[model] ; example of DB configuration for MySQL @@ -88,10 +94,10 @@ dir = PATH "data" ;[model] ; example of DB configuration for SQLite -class = zerobin_db -[model_options] -dsn = "sqlite:" PATH "data/db.sq3" -usr = null -pwd = null -opt[12] = true ; PDO::ATTR_PERSISTENT +;class = zerobin_db +;[model_options] +;dsn = "sqlite:" PATH "data/db.sq3" +;usr = null +;pwd = null +;opt[12] = true ; PDO::ATTR_PERSISTENT diff --git a/js/zerobin.js b/js/zerobin.js index 1f15b6e..b332912 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -134,7 +134,7 @@ function zeroDecipher(key, data) { try { return decompress(sjcl.decrypt(key, data)); } catch (err) { - var password = prompt("Please enter the password for this paste.", ""); + var password = prompt("Please enter the password for this paste:", ""); return decompress(sjcl.decrypt(key + sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password)), data)); } } @@ -423,7 +423,7 @@ function stateNewPaste() { $('#discussion').addClass('hidden'); $('#prettymessage').addClass('hidden'); // Show password field - $('#password').show(); + $('#password').removeClass('hidden'); } /** diff --git a/lib/zerobin.php b/lib/zerobin.php index 7d6b0c9..5e5106d 100644 --- a/lib/zerobin.php +++ b/lib/zerobin.php @@ -231,7 +231,7 @@ class zerobin } // Read open discussion flag. - if ($this->_conf['main']['opendiscussion'] && !empty($_POST['opendiscussion'])) + if ($this->_conf['main']['discussion'] && !empty($_POST['opendiscussion'])) { $opendiscussion = $_POST['opendiscussion']; if ($opendiscussion !== '0') @@ -489,11 +489,13 @@ class zerobin $page->assign('ERROR', $this->_error); $page->assign('STATUS', $this->_status); $page->assign('VERSION', self::VERSION); + $page->assign('DISCUSSION', $this->_getMainConfig('discussion', true)); $page->assign('OPENDISCUSSION', $this->_getMainConfig('opendiscussion', true)); $page->assign('SYNTAXHIGHLIGHTING', $this->_getMainConfig('syntaxhighlighting', true)); $page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_getMainConfig('syntaxhighlightingtheme', '')); $page->assign('NOTICE', $this->_getMainConfig('notice', '')); $page->assign('BURNAFTERREADINGSELECTED', $this->_getMainConfig('burnafterreadingselected', false)); + $page->assign('PASSWORD', $this->_getMainConfig('password', true)); $page->assign('BASE64JSVERSION', $this->_getMainConfig('base64version', '2.1.9')); $page->assign('EXPIRE', $expire); $page->assign('EXPIREDEFAULT', $this->_conf['expire']['default']); diff --git a/tpl/bootstrap.html b/tpl/bootstrap.html index 87f9c6d..b0cecb0 100644 --- a/tpl/bootstrap.html +++ b/tpl/bootstrap.html @@ -60,10 +60,10 @@ {loop="EXPIRE"} {/loop} - +
  • @@ -73,20 +73,20 @@ Burn after reading -
  • + {if="$DISCUSSION"}
  • -
  • + {/if}{if="$PASSWORD"}
  • -
  • + {/if}
  • diff --git a/tpl/page.html b/tpl/page.html index b501d7c..71d0d9f 100644 --- a/tpl/page.html +++ b/tpl/page.html @@ -57,12 +57,14 @@ + {if="$DISCUSSION"} - + {/if}{if="$PASSWORD"} + {/if}