slight configuration changes, template modifications to make discussions
and password configurable, removed generated configuration test as it grows quite big and a new one can be generated easily if needed
This commit is contained in:
parent
0198371049
commit
d3c4600806
28
cfg/conf.ini
28
cfg/conf.ini
@ -8,8 +8,11 @@
|
|||||||
; @version 0.19
|
; @version 0.19
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
; enable or disable discussions, defaults to true
|
; enable or disable the discussion feature, defaults to true
|
||||||
opendiscussion = true
|
discussion = true
|
||||||
|
|
||||||
|
; preselect the discussion feature, defaults to false
|
||||||
|
opendiscussion = false
|
||||||
|
|
||||||
; enable or disable syntax highlighting, defaults to true
|
; enable or disable syntax highlighting, defaults to true
|
||||||
syntaxhighlighting = true
|
syntaxhighlighting = true
|
||||||
@ -20,6 +23,9 @@ syntaxhighlighting = true
|
|||||||
; preselect the burn-after-reading feature, defaults to false
|
; preselect the burn-after-reading feature, defaults to false
|
||||||
burnafterreadingselected = 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
|
; size limit per paste or comment in bytes, defaults to 2 Mibibytes
|
||||||
sizelimit = 2097152
|
sizelimit = 2097152
|
||||||
|
|
||||||
@ -72,9 +78,9 @@ dir = PATH "data"
|
|||||||
[model]
|
[model]
|
||||||
; name of data model class to load and directory for storage
|
; name of data model class to load and directory for storage
|
||||||
; the default model "zerobin_data" stores everything in the filesystem
|
; the default model "zerobin_data" stores everything in the filesystem
|
||||||
;class = zerobin_data
|
class = zerobin_data
|
||||||
;[model_options]
|
[model_options]
|
||||||
;dir = PATH "data"
|
dir = PATH "data"
|
||||||
|
|
||||||
;[model]
|
;[model]
|
||||||
; example of DB configuration for MySQL
|
; example of DB configuration for MySQL
|
||||||
@ -88,10 +94,10 @@ dir = PATH "data"
|
|||||||
|
|
||||||
;[model]
|
;[model]
|
||||||
; example of DB configuration for SQLite
|
; example of DB configuration for SQLite
|
||||||
class = zerobin_db
|
;class = zerobin_db
|
||||||
[model_options]
|
;[model_options]
|
||||||
dsn = "sqlite:" PATH "data/db.sq3"
|
;dsn = "sqlite:" PATH "data/db.sq3"
|
||||||
usr = null
|
;usr = null
|
||||||
pwd = null
|
;pwd = null
|
||||||
opt[12] = true ; PDO::ATTR_PERSISTENT
|
;opt[12] = true ; PDO::ATTR_PERSISTENT
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ function zeroDecipher(key, data) {
|
|||||||
try {
|
try {
|
||||||
return decompress(sjcl.decrypt(key, data));
|
return decompress(sjcl.decrypt(key, data));
|
||||||
} catch (err) {
|
} 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));
|
return decompress(sjcl.decrypt(key + sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(password)), data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +423,7 @@ function stateNewPaste() {
|
|||||||
$('#discussion').addClass('hidden');
|
$('#discussion').addClass('hidden');
|
||||||
$('#prettymessage').addClass('hidden');
|
$('#prettymessage').addClass('hidden');
|
||||||
// Show password field
|
// Show password field
|
||||||
$('#password').show();
|
$('#password').removeClass('hidden');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -231,7 +231,7 @@ class zerobin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read open discussion flag.
|
// Read open discussion flag.
|
||||||
if ($this->_conf['main']['opendiscussion'] && !empty($_POST['opendiscussion']))
|
if ($this->_conf['main']['discussion'] && !empty($_POST['opendiscussion']))
|
||||||
{
|
{
|
||||||
$opendiscussion = $_POST['opendiscussion'];
|
$opendiscussion = $_POST['opendiscussion'];
|
||||||
if ($opendiscussion !== '0')
|
if ($opendiscussion !== '0')
|
||||||
@ -489,11 +489,13 @@ class zerobin
|
|||||||
$page->assign('ERROR', $this->_error);
|
$page->assign('ERROR', $this->_error);
|
||||||
$page->assign('STATUS', $this->_status);
|
$page->assign('STATUS', $this->_status);
|
||||||
$page->assign('VERSION', self::VERSION);
|
$page->assign('VERSION', self::VERSION);
|
||||||
|
$page->assign('DISCUSSION', $this->_getMainConfig('discussion', true));
|
||||||
$page->assign('OPENDISCUSSION', $this->_getMainConfig('opendiscussion', true));
|
$page->assign('OPENDISCUSSION', $this->_getMainConfig('opendiscussion', true));
|
||||||
$page->assign('SYNTAXHIGHLIGHTING', $this->_getMainConfig('syntaxhighlighting', true));
|
$page->assign('SYNTAXHIGHLIGHTING', $this->_getMainConfig('syntaxhighlighting', true));
|
||||||
$page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_getMainConfig('syntaxhighlightingtheme', ''));
|
$page->assign('SYNTAXHIGHLIGHTINGTHEME', $this->_getMainConfig('syntaxhighlightingtheme', ''));
|
||||||
$page->assign('NOTICE', $this->_getMainConfig('notice', ''));
|
$page->assign('NOTICE', $this->_getMainConfig('notice', ''));
|
||||||
$page->assign('BURNAFTERREADINGSELECTED', $this->_getMainConfig('burnafterreadingselected', false));
|
$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('BASE64JSVERSION', $this->_getMainConfig('base64version', '2.1.9'));
|
||||||
$page->assign('EXPIRE', $expire);
|
$page->assign('EXPIRE', $expire);
|
||||||
$page->assign('EXPIREDEFAULT', $this->_conf['expire']['default']);
|
$page->assign('EXPIREDEFAULT', $this->_conf['expire']['default']);
|
||||||
|
@ -60,10 +60,10 @@
|
|||||||
{loop="EXPIRE"}
|
{loop="EXPIRE"}
|
||||||
<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
|
<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
|
||||||
</select>
|
</select>
|
||||||
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Expires <span id="pasteExpirationDisplay"></span><span class="caret"></span></a>
|
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Expires <span id="pasteExpirationDisplay"></span> <span class="caret"></span></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
{loop="EXPIRE"}
|
{loop="EXPIRE"}
|
||||||
<li><a href="#" onclick="$('#pasteExpiration').val('{$key}');$('#pasteExpirationDisplay').val('{$value}');return false;">{$value}</a></li>{/loop}
|
<li><a href="#" onclick="$('#pasteExpiration').val('{$key}');$('#pasteExpirationDisplay').text('{$value}');return false;">{$value}</a></li>{/loop}
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
@ -73,20 +73,20 @@
|
|||||||
Burn after reading
|
Burn after reading
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>{if="$DISCUSSION"}
|
||||||
<li>
|
<li>
|
||||||
<div id="opendisc" class="navbar-text checkbox hidden">
|
<div id="opendisc" class="navbar-text checkbox hidden">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="!$OPENDISCUSSION"} disabled="disabled"{/if} />
|
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
|
||||||
Open discussion
|
Open discussion
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>{/if}{if="$PASSWORD"}
|
||||||
<li>
|
<li>
|
||||||
<div id="password" class="navbar-text" style="display:none;" >
|
<div id="password" class="navbar-form hidden">
|
||||||
<input type="password" id="passwordinput" placeholder="Password (optional)" size="19"/>
|
<input type="password" id="passwordinput" placeholder="Password (optional)" class="form-control" size="19"/>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>{/if}
|
||||||
<li>
|
<li>
|
||||||
<p id="remainingtime" class="hidden navbar-text"></p>
|
<p id="remainingtime" class="hidden navbar-text"></p>
|
||||||
</li>
|
</li>
|
||||||
|
@ -57,12 +57,14 @@
|
|||||||
<div id="burnafterreadingoption" class="button hidden">
|
<div id="burnafterreadingoption" class="button hidden">
|
||||||
<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
|
<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
|
||||||
<label for="burnafterreading">Burn after reading</label>
|
<label for="burnafterreading">Burn after reading</label>
|
||||||
</div>
|
</div>{if="$DISCUSSION"}
|
||||||
<div id="opendisc" class="button hidden">
|
<div id="opendisc" class="button hidden">
|
||||||
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="!$OPENDISCUSSION"} disabled="disabled"{/if} />
|
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="$OPENDISCUSSION"} checked="checked"{/if} />
|
||||||
<label for="opendiscussion" {if="!$OPENDISCUSSION"} style="color: #BBBBBB;"{/if}>Open discussion</label>
|
<label for="opendiscussion" {if="!$OPENDISCUSSION"} style="color: #BBBBBB;"{/if}>Open discussion</label>
|
||||||
</div>
|
</div>{/if}{if="$PASSWORD"}
|
||||||
<input id="password" placeholder="Optional password (recommended)" size="32" style="display:none;" />
|
<div id="password" class="hidden">
|
||||||
|
<input id="passwordinput" placeholder="Optional password (recommended)" size="32" />
|
||||||
|
</div>{/if}
|
||||||
</div>
|
</div>
|
||||||
<div id="pasteresult" class="hidden">
|
<div id="pasteresult" class="hidden">
|
||||||
<div id="deletelink"></div>
|
<div id="deletelink"></div>
|
||||||
|
1
tst/.gitignore
vendored
Normal file
1
tst/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/configuration.php
|
@ -31,10 +31,12 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
|
|||||||
$page->assign('ERROR', self::$error);
|
$page->assign('ERROR', self::$error);
|
||||||
$page->assign('STATUS', self::$status);
|
$page->assign('STATUS', self::$status);
|
||||||
$page->assign('VERSION', self::$version);
|
$page->assign('VERSION', self::$version);
|
||||||
$page->assign('BURNAFTERREADINGSELECTED', false);
|
$page->assign('DISCUSSION', true);
|
||||||
$page->assign('OPENDISCUSSION', false);
|
$page->assign('OPENDISCUSSION', true);
|
||||||
$page->assign('SYNTAXHIGHLIGHTING', true);
|
$page->assign('SYNTAXHIGHLIGHTING', true);
|
||||||
$page->assign('SYNTAXHIGHLIGHTINGTHEME', 'sons-of-obsidian');
|
$page->assign('SYNTAXHIGHLIGHTINGTHEME', 'sons-of-obsidian');
|
||||||
|
$page->assign('BURNAFTERREADINGSELECTED', false);
|
||||||
|
$page->assign('PASSWORD', true);
|
||||||
$page->assign('BASE64JSVERSION', '2.1.9');
|
$page->assign('BASE64JSVERSION', '2.1.9');
|
||||||
$page->assign('NOTICE', 'example');
|
$page->assign('NOTICE', 'example');
|
||||||
$page->assign('EXPIRE', self::$expire);
|
$page->assign('EXPIRE', self::$expire);
|
||||||
@ -72,15 +74,29 @@ class RainTPLTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_content,
|
$this->_content,
|
||||||
'outputs error correctly'
|
'outputs error correctly'
|
||||||
);
|
);
|
||||||
|
$this->assertTag(
|
||||||
|
array(
|
||||||
|
'id' => 'password',
|
||||||
|
),
|
||||||
|
$this->_content,
|
||||||
|
'password available if configured'
|
||||||
|
);
|
||||||
$this->assertTag(
|
$this->assertTag(
|
||||||
array(
|
array(
|
||||||
'id' => 'opendiscussion',
|
'id' => 'opendiscussion',
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'disabled' => 'disabled'
|
'checked' => 'checked'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
$this->_content,
|
$this->_content,
|
||||||
'disables discussions if configured'
|
'checked discussion if configured'
|
||||||
|
);
|
||||||
|
$this->assertTag(
|
||||||
|
array(
|
||||||
|
'id' => 'opendisc',
|
||||||
|
),
|
||||||
|
$this->_content,
|
||||||
|
'discussions available if configured'
|
||||||
);
|
);
|
||||||
// testing version number in JS address, since other instances may not be present in different templates
|
// testing version number in JS address, since other instances may not be present in different templates
|
||||||
$this->assertTag(
|
$this->assertTag(
|
||||||
|
@ -16,19 +16,16 @@ $vrd = array('view', 'read', 'delete');
|
|||||||
$vcud = array('view', 'create', 'read', 'delete');
|
$vcud = array('view', 'create', 'read', 'delete');
|
||||||
|
|
||||||
new configurationTestGenerator(array(
|
new configurationTestGenerator(array(
|
||||||
'main/opendiscussion' => array(
|
'main/discussion' => array(
|
||||||
array(
|
array(
|
||||||
'setting' => true,
|
'setting' => true,
|
||||||
'tests' => array(
|
'tests' => array(
|
||||||
array(
|
array(
|
||||||
'conditions' => array('steps' => $vrd),
|
'conditions' => array('steps' => $vrd),
|
||||||
'type' => 'NotTag',
|
'type' => 'Tag',
|
||||||
'args' => array(
|
'args' => array(
|
||||||
array(
|
array(
|
||||||
'id' => 'opendiscussion',
|
'id' => 'opendisc',
|
||||||
'attributes' => array(
|
|
||||||
'disabled' => 'disabled',
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
'$content',
|
'$content',
|
||||||
'outputs enabled discussion correctly'
|
'outputs enabled discussion correctly'
|
||||||
@ -57,16 +54,54 @@ new configurationTestGenerator(array(
|
|||||||
'setting' => false,
|
'setting' => false,
|
||||||
'tests' => array(
|
'tests' => array(
|
||||||
array(
|
array(
|
||||||
|
'type' => 'NotTag',
|
||||||
|
'args' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'opendisc',
|
||||||
|
),
|
||||||
|
'$content',
|
||||||
|
'outputs disabled discussion correctly'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'affects' => $vrd
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'main/opendiscussion' => array(
|
||||||
|
array(
|
||||||
|
'setting' => true,
|
||||||
|
'tests' => array(
|
||||||
|
array(
|
||||||
|
'conditions' => array('main/discussion' => true),
|
||||||
'type' => 'Tag',
|
'type' => 'Tag',
|
||||||
'args' => array(
|
'args' => array(
|
||||||
array(
|
array(
|
||||||
'id' => 'opendiscussion',
|
'id' => 'opendiscussion',
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'disabled' => 'disabled',
|
'checked' => 'checked',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'$content',
|
'$content',
|
||||||
'outputs disabled discussion correctly'
|
'outputs checked discussion correctly'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'affects' => $vrd
|
||||||
|
), array(
|
||||||
|
'setting' => false,
|
||||||
|
'tests' => array(
|
||||||
|
array(
|
||||||
|
'conditions' => array('main/discussion' => true),
|
||||||
|
'type' => 'NotTag',
|
||||||
|
'args' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'opendiscussion',
|
||||||
|
'attributes' => array(
|
||||||
|
'checked' => 'checked',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'$content',
|
||||||
|
'outputs unchecked discussion correctly'
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -240,6 +275,40 @@ new configurationTestGenerator(array(
|
|||||||
'affects' => array('view'),
|
'affects' => array('view'),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'main/password' => array(
|
||||||
|
array(
|
||||||
|
'setting' => true,
|
||||||
|
'tests' => array(
|
||||||
|
array(
|
||||||
|
'type' => 'Tag',
|
||||||
|
'args' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'password',
|
||||||
|
),
|
||||||
|
'$content',
|
||||||
|
'outputs password input correctly'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'affects' => $vrd
|
||||||
|
), array(
|
||||||
|
'setting' => false,
|
||||||
|
'tests' => array(
|
||||||
|
array(
|
||||||
|
'conditions' => array('main/discussion' => true),
|
||||||
|
'type' => 'NotTag',
|
||||||
|
'args' => array(
|
||||||
|
array(
|
||||||
|
'id' => 'password',
|
||||||
|
),
|
||||||
|
'$content',
|
||||||
|
'removes password input correctly'
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
'affects' => $vrd
|
||||||
|
),
|
||||||
|
),
|
||||||
'main/template' => array(
|
'main/template' => array(
|
||||||
array(
|
array(
|
||||||
'setting' => 'page',
|
'setting' => 'page',
|
||||||
@ -421,7 +490,7 @@ class configurationTestGenerator
|
|||||||
* creating factorial configurations
|
* creating factorial configurations
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
const MAX_ITERATIONS = 1000;
|
const MAX_ITERATIONS = 2000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* options to test
|
* options to test
|
||||||
|
17345
tst/configuration.php
17345
tst/configuration.php
File diff suppressed because it is too large
Load Diff
49
tst/test.ini
Normal file
49
tst/test.ini
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
[main]
|
||||||
|
discussion = true
|
||||||
|
opendiscussion = true
|
||||||
|
syntaxhighlighting = true
|
||||||
|
burnafterreadingselected = true
|
||||||
|
password = true
|
||||||
|
sizelimit = 10
|
||||||
|
template = "page"
|
||||||
|
base64version = "2.1.9"
|
||||||
|
syntaxhighlightingtheme = "sons-of-obsidian"
|
||||||
|
|
||||||
|
[expire]
|
||||||
|
default = "1week"
|
||||||
|
|
||||||
|
[expire_options]
|
||||||
|
5min = "300"
|
||||||
|
10min = "600"
|
||||||
|
1hour = "3600"
|
||||||
|
1day = "86400"
|
||||||
|
1week = "604800"
|
||||||
|
1month = "2592000"
|
||||||
|
1year = "31536000"
|
||||||
|
never = "0"
|
||||||
|
|
||||||
|
[expire_labels]
|
||||||
|
5min = "5 minutes"
|
||||||
|
10min = "10 minutes"
|
||||||
|
1hour = "1 hour"
|
||||||
|
1day = "1 day"
|
||||||
|
1week = "1 week"
|
||||||
|
1month = "1 month"
|
||||||
|
1year = "1 year"
|
||||||
|
never = "Never"
|
||||||
|
|
||||||
|
[traffic]
|
||||||
|
limit = 0
|
||||||
|
dir = "../data"
|
||||||
|
|
||||||
|
[model]
|
||||||
|
class = "zerobin_db"
|
||||||
|
|
||||||
|
[model_options]
|
||||||
|
dsn = "sqlite:../data/db.sq3"
|
||||||
|
usr = ""
|
||||||
|
pwd = ""
|
||||||
|
opt = array (
|
||||||
|
12 => '1',
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user