Browse Source

external config file. minor updates to the templates

master
Rolf Brugger 10 years ago
parent
commit
b3a8b25868
  1. 4
      doc/index.html
  2. 48
      index.php
  3. 15
      sv.js
  4. 34
      svconfig.php-dist
  5. 4
      tpl-iphone/main.php
  6. 2
      tpl-iphone/searchresults.php
  7. 5
      tpl-std/entryform.php
  8. 4
      tpl-std/incl-titlebar.php

4
doc/index.html

@ -60,7 +60,7 @@
<p>If you have problems please ask your questions in the <a href='http://sourceforge.net/forum/?group_id=205981'>support forum</a>.</p>
<h3>Configuration</h3>
<p>In the main file <tt>index.php</tt> there is a configuration section below the lines <tt> *** Settings</tt>.
<p>In the configuration file <tt>svconfig.php</tt> (can initially be copied from <tt>svconfig.php-dist</tt>) there is a configuration section below the lines <tt> *** Settings</tt>.
<ul>
<li>The setting for <tt>$dateformat</tt> specifies the date format.</li>
<li><tt>$forcesamepf</tt> defines if a global pass phrase is to be used, if each category has its own pass phrase or if each entry can have it's own pass phrase. </li>
@ -69,7 +69,7 @@
</p>
<h3>Updating an Existing Installation</h3>
<p>Simply replace the files <tt>index.php</tt>, <tt>sv.js</tt>, <tt>img/*</tt> and <tt>tpl-*</tt> with the new files from the distribution. </p>
<p>Simply replace the files <tt>index.php</tt>, <tt>sv.js</tt>, <tt>img/*</tt> and <tt>tpl-*</tt> with the new files from the distribution. Check <tt>svconfig.php-dist</tt> if there are new configuration parameters.</p>
<a name="usage" ></a>

48
index.php

@ -9,6 +9,10 @@
# Email: mail at rolfb dot ch
#
# Versions - History:
# 1.7 - settings are now in a separate file.
# - search also works with get parameter (needed for saved search feature of firefox)
# - generate passwords based on 3 different caracter sets
#
# 1.6 Jun 11: - Bulk decrypt entries shows a list of not decrypted entries too.
# - Set cursor to password form field.
# Many thanks to Fabio B. who contributed the following features:
@ -43,38 +47,21 @@
#
################################################################
// ----------------------------------------------------------------------------------------
// *** Settings
// ----------------------------------------------------------------------------------------
// date format string as used by php function 'date'
//$dateformat = 'm.d.y G:i'; // "09.19.07 15:44"
//$dateformat = 'M jS Y g:ia'; // "Sep 19th 2007 3:44pm"
//$dateformat = 'd-M-Y G:i'; // "09-Sep-2007 15:44"
// set default values
$dateformat = 'd-M-Y'; // "09-Sep-2007"
date_default_timezone_set('Europe/Zurich');
// Checks if the pass phrase that was entered to encode an entry has already
// been used to encode other entries. Depending on the usage scenario a re-used
// pass phrase may be wanted or unwanted.
// 1 to enable check, 0 to disable check.
$checkexistingpf = 1;
// Restictions to be applied for a pass phrase when an entry is saved.
// 0: No restrictions. Any entry can be saved with any pass phrase
// a: An entry can only be saved with a pass phrase that has been used to encode
// all other entries. All entries will have the same pass phrase.
// c: An entry can only be saved with a pass phrase that has been used to encode
// all other entries of the same category. All entries in a category will have the same
// pass phrase.
$forcesamepf = 'c';
// Place where the vault file is stored. This may be a location that is not web readable.
// However, if good passphrases were chosen, it is no particular risk to put this file at a
// web readable location. All precious data is encrypted.
$forcesamepf = '0';
$vaultfname = "vault/simplevault.txt";
date_default_timezone_set('Europe/Zurich');
// get settings form configuration file
if (file_exists('svconfig.php')){
include 'svconfig.php';
}
error_reporting(E_ERROR | E_WARNING | E_PARSE);
@ -120,6 +107,7 @@ $myfname = basename($_SERVER["PHP_SELF"]);
$infomsg = array();
$errormsg= array();
// ----------------------------------------------------------------------------------------
// *** Actions
// ----------------------------------------------------------------------------------------
@ -149,17 +137,17 @@ if(isset($_POST['entrysave'])){
// *** make checks
if(!isset($_POST['cat']) or strlen($_POST['cat'])==0){
$errormsg[] = "Could not save entry: no category set.</span></p>";
$errormsg[] = "Could not save entry: no category set.";
include "$template/entryform.php";
return;
}
else if(!isset($_POST['t1']) or strlen($_POST['t1'])==0){
$errormsg[] = "Could not save entry: no title set.</span></p>";
$errormsg[] = "Could not save entry: no title set.";
include "$template/entryform.php";
return;
}
else if(!isset($_POST['newp3']) or strlen($_POST['newp3'])==0){
$errormsg[] = "Could not save entry: no password set.</span></p>";
$errormsg[] = "Could not save entry: no password set.";
include "$template/entryform.php";
return;
}
@ -423,13 +411,13 @@ elseif(isset($_GET['tools'])){
// *** Browse for existing entries
else{
$filter = $_POST['filter'];
$search = $_REQUEST['s'];
$records = array();
foreach ($vlt as $record){
$recfields = explode ("\t", $record, $nbfields);
if ( (count ($_GET) === 0 and count ($_POST) === 0)
or (isset($_GET['cat']) and $_GET['cat'] == $recfields[0])
or (isset($filter) and strlen($filter)>1 and stripos($record, $filter) !== false )
or (isset($search) and strlen($search)>1 and stripos($record, $search) !== false )
){
array_push($records, array('cat'=>$recfields[0],'t1'=>$recfields[1],'t2'=>$recfields[2],'mdate'=>$recfields[3]));
}

15
sv.js

@ -14,9 +14,20 @@ function toggle_pf(id)
element.type = element.type === "password" ? "text" : "password";
}
function generate_password(id)
function generate_password(id, quality)
{
var chars = "\\|!\"£$%&/()(=?^[];,:.<>+*/@abcdefghijmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ";
switch (quality)
{
case 'c':
var chars = "abcdefghijmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ";
break
case 's':
var chars = "!%=#-?;,:.+_abcdefghijmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ";
break
default:
var chars = "\\|!\"£$%&/()(=#-?^[];,:.<>+*/@abcdefghijmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWYXZ";
break
}
var len = 16;
var element = document.getElementById (id);

34
svconfig.php-dist

@ -0,0 +1,34 @@
<?php
// ----------------------------------------------------------------------------------------
// *** Simplevault Settings
// ----------------------------------------------------------------------------------------
// date format string as used by php function 'date'
//$dateformat = 'm.d.y G:i'; // "09.19.07 15:44"
//$dateformat = 'M jS Y g:ia'; // "Sep 19th 2007 3:44pm"
//$dateformat = 'd-M-Y G:i'; // "09-Sep-2007 15:44"
$dateformat = 'd-M-Y'; // "09-Sep-2007"
date_default_timezone_set('Europe/Zurich');
// Checks if the pass phrase that was entered to encode an entry has already
// been used to encode other entries. Depending on the usage scenario a re-used
// pass phrase may be wanted or unwanted.
// 1 to enable check, 0 to disable check.
$checkexistingpf = 1;
// Restictions to be applied for a pass phrase when an entry is saved.
// 0: No restrictions. Any entry can be saved with any pass phrase
// a: An entry can only be saved with a pass phrase that has been used to encode
// all other entries. All entries will have the same pass phrase.
// c: An entry can only be saved with a pass phrase that has been used to encode
// all other entries of the same category. All entries in a category will have the same
// pass phrase.
$forcesamepf = 'c';
// Place where the vault file is stored. This may be a location that is not web readable.
// However, if good passphrases were chosen, it is no particular risk to put this file at a
// web readable location. All precious data is encrypted.
$vaultfname = "vault/simplevault.txt";
?>

4
tpl-iphone/main.php

@ -1,4 +1,4 @@
<?php if (isset($_POST['filter'])){include "$template/searchresults.php"; exit(); } // use another template for serach results ?>
<?php if (isset($_REQUEST['s'])){include "$template/searchresults.php"; exit(); } // use another template for serach results ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@ -78,7 +78,7 @@
<a class="button blueButton" type="submit">Search</a>
<label>Search:</label>
<input type='text' name='filter' value='' />
<input type='text' name='s' value='' />
<!-- input type='submit' name='filterbutton' value='Search' / -->
</fieldset>
</form>

2
tpl-iphone/searchresults.php

@ -3,7 +3,7 @@
$currcat = "";
print "<ul title='Search Results' selected='true'>\n";
if(count($records)==0){
print "<li>no item matching '".$_POST['filter']."'</li>";
print "<li>no item matching '".$_REQUEST['s']."'</li>";
}
foreach ($records as $recfields){
if($currcat != $recfields['cat']){ // new category has started

5
tpl-std/entryform.php

@ -43,7 +43,10 @@
</td></tr>
<tr><td>Password: *</td><td>
<input id="newp3" name='newp3' type='text' value='<?php echo $encfields[3] ?>' size='20' maxlength='200'/>
<input type="button" value="Generate" onclick="generate_password ('newp3')"/>
Generate:
<input type="button" value="cQ3" onclick="generate_password ('newp3', 'c')"/>
<input type="button" value="cQ3_!" onclick="generate_password ('newp3', 's')"/>
<input type="button" value="cQ3_!<£" onclick="generate_password ('newp3', 'a')"/>
</td></tr>
<tr><td>
<input name='newp8' type='text' value='<?php echo $encfields[8] ?>' size='6' maxlength='30'/>

4
tpl-std/incl-titlebar.php

@ -5,8 +5,8 @@
<div class='leftblock'>
<span>
<a href='index.php'><b>Home</b></a> &nbsp; &nbsp;
<input type='text' name='filter' value='<?= htmlspecialchars ($filter) ?>' size ='7' id='inpfield' />
<input type='image' src='img/go-arr.png' name='image' title='run filter' />
<input type='text' name='s' value='<?= htmlspecialchars ($search) ?>' size ='7' id='inpfield' />
<input type='image' src='img/go-arr.png' name='image' title='run search' />
</span>
</div>
<div class='rightblock'><span><a href='?tools'>Tools</a></span></div>

Loading…
Cancel
Save