-
@@ -1,3 +0,0 @@
|
||||
/index.html/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
D/contents////
|
||||
D/images////
|
||||
@@ -1 +0,0 @@
|
||||
NOTE/0x49
|
||||
@@ -1 +0,0 @@
|
||||
zarahg@cvs.htnews.sourceforge.net:/cvsroot/htnews
|
||||
@@ -1,14 +0,0 @@
|
||||
/about/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/deutsch/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/index/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/installation/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/license/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/screenshots/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/upgrade/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/usage/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/cvs/1.2/Sat Jul 1 14:55:31 2000//
|
||||
/menu/1.2/Sat Jul 1 14:58:41 2000//
|
||||
/changelog/1.2/Sun Jul 9 22:16:25 2000//
|
||||
/version/1.2/Sun Jul 9 22:16:43 2000//
|
||||
/download/1.4/Sun Jul 9 23:03:12 2000//
|
||||
D
|
||||
@@ -1 +0,0 @@
|
||||
NOTE/0x49/contents
|
||||
@@ -1 +0,0 @@
|
||||
zarahg@cvs.htnews.sourceforge.net:/cvsroot/htnews
|
||||
@@ -1,13 +0,0 @@
|
||||
<h2>about note and this page</h2>
|
||||
<p>
|
||||
The author of note is Thomas Linden. if you have any questions, suggestions, votes or even flames, please feel free to
|
||||
send me an <a href="tom at daemon.de">E-mail</a>!
|
||||
<p>
|
||||
This page is hosted by <a href="http://www.consol.de">ConSol* GmbH, Germany</a> - THANKS A LOT!
|
||||
<p>
|
||||
Powered by <a href="http://www.engelschall.com/sw/eperl/">ePerl</a> and <a href="http://www.vim.org">vi</a>.
|
||||
<p>
|
||||
<a href="http://www.kernel.org"><img src="images/linux.gif" border=0></a>
|
||||
<p>
|
||||
Logo created with:<br><a href="http://www.cooltext.com"><img src="http://www.cooltext.com/images/gfx_cool.gif" border=0></a>
|
||||
|
||||
@@ -1,294 +0,0 @@
|
||||
<h2>changelog</h2>
|
||||
|
||||
<hr><ul>
|
||||
1.0.8:
|
||||
<li><b>FIXED</b>:<br>
|
||||
typo in noterc shipped with package may caused confusion (BLOWFISH
|
||||
instead of Blowfish).
|
||||
<li><b>CHANGED</b>:<br>
|
||||
changed the way note manages temporary filez. It uses now a random
|
||||
string instead of just it's own PID. It does also change it's umask
|
||||
to 077 and, if applicable (on ext2 filesystems) issues "chattr +s"
|
||||
which will cause the ext2 inodes to be zero'd after file deletion.
|
||||
<li><b>ADDED</b>:<br>
|
||||
A new config option allows the user to specify her own temp-directory.
|
||||
The default is still /tmp.
|
||||
</ul>
|
||||
|
||||
<hr><ul>
|
||||
1.0.7:
|
||||
<li><b>FIXED</b>:<br> there was a bug in the search expression, use now \Q and \E.
|
||||
<li><b>ADDED</b>:<br> --config <file> allows one to use another config than the default.
|
||||
</ul>
|
||||
<hr><ul>
|
||||
1.0.6:
|
||||
<li><b>FIXED</b>:<br> Forgot "PreferredEditor" config-option in the new config format.
|
||||
<li><b>FIXED</b>:<br> the interactive "cd .." command has ignored the presence of a
|
||||
"DefaultLong" setting(and search too)... thx to Peter.
|
||||
<li><b>CHANGED</b>:<br> Optimized a little bit the output routine, now it is better to read.
|
||||
<li><b>ADDED</b>:<br> sub format and appropriate config-option for text formatting capabilities.
|
||||
<li><b>CHANGED</b>:<br> changed getconfig regexp, which allows now also to use Option = Param.
|
||||
<li><b>FIXED</b>:<br> was not possible to override config-options, which are set by default to
|
||||
something.
|
||||
<li><b>ADDED</b>:<br> note chacks now, if a database os actually really encrypted and exits with
|
||||
an error if it s and the user turned off encryption. This protects her from
|
||||
destroying it's own database ..
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.5:
|
||||
<li><b>FIXED</b>:<br> the T (and t respectively) printed nothing out since 1.0.3! It does
|
||||
it now again...
|
||||
<li><b>ADDED</b>:<br> a new database backend added, NOTEDB::dbm, which uses DBM files for
|
||||
storage.
|
||||
<li><b>FIXED</b>:<br> &display-tree returns now, if there is no note, otherwise it
|
||||
would die because of an undefined refernce.
|
||||
<li><b>CHANGED</b>:<br> Changed the config file format completely. It is now no more a perl
|
||||
file, instead it is a simple plain text file which note parses.
|
||||
<li><b>CHANGED</b>:<br> Changed the way, note loads it database backend. It uses now the
|
||||
$dbdriver variable as module-name, which makes it possible easily
|
||||
to write your own backend without the need to change note itself.
|
||||
<li><b>FIXED</b>:<br> Removed Getopt::Long option "bundling", causes errors with perl
|
||||
5.6.0 and is not senceful.
|
||||
<li><b>FIXED</b>:<br> Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
|
||||
were case insensitive causing -i to be interpreted as --import
|
||||
instead of --interactive ;-(((
|
||||
<li><b>ADDED</b>:<br> a new config option $DEFAULT_LIST, which causes note, \
|
||||
if turned to "LONG", to use long-listing as default. |
|
||||
But it will still be able to use short-listing if you |
|
||||
explicit specify that. | submitted by
|
||||
<li><b>FIXED</b>:<br> sub search prints now an appropriate error-message in |==> Peter Palmreuther
|
||||
case no searchstring was given instead of jumping to | thanks a lot!
|
||||
usage. |
|
||||
<li><b>CHANGED</b>:<br> Changed the text in the interactive help to reflect |
|
||||
changes of verion 1.0.3 (t and T). /
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.4:
|
||||
<li><b>CHANGED</b>:<br> Moved from @ARGV-parsing to Getopt::Long, adding options is now
|
||||
much easier and I do now understand my own code ;-)
|
||||
<li><b>ADDED</b>:<br> --raw, the "Raw Mode", which turns off any formatting of output.
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.3:
|
||||
<li><b>ADDED</b>:<br> "-" works also for --dump, but in the other direction. It causes
|
||||
note to dump to standard output instead into a file.
|
||||
<li><b>ADDED</b>:<br> you can specify - as filename for use with --import and if you want
|
||||
to create a new note. "-" stands for standardinput and it allows you
|
||||
tp pipe another commands output to note!
|
||||
<li><b>ADDED</b>:<br> you can now use an environment variable for the passphrase (when using
|
||||
encryption). If it is presen, note will not ask for a passphrase. This
|
||||
is very usefull in comination with the addition above, for use in
|
||||
scripts.
|
||||
<li><b>CHANGED</b>:<br> the interactive help screen is now coloured.
|
||||
<li><b>ADDED</b>:<br> -o commandline switch, which causes note to overwrite an existing
|
||||
database when importing data from a previous dump. Very handy if
|
||||
you want to re-initialize your db, i.e. if you changed the format.
|
||||
<li><b>ADDED</b>:<br> the long-tree-view (-T) displays now also the note-number of each
|
||||
note.
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.2:
|
||||
<li><b>ADDED</b>:<br> Topic-Tree overview command (-t or -T).
|
||||
<li><b>ADDED</b>:<br> Enhanced list command in interactive mode, you can now specify
|
||||
a topic which notes you want to see.
|
||||
<li><b>CHANGED</b>:<br> updated the help and usage sections to reflect the additions above.
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.1:
|
||||
<li><b>FIXED</b>:<br> fixed bug in NOTEDB::mysql, which caused note t store NULL values
|
||||
in db, if encryption was off. A really dump failure :-(
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
1.0.0:
|
||||
<li><b>CHANGED</b>:<br> removed install.#!/bin/sh. use now a Makefile for installation.
|
||||
<li><b>ADDED</b>:<br> Encryption support. Note can now encrypt notes using IDEA
|
||||
or DES as encryption-protocols(symetric).
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
0.9:
|
||||
<li><b>FIXED</b>:<br> There were many new bugs after my last changes *grrrrr*. fixed.
|
||||
Works now properly, with both backends!
|
||||
<li><b>FIXED</b>:<br> and another bug: recounting of numbers did not take care about
|
||||
the existing order! If you deleted note #12, then note #13 became
|
||||
not neccessarily #12! Instead it becames any other number (kind of
|
||||
randomly...).
|
||||
<li><b>CHANGED</b>:<br> NOTEDB::binary set_del function changed, it does no more require
|
||||
a temporary file for number recount. Instead it uses get_all and
|
||||
stores all notes in RAM and then rewrites the database.
|
||||
<li><b>FIXED</b>:<br> fixed the set_new call within note. It used 0 as the first param
|
||||
(number) which is not useful since we dont have support for auto-
|
||||
increment from all database backends.
|
||||
<li><b>FIXED</b>:<br> fixed the function set_recountnum in NITEDB::mysql, it was also
|
||||
incorrect :-((( 0.8 seemed to be a very bad early alpha...........
|
||||
<li><b>FIXED</b>:<br> there was a bug in NOTEDB::binary which caused not to recount note
|
||||
numbers after deleting one :-(
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
0.8:
|
||||
<li><b>ADDED</b>:<br> NOTEDB::binary. so now 0.8 is ready for shipping !
|
||||
<li><b>FIXED</b>:<br> regexp bug fixed. It was only possible to delete 2 items together
|
||||
separated by comma ("d 1,2,3,4" deleted only 1,2!).
|
||||
<li><b>ADDED</b>:<br> Some new config options which reflects the new module structure.
|
||||
So you can change your database backend without the need to
|
||||
replace the note script itself.
|
||||
<li><b>FIXED</b>:<br> the previously added feature "cd <topic>" didn't really work :-(
|
||||
<li><b>ADDED</b>:<br> NOTEDB::mysql added. Perlmodule, which I will use within
|
||||
note from now on instead of buildin functions for accessing the
|
||||
database. From now on I only need to maintain one version of
|
||||
note, since the module interface will be identical between the
|
||||
bin and sql version.
|
||||
<li><b>CHANGED</b>:<br> The SQL code does not use Mysql.pm anymore. Instead it is coded
|
||||
using the more portable DBI module. This allows one easily to
|
||||
switch to anther database, which is supported by DBI.
|
||||
<li><b>CHANGED</b>:<br> Locking. The db-table will now be locked before note accesses it.
|
||||
<li><b>FIXED</b>:<br> width of listings is now always the same independent of the string-
|
||||
length of a certain note.
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
0.7:
|
||||
<li><b>ADDED</b>:<br> one can now use the unix-like "cd" command to change to another
|
||||
topic, thus use "cd topicname" instead just typing "topicname"!
|
||||
<li><b>FIXED</b>:<br> there was a smal regex bug which maked it impossible to use such
|
||||
topics: "4 test", in such a case note just displayed note number 4
|
||||
instead of cd'ing to topic "4 test".
|
||||
<li><b>ADDED</b>:<br> a new config option "$KEEP_TIMESTAMP" allows a user to disable
|
||||
note's default behavior of updating the timestamp of a note after
|
||||
editing it.
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
0.6:
|
||||
<li><b>FIXED</b>:<br> oops - the new suptopic feature confused the commandline-mode of
|
||||
note! quickly corrected! so subtopics also available from command-
|
||||
line.
|
||||
<li><b>FIXED</b>:<br> a small bug fiyed, it was impossible to use -D or -I from command-
|
||||
line, if $ALWAYS_INT was turned on, now it is.
|
||||
<li><b>FIXED</b>:<br> fixed problem with local/global variable $time, which confused
|
||||
the script under certain circumstances, now $time is no more global,
|
||||
it will be read in (using &getdate) locally by &new and &edit.
|
||||
<li><b>CHANGED</b>:<br> The Topic separator is no longer hardcoded, one can customize
|
||||
it using the $TopicSep variable, the default is now /, the backslash
|
||||
will no mor work!
|
||||
<li><b>CHANGED</b>:<br> use perl buildin localtime() function instead of
|
||||
GNU date, which is possibly not installed on every target
|
||||
system (i.e. win32), therefore better portability!
|
||||
<li><b>CHANGED</b>:<br> use now the strict module
|
||||
<li><b>ADDED</b>:<br> Support for subtopics added (and sub-sub-..-topics).
|
||||
<li><b>CHANGED</b>:<br> Removed the "T" command, it is now obsolete.
|
||||
<li><b>CHANGED</b>:<br> behavior of list command changed, now shows topics as well as
|
||||
notes under the current topic(if there are some).
|
||||
<li><b>CHANGED</b>:<br> The ".." command takes you now one level higher in your topic-
|
||||
structure.
|
||||
<li><b>ADDED</b>:<br> A new config option $PreferredEditor, which you can use to
|
||||
specify your own choice of editor.
|
||||
<li><b>FIXED</b>:<br> A bug at line 769 causing single note where smaller than note-
|
||||
listings
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
|
||||
0.5:
|
||||
<li><b>ADDED</b>:<br> Topic support(requested). You can sort the various notes under
|
||||
different topics now.
|
||||
<li><b>FIXED</b>:<br> There was another bug, which caused the list command to display
|
||||
the notes with a too high value of $maxlen.
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
|
||||
0.4.2:
|
||||
<li><b>ADDED</b>:<br> If run in interactive mode, note will at first do a list command.
|
||||
<li><b>FIXED</b>:<br> A bug caused note to save bogus timestamps after editing a note.
|
||||
<li><b>CHANGED</b>:<br> It does no more print 3 newlines before the menu in interactive mode.
|
||||
<li><b>FIXED</b>:<br> Some more vars will be resetted during each loop in interactive mode.
|
||||
$ListType.
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
|
||||
0.4.1:
|
||||
<li><b>ADDED</b>:<br> The install.#!/bin/sh script for the mysql version is no able to install the
|
||||
required Mysql module directly from CPAN, thanks to David A. Bandel!
|
||||
<li><b>FIXED</b>:<br> The mysql version did not display notes (i.e.: "note 3" did nothing)
|
||||
<li><b>CHANGED</b>:<br> Again, the sql-format of the mysql database has been changed. Now
|
||||
there are only 3 fields, the number filed is the primary key, the id
|
||||
field in previous versions was a waste of diskspace...
|
||||
<li><b>CHANGED</b>:<br> The format of the dump-output has been changed.
|
||||
<li><b>ADDED</b>:<br> It is now possible to import previously dumped notes into the notedb
|
||||
(dumps from both versions are compatible with each other)
|
||||
<li><b>FIXED</b>:<br> the function num_bereich() had a bug, which caused ot to ignore under
|
||||
some circumstances one number (i.e. "note -d 4-13" did nothing).
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
|
||||
0.4:
|
||||
<li><b>CHANGED</b>:<br> ok, mysql support is back again (upon requests). therefore there
|
||||
are two different version of the script in the same time with
|
||||
the same features, one for mysql and the other one for the binary
|
||||
database.
|
||||
<li><b>ADDED</b>:<br> Dump to textfile capability. Later on I want to dump it into a
|
||||
palm readable format, any help is welcome!
|
||||
<li><b>ADDED</b>:<br> interactive mode.
|
||||
<li><b>CHANGED</b>:<br> Better modularity, better code.
|
||||
<li><b>CHANGED</b>:<br> note can now run without the need of a config file. If does not
|
||||
exist, it will try to work with default values.
|
||||
|
||||
<li><b>ADDED</b>:<br> sub num_bereich(), which allows one to specify more then one
|
||||
number for deletion or displaying (i.e.: "-d 1,4,7" or "-d 4-9")
|
||||
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
|
||||
0.3:
|
||||
<li><b>CHANGED</b>:<br> it uses no more a mysql database, but a binary file instead.
|
||||
This is much faster!
|
||||
<li><b>ADDED</b>:<br> note can display the notes with colors, it is turned off by default
|
||||
|
||||
|
||||
</ul><hr><ul>
|
||||
|
||||
|
||||
0.2:
|
||||
<li><b>FIXED</b>:<br> now any occurence of ' will be masked with \' before storage
|
||||
to the mysql database.
|
||||
<li><b>FIXED</b>:<br> now numbers of notes will be recounted, if one delete one note,
|
||||
so the list of notes will everytime start with 1,2,3,...
|
||||
<li><b>CHANGED</b>:<br> the look of the list output has been changed, similar to a table
|
||||
|
||||
|
||||
</ul><hr>
|
||||
|
||||
0.1:
|
||||
INITIAL RELEASE.
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<h2>CVS</h2>
|
||||
<p>
|
||||
|
||||
The whole note source tree is now maintained via CVS at <a href="http://sourceforge.net">sourceforge.net</a>.
|
||||
|
||||
You can browse the repository via the web:
|
||||
<br>
|
||||
<a target="newspot" href="http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/NOTE/?cvsroot=htnews">http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/NOTE/?cvsroot=htnews</a>.
|
||||
|
||||
<p>
|
||||
|
||||
Or you can use the <b>cvs</b> command:
|
||||
<br>
|
||||
<pre>
|
||||
cvs -d:pserver:anonymous@cvs.htnews.sourceforge.net:/cvsroot/htnews login
|
||||
|
||||
cvs -z3 -d:pserver:anonymous@cvs.htnews.sourceforge.net:/cvsroot/htnews co NOTE
|
||||
</pre>
|
||||
<br>
|
||||
When prompted for a password for anonymous, simply press the Enter key.
|
||||
@@ -1,19 +0,0 @@
|
||||
<h2>Hinweise für deutsche Besucher</h2>
|
||||
note ist ein Konsolenprogram, mit dem man einfach Notizen verwalten
|
||||
kann, <20>hnlich wie bei "knotes". Es ist in Perl geschrieben. Note
|
||||
verwendet externe (mitgelieferte!) Module als Speicher-Backend, um
|
||||
die Daten zu speichern. Momentan ist ein mysql-Modul dabei, sowie
|
||||
ein "binary"-Modul, note's eigenes Datenformat und seit 1.0.5 auch ein
|
||||
DBM modul. Das mysql Modul verwendet Perls Standard Modul DBI
|
||||
und ist damit f<>r alle g<>ngigen DBMS verwendbar.
|
||||
Seit Version 1.0.0 wird Verschl<68>sselung unterst<73>tzt(IDEA oder DES),
|
||||
man kann also durchaus auch sensible Daten speichern.
|
||||
<p>
|
||||
Die Dokumentation für <b>note</b> liegt leider nur in englisch vor. Trotzdem müssen Deutsche
|
||||
nicht ganz leer ausgehen :-)
|
||||
<p>
|
||||
Hannes Lau hat auf seiner <a href="http://home.debitel.net/user/hannes.lau/Linux-Text.htm#Notizen">Homepage</a> eine kurze Beschreibung bereitgestellt (Tausend Dank!).
|
||||
<p>
|
||||
Eine ausf<73>hrliche Beschreibung des Programmes ist ausserdem im
|
||||
<a href="http://www.linux-magazin.de">LinuxMagazin 5/2000</a> S. 106 erschienen (allerdings basierend auf einer
|
||||
<EFBFBD>lteren Version...)!<br> *stolzsei* ;-)
|
||||
@@ -1,17 +0,0 @@
|
||||
<h2>downloads</h2>
|
||||
<p>
|
||||
Here you can find the <b>note</b> package for free download. Follow the installation instructions in the
|
||||
README file provided with the package or read the <a href="install.html">online version</a>.
|
||||
<p>
|
||||
newest: <a href="ftp://ftp.daemon.de/pub/note/note-1.0.8.tar.gz">note-1.0.8.tar.gz</a><br>
|
||||
<a href="ftp://ftp.daemon.de/pub/note/note-1.0.7.tar.gz">note-1.0.7.tar.gz</a><br>
|
||||
<a href="ftp://ftp.daemon.de/pub/note/note-1.0.6.tar.gz">note-1.0.6.tar.gz</a><br>
|
||||
<a href="ftp://ftp.daemon.de/pub/note/note-1.0.5.tar.gz">note-1.0.5.tar.gz</a><br>
|
||||
<a href="ftp://ftp.daemon.de/pub/note/README.txt">read the README</a><br>
|
||||
<a href="ftp://ftp.daemon.de/pub/note/Changelog.txt">read the Changelog</a><br>
|
||||
|
||||
<hr>
|
||||
If you encounter any problems with the site above, try to use one of the following mirrors:<p>
|
||||
<a href="ftp://www.0x49.org/pub/scip/note/">ftp://www.0x49.org/pub/scip/note/</a>
|
||||
<br>
|
||||
<a href="http://sourceforge.net/project/filelist.php?group_id=656">http://sourceforge.net/project/filelist.php?group_id=656</a>
|
||||
@@ -1,49 +0,0 @@
|
||||
<h3>welcome to the homepage of <I>note</I> by <a href="mailto: tom at daemon.de">Thomas Linden</a></h3>
|
||||
<I>note</I> is a small console program written in perl, which allows
|
||||
you to manage notes similar to programs like "knotes" from
|
||||
commandline. Note can use different database-backends for
|
||||
notes-storage. It ships with a DBI-based mysql-module(which
|
||||
can also be used for other by DBI supported DBMS) and another
|
||||
module, which uses a binary file for storage and a DBM module.<br>
|
||||
Note supports since version 1.0.0 encryption(IDEA or DES)!<p>
|
||||
Here is a brief list of it's features:
|
||||
|
||||
<ul><li> Three different database backends, mysql(DBI), dbm, binary(bin file).
|
||||
</li><li> Commandline interface using the standard perl module
|
||||
Getopt::Long, which allows you to use short or long
|
||||
command-line options.
|
||||
</li><li> Interactive interface(pure ascii), the following functions
|
||||
are available in interactive mode: list, display, topic,
|
||||
delete, edit, help.
|
||||
</li><li> Highly confiurable using a perlish configfile ~/.noterc.
|
||||
although it is configurable it is not required, note can
|
||||
run without a configfile using useful default presets.
|
||||
</li><li> Colourized output is supported using ASCII Escape-Sequences.
|
||||
</li><li> The user can customize the color for each item.
|
||||
</li><li> Data can be stored in various different database backends,
|
||||
since all database access is excluded from the program itself
|
||||
in perl modules.
|
||||
</li><li> Notes can be deleted, edited and you can search trough your notes.
|
||||
</li><li> Notes can be categorized. Each category(topic) can contain multiple
|
||||
notes and even more sup-topics. There is no limitation about
|
||||
sub topics.
|
||||
</li><li> You can view all notes in a list and it is possible only to view
|
||||
notes under a certain topic.
|
||||
</li><li> There is a tree-view, which allows you to get an overview of your
|
||||
topic-hierarchy.
|
||||
</li><li> Notes can be encrypted using DES or IDEA algorythms and Crypt::CBC.
|
||||
</li><li> You can dump the contents of your note database into a plain text
|
||||
file, which can later be imported. Imports can be appended or it can
|
||||
</li><li>verwrite an existing database (-o).
|
||||
</li><li> Note has scripting capabilities, you can create a new note by piping
|
||||
another commands output to note, you can also import a notedump from
|
||||
stdin as well es duming to stdout instead a file. Additional, there
|
||||
is an option --raw available, which prints everything out completely
|
||||
without formatting.
|
||||
</li><li> It can be installed without root-privileges.
|
||||
</li><li> Last, a while ago a user stated: "... it simply does, what it says ..."
|
||||
</li></ul>
|
||||
|
||||
<p>
|
||||
<I>note</I> is released under the terms of the <a href="license.html"><b>Gnu Public License(GPL)</b></a>
|
||||
and is therefore free Software.
|
||||
@@ -1,42 +0,0 @@
|
||||
<h2>installation of note</h2>
|
||||
<p>
|
||||
Unpack the tar-ball and issue the command:<br>
|
||||
$ perl Makefile.PL<br>
|
||||
It will ask you a few questions about file destinations.
|
||||
The script will find itself the proper destinations for
|
||||
the files. So, if you agree with it, simply press ENTER.
|
||||
However, you may decide to use other destinations. In this
|
||||
case, enter it, when asked. This maybe usefull, if you are
|
||||
installing it in your ome-directory and if you are not root!
|
||||
<p>
|
||||
For installation instructions for the mysql database installation
|
||||
see mysql/README.
|
||||
<p>
|
||||
If want to use another SQL database, i.e. postgresql then set
|
||||
the option "DbDriver" to the name of the responding DBI-driver
|
||||
and create a symlink of this name like this:
|
||||
<br> /usr/lib/perl5/siteperl/NOTEDB $ ln -s mysql.pm oracle.pm
|
||||
<br> The functionality is the same, but not the name!
|
||||
<p>
|
||||
The default binary file backend does not need any special installation
|
||||
procedure, you need only to spceify a filename in your config file.
|
||||
<p>
|
||||
The DBM backend(NOTEDB::dbm) requires the existence of a directory,
|
||||
which you must specify in your config using the option "DbName".
|
||||
<p>
|
||||
|
||||
|
||||
<b>Configuration</b>
|
||||
|
||||
This version of note doesn't neccessarily need
|
||||
a configuration file. But you can have one and change
|
||||
some default values. Take a look to the file config/noterc
|
||||
provided with this tarball. There are detailed instructions
|
||||
about every available parameter.
|
||||
<br> Simply copy this file into your home-directory and name it
|
||||
.noterc
|
||||
If you decide not to use the default database backend (a binary
|
||||
file), you will *need* a configuration!
|
||||
|
||||
|
||||
|
||||
@@ -1,342 +0,0 @@
|
||||
<pre>
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
</pre>
|
||||
@@ -1,19 +0,0 @@
|
||||
<img src="images/note.jpg" border=0>
|
||||
<HR SIZE="1" NOSHADE="1">
|
||||
<a href="index.html">home</a><p>
|
||||
<a href="installation.html">installation</a><p>
|
||||
<a href="usage.html">usage</a><p>
|
||||
<a href="upgrade.html">upgrade</a><p>
|
||||
<a href="changelog.html">changelog</a><p>
|
||||
<a href="download.html">download</a><p>
|
||||
<a href="license.html">license</a><p>
|
||||
<a href="cvs.html">cvs</a><p>
|
||||
<a href="screenshots.html">screenshots</a><p>
|
||||
<a href="deutsch.html">deutsch</a><p>
|
||||
<a href="about.html">about</a><p>
|
||||
<HR SIZE="1" NOSHADE="1">
|
||||
<center><font size=-2>last updated 02.07.2000</font>
|
||||
<p>
|
||||
<img src="images/anybrow.gif" alt="best viewed with any browser">
|
||||
</center>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<h2>screenshots</h2>
|
||||
|
||||
Yes there are also screenshots of note available :-)
|
||||
<br>
|
||||
Simply click on a tumbnail to enlarge the image!
|
||||
<p>
|
||||
<a href="images/note.gif">Linux</a>
|
||||
<br><a href="images/note-linux.gif"><img src="images/note_linux_small.png" border=0></a>
|
||||
<p>
|
||||
<a href="images/note-win32.gif">Win32</a>
|
||||
<br><a href="images/note-win32.gif"><img src="images/note_win32_small.png" border=0></a>
|
||||
<p>
|
||||
<a href="images/note-be.jpg">BeOS</a>
|
||||
<br><a href="images/note-be.jpg"><img src="images/note_be_small.png" border=0></a>
|
||||
<p>
|
||||
and finally here a <a href="http://home.debitel.net/user/hannes.lau/Desktop.htm">desktop</a> of a user with note running.
|
||||
@@ -1,45 +0,0 @@
|
||||
<h2>upgrade from previous version of note to 1.0.x</h2>
|
||||
<p>
|
||||
In any case: BACKUP your existing note database!!!!!!!
|
||||
The format has not changed, but some default values
|
||||
(see the new config file-sample). Use this command
|
||||
to save your note database with your *old* version
|
||||
of note:<br>
|
||||
"note -D"<br>
|
||||
This works with both the mysql and the binary version.
|
||||
<p>
|
||||
You need to reedit your configfile. Please refer to the
|
||||
sample config in config/noterc.
|
||||
<p>
|
||||
<hr>
|
||||
<p>
|
||||
This version of note has now encryption support build in.
|
||||
If you decide to use it, you need to re-initialize your
|
||||
note database. That's why, because your current database
|
||||
is unencrypted and *if* you want to secure your data, you
|
||||
need to secure everything. That means, your existing data
|
||||
must be encrypted before you can use this new capability!
|
||||
<p>
|
||||
Follow this steps:
|
||||
<ul>
|
||||
<li> backup existing db:
|
||||
<br> $ note -D
|
||||
<li> backup the db:
|
||||
<br> $ cp .notedb .notedb.save
|
||||
or (for mysql users!):
|
||||
<br> $ cp -r /usr/local/mysql/data/notedb ~/notedb.mysql.save
|
||||
<li> go into note and delete all existing notes:
|
||||
<br> $ note -d 1-20 (or however)
|
||||
<li> now upgrade your note installation:
|
||||
<br> $ perl Makefile.PL; make install
|
||||
<li> re-configure note. Turn $USE_CRYPT on by setting it
|
||||
to "YES".
|
||||
<li> re-initialize your database:
|
||||
<br> $ note -I note.dump.2323 (or whatever)<br>
|
||||
note will prompt you for a passphrase. It will be used
|
||||
by Crypt::CBC for encrypting your data.
|
||||
</ul>
|
||||
From now on, your data is encrypted. You will need the passphrase
|
||||
you set above for decrypting it! So - don't forget it!
|
||||
|
||||
|
||||
@@ -1,350 +0,0 @@
|
||||
<h2>usage of note</h2>
|
||||
<p>
|
||||
<a href="#desc">1. Description</a><p>
|
||||
<a href="#topics">2. Topics</a><p>
|
||||
<a href="#format">3. Formatting of note-text</a><p>
|
||||
<a href="#script">4. Scripting</a><p>
|
||||
<a href="#dbformat">5. Binary DB</a><p>
|
||||
<a href="#sqlformat">6. Mysql DB</a><p>
|
||||
<a href="#dumpformat">7. Dump Format</a><p>
|
||||
<a href="#security">8. Security</a><p>
|
||||
<hr>
|
||||
<p>
|
||||
<a name="#desc">
|
||||
<h4>Decription</h4>
|
||||
|
||||
If you don't know, how to run note, try "note -h" first.
|
||||
It will tell you all available commandline options.
|
||||
<p>
|
||||
To create a new note, simply run "note". You can enter
|
||||
the note (the length is by default limited to 4096 bytes,
|
||||
which you can change from your config file if you are using
|
||||
the binary backend, therwise there is no limitation).
|
||||
End by typing a . on a line itself. note will tell you the
|
||||
number of the note.
|
||||
<p>
|
||||
If you want to view the note, type "note 1", if the notenumber
|
||||
was 1.
|
||||
<p>
|
||||
If you want to get an overview of all notes, type "note -l".
|
||||
You will get a list of all notes, containing the number,
|
||||
the first line and the creation date. If topic-support is
|
||||
turned on (which is by default), then all subtopics under the
|
||||
current topic will be displayed first.
|
||||
<br> If you want to get a listing of all
|
||||
If you want to see the timestamps, use "-L" instead of "-l".
|
||||
Read more about topics below in the section "Topics".
|
||||
You can also specify the topic which notes you want to see:
|
||||
"-l mytopic" does the trick.
|
||||
<br> Additional, you might want to get an overview of your topic-
|
||||
strcture. You can use the command "-t" in this case, which
|
||||
will display a tree-view of your tpic-structure. You can
|
||||
use the command "-T" if you want to see the notes under each
|
||||
topic too. "-T" will also show the number of each note.
|
||||
<p>
|
||||
To edit a certain note, type "note -e 1". It will invoke your
|
||||
editor (vi or pico). You can edit it, after saving, note
|
||||
will store the changed note to the database.
|
||||
<p>
|
||||
Of course you can drop a certain note: "note -d 1" deletes
|
||||
note number 1. If a note in the middle or the beginning of
|
||||
the database will be deleted, note will recount the other
|
||||
existent notes. For example there are 3 notes, number 1, 2
|
||||
and 3. If you delete number 2, then number 3 will become
|
||||
number 2.
|
||||
<br> You can also make use of the extended delete-syntax:
|
||||
To delete note 1 and 2, use "-d 1,2"
|
||||
To delete note 1,2 and 3, use "-d 1-3".
|
||||
<p>
|
||||
If you cannot remember, which note you are looking for, you
|
||||
can use the search capability of note: "note -s <searchstring>".
|
||||
note will search the whole note database case insensitive for
|
||||
an occurence of this string and tell you the number and first-
|
||||
line it have.
|
||||
<p>
|
||||
Instead of using note from the commandline you can use the
|
||||
interactive mode. Run note with "note -i". If you need assistance
|
||||
type "?" or "h" at the ">" prompt. The interactive mode
|
||||
provides you the most functions of note.
|
||||
<p>
|
||||
You can also dump the contents of your note-database into a
|
||||
ASCII-textfile(-D). You can use this file later to import it into
|
||||
your note-database(-I). This is usefull, if you want quickly trans-
|
||||
fer your notes from one host to another (i.e. you could mail
|
||||
your note-dump form your office to home and import it there
|
||||
for further use).
|
||||
<br> The dumps from the two versions of note are in the same format.
|
||||
Using dumps it is also possible to reinitialize your database. You
|
||||
can use the "-o" switch whcih causes note to overwrite your existing
|
||||
database. This is very handy if you changed heavily your config. And
|
||||
it is required, if you changed: encryption, db-driver, (binary-format)
|
||||
and the password. You can use the following command for reinitializing:
|
||||
<br> $ note -D - | note -o -I -
|
||||
<br> What the hell, does it?! Step by step:
|
||||
<ul>
|
||||
<li> "note -D -" creates a note-database dump and prints it out
|
||||
to stantdard output.
|
||||
<li> "|" this is the shell's pipe command. It takes the output
|
||||
of the left program and gives it to the right program as standard
|
||||
input.
|
||||
<li> "note -o -I -" imports a note-database dump from standard input
|
||||
and overwrites an existing database.
|
||||
</ul>
|
||||
Before you use the "-o" switch, I consider yuo to make a backup!
|
||||
|
||||
<p>
|
||||
|
||||
<a href="#top">top</a><p><p><a name="topics">
|
||||
<h4>Topics</h4>
|
||||
|
||||
If topic-support is turned on (which is by default), the various
|
||||
notes are sorted under various topics. There is no special database
|
||||
field for the topic. Instead the topic will be stored right in the
|
||||
note.
|
||||
<br> If the first line of your note contains some text bordered by slashes
|
||||
(or whatever you prefer, set "TopicSeparator" in your config! default is slash),
|
||||
then note will consider it as the topic of this certain note. For examle:
|
||||
<br> /TodoList/
|
||||
<br> If you are using topics, no data after the topic is allowed, if there
|
||||
is any text, note will consider it as a subtopic! Therefore, don't for-
|
||||
get to put a newline after the topic-line.
|
||||
<p>
|
||||
If you are in interactive mode, you can "cd" to a different note simply
|
||||
by typing it's name at the command-prompt, or you can use the well-known
|
||||
syntax "cd topic".
|
||||
<br> The list-command will only show you notes under this topic. If you create
|
||||
a new note, it will automagically inserted under the current topic (note
|
||||
will prepend the string "/topicname/" to the text of your note).
|
||||
<p>
|
||||
You can create at any time from any point a new topic. Just create a new
|
||||
note and type the name of the new topic bordered by slashes (or TopicSeparator)
|
||||
at the first line of this note. After saving, there will be available a
|
||||
new topic with one note in it.
|
||||
<p>
|
||||
You can create as many subtopics as you like, the format is similar to a
|
||||
filesystem-path. An example, say, you want to create such a structure:
|
||||
<p>
|
||||
<pre>
|
||||
(root - top level)
|
||||
|
|
||||
|----test
|
||||
| |----subtopic
|
||||
| | |--note 1
|
||||
| | |--note 2
|
||||
| |
|
||||
| |--note 4
|
||||
|
|
||||
|--note 3
|
||||
</pre>
|
||||
<p>
|
||||
Then you may create those 4 new notes:
|
||||
<br>
|
||||
<pre>
|
||||
--- snip ---
|
||||
/test/subtopic/
|
||||
note 1
|
||||
--- snip ---
|
||||
/test/subtopic/
|
||||
note 2
|
||||
--- snip ---
|
||||
note 3
|
||||
--- snip ---
|
||||
/test/
|
||||
note 4
|
||||
--- snip ---
|
||||
</pre><br>
|
||||
I hope, you got the point ;-)
|
||||
<p>
|
||||
|
||||
|
||||
If a note does not contain the "magic" /topic/ construction on the first
|
||||
line, it will be listed under the "root" of note, that is the point you are
|
||||
at the startup of note.
|
||||
<p>
|
||||
You can subsequently move a note without a topic to a certain topic. Simply
|
||||
edit it and insert at the first line the above mentioned construction.
|
||||
<p>
|
||||
Note: Please don't forget the prepending and appending a slash of a topic.
|
||||
You will get strange results without it!
|
||||
|
||||
|
||||
<p>
|
||||
|
||||
<a href="#top">top</a><p><p><a name="format">
|
||||
<h4>Formatting of notes</h4>
|
||||
|
||||
Another very nice feature is the possibility to format the note-text (as much as
|
||||
shell allows it). First, you can use the note-internal "magic-strings" for color-
|
||||
izing. Those strings looks much like HTML:
|
||||
i<br> "<green>here is a green line of text</green> no more green."
|
||||
As you see, the beginning of another color starts with a tag(kinda) of the color
|
||||
<colorname> and ens with an end tag </colorname>.
|
||||
<p>
|
||||
The following colors are available:
|
||||
black, red, green, yellow, blue, magenta, cyan and white.
|
||||
<p>
|
||||
Beside colorizing text, you can also create bold or underlined text! If you decide
|
||||
to use this (additional) feature, you need to set the Config-Option "FormatNotes"
|
||||
to 1 which turns it on.
|
||||
<br> Usage is very straightforward, if a word (a word is defined as some text with at least
|
||||
one space surrounded) is between a magic mark-character. Here are the available
|
||||
things, you can do:
|
||||
<pre>
|
||||
bold: **word**
|
||||
underlined: __word__
|
||||
inverse: {{word}}
|
||||
</pre>
|
||||
The text will be formatted using the actually note-color.
|
||||
<p>
|
||||
|
||||
|
||||
<a href="#top">top</a><p><p><a name="script">
|
||||
<h4>Scripting</h4>
|
||||
|
||||
Since version 1.0.3 there are some additions which allows you to use note in
|
||||
scripts, without user-interaction. You might run a special script as cronjob,
|
||||
which adds a note under a certain topic every week. Or the like.
|
||||
<p>
|
||||
Here are the possibilies you have:
|
||||
<p>
|
||||
You can add a new note through a pipe, another commands output becomes
|
||||
note's input:
|
||||
<br> $ cat /var/spool/news/daily | note -
|
||||
<br> This command adds the content of a file "daily" as a new note. Note the dash.
|
||||
it stands for "Standard Input". Note will be completely silent and it will not
|
||||
ask for something.
|
||||
<p>
|
||||
Suppose you are using encryption. You might wonder, how note will get your
|
||||
passphrase? The solution: You need to set up an environment variable which
|
||||
contains the password:
|
||||
<br> $ export NOTE_PASSWD=secret
|
||||
<br> If the variable is present, note will not ask you for a passphrase!
|
||||
<p>
|
||||
Another thingy you might find useful is the -r (--raw) command-line flag. This
|
||||
turns note into raw mode , which means it will only print the
|
||||
data without any formatting. Raw mode is available for list and display,
|
||||
since it makes no sense, interactive mode doe not support raw mode.
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
<a href="#top">top</a><p><p><a name="dbformat">
|
||||
<h4>Format of the notedb (binary backend)</h4>
|
||||
|
||||
The database where the notes are stored is a binary fixed record length file
|
||||
of the following format:
|
||||
It consists of three fixed length fields per entry. The fields
|
||||
have the following types:
|
||||
<ul>
|
||||
<li> Number: Integer (1 byte)
|
||||
<li> Note: String (default 1024 bytes)
|
||||
<li> Time: String (default 64 bytes)
|
||||
</ul>
|
||||
You can change the sizes of the fields "Note" and "Time" in
|
||||
the configfile "~/.noterc". If it does not exist, the above
|
||||
defaults will be used.
|
||||
<br> If the data to be stored is smaller then the size of the field,
|
||||
it will be filled with ZERO's ("\0"). The Note and the Time
|
||||
fields will be uuencoded before storage. Of course, this is
|
||||
no security, never mind...
|
||||
|
||||
<p>
|
||||
|
||||
<a href="#top">top</a><p><p><a name="sqlformat">
|
||||
<h4>The note-database (mysql backend)</h4>
|
||||
|
||||
The sql-database for the mysql version has the following design:
|
||||
<pre>
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
| number | int(10) | | PRI | 0 | auto_increment |
|
||||
| note | text | YES | | NULL | |
|
||||
| date | text | YES | | NULL | |
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
||||
<a href="#top">top</a><p><p><a name="dumpformat">
|
||||
<h4>Format of the ASCII-dump file (note -D)</h4>
|
||||
|
||||
The dump of a note-database (if you use note -D) has the following
|
||||
format:
|
||||
<pre>
|
||||
--- snip ---
|
||||
Number: 1
|
||||
Timestamp: 14.01.2000 00:25:01
|
||||
This is a sample text
|
||||
in a sample note.
|
||||
|
||||
Number: 2
|
||||
Timestamp: 14.01.2000 02:37:40
|
||||
And this is another sample
|
||||
of a note.
|
||||
--- snip ---
|
||||
</pre>
|
||||
<p> You can reimport a dump into your note-database with "note -I <file>"
|
||||
Existing notes will not overwritten, note will append the imported
|
||||
data to your note-database.
|
||||
<p>
|
||||
|
||||
|
||||
<a href="#top">top</a><p><p><a name="security">
|
||||
<h4>Security</h4>
|
||||
|
||||
If you are using the MySQL driver, refer to the mysql
|
||||
manual for more informations about security of mysql databases:
|
||||
http://www.mysql.org/Manual_chapter/manual_Privilege_system.html
|
||||
<p>
|
||||
If you are using notes proprietary binary driver, then
|
||||
the permission 0600 of the file "~/.notedb" is strongly required!
|
||||
<p>
|
||||
Additional, you can turn on encryption from the config file.
|
||||
Simply set UseEncryption to 1. Please note, that you need
|
||||
to decide, if you want to use encryption before the first use
|
||||
of note! If have already a note database and want to "migrate"
|
||||
to encryption, I suggest you to follow the directions in the
|
||||
file UPGRADE!
|
||||
<p>
|
||||
You can choose from different encryption algorythms. The default
|
||||
is IDEA, but DES or BLOWFISH is also possible. You need to have
|
||||
installed the following additional perl-modules on your system:
|
||||
<ul>
|
||||
<li> MD5
|
||||
<li> Crypt::IDEA
|
||||
<li> Crypt::DES
|
||||
<li> Crypt::CBC
|
||||
</ul>
|
||||
After turning on encryption, note will ask you for a passphrase
|
||||
everytime it runs! It will *not* store this passphrase!
|
||||
So, don't forget it! Be careful!
|
||||
<p>
|
||||
Once note have encrypted some data using this passphrase, you
|
||||
cannot simply switch to another passphrase, because all data
|
||||
within the database needs to be encrypted using the same passphrase!
|
||||
If you want to change the passphrase for any reason, please read
|
||||
the file UPGRADE and follow it's directions!
|
||||
<br> Someday I will add a "change passwd" function, which will do all
|
||||
these things for you. Someday, I said...
|
||||
For now you can use the "re-initialze database" functionality, mentioned
|
||||
earlier in the "Usage" section (at the end of the section).
|
||||
<p>
|
||||
Note: To make sure, the encrypted data can be stored properly,
|
||||
it will be uuencoded after encryption.
|
||||
<p>
|
||||
Note: *If* you forgot your passphrase and *if* you don't have
|
||||
a backup of your database without encryption, PLEASE
|
||||
don't bother me with "helpme" emails! If you don't know
|
||||
the phrase, then the data can't be decrypted. Even if it
|
||||
is possible - I am not responsible for that!
|
||||
<p>
|
||||
Note: How does note know, if the passphrase was incorrect? It uses the
|
||||
specified phrase and encodes at least one note (the first one)
|
||||
and checks if the decrypted timestamp field matches the following
|
||||
expression: "^\d+\.\d+". Translated from perl to human:
|
||||
the timestamp must begin with minimum one digit (possibly more),
|
||||
followed by one dot, followed by minimum one digit (possibly more).
|
||||
Chances are bad, that a wrong passphrase will cause a timestamp
|
||||
matching the rule above. If you have other experiences, please
|
||||
drop me a mail!
|
||||
@@ -1 +0,0 @@
|
||||
1.0.8
|
||||
@@ -1,14 +0,0 @@
|
||||
/anybrow.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/button.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/gproc.jpg/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/linux.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/msfree.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/note-be.jpg/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/note-linux.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/note-win32.gif/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/note.jpg/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/note_be_small.png/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/note_linux_small.png/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/note_win32_small.png/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
/notes.png/1.1.1.1/Sat Jul 1 14:40:51 2000//
|
||||
D
|
||||
@@ -1 +0,0 @@
|
||||
NOTE/0x49/images
|
||||
@@ -1 +0,0 @@
|
||||
zarahg@cvs.htnews.sourceforge.net:/cvsroot/htnews
|
||||
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 948 B |
|
Before Width: | Height: | Size: 71 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 222 KiB |
|
Before Width: | Height: | Size: 7.2 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 23 KiB |
|
Before Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 760 B |
@@ -1,86 +0,0 @@
|
||||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<?
|
||||
# ePerl
|
||||
my $me = $0;
|
||||
$me =~ s(^.*/)();
|
||||
my $src = $me;
|
||||
$src =~ s/\.html$//;
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="description" content="www.0x49.org - the home of the console note program">
|
||||
<meta name="keywords" content="note, notes, notizen, console, perl, textmode, opensource, free">
|
||||
<meta name="author" content="Thomas Linden">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>www.0x49.org - the note homepage (<? print $src ?>)</title>
|
||||
<!--
|
||||
THE CONTENTS OF THESE WEBPAGES ARE PROTECTED BY COPYRIGHT LAW!
|
||||
|
||||
COPYRIGHT (C) 2000 THOMAS LINDEN, MUNICH.
|
||||
ALL RIGHTS RESERVED.
|
||||
-->
|
||||
</head>
|
||||
<body link="#000099" vlink="#000099">
|
||||
<br>
|
||||
<TABLE cellspacing="0" cellpadding="0" width="100%" border="0" bgcolor="cornflowerblue">
|
||||
<TR>
|
||||
<TD>
|
||||
<TABLE cellspacing="2" cellpadding="2" width="100%" border="0" bgcolor="#FFFFFF">
|
||||
<TR BGCOLOR="cornflowerblue" align="center">
|
||||
<TD colspan=2 align=right>
|
||||
<SPAN class=titlebar><font face="helvetica" color="#fffff"><b>note
|
||||
<?
|
||||
# ePerl
|
||||
open VERSION, "contents/version" || die $!;
|
||||
my $version = <VERSION>;
|
||||
close VERSION;
|
||||
chomp $version;
|
||||
print $version;
|
||||
?>
|
||||
homepage</b></font></SPAN>
|
||||
</TD>
|
||||
</TR>
|
||||
<TR align=left>
|
||||
<TD width=15% bgcolor="beige" valign="top">
|
||||
<font face="helvetica" >
|
||||
<?
|
||||
# ePerl
|
||||
open MENU, "contents/menu" || die $!;
|
||||
my @menu = <MENU>;
|
||||
close MENU;
|
||||
foreach (@menu) {
|
||||
if(/\Q$me\E/) {
|
||||
print "<b>$_</b>";
|
||||
}
|
||||
else {
|
||||
print;
|
||||
}
|
||||
}
|
||||
?>
|
||||
</font>
|
||||
<p> </p>
|
||||
</TD>
|
||||
<TD valign="top">
|
||||
<TABLE WIDTH="90%" ALIGN="CENTER" VALIGN="TOP">
|
||||
<TR>
|
||||
<TD>
|
||||
<?
|
||||
# ePerl
|
||||
$src = "contents/$src";
|
||||
open SRC, "$src" || die $!;
|
||||
my @lines = <SRC>;
|
||||
print @lines;
|
||||
close SRC;
|
||||
?>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
</TD>
|
||||
</TR>
|
||||
</TABLE>
|
||||
<P>
|
||||
</body>
|
||||
</html>
|
||||
11
CVS/Entries
@@ -1,12 +1,15 @@
|
||||
/Makefile.PL/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/Makefile.PL/1.2/Thu Aug 10 09:21:56 2000//
|
||||
/UPGRADE/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/note/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
/note.1/1.1/Thu Aug 10 09:23:02 2000//
|
||||
/note.pod/1.1/Thu Aug 10 09:23:02 2000//
|
||||
/stresstest.sh/1.1.1.1/Sat Jul 1 14:40:50 2000//
|
||||
D/0x49////
|
||||
D/NOTEDB////
|
||||
D/bin////
|
||||
D/config////
|
||||
D/mysql////
|
||||
/Changelog/1.2/Sun Jul 9 22:08:40 2000//
|
||||
/VERSION/1.2/Sun Jul 9 22:10:55 2000//
|
||||
/README/1.2/Sun Jul 9 22:37:00 2000//
|
||||
/Changelog/1.4/Fri Aug 11 00:03:46 2000//
|
||||
/NOTEDB.pm/1.2/Fri Aug 11 00:05:58 2000//
|
||||
/README/1.4/Fri Aug 11 00:03:51 2000//
|
||||
/VERSION/1.3/Fri Aug 11 00:03:51 2000//
|
||||
|
||||
@@ -29,6 +29,9 @@ CHANGED: use "unshift" instead of push to add $libpath to @INC.
|
||||
ADDED: a new feature, Caching of notes. supported by binary.pm and
|
||||
mysql.pm. To turn it on, one need to set "Cache" in the config
|
||||
to a true value.
|
||||
CHANGED: oop-ized and re-indented the modules dbm.pm, mysql.pm and
|
||||
binary.pm.
|
||||
ADDED: You can now specify a port for the mysql backend ("DbPort").
|
||||
|
||||
================================================================================
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# NOTEDB::mysql and NOTEDB::binary are internals
|
||||
# of note.
|
||||
#
|
||||
# $Id: Makefile.PL,v 1.1.1.1 2000/07/01 14:40:50 zarahg Exp $
|
||||
# $Id: Makefile.PL,v 1.2 2000/08/10 09:21:56 zarahg Exp $
|
||||
#
|
||||
# check for the existence of optional modules:
|
||||
sub chk_mod
|
||||
|
||||
95
NOTEDB.pm
@@ -2,7 +2,7 @@
|
||||
# this is a generic module, used by note database
|
||||
# backend modules.
|
||||
#
|
||||
# $Id$
|
||||
# $Id: NOTEDB.pm,v 1.2 2000/08/11 00:05:58 zarahg Exp $
|
||||
#
|
||||
# Copyright (c) 2000 Thomas Linden <tom@daemon.de>
|
||||
|
||||
@@ -10,36 +10,40 @@
|
||||
package NOTEDB;
|
||||
|
||||
BEGIN {
|
||||
# make sure, it works, otherwise encryption
|
||||
# is not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
# make sure, it works, otherwise encryption
|
||||
# is not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub no_crypt {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
|
||||
|
||||
sub use_crypt {
|
||||
my($this,$key,$method) = @_;
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
my($this,$key,$method) = @_;
|
||||
my($cipher);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
else {
|
||||
$this->{cipher} = $cipher;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -150,7 +154,10 @@ sub generate_search {
|
||||
|
||||
$string =~ s/\/\s*(?!and|or)/\//g;
|
||||
|
||||
#my $res = qq(\$match = 1 if($string););
|
||||
return qq(\$match = 1 if($string););
|
||||
#print $res . "\n";
|
||||
#return $res;
|
||||
}
|
||||
|
||||
sub check_or {
|
||||
@@ -179,25 +186,49 @@ sub check_exact {
|
||||
#
|
||||
my($this, $str) = @_;
|
||||
|
||||
my %globs = (
|
||||
'*' => '.*',
|
||||
'?' => '.',
|
||||
'[' => '[',
|
||||
']' => ']',
|
||||
'+' => '\+',
|
||||
'.' => '\.',
|
||||
'$' => '\$',
|
||||
'@' => '\@',
|
||||
my %wildcards = (
|
||||
'*' => '.*',
|
||||
'?' => '.',
|
||||
'[' => '[',
|
||||
']' => ']',
|
||||
'+' => '\+',
|
||||
'.' => '\.',
|
||||
'$' => '\$',
|
||||
'@' => '\@',
|
||||
'/' => '\/',
|
||||
'|' => '\|',
|
||||
'}' => '\}',
|
||||
'{' => '\{',
|
||||
);
|
||||
|
||||
my %escapes = (
|
||||
'*' => '\*',
|
||||
'?' => '\?',
|
||||
'[' => '[',
|
||||
']' => ']',
|
||||
'+' => '\+',
|
||||
'.' => '\.',
|
||||
'$' => '\$',
|
||||
'@' => '\@',
|
||||
'(' => '\(',
|
||||
')' => '\)',
|
||||
'/' => '\/',
|
||||
'|' => '\|',
|
||||
'}' => '\}',
|
||||
'{' => '\{',
|
||||
);
|
||||
|
||||
# mask backslash
|
||||
$str =~ s/\\/\\\\/g;
|
||||
|
||||
|
||||
if ($str =~ /^"/ && $str =~ /"$/) {
|
||||
# mask bracket-constructs
|
||||
$str =~ s/(\(|\))/\\$1/g;
|
||||
$str =~ s/(.)/$escapes{$1} || "$1"/ge;
|
||||
}
|
||||
else {
|
||||
$str =~ s/(.)/$wildcards{$1} || "$1"/ge;
|
||||
}
|
||||
$str =~ s/(.)/$globs{$1} || "$1"/ge;
|
||||
|
||||
$str =~ s/^"//;
|
||||
$str =~ s/"$//;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/README/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/binary.pm/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/dbm.pm/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/mysql.pm/1.1.1.1/Sat Jul 1 14:40:52 2000//
|
||||
/binary.pm/1.3/Fri Aug 11 00:05:58 2000//
|
||||
/dbm.pm/1.3/Fri Aug 11 00:05:58 2000//
|
||||
/mysql.pm/1.3/Fri Aug 11 00:05:58 2000//
|
||||
D
|
||||
|
||||
417
NOTEDB/binary.pm
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: binary.pm,v 1.1.1.1 2000/07/01 14:40:52 zarahg Exp $
|
||||
# $Id: binary.pm,v 1.3 2000/08/11 00:05:58 zarahg Exp $
|
||||
# Perl module for note
|
||||
# binary database backend. see docu: perldoc NOTEDB::binary
|
||||
#
|
||||
@@ -14,185 +14,179 @@ use NOTEDB;
|
||||
use Fcntl qw(LOCK_EX LOCK_UN);
|
||||
|
||||
|
||||
# Globals:
|
||||
my ($NOTEDB, $sizeof, $typedef,$version);
|
||||
my ($cipher);
|
||||
|
||||
$version = "(NOTEDB::binary, 1.6)";
|
||||
|
||||
|
||||
sub new
|
||||
{
|
||||
my($this, $dbdriver, $dbname, $MAX_NOTE, $MAX_TIME) = @_;
|
||||
my($this, $dbdriver, $dbname, $MAX_NOTE, $MAX_TIME) = @_;
|
||||
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
$NOTEDB = $dbname;
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
|
||||
if(! -e $NOTEDB)
|
||||
{
|
||||
open(TT,">$NOTEDB") or die "Could not create $NOTEDB: $!\n";
|
||||
close (TT);
|
||||
}
|
||||
elsif(! -w $NOTEDB)
|
||||
{
|
||||
print "$NOTEDB is not writable!\n";
|
||||
exit(1);
|
||||
}
|
||||
if(! -e $dbname) {
|
||||
open(TT,">$dbname") or die "Could not create $dbname: $!\n";
|
||||
close (TT);
|
||||
}
|
||||
elsif(! -w $dbname) {
|
||||
print "$dbname is not writable!\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
my $TYPEDEF = "i a$MAX_NOTE a$MAX_TIME";
|
||||
my $SIZEOF = length pack($TYPEDEF, () );
|
||||
$self->{version} = "(NOTEDB::binary, 1.7)";
|
||||
$self->{NOTEDB} = $dbname;
|
||||
my $TYPEDEF = "i a$MAX_NOTE a$MAX_TIME";
|
||||
my $SIZEOF = length pack($TYPEDEF, () );
|
||||
|
||||
$sizeof = $SIZEOF;
|
||||
$typedef = $TYPEDEF;
|
||||
$self->{sizeof} = $SIZEOF;
|
||||
$self->{typedef} = $TYPEDEF;
|
||||
|
||||
return $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
# clean the desk!
|
||||
}
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
my $this = shift;
|
||||
return $this->{version};
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
unlink $NOTEDB;
|
||||
open(TT,">$NOTEDB") or die "Could not create $NOTEDB: $!\n";
|
||||
close (TT);
|
||||
my $this = shift;
|
||||
unlink $this->{NOTEDB};
|
||||
open(TT,">$this->{NOTEDB}") or die "Could not create $this->{NOTEDB}: $!\n";
|
||||
close (TT);
|
||||
}
|
||||
|
||||
|
||||
sub get_single {
|
||||
my($this, $num) = @_;
|
||||
my($address, $note, $date, $buffer, $n, $t, $buffer, );
|
||||
my($this, $num) = @_;
|
||||
my($address, $note, $date, $buffer, $n, $t, $buffer, );
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
$address = ($num-1) * $sizeof;
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
read(NOTE, $buffer, $sizeof);
|
||||
($num, $n, $t) = unpack($typedef, $buffer);
|
||||
$address = ($num-1) * $this->{sizeof};
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
read(NOTE, $buffer, $this->{sizeof});
|
||||
($num, $n, $t) = unpack($this->{typedef}, $buffer);
|
||||
|
||||
$note = ude($n);
|
||||
$date = ude($t);
|
||||
$note = $this->ude($n);
|
||||
$date = $this->ude($t);
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return $note, $date;
|
||||
return $note, $date;
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my $this = shift;
|
||||
my($num, $note, $date, %res);
|
||||
my $this = shift;
|
||||
my($num, $note, $date, %res);
|
||||
|
||||
if ($this->unchanged) {
|
||||
return %{$this->{cache}};
|
||||
}
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
my($buffer, $t, $n);
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof)) {
|
||||
($num, $note, $date) = unpack($typedef, $buffer);
|
||||
$t = ude($date);
|
||||
$n = ude($note);
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
if ($this->unchanged) {
|
||||
return %{$this->{cache}};
|
||||
}
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
my($buffer, $t, $n);
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $this->{sizeof})) {
|
||||
($num, $note, $date) = unpack($this->{typedef}, $buffer);
|
||||
$t = $this->ude($date);
|
||||
$n = $this->ude($note);
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
$this->cache(%res);
|
||||
return %res;
|
||||
$this->cache(%res);
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my $this = shift;
|
||||
my($num, $te, $me, $buffer);
|
||||
my $this = shift;
|
||||
my($num, $te, $me, $buffer);
|
||||
|
||||
if ($this->unchanged) {
|
||||
$num = 1;
|
||||
foreach (keys %{$this->{cache}}) {
|
||||
$num++;
|
||||
}
|
||||
return $num;
|
||||
if ($this->unchanged) {
|
||||
$num = 1;
|
||||
foreach (keys %{$this->{cache}}) {
|
||||
$num++;
|
||||
}
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof)) {
|
||||
($num, $te, $me) = unpack($typedef, $buffer);
|
||||
}
|
||||
$num += 1;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return $num;
|
||||
}
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $this->{sizeof})) {
|
||||
($num, $te, $me) = unpack($this->{typedef}, $buffer);
|
||||
}
|
||||
$num += 1;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($buffer, $num, $note, $date, %res, $t, $n, $match);
|
||||
my($this, $searchstring) = @_;
|
||||
my($buffer, $num, $note, $date, %res, $t, $n, $match);
|
||||
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
|
||||
if ($this->unchanged) {
|
||||
foreach my $num (keys %{$this->{cache}}) {
|
||||
$_ = $this->{cache}{$num}->{note};
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
$res{$num}->{note} = $this->{cache}{$num}->{note};
|
||||
$res{$num}->{date} = $this->{cache}{$num}->{date}
|
||||
}
|
||||
$match = 0;
|
||||
if ($this->unchanged) {
|
||||
foreach my $num (keys %{$this->{cache}}) {
|
||||
$_ = $this->{cache}{$num}->{note};
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
$res{$num}->{note} = $this->{cache}{$num}->{note};
|
||||
$res{$num}->{date} = $this->{cache}{$num}->{date}
|
||||
}
|
||||
return %res;
|
||||
$match = 0;
|
||||
}
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof))
|
||||
{
|
||||
($num, $note, $date) = unpack($typedef, $buffer);
|
||||
$n = ude($note);
|
||||
$t = ude($date);
|
||||
$_ = $n;
|
||||
eval $regex;
|
||||
if($match)
|
||||
{
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return %res;
|
||||
}
|
||||
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $this->{sizeof})) {
|
||||
($num, $note, $date) = unpack($this->{typedef}, $buffer);
|
||||
$n = $this->ude($note);
|
||||
$t = $this->ude($date);
|
||||
$_ = $n;
|
||||
eval $regex;
|
||||
if($match)
|
||||
{
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
@@ -200,132 +194,135 @@ sub get_search
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
my $address = ($num -1 ) * $sizeof;
|
||||
my($this, $num, $note, $date) = @_;
|
||||
my $address = ($num -1 ) * $this->{sizeof};
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
my $n = uen($note);
|
||||
my $t = uen($date);
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
my $n = $this->uen($note);
|
||||
my $t = $this->uen($date);
|
||||
|
||||
my $buffer = pack($typedef, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
my $buffer = pack($this->{typedef}, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
$this->changed;
|
||||
$this->changed;
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
my($this, $num, $note, $date) = @_;
|
||||
open NOTE, "+<$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END); # APPEND
|
||||
my $n = uen($note);
|
||||
my $t = uen($date);
|
||||
my $buffer = pack($typedef, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END); # APPEND
|
||||
my $n = $this->uen($note);
|
||||
my $t = $this->uen($date);
|
||||
my $buffer = pack($this->{typedef}, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
$this->changed;
|
||||
$this->changed;
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
my($this, $num) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
|
||||
$setnum = 1;
|
||||
$setnum = 1;
|
||||
|
||||
%orig = $this->get_all();
|
||||
return "ERROR" if (! exists $orig{$num});
|
||||
%orig = $this->get_all();
|
||||
return "ERROR" if (! exists $orig{$num});
|
||||
|
||||
delete $orig{$num};
|
||||
delete $orig{$num};
|
||||
|
||||
# overwrite, but keep number!
|
||||
open NOTE, ">$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
foreach $N (keys %orig) {
|
||||
$n = uen($orig{$N}->{'note'});
|
||||
$t = uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $typedef, $N, $n, $t); # keep orig number, note have to call recount!
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
# overwrite, but keep number!
|
||||
open NOTE, ">$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
foreach $N (keys %orig) {
|
||||
$n = $this->uen($orig{$N}->{'note'});
|
||||
$t = $this->uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $this->{typedef}, $N, $n, $t);
|
||||
# keep orig number, note have to call recount!
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
$this->changed;
|
||||
$this->changed;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
sub set_recountnums
|
||||
{
|
||||
my($this) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
my($this) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
|
||||
$setnum = 1;
|
||||
%orig = $this->get_all();
|
||||
$setnum = 1;
|
||||
%orig = $this->get_all();
|
||||
|
||||
open NOTE, ">$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
open NOTE, ">$this->{NOTEDB}" or die "could not open $this->{NOTEDB}\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
|
||||
foreach $N (sort {$a <=> $b} keys %orig) {
|
||||
$n = uen($orig{$N}->{'note'});
|
||||
$t = uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $typedef, $setnum, $n, $t);
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
foreach $N (sort {$a <=> $b} keys %orig) {
|
||||
$n = $this->uen($orig{$N}->{'note'});
|
||||
$t = $this->uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $this->{typedef}, $setnum, $n, $t);
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
$this->changed;
|
||||
$this->changed;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = pack("u", $_[0]);
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $this->{cipher}->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = pack("u", $_[0]);
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = unpack("u", $_[0]);
|
||||
}
|
||||
return $T;
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $this->{cipher}->decrypt(unpack("u",$_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = unpack("u", $_[0]);
|
||||
}
|
||||
return $T;
|
||||
}
|
||||
|
||||
|
||||
|
||||
197
NOTEDB/dbm.pm
@@ -1,180 +1,187 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: dbm.pm,v 1.1.1.1 2000/07/01 14:40:52 zarahg Exp $
|
||||
# $Id: dbm.pm,v 1.3 2000/08/11 00:05:58 zarahg Exp $
|
||||
# Perl module for note
|
||||
# DBM database backend. see docu: perldoc NOTEDB::dbm
|
||||
#
|
||||
|
||||
package NOTEDB;
|
||||
|
||||
use DB_File;
|
||||
#use Data::Dumper;
|
||||
use Data::Dumper;
|
||||
use NOTEDB;
|
||||
use strict;
|
||||
package NOTEDB;
|
||||
|
||||
|
||||
|
||||
# Globals:
|
||||
my ($dbm_dir, $notefile, $timefile, $version, $cipher, %note, %date);
|
||||
$notefile = "note.dbm";
|
||||
$timefile = "date.dbm";
|
||||
my (%note, %date);
|
||||
|
||||
$version = "(NOTEDB::dbm, 1.1)";
|
||||
|
||||
sub new
|
||||
{
|
||||
my($this, $dbdriver, $dbm_dir) = @_;
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
my($this, $dbdriver, $dbm_dir) = @_;
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
|
||||
tie %note, "DB_File", "$dbm_dir/$notefile" || die $!;
|
||||
tie %date, "DB_File", "$dbm_dir/$timefile" || die $!;
|
||||
my $notefile = "note.dbm";
|
||||
my $timefile = "date.dbm";
|
||||
$self->{version} = "(NOTEDB::dbm, 1.2)";
|
||||
|
||||
return $self;
|
||||
tie %note, "DB_File", "$dbm_dir/$notefile" || die $!;
|
||||
tie %date, "DB_File", "$dbm_dir/$timefile" || die $!;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
untie %note, %date;
|
||||
# clean the desk!
|
||||
untie %note, %date;
|
||||
}
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
my $this = shift;
|
||||
return $this->{version};
|
||||
}
|
||||
|
||||
|
||||
sub get_single
|
||||
sub get_single
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date);
|
||||
return ude ($note{$num}), ude($date{$num});
|
||||
my($this, $num) = @_;
|
||||
my($note, $date);
|
||||
return $this->ude ($note{$num}), $this->ude($date{$num});
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my($this, $num, $note, $date, %res, $real);
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
$res{$num}->{'note'} = ude($note{$num});
|
||||
$res{$num}->{'date'} = ude($date{$num});
|
||||
}
|
||||
return %res;
|
||||
my $this = shift;
|
||||
my($num, $note, $date, %res, $real);
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
$res{$num}->{'note'} = $this->ude($note{$num});
|
||||
$res{$num}->{'date'} = $this->ude($date{$num});
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my($this, $num);
|
||||
foreach (sort {$a <=> $b} keys %date) {
|
||||
$num = $_;
|
||||
}
|
||||
$num++;
|
||||
return $num;
|
||||
my($this, $num);
|
||||
foreach (sort {$a <=> $b} keys %date) {
|
||||
$num = $_;
|
||||
}
|
||||
$num++;
|
||||
return $num;
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res, $match);
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res, $match);
|
||||
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
$_ = $this->ude($note{$num});
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
if ($match) {
|
||||
$res{$num}->{'note'} = $this->ude($note{$num});
|
||||
$res{$num}->{'date'} = $this->ude($date{$num});
|
||||
}
|
||||
$match = 0;
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
$_ = ude($note{$num});
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
$res{$num}->{'note'} = ude($note{$num});
|
||||
$res{$num}->{'date'} = ude($date{$num});
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return %res;
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub set_recountnums
|
||||
{
|
||||
my $this = shift;
|
||||
my(%Note, %Date, $num, $setnum);
|
||||
$setnum = 1;
|
||||
foreach $num (sort {$a <=> $b} keys %note) {
|
||||
$Note{$setnum} = $note{$num};
|
||||
$Date{$setnum} = $date{$num};
|
||||
$setnum++;
|
||||
}
|
||||
%note = %Note;
|
||||
%date = %Date;
|
||||
my $this = shift;
|
||||
my(%Note, %Date, $num, $setnum);
|
||||
$setnum = 1;
|
||||
foreach $num (sort {$a <=> $b} keys %note) {
|
||||
$Note{$setnum} = $note{$num};
|
||||
$Date{$setnum} = $date{$num};
|
||||
$setnum++;
|
||||
}
|
||||
%note = %Note;
|
||||
%date = %Date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$note{$num} = uen($note);
|
||||
$date{$num} = uen($date);
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$note{$num} = $this->uen($note);
|
||||
$date{$num} = $this->uen($date);
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$this->set_edit($num, $note, $date); # just the same thing
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$this->set_edit($num, $note, $date); # just the same thing
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
($note, $date) = $this->get_single($num);
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
delete $note{$num};
|
||||
delete $date{$num};
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
($note, $date) = $this->get_single($num);
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
delete $note{$num};
|
||||
delete $date{$num};
|
||||
}
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
my($this) = @_;
|
||||
%note = ();
|
||||
%date = ();
|
||||
return;
|
||||
my($this) = @_;
|
||||
%note = ();
|
||||
%date = ();
|
||||
return;
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $this->{cipher}->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $this->{cipher}->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
381
NOTEDB/mysql.pm
@@ -1,174 +1,192 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: mysql.pm,v 1.1.1.1 2000/07/01 14:40:52 zarahg Exp $
|
||||
# $Id: mysql.pm,v 1.3 2000/08/11 00:05:58 zarahg Exp $
|
||||
# Perl module for note
|
||||
# mysql database backend. see docu: perldoc NOTEDB::binary
|
||||
# mysql database backend. see docu: perldoc NOTEDB::mysql
|
||||
#
|
||||
|
||||
|
||||
package NOTEDB;
|
||||
|
||||
|
||||
use DBI;
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use NOTEDB;
|
||||
|
||||
package NOTEDB;
|
||||
|
||||
# Globals:
|
||||
my ($DB, $table, $fnum, $fnote, $fdate, $version, $cipher);
|
||||
$table = "note";
|
||||
$fnum = "number";
|
||||
$fnote = "note";
|
||||
$fdate = "date";
|
||||
$version = "(NOTEDB::mysql, 1.4)";
|
||||
|
||||
# prepare some std statements... #####################################################################
|
||||
my $sql_getsingle = "SELECT $fnote,$fdate FROM $table WHERE $fnum = ?";
|
||||
my $sql_all = "SELECT $fnum,$fnote,$fdate FROM $table";
|
||||
my $sql_nextnum = "SELECT max($fnum) FROM $table";
|
||||
my $sql_incrnum = "SELECT $fnum FROM $table ORDER BY $fnum";
|
||||
|
||||
my $sql_setnum = "UPDATE $table SET $fnum = ? WHERE $fnum = ?";
|
||||
my $sql_edit = "UPDATE $table SET $fnote = ?, $fdate = ? WHERE $fnum = ?";
|
||||
|
||||
my $sql_insertnew = "INSERT INTO $table VALUES (?, ?, ?)";
|
||||
|
||||
my $sql_del = "DELETE FROM $table WHERE $fnum = ?";
|
||||
my $sql_del_all = "DELETE FROM $table";
|
||||
######################################################################################################
|
||||
|
||||
sub new
|
||||
{
|
||||
# no prototype, because of the bin-version, which takes only a filename!
|
||||
my($this, $dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd) = @_;
|
||||
# no prototype, because of the bin-version, which takes only a filename!
|
||||
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
my $database = "DBI:$dbdriver:$dbname;host=$dbhost";
|
||||
my($this, $dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd,
|
||||
$table, $fnum, $fnote, $fdate, $dbport) = @_;
|
||||
|
||||
$DB = DBI->connect($database, $dbuser, $dbpasswd) || die DBI->errstr();
|
||||
return $self;
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
|
||||
my $database;
|
||||
if ($dbport) {
|
||||
$database = "DBI:$dbdriver:$dbname;host=$dbhost:$dbport";
|
||||
}
|
||||
else {
|
||||
$database = "DBI:$dbdriver:$dbname;host=$dbhost";
|
||||
}
|
||||
|
||||
$self->{version} = "(NOTEDB::mysql, 1.5)";
|
||||
$self->{table} = $table;
|
||||
|
||||
$self->{sql_getsingle} = "SELECT $fnote,$fdate FROM $self->{table} WHERE $fnum = ?";
|
||||
$self->{sql_all} = "SELECT $fnum,$fnote,$fdate FROM $self->{table}";
|
||||
$self->{sql_nextnum} = "SELECT max($fnum) FROM $self->{table}";
|
||||
$self->{sql_incrnum} = "SELECT $fnum FROM $self->{table} ORDER BY $fnum";
|
||||
$self->{sql_setnum} = "UPDATE $self->{table} SET $fnum = ? WHERE $fnum = ?";
|
||||
$self->{sql_edit} = "UPDATE $self->{table} SET $fnote = ?,$fdate = ? WHERE $fnum = ?";
|
||||
$self->{sql_insertnew} = "INSERT INTO $self->{table} VALUES (?, ?, ?)";
|
||||
$self->{sql_del} = "DELETE FROM $self->{table} WHERE $fnum = ?";
|
||||
$self->{sql_del_all} = "DELETE FROM $self->{table}";
|
||||
|
||||
$self->{DB} = DBI->connect($database, $dbuser, $dbpasswd) or die DBI->errstr();
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
# clean the desk!
|
||||
my $this = shift;
|
||||
$this->{DB}->disconnect;
|
||||
}
|
||||
|
||||
|
||||
sub lock {
|
||||
my($this) = @_;
|
||||
# LOCK the database!
|
||||
my $lock = $DB->prepare("LOCK TABLES $table WRITE") || die $DB->errstr();
|
||||
$lock->execute() || die $DB->errstr();
|
||||
my($this) = @_;
|
||||
# LOCK the database!
|
||||
my $lock = $this->{DB}->prepare("LOCK TABLES $this->{table} WRITE")
|
||||
|| die $this->{DB}->errstr();
|
||||
$lock->execute() || die $this->{DB}->errstr();
|
||||
}
|
||||
|
||||
|
||||
sub unlock {
|
||||
my($this) = @_;
|
||||
my $unlock = $DB->prepare("UNLOCK TABLES") || die $DB->errstr;
|
||||
$unlock->execute() || die $DB->errstr();
|
||||
$DB->disconnect || die $DB->errstr;
|
||||
my($this) = @_;
|
||||
my $unlock = $this->{DB}->prepare("UNLOCK TABLES") || die $this->{DB}->errstr;
|
||||
$unlock->execute() || die $this->{DB}->errstr();
|
||||
}
|
||||
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
my $this = shift;
|
||||
return $this->{version};
|
||||
}
|
||||
|
||||
|
||||
sub get_single {
|
||||
my($this, $num) = @_;
|
||||
my($this, $num) = @_;
|
||||
|
||||
my($note, $date);
|
||||
my $statement = $DB->prepare($sql_getsingle) || die $DB->errstr();
|
||||
my($note, $date);
|
||||
my $statement = $this->{DB}->prepare($this->{sql_getsingle}) || die $this->{DB}->errstr();
|
||||
|
||||
$statement->execute($num) || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($note, $date)) || die $DB->errstr();
|
||||
$statement->execute($num) || die $this->{DB}->errstr();
|
||||
$statement->bind_columns(undef, \($note, $date)) || die $this->{DB}->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
return ude($note), ude($date);
|
||||
}
|
||||
while($statement->fetch) {
|
||||
return $this->ude($note), $this->ude($date);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my $this = shift;
|
||||
my($num, $note, $date, %res);
|
||||
my $this = shift;
|
||||
my($num, $note, $date, %res);
|
||||
|
||||
if ($this->unchanged) {
|
||||
return %{$this->{cache}};
|
||||
}
|
||||
if ($this->unchanged) {
|
||||
return %{$this->{cache}};
|
||||
}
|
||||
|
||||
my $statement = $DB->prepare($sql_all) || die $DB->errstr();
|
||||
my $statement = $this->{DB}->prepare($this->{sql_all}) or die $this->{DB}->errstr();
|
||||
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num, $note, $date)) || die $DB->errstr();
|
||||
$statement->execute or die $this->{DB}->errstr();
|
||||
$statement->bind_columns(undef, \($num, $note, $date)) or die $this->{DB}->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
$res{$num}->{'note'} = ude($note);
|
||||
$res{$num}->{'date'} = ude($date);
|
||||
}
|
||||
while($statement->fetch) {
|
||||
$res{$num}->{'note'} = $this->ude($note);
|
||||
$res{$num}->{'date'} = $this->ude($date);
|
||||
}
|
||||
|
||||
$this->cache(%res);
|
||||
return %res;
|
||||
$this->cache(%res);
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my($this, $num);
|
||||
if ($this->unchanged) {
|
||||
$num = 1;
|
||||
foreach (keys %{$this->{cache}}) {
|
||||
$num++;
|
||||
}
|
||||
return $num;
|
||||
my $this = shift;
|
||||
my($num);
|
||||
if ($this->unchanged) {
|
||||
$num = 1;
|
||||
foreach (keys %{$this->{cache}}) {
|
||||
$num++;
|
||||
}
|
||||
return $num;
|
||||
}
|
||||
|
||||
my $statement = $DB->prepare($sql_nextnum) || die $DB->errstr();
|
||||
my $statement = $this->{DB}->prepare($this->{sql_nextnum}) || die $this->{DB}->errstr();
|
||||
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $DB->errstr();
|
||||
$statement->execute || die $this->{DB}->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $this->{DB}->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
return $num+1;
|
||||
}
|
||||
while($statement->fetch) {
|
||||
return $num+1;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res, $match);
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res, $match, $use_cache);
|
||||
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
my $regex = $this->generate_search($searchstring);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
|
||||
if ($this->unchanged) {
|
||||
foreach my $num (keys %{$this->{cache}}) {
|
||||
$_ = $this->{cache}{$num}->{note};
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
$res{$num}->{note} = $this->{cache}{$num}->{note};
|
||||
$res{$num}->{date} = $this->{cache}{$num}->{date}
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
my $statement = $this->{DB}->prepare($this->{sql_all}) or die $this->{DB}->errstr();
|
||||
|
||||
$statement->execute or die $this->{DB}->errstr();
|
||||
$statement->bind_columns(undef, \($num, $note, $date)) or die $this->{DB}->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
$note = $this->ude($note);
|
||||
$date = $this->ude($date);
|
||||
$_ = $note;
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
print "invalid expression: \"$searchstring\"!\n";
|
||||
return;
|
||||
}
|
||||
$match = 0;
|
||||
|
||||
my %data;
|
||||
if ($this->unchanged) {
|
||||
%data = %{$this->{cache}};
|
||||
}
|
||||
else {
|
||||
%data = $this->get_all();
|
||||
}
|
||||
foreach $num (sort { $a <=> $b } keys %data) {
|
||||
$note = ude($data{$num}->{'note'});
|
||||
$date = ude($data{$num}->{'date'});
|
||||
$_ = $note;
|
||||
eval $regex;
|
||||
if($match) {
|
||||
if($match) {
|
||||
$res{$num}->{'note'} = $note;
|
||||
$res{$num}->{'date'} = $date;
|
||||
}
|
||||
$match = 0;
|
||||
}
|
||||
|
||||
return %res;
|
||||
$match = 0;
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
@@ -176,116 +194,119 @@ sub get_search
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
my($this, $num, $note, $date) = @_;
|
||||
|
||||
$this->lock;
|
||||
my $statement = $DB->prepare($sql_edit) || die $DB->errstr();
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute(uen($note), uen($date), $num) || die $DB->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
$this->lock;
|
||||
my $statement = $this->{DB}->prepare($this->{sql_edit}) or die $this->{DB}->errstr();
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute($this->uen($note), $this->uen($date), $num)
|
||||
or die $this->{DB}->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$this->lock;
|
||||
my $statement = $DB->prepare($sql_insertnew) || die $DB->errstr();
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$this->lock;
|
||||
my $statement = $this->{DB}->prepare($this->{sql_insertnew}) || die $this->{DB}->errstr();
|
||||
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute($num, uen($note), uen($date)) || die $DB->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute($num, $this->uen($note), $this->uen($date)) || die $this->{DB}->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
|
||||
$this->lock;
|
||||
($note, $date) = $this->get_single($num);
|
||||
$this->lock;
|
||||
($note, $date) = $this->get_single($num);
|
||||
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
|
||||
# delete record!
|
||||
my $statement = $DB->prepare($sql_del) || die $DB->errstr();
|
||||
$statement->execute($num) || die $DB->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
return;
|
||||
# delete record!
|
||||
my $statement = $this->{DB}->prepare($this->{sql_del}) || die $this->{DB}->errstr();
|
||||
$statement->execute($num) || die $this->{DB}->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
my($this) = @_;
|
||||
$this->lock;
|
||||
my $statement = $DB->prepare($sql_del_all) || die $DB->errstr();
|
||||
$statement->execute() || die $DB->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
return;
|
||||
my($this) = @_;
|
||||
$this->lock;
|
||||
my $statement = $this->{DB}->prepare($this->{sql_del_all}) || die $this->{DB}->errstr();
|
||||
$statement->execute() || die $this->{DB}->errstr();
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
return;
|
||||
}
|
||||
|
||||
sub set_recountnums {
|
||||
my $this = shift;
|
||||
my $this = shift;
|
||||
|
||||
$this->lock;
|
||||
$this->lock;
|
||||
|
||||
my(@count, $i, $num, $setnum, $pos);
|
||||
$setnum = 1;
|
||||
$pos=0; $i=0; @count = ();
|
||||
my(@count, $i, $num, $setnum, $pos);
|
||||
$setnum = 1;
|
||||
$pos=0; $i=0; @count = ();
|
||||
|
||||
my $statement = $DB->prepare($sql_incrnum) || die $DB->errstr();
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $DB->errstr();
|
||||
# store real id's in an array!
|
||||
while($statement->fetch) {
|
||||
$count[$i] = $num;
|
||||
$i++;
|
||||
}
|
||||
# now recount them!
|
||||
my $sub_statement = $DB->prepare($sql_setnum) || die $DB->errstr();
|
||||
for($pos=0;$pos<$i;$pos++) {
|
||||
$setnum = $pos +1;
|
||||
$sub_statement->execute($setnum,$count[$pos]) || die $DB->errstr();
|
||||
}
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
my $statement = $this->{DB}->prepare($this->{sql_incrnum}) || die $this->{DB}->errstr();
|
||||
$statement->execute || die $this->{DB}->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $this->{DB}->errstr();
|
||||
# store real id's in an array!
|
||||
while($statement->fetch) {
|
||||
$count[$i] = $num;
|
||||
$i++;
|
||||
}
|
||||
# now recount them!
|
||||
my $sub_statement = $this->{DB}->prepare($this->{sql_setnum}) || die $this->{DB}->errstr();
|
||||
for($pos=0;$pos<$i;$pos++) {
|
||||
$setnum = $pos +1;
|
||||
$sub_statement->execute($setnum,$count[$pos]) || die $this->{DB}->errstr();
|
||||
}
|
||||
$this->unlock;
|
||||
$this->changed;
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $this->{cipher}->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
my $this = shift;
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $this->{cipher}->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
}
|
||||
|
||||
1; # keep this!
|
||||
|
||||
10
README
@@ -1,4 +1,4 @@
|
||||
note 1.0.9 by Thomas Linden, 08/08/2000
|
||||
note 1.1.0 by Thomas Linden, 12/08/2000
|
||||
=======================================
|
||||
|
||||
Introduction
|
||||
@@ -199,10 +199,12 @@ Usage
|
||||
|
||||
or:
|
||||
|
||||
$ note -s "(mike OR arnold) AND (jackson OR schwarzenegger)"
|
||||
$ note -s "(mike OR ar??ld) AND (jackson OR schwarzen*)"
|
||||
|
||||
If note finds a note, which first line is a topic, then it will
|
||||
display it's second line.
|
||||
If you want to search for ? or * then you have to surround the
|
||||
searchstring with apostrophs ("").
|
||||
These rules apply for the interactive search too.
|
||||
|
||||
Instead of using note from the commandline you can use the
|
||||
@@ -218,7 +220,7 @@ Usage
|
||||
for further use).
|
||||
The dumps from the two versions of note are in the same format.
|
||||
Using dumps it is also possible to reinitialize your database. You
|
||||
can use the "-o" switch whcih causes note to overwrite your existing
|
||||
can use the "-o" switch which causes note to overwrite your existing
|
||||
database. This is very handy if you changed heavily your config. And
|
||||
it is required, if you changed: encryption, db-driver, (binary-format)
|
||||
and the password. You can use the following command for reinitializing:
|
||||
@@ -595,4 +597,4 @@ Contributors / Credits
|
||||
Last changed
|
||||
============
|
||||
|
||||
08/08/2000
|
||||
12/08/2000
|
||||
|
||||
330
Tools.pm
Normal file
@@ -0,0 +1,330 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# generic tool functions
|
||||
#
|
||||
# Copyright (c) 2000 ConSol* GmbH, Munich.
|
||||
# All Rights Reserved. Unauthorized use forbidden.
|
||||
#
|
||||
# $Id: Tools.pm,v 1.11 2000/08/04 17:41:40 tom Exp $
|
||||
package Consol::Util::Tools;
|
||||
|
||||
use Exporter ();
|
||||
use strict;
|
||||
use Carp qw(cluck);
|
||||
use FileHandle ();
|
||||
use Date::Manip;
|
||||
use Data::Dumper;
|
||||
use vars qw(@ISA @EXPORT @EXPORT_OK @EXPORT_TAGS $DEBUG);
|
||||
|
||||
@ISA=qw(Exporter);
|
||||
# auto export subs
|
||||
@EXPORT=qw(getyesterdate debug generate_regex crypt_data);
|
||||
@EXPORT_OK=qw();
|
||||
@EXPORT_TAGS=();
|
||||
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Tools - general utilitiy package, no OOP.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
use Tools qw (getyesterdate debug);
|
||||
|
||||
|
||||
=head1 SUB getyesterdate
|
||||
|
||||
my $onedayago = getyesterdate();
|
||||
|
||||
returns the date one day ago in the following format: YYYYMMDD
|
||||
|
||||
=cut
|
||||
|
||||
sub getyesterdate
|
||||
{
|
||||
my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
|
||||
my($lastmonth, $lastyear);
|
||||
$year += 1900;
|
||||
$mon += 1;
|
||||
|
||||
if ($mon == 1) {
|
||||
$lastmonth = 12;
|
||||
$lastyear = $year - 1;
|
||||
}
|
||||
else {
|
||||
$lastmonth = $mon - 1;
|
||||
$lastyear = $year;
|
||||
}
|
||||
my @DAYS_IN_MONTH = qw(0 31 28 31 30 31 30 31 31 30 31 30 31);
|
||||
my ($day,@days);
|
||||
if ((($year % 4) == 0) && ((($year % 100) != 0) || (($year % 400) == 0))) {
|
||||
$DAYS_IN_MONTH[2]++;
|
||||
}
|
||||
|
||||
if ($mday == 1) {
|
||||
$mday = $DAYS_IN_MONTH[$lastmonth];
|
||||
$year = $lastyear;
|
||||
$mon = $lastmonth;
|
||||
}
|
||||
else {
|
||||
$mday--;
|
||||
}
|
||||
$mon =~ s/^(\d)$/0$1/;
|
||||
$hour =~ s/^(\d)$/0$1/;
|
||||
$min =~ s/^(\d)$/0$1/;
|
||||
$sec =~ s/^(\d)$/0$1/;
|
||||
$mday =~ s/^(\d)$/0$1/;
|
||||
return "$year$mon$mday";
|
||||
}
|
||||
|
||||
|
||||
=head1 SUB debug
|
||||
|
||||
BEGIN { $DEBUG = 1; }
|
||||
debug("some odd errors occured");
|
||||
|
||||
prints the given message to STDERR if $DEBUG is true (1).
|
||||
It adds the packagename and the linenumber of the caller to the output.
|
||||
|
||||
=cut
|
||||
|
||||
sub debug {
|
||||
my(@msg) = @_;
|
||||
return if(!$DEBUG);
|
||||
my($package, $filename, $line) = caller;
|
||||
print "$package $line: @msg\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
=head1 SUB generate_regex
|
||||
|
||||
This subroutine generates valid perlcode based on userinput
|
||||
for further validation using B<eval>. You can catch exceptions
|
||||
using the B<$@> variable. A user supplied expression an contain
|
||||
AND, OR, brackets (), wildcards (* for any characters, ? for one character),
|
||||
or even valid perl regex(in this special case, it will not transformed
|
||||
in any way). See below for example usage!
|
||||
|
||||
$code = generate_regex(
|
||||
-string => "(max AND moritz) OR (tina AND ute)",
|
||||
-case => 1,
|
||||
-if => 1,
|
||||
);
|
||||
|
||||
If you set B<-if> to B<1> the following output will be created:
|
||||
|
||||
$match = 1 if( (/max/i and /moritz/i ) or (/tina/i and /ute/i ) );
|
||||
|
||||
otherwise you will only get a code fragment:
|
||||
|
||||
(/max/i and /moritz/i ) or (/tina/i and /ute/i )
|
||||
|
||||
If you set B<-case> to B<1>, the code will search case sensitive.
|
||||
|
||||
If B<-string> is empty, "/^/" will be returned.
|
||||
|
||||
Sample usage:
|
||||
|
||||
#!/usr/bin/perl
|
||||
use Tools qw(generate_regex);
|
||||
my $match = undef;
|
||||
my $input = <>;
|
||||
chomp $input;
|
||||
my $regex = generate_regex(-string => $input, -if => 1);
|
||||
eval $regex;
|
||||
if ($@) {
|
||||
die "invalid expression: $@\n";
|
||||
}
|
||||
open FILE, "<textfile" or die $!;
|
||||
while (<FILE>) {
|
||||
eval $regex;
|
||||
if ($match) {
|
||||
print "$. matched the expression \"$input\"\n";
|
||||
}
|
||||
}
|
||||
close FILE;
|
||||
|
||||
Allowed expressions:
|
||||
|
||||
"Hans Wurst" # exact match
|
||||
max AND moritz # AND
|
||||
max OR moritz # OR
|
||||
(max AND moritz) OR tina # combined with ()
|
||||
((max AND moritz) AND tina) OR (hans AND mike) # more complicated with ()
|
||||
(*aol.com OR *gmx.de) AND (*free* OR *money*) # slightly more complicated with wildcards
|
||||
/^[a-zA-Z]+?.*\d{4}$/ # yes, a user can also supply a regex!
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
sub generate_regex {
|
||||
#
|
||||
# interface sub for generate_search()
|
||||
#
|
||||
my %params = @_;
|
||||
my($result);
|
||||
$result = &generate_search($params{-string}, $params{-case});
|
||||
if ($params{-if}) {
|
||||
$result = qq(\$match = 1 if($result););
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub generate_search {
|
||||
#
|
||||
# get user input and create perlcode ready for eval
|
||||
# sample input:
|
||||
# "ann.a OR eg???on AND u*do$"
|
||||
# resulting output:
|
||||
# "$match = $_ if(/ann\.a/i or /eg...on/i and /u.*do\$/i );
|
||||
#
|
||||
my($string,$case) = @_;
|
||||
|
||||
if ($string =~ /^\/.+?\/$/) {
|
||||
return $string;
|
||||
}
|
||||
elsif (!$string) {
|
||||
return "/^/";
|
||||
}
|
||||
|
||||
# per default case sensitive
|
||||
$case = ($case ? "" : "i");
|
||||
|
||||
# we will get a / in front of the first word too!
|
||||
$string = " " . $string . " ";
|
||||
|
||||
# check for apostrophs
|
||||
$string =~ s/(?<=\s)(\(??)("[^"]+"|\S+)(\)??)(?=\s)/$1 . &check_exact($2) . $3/ge;
|
||||
|
||||
# remove odd spaces infront of and after <20>and<6E> and <20>or<6F>
|
||||
$string =~ s/\s\s*(AND|OR)\s\s*/ $1 /g;
|
||||
|
||||
# remove odd spaces infront of <20>(<28> and after <20>)<29>
|
||||
$string =~ s/(\s*\()/\(/g;
|
||||
$string =~ s/(\)\s*)/\)/g;
|
||||
|
||||
# remove first and last space so it will not masked!
|
||||
$string =~ s/^\s//;
|
||||
$string =~ s/\s$//;
|
||||
|
||||
# mask spaces if not infront of or after <20>and<6E> and <20>or<6F>
|
||||
$string =~ s/(?<!AND)(?<!OR)(\s+?)(?!AND|OR)/'\s' x length($1)/ge;
|
||||
|
||||
# add first space again
|
||||
$string = " " . $string;
|
||||
|
||||
# lowercase AND and OR
|
||||
$string =~ s/(\s??OR\s??|\s??AND\s??)/\L$1\E/g;
|
||||
|
||||
# surround brackets with at least one space
|
||||
$string =~ s/(?<!\\)(\)|\()/ $1 /g;
|
||||
|
||||
# surround strings with slashes
|
||||
$string =~ s/(?<=\s)(\S+)/ &check_or($1, $case) /ge;
|
||||
|
||||
# remove slashes on <20>and<6E> and <20>or<6F>
|
||||
$string =~ s/\/(and|or)\/$case/$1/g;
|
||||
|
||||
# remove spaces inside /string/ constructs
|
||||
$string =~ s/(?<!and)(?<!or)\s*\//\//g;
|
||||
|
||||
$string =~ s/\/\s*(?!and|or)/\//g;
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
sub check_or {
|
||||
#
|
||||
# surrounds string with slashes if it is not
|
||||
# <20>and<6E> or <20>or<6F>
|
||||
#
|
||||
my($str, $case) = @_;
|
||||
if ($str =~ /^\s*(or|and)\s*$/) {
|
||||
return " $str ";
|
||||
}
|
||||
elsif ($str =~ /(?<!\\)[)(]/) {
|
||||
return $str;
|
||||
}
|
||||
else {
|
||||
return " \/$str\/$case ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub check_exact {
|
||||
#
|
||||
# helper for generate_search()
|
||||
# masks special chars if string
|
||||
# not inside ""
|
||||
#
|
||||
my($str) = @_;
|
||||
|
||||
my %globs = (
|
||||
'*' => '.*',
|
||||
'?' => '.',
|
||||
'[' => '[',
|
||||
']' => ']',
|
||||
'+' => '\+',
|
||||
'.' => '\.',
|
||||
'$' => '\$',
|
||||
'@' => '\@',
|
||||
);
|
||||
|
||||
# mask backslash
|
||||
$str =~ s/\\/\\\\/g;
|
||||
|
||||
if ($str =~ /^"/ && $str =~ /"$/) {
|
||||
# mask bracket-constructs
|
||||
$str =~ s/(\(|\))/\\$1/g;
|
||||
}
|
||||
$str =~ s/(.)/$globs{$1} || "$1"/ge;
|
||||
|
||||
$str =~ s/^"//;
|
||||
$str =~ s/"$//;
|
||||
|
||||
# mask spaces
|
||||
$str =~ s/\s/\\s/g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sub crypt_data {
|
||||
#
|
||||
# enrypt a passwd
|
||||
#
|
||||
my($cleartext) = @_;
|
||||
debug("\"$cleartext\"");
|
||||
return if(!$cleartext);
|
||||
|
||||
# create a random salt
|
||||
my @range=('0'..'9','a'..'z','A'..'Z');
|
||||
|
||||
my $salt=$range[rand(int($#range)+1)] . $range[rand(int($#range)+1)];
|
||||
|
||||
return crypt($cleartext, "$salt");
|
||||
}
|
||||
|
||||
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Thomas Linden
|
||||
|
||||
=cut
|
||||
|
||||
1;
|
||||
|
||||
# Local Variables: ***
|
||||
# perl-master-file: ../../webmin/index.pl ***
|
||||
# End: ***
|
||||
@@ -1,2 +1,2 @@
|
||||
/note/1.3/Fri Jul 21 06:41:25 2000//
|
||||
/note/1.5/Fri Aug 11 00:05:58 2000//
|
||||
D
|
||||
|
||||
56
bin/note
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: note,v 1.3 2000/07/21 06:41:25 zarahg Exp $
|
||||
# $Id: note,v 1.5 2000/08/11 00:05:58 zarahg Exp $
|
||||
#
|
||||
#
|
||||
# note - console notes management with database and encryption support.
|
||||
@@ -79,7 +79,7 @@ my (
|
||||
#
|
||||
# db specifics from .noterc
|
||||
#
|
||||
$db, $dbname, $dbhost, $dbuser, $dbpasswd, $encrypt_passwd, $clearstring,
|
||||
$db, $dbname, $dbhost, $dbport, $dbuser, $dbpasswd, $encrypt_passwd, $clearstring,
|
||||
$table, $fnum, $fnote, $fdate, $date, $dbdriver, $libpath,
|
||||
|
||||
#
|
||||
@@ -127,14 +127,17 @@ $TIME_COLOR = "black";
|
||||
$TOPIC_COLOR = "BLACK";
|
||||
$TOPIC = 1;
|
||||
$TopicSep = '/';
|
||||
$version = "1.0.9";
|
||||
$version = "1.1.0";
|
||||
if ($TOPIC) {
|
||||
$CurDepth = 1; # the current depth inside the topic "directory" structure...
|
||||
}
|
||||
$USE_CRYPT = "NO";
|
||||
$TempDir = "/tmp";
|
||||
|
||||
|
||||
# mysql stuff
|
||||
$table = "note";
|
||||
$fnote = "note";
|
||||
$fdate = "date";
|
||||
$fnum = "number";
|
||||
|
||||
#
|
||||
# process command line args
|
||||
@@ -302,6 +305,12 @@ elsif ($opt_c) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
# directly jump to encrypt, 'cause this sub does
|
||||
# not require a database connection
|
||||
if ($mode eq "encrypt_passwd") {
|
||||
&encrypt_passwd;
|
||||
exit;
|
||||
}
|
||||
|
||||
# Always interactive?
|
||||
if ($ALWAYS_INT eq "YES" && $mode ne "dump" && $mode ne "import") {
|
||||
@@ -331,8 +340,8 @@ elsif ($dbdriver eq "mysql") {
|
||||
# do the new() later because of the encrypted password!
|
||||
eval {
|
||||
require "NOTEDB/mysql.pm";
|
||||
#$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
|
||||
};
|
||||
die $@ if($@);
|
||||
}
|
||||
else {
|
||||
eval {
|
||||
@@ -395,7 +404,8 @@ if ($USE_CRYPT eq "YES" && $NOTEDB::crypt_supported == 1) {
|
||||
my $cipher = new Crypt::CBC($key, $CRYPT_METHOD);
|
||||
# decrypt the dbpasswd, if it's encrypted!
|
||||
my $dbpasswd = $cipher->decrypt(unpack("u",$dbpasswd)) if($encrypt_passwd);
|
||||
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd, $table, $fnum, $fnote, $fdate);
|
||||
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser,
|
||||
$dbpasswd, $table, $fnum, $fnote, $fdate, $dbport);
|
||||
};
|
||||
die "Could not connect do db: $@!\n" if($@);
|
||||
}
|
||||
@@ -408,18 +418,22 @@ if ($USE_CRYPT eq "YES" && $NOTEDB::crypt_supported == 1) {
|
||||
print "access denied.\n"; # decrypted $date is not a number!
|
||||
exit(1);
|
||||
}
|
||||
} #else empty!
|
||||
} #else empty database!
|
||||
}
|
||||
else {
|
||||
$db->no_crypt;
|
||||
# does: NOTEDB::crypt_supported = 0;
|
||||
my ($cnote, $cdate) = $db->get_single(1);
|
||||
if ($cdate ne "") {
|
||||
if ($cdate !~ /^\d+\.\d+?/) {
|
||||
print "$NOTEDB seems to be encrypted!\n";
|
||||
exit(1);
|
||||
if ($dbdriver eq "mysql") {
|
||||
$db = new NOTEDB($dbdriver, $dbname, $dbhost, $dbuser,
|
||||
$dbpasswd, $table, $fnum, $fnote, $fdate, $dbport);
|
||||
}
|
||||
$db->no_crypt;
|
||||
# does: NOTEDB::crypt_supported = 0;
|
||||
my ($cnote, $cdate) = $db->get_single(1);
|
||||
if ($cdate ne "") {
|
||||
if ($cdate !~ /^\d+\.\d+?/) {
|
||||
print "$NOTEDB seems to be encrypted!\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -464,9 +478,6 @@ elsif ($mode eq "import") {
|
||||
elsif ($mode eq "interactive") {
|
||||
&interactive;
|
||||
}
|
||||
elsif ($mode eq "encrypt_passwd") {
|
||||
&encrypt_passwd;
|
||||
}
|
||||
else {
|
||||
#undefined :-(
|
||||
}
|
||||
@@ -1454,6 +1465,7 @@ sub getconfig
|
||||
$libpath = $value if (/^LibPath/);
|
||||
$dbdriver = $value if (/^DbDriver/);
|
||||
$dbhost = $value if (/^DbHost/);
|
||||
$dbport = $value if (/^DbPort/);
|
||||
$dbuser = $value if (/^DbUser/);
|
||||
$dbpasswd = $value if (/^DbPasswd/);
|
||||
$encrypt_passwd = $value if (/^encrypt_passwd/);
|
||||
@@ -1508,6 +1520,12 @@ sub getconfig
|
||||
__END__
|
||||
#
|
||||
# $Log: note,v $
|
||||
# Revision 1.5 2000/08/11 00:05:58 zarahg
|
||||
# 1.1.0 beta2 ready for testing
|
||||
#
|
||||
# Revision 1.4 2000/08/10 09:21:56 zarahg
|
||||
# ready for 1.1.0 shipping, lots of changes/additions, see Changelog
|
||||
#
|
||||
# Revision 1.3 2000/07/21 06:41:25 zarahg
|
||||
# 638: precedence bug fixed
|
||||
#
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/noterc/1.3/Sun Jul 9 22:37:15 2000//
|
||||
/noterc/1.5/Fri Aug 11 00:04:03 2000//
|
||||
D
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# 1.0.8 -*- sh -*-
|
||||
# 1.1.0 -*- sh -*-
|
||||
# This is a sample config for the note script
|
||||
# There are useful defaults set in note itself.
|
||||
#
|
||||
@@ -35,6 +35,7 @@ DbDriver binary
|
||||
|
||||
# backend specific settings for sql backend
|
||||
#DbHost localhost
|
||||
#DbPort
|
||||
#DbUser you
|
||||
#DbPasswd
|
||||
#DbName mynotes
|
||||
@@ -164,6 +165,9 @@ ShortCd 0
|
||||
# this is currently only supported by the binary and the mysql backends
|
||||
# set it to 1 to turn it on, the default is 0 (off)
|
||||
Cache 0
|
||||
|
||||
|
||||
|
||||
# That's all about it for now.
|
||||
# If you still have any questiosn, please feel free to contact
|
||||
# me by email: Thomas Linden <tom@daemon.de>
|
||||
|
||||
@@ -1,277 +0,0 @@
|
||||
==================================================================================
|
||||
|
||||
1.0.7:
|
||||
FIXED: there was a bug in the search expression, use now \Q and \E.
|
||||
ADDED: --config <file> allows one to use another config than the default.
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.6:
|
||||
FIXED: there were some odd bugs in commandline parsing, some options were unavailable.
|
||||
FIXED: Forgot "PreferredEditor" config-option in the new config format.
|
||||
FIXED: the interactive "cd .." command has ignored the presence of a
|
||||
"DefaultLong" setting(and search too)... thx to Peter.
|
||||
CHANGED: Optimized a little bit the output routine, now it is better to read.
|
||||
ADDED: sub format and appropriate config-option for text formatting capabilities.
|
||||
CHANGED: changed getconfig regexp, which allows now also to use Option = Param.
|
||||
FIXED: was not possible to override config-options, which are set by default to
|
||||
something.
|
||||
ADDED: note chacks now, if a database os actually really encrypted and exits with
|
||||
an error if it s and the user turned off encryption. This protects her from
|
||||
destroying it's own database ..
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.5:
|
||||
FIXED: the T (and t respectively) printed nothing out since 1.0.3! It does
|
||||
it now again...
|
||||
ADDED: a new database backend added, NOTEDB::dbm, which uses DBM files for
|
||||
storage.
|
||||
FIXED: &display-tree returns now, if there is no note, otherwise it
|
||||
would die because of an undefined refernce.
|
||||
CHANGED: Changed the config file format completely. It is now no more a perl
|
||||
file, instead it is a simple plain text file which note parses.
|
||||
CHANGED: Changed the way, note loads it database backend. It uses now the
|
||||
$dbdriver variable as module-name, which makes it possible easily
|
||||
to write your own backend without the need to change note itself.
|
||||
FIXED: Removed Getopt::Long option "bundling", causes errors with perl
|
||||
5.6.0 and is not senceful.
|
||||
FIXED: Added the Getopt::Long option "no_ignore_case". In 1.0.4 options
|
||||
were case insensitive causing -i to be interpreted as --import
|
||||
instead of --interactive ;-(((
|
||||
ADDED: a new config option $DEFAULT_LIST, which causes note, \
|
||||
if turned to "LONG", to use long-listing as default. |
|
||||
But it will still be able to use short-listing if you |
|
||||
explicit specify that. | submitted by
|
||||
FIXED: sub search prints now an appropriate error-message in |==> Peter Palmreuther
|
||||
case no searchstring was given instead of jumping to | thanks a lot!
|
||||
usage. |
|
||||
CHANGED: Changed the text in the interactive help to reflect |
|
||||
changes of verion 1.0.3 (t and T). /
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.4:
|
||||
CHANGED: Moved from @ARGV-parsing to Getopt::Long, adding options is now
|
||||
much easier and I do now understand my own code ;-)
|
||||
ADDED: --raw, the "Raw Mode", which turns off any formatting of output.
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.3:
|
||||
ADDED: "-" works also for --dump, but in the other direction. It causes
|
||||
note to dump to standard output instead into a file.
|
||||
ADDED: you can specify - as filename for use with --import and if you want
|
||||
to create a new note. "-" stands for standardinput and it allows you
|
||||
tp pipe another commands output to note!
|
||||
ADDED: you can now use an environment variable for the passphrase (when using
|
||||
encryption). If it is presen, note will not ask for a passphrase. This
|
||||
is very usefull in comination with the addition above, for use in
|
||||
scripts.
|
||||
CHANGED: the interactive help screen is now coloured.
|
||||
ADDED: -o commandline switch, which causes note to overwrite an existing
|
||||
database when importing data from a previous dump. Very handy if
|
||||
you want to re-initialize your db, i.e. if you changed the format.
|
||||
ADDED: the long-tree-view (-T) displays now also the note-number of each
|
||||
note.
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.2:
|
||||
ADDED: Topic-Tree overview command (-t or -T).
|
||||
ADDED: Enhanced list command in interactive mode, you can now specify
|
||||
a topic which notes you want to see.
|
||||
CHANGED: updated the help and usage sections to reflect the additions above.
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.1:
|
||||
FIXED: fixed bug in NOTEDB::mysql, which caused note t store NULL values
|
||||
in db, if encryption was off. A really dump failure :-(
|
||||
|
||||
==================================================================================
|
||||
|
||||
1.0.0:
|
||||
CHANGED: removed install.sh. use now a Makefile for installation.
|
||||
ADDED: Encryption support. Note can now encrypt notes using IDEA
|
||||
or DES as encryption-protocols(symetric).
|
||||
|
||||
==================================================================================
|
||||
|
||||
0.9:
|
||||
FIXED: There were many new bugs after my last changes *grrrrr*. fixed.
|
||||
Works now properly, with both backends!
|
||||
FIXED: and another bug: recounting of numbers did not take care about
|
||||
the existing order! If you deleted note #12, then note #13 became
|
||||
not neccessarily #12! Instead it becames any other number (kind of
|
||||
randomly...).
|
||||
CHANGED: NOTEDB::binary set_del function changed, it does no more require
|
||||
a temporary file for number recount. Instead it uses get_all and
|
||||
stores all notes in RAM and then rewrites the database.
|
||||
FIXED: fixed the set_new call within note. It used 0 as the first param
|
||||
(number) which is not useful since we dont have support for auto-
|
||||
increment from all database backends.
|
||||
FIXED: fixed the function set_recountnum in NITEDB::mysql, it was also
|
||||
incorrect :-((( 0.8 seemed to be a very bad early alpha...........
|
||||
FIXED: there was a bug in NOTEDB::binary which caused not to recount note
|
||||
numbers after deleting one :-(
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
0.8:
|
||||
ADDED: NOTEDB::binary. so now 0.8 is ready for shipping !
|
||||
FIXED: regexp bug fixed. It was only possible to delete 2 items together
|
||||
separated by comma ("d 1,2,3,4" deleted only 1,2!).
|
||||
ADDED: Some new config options which reflects the new module structure.
|
||||
So you can change your database backend without the need to
|
||||
replace the note script itself.
|
||||
FIXED: the previously added feature "cd <topic>" didn't really work :-(
|
||||
ADDED: NOTEDB::mysql added. Perlmodule, which I will use within
|
||||
note from now on instead of buildin functions for accessing the
|
||||
database. From now on I only need to maintain one version of
|
||||
note, since the module interface will be identical between the
|
||||
bin and sql version.
|
||||
CHANGED: The SQL code does not use Mysql.pm anymore. Instead it is coded
|
||||
using the more portable DBI module. This allows one easily to
|
||||
switch to anther database, which is supported by DBI.
|
||||
CHANGED: Locking. The db-table will now be locked before note accesses it.
|
||||
FIXED: width of listings is now always the same independent of the string-
|
||||
length of a certain note.
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
0.7:
|
||||
ADDED: one can now use the unix-like "cd" command to change to another
|
||||
topic, thus use "cd topicname" instead just typing "topicname"!
|
||||
FIXED: there was a smal regex bug which maked it impossible to use such
|
||||
topics: "4 test", in such a case note just displayed note number 4
|
||||
instead of cd'ing to topic "4 test".
|
||||
ADDED: a new config option "$KEEP_TIMESTAMP" allows a user to disable
|
||||
note's default behavior of updating the timestamp of a note after
|
||||
editing it.
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
0.6:
|
||||
FIXED: oops - the new suptopic feature confused the commandline-mode of
|
||||
note! quickly corrected! so subtopics also available from command-
|
||||
line.
|
||||
FIXED: a small bug fiyed, it was impossible to use -D or -I from command-
|
||||
line, if $ALWAYS_INT was turned on, now it is.
|
||||
FIXED: fixed problem with local/global variable $time, which confused
|
||||
the script under certain circumstances, now $time is no more global,
|
||||
it will be read in (using &getdate) locally by &new and &edit.
|
||||
CHANGED: The Topic separator is no longer hardcoded, one can customize
|
||||
it using the $TopicSep variable, the default is now /, the backslash
|
||||
will no mor work!
|
||||
CHANGED: use perl buildin localtime() function instead of
|
||||
GNU date, which is possibly not installed on every target
|
||||
system (i.e. win32), therefore better portability!
|
||||
CHANGED: use now the strict module
|
||||
ADDED: Support for subtopics added (and sub-sub-..-topics).
|
||||
CHANGED: Removed the "T" command, it is now obsolete.
|
||||
CHANGED: behavior of list command changed, now shows topics as well as
|
||||
notes under the current topic(if there are some).
|
||||
CHANGED: The ".." command takes you now one level higher in your topic-
|
||||
structure.
|
||||
ADDED: A new config option $PreferredEditor, which you can use to
|
||||
specify your own choice of editor.
|
||||
FIXED: A bug at line 769 causing single note where smaller than note-
|
||||
listings
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
|
||||
0.5:
|
||||
ADDED: Topic support(requested). You can sort the various notes under
|
||||
different topics now.
|
||||
FIXED: There was another bug, which caused the list command to display
|
||||
the notes with a too high value of $maxlen.
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
|
||||
0.4.2:
|
||||
ADDED: If run in interactive mode, note will at first do a list command.
|
||||
FIXED: A bug caused note to save bogus timestamps after editing a note.
|
||||
CHANGED: It does no more print 3 newlines before the menu in interactive mode.
|
||||
FIXED: Some more vars will be resetted during each loop in interactive mode.
|
||||
$ListType.
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
|
||||
0.4.1:
|
||||
ADDED: The install.sh script for the mysql version is no able to install the
|
||||
required Mysql module directly from CPAN, thanks to David A. Bandel!
|
||||
FIXED: The mysql version did not display notes (i.e.: "note 3" did nothing)
|
||||
CHANGED: Again, the sql-format of the mysql database has been changed. Now
|
||||
there are only 3 fields, the number filed is the primary key, the id
|
||||
field in previous versions was a waste of diskspace...
|
||||
CHANGED: The format of the dump-output has been changed.
|
||||
ADDED: It is now possible to import previously dumped notes into the notedb
|
||||
(dumps from both versions are compatible with each other)
|
||||
FIXED: the function num_bereich() had a bug, which caused ot to ignore under
|
||||
some circumstances one number (i.e. "note -d 4-13" did nothing).
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
|
||||
0.4:
|
||||
CHANGED: ok, mysql support is back again (upon requests). therefore there
|
||||
are two different version of the script in the same time with
|
||||
the same features, one for mysql and the other one for the binary
|
||||
database.
|
||||
ADDED: Dump to textfile capability. Later on I want to dump it into a
|
||||
palm readable format, any help is welcome!
|
||||
ADDED: interactive mode.
|
||||
CHANGED: Better modularity, better code.
|
||||
CHANGED: note can now run without the need of a config file. If does not
|
||||
exist, it will try to work with default values.
|
||||
ADDED: sub num_bereich(), which allows one to specify more then one
|
||||
number for deletion or displaying (i.e.: "-d 1,4,7" or "-d 4-9")
|
||||
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
|
||||
0.3:
|
||||
CHANGED: it uses no more a mysql database, but a binary file instead.
|
||||
This is much faster!
|
||||
ADDED: note can display the notes with colors, it is turned off by default
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
|
||||
0.2:
|
||||
FIXED: now any occurence of ' will be masked with \' before storage
|
||||
to the mysql database.
|
||||
FIXED: now numbers of notes will be recounted, if one delete one note,
|
||||
so the list of notes will everytime start with 1,2,3,...
|
||||
CHANGED: the look of the list output has been changed, similar to a table
|
||||
|
||||
|
||||
==================================================================================
|
||||
|
||||
0.1:
|
||||
INITIAL RELEASE.
|
||||
@@ -1,108 +0,0 @@
|
||||
# does not use ExtUtils::MakeMaker, because
|
||||
# NOTEDB::mysql and NOTEDB::binary are internals
|
||||
# of note.
|
||||
#
|
||||
# $Id: Makefile.PL,v 1.1 2000/04/17 17:38:49 thomas Exp thomas $
|
||||
#
|
||||
# check for the existence of optional modules:
|
||||
sub chk_mod
|
||||
{
|
||||
my($mod, $msg) = @_;
|
||||
print "<====\tchecking $mod \t====>\n";
|
||||
eval {
|
||||
$mod .= ".pm";
|
||||
$mod =~ s/::/\//g;
|
||||
require $mod;
|
||||
};
|
||||
if($@) {
|
||||
print $msg;
|
||||
}
|
||||
else {
|
||||
print " ... installed.\n";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
|
||||
&chk_mod(
|
||||
"Getopt::Long",
|
||||
"WARNING: Getopt::Long seems not to be installed on your system!\n"
|
||||
."But it is strongly required in order to run note!\n"
|
||||
);
|
||||
|
||||
&chk_mod(
|
||||
"DB_File",
|
||||
"WARNING: DB_File seems not to be installed on your system!\n"
|
||||
."It is required, if you want to use the DBM backend.\n"
|
||||
);
|
||||
|
||||
|
||||
&chk_mod(
|
||||
"DBI",
|
||||
" WARNING: module DBI is not installed on your system.\n"
|
||||
." It is required, if you want to use a SQL database with\n"
|
||||
."note.\n"
|
||||
);
|
||||
|
||||
&chk_mod(
|
||||
"Crypt::IDEA",
|
||||
" WARNING: module Crypt::IDEA is not installed on your system.\n"
|
||||
." It is required, if you want to encrypt your data using IDEA.\n"
|
||||
);
|
||||
|
||||
&chk_mod(
|
||||
"Crypt::DES",
|
||||
" WARNING: module Crypt::DES is not installed on your system.\n"
|
||||
." It is required, if you want to encrypt your data using DES.\n"
|
||||
);
|
||||
|
||||
&chk_mod(
|
||||
"Crypt::CBC",
|
||||
" WARNING: module Crypt::CBC is not installed on your system.\n"
|
||||
." It is required, if you want to encrypt your data using CBC.\n"
|
||||
);
|
||||
|
||||
&chk_mod(
|
||||
"MD5",
|
||||
" WARNING: module MD5 is not installed on your system.\n"
|
||||
." It is required by Crypt::CBC.\n"
|
||||
);
|
||||
|
||||
foreach $dir (@INC) {
|
||||
if($dir =~ /site_perl/)
|
||||
{ $LIBDIR = $dir; last; }
|
||||
}
|
||||
print "directory, where to install libs [$LIBDIR]: ";
|
||||
$input = <>;
|
||||
chomp $input;
|
||||
$LIBDIR = $input if($input ne "");
|
||||
|
||||
$BINDIR = "/usr/local/bin";
|
||||
print "directory, where to install note [$BINDIR]: ";
|
||||
$input = <>;
|
||||
chomp $input;
|
||||
$BINDIR = $input if($input ne "");
|
||||
|
||||
$install = `which install`;
|
||||
|
||||
open M, "> Makefile" || die $!;
|
||||
print M qq~BIN = bin/note
|
||||
LIBS = NOTEDB/mysql.pm NOTEDB/binary.pm NOTEDB/dbm.pm
|
||||
INSTBIN = $BINDIR
|
||||
INSTLIB = $LIBDIR
|
||||
INSTALL = $install
|
||||
all:
|
||||
\@echo "done. Type make install.\\n"
|
||||
|
||||
install:
|
||||
\$(INSTALL) -d -m 755 \$(INSTLIB)/NOTEDB
|
||||
\$(INSTALL) -m 755 \$(LIBS) \$(INSTLIB)/NOTEDB
|
||||
\$(INSTALL) -m 755 \$(BIN) \$(INSTBIN)
|
||||
~;
|
||||
|
||||
print "Type \"make install\" to install all files.\n\n";
|
||||
print "Please note: You may also copy the file \"config/noterc\" to\n"
|
||||
."your home: \"cp config/noterc ~/.noterc\". Don't forget to edit\n"
|
||||
."your config-file. Read the README for more informations on this\n"
|
||||
."topic.\n"
|
||||
."Thanks for choosing \"note\"! You are helping to keep the \n"
|
||||
."OpenSource idea alive! Enjoy and tell me, what you think!\n\n";
|
||||
@@ -1,7 +0,0 @@
|
||||
perl modules for note used as database backends.
|
||||
the install.sh script will install both of them,
|
||||
although you may only need one backend. Perhaps
|
||||
other users on your system have oter ideas in mind...
|
||||
|
||||
Therefore, please ignore these file. There is nothing
|
||||
to edit or to do. Simply leave this directory :-)
|
||||
@@ -1,388 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: binary.pm,v 1.6 2000/06/25 19:48:00 scip Exp scip $
|
||||
# Perl module for note
|
||||
# binary database backend. see docu: perldoc NOTEDB::binary
|
||||
#
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
use IO::Seekable;
|
||||
|
||||
package NOTEDB;
|
||||
use Fcntl qw(LOCK_EX LOCK_UN);
|
||||
BEGIN {
|
||||
# make sure, it works, although encryption
|
||||
# not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Globals:
|
||||
my ($NOTEDB, $sizeof, $typedef,$version);
|
||||
my ($cipher);
|
||||
|
||||
$version = "(NOTEDB::binary, 1.6)";
|
||||
|
||||
|
||||
sub new
|
||||
{
|
||||
my($this, $dbdriver, $dbname, $MAX_NOTE, $MAX_TIME) = @_;
|
||||
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
$NOTEDB = $dbname;
|
||||
|
||||
if(! -e $NOTEDB)
|
||||
{
|
||||
open(TT,">$NOTEDB") or die "Could not create $NOTEDB: $!\n";
|
||||
close (TT);
|
||||
}
|
||||
elsif(! -w $NOTEDB)
|
||||
{
|
||||
print "$NOTEDB is not writable!\n";
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
my $TYPEDEF = "i a$MAX_NOTE a$MAX_TIME";
|
||||
my $SIZEOF = length pack($TYPEDEF, () );
|
||||
|
||||
$sizeof = $SIZEOF;
|
||||
$typedef = $TYPEDEF;
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
}
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
}
|
||||
|
||||
sub no_crypt {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
|
||||
sub use_crypt {
|
||||
my($this,$key,$method) = @_;
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
unlink $NOTEDB;
|
||||
open(TT,">$NOTEDB") or die "Could not create $NOTEDB: $!\n";
|
||||
close (TT);
|
||||
}
|
||||
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($address, $note, $date, $buffer, $n, $t, $buffer, );
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
$address = ($num-1) * $sizeof;
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
read(NOTE, $buffer, $sizeof);
|
||||
($num, $n, $t) = unpack($typedef, $buffer);
|
||||
|
||||
$note = ude($n);
|
||||
$date = ude($t);
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return $note, $date;
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my($this, $num, $note, $date, %res);
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
my($buffer, $t, $n);
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof)) {
|
||||
($num, $note, $date) = unpack($typedef, $buffer);
|
||||
$t = ude($date);
|
||||
$n = ude($note);
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my($this, $num, $te, $me, $buffer);
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof)) {
|
||||
($num, $te, $me) = unpack($typedef, $buffer);
|
||||
}
|
||||
$num += 1;
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return $num;
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($buffer, $num, $note, $date, %res, $t, $n);
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
while(read(NOTE, $buffer, $sizeof))
|
||||
{
|
||||
($num, $note, $date) = unpack($typedef, $buffer);
|
||||
$n = ude($note);
|
||||
$t = ude($date);
|
||||
if($n =~ /\Q$searchstring\E/i)
|
||||
{
|
||||
$res{$num}->{'note'} = $n;
|
||||
$res{$num}->{'date'} = $t;
|
||||
}
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
my $address = ($num -1 ) * $sizeof;
|
||||
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, $address, IO::Seekable::SEEK_SET);
|
||||
my $n = uen($note);
|
||||
my $t = uen($date);
|
||||
|
||||
my $buffer = pack($typedef, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
open NOTE, "+<$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END); # APPEND
|
||||
my $n = uen($note);
|
||||
my $t = uen($date);
|
||||
my $buffer = pack($typedef, $num, $n, $t);
|
||||
print NOTE $buffer;
|
||||
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
|
||||
$setnum = 1;
|
||||
|
||||
%orig = $this->get_all();
|
||||
return "ERROR" if (! exists $orig{$num});
|
||||
|
||||
delete $orig{$num};
|
||||
|
||||
# overwrite, but keep number!
|
||||
open NOTE, ">$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
foreach $N (keys %orig) {
|
||||
$n = uen($orig{$N}->{'note'});
|
||||
$t = uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $typedef, $N, $n, $t); # keep orig number, note have to call recount!
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
return;
|
||||
}
|
||||
|
||||
sub set_recountnums
|
||||
{
|
||||
my($this) = @_;
|
||||
my(%orig, $note, $date, $T, $setnum, $buffer, $n, $N, $t);
|
||||
|
||||
$setnum = 1;
|
||||
%orig = $this->get_all();
|
||||
|
||||
open NOTE, ">$NOTEDB" or die "could not open $NOTEDB\n";
|
||||
flock NOTE, LOCK_EX;
|
||||
seek(NOTE, 0, 0); # START FROM BEGINNING
|
||||
|
||||
foreach $N (sort {$a <=> $b} keys %orig) {
|
||||
$n = uen($orig{$N}->{'note'});
|
||||
$t = uen($orig{$N}->{'date'});
|
||||
$buffer = pack( $typedef, $setnum, $n, $t);
|
||||
print NOTE $buffer;
|
||||
seek(NOTE, 0, IO::Seekable::SEEK_END);
|
||||
$setnum++;
|
||||
}
|
||||
flock NOTE, LOCK_UN;
|
||||
close NOTE;
|
||||
return;
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = pack("u", $_[0]);
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = unpack("u", $_[0]);
|
||||
}
|
||||
return $T;
|
||||
}
|
||||
|
||||
1; # keep this!
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NOTEDB::binary - module lib for accessing a notedb from perl
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# include the module
|
||||
use NOTEDB;
|
||||
|
||||
# create a new NOTEDB object
|
||||
$db = new NOTEDB("binary", "/home/tom/.notedb", 4096, 24);
|
||||
|
||||
# decide to use encryption
|
||||
# $key is the cipher to use for encryption
|
||||
# $method must be either Crypt::IDEA or Crypt::DES
|
||||
# you need Crypt::CBC, Crypt::IDEA and Crypt::DES to have installed.
|
||||
$db->use_crypt($key,$method);
|
||||
|
||||
# do not use encryption
|
||||
# this is the default
|
||||
$db->no_crypt;
|
||||
|
||||
# get a single note
|
||||
($note, $date) = $db->get_single(1);
|
||||
|
||||
# search for a certain note
|
||||
%matching_notes = $db->get_search("somewhat");
|
||||
# format of returned hash:
|
||||
#$matching_notes{$numberofnote}->{'note' => 'something', 'date' => '23.12.2000 10:33:02'}
|
||||
|
||||
# get all existing notes
|
||||
%all_notes = $db->get_all();
|
||||
# format of returnes hash like the one from get_search above
|
||||
|
||||
# get the next noteid available
|
||||
$next_num = $db->get_nextnum();
|
||||
|
||||
# modify a certain note
|
||||
$db->set_edit(1, "any text", "23.12.2000 10:33:02");
|
||||
|
||||
# create a new note
|
||||
$db->set_new(5, "any new text", "23.12.2000 10:33:02");
|
||||
|
||||
# delete a certain note
|
||||
$db->set_del(5);
|
||||
|
||||
# turn on encryption. CryptMethod must be IDEA, DES or BLOWFISH
|
||||
$db->use_crypt("passphrase", "CryptMethod");
|
||||
|
||||
# turn off encryption. This is the default.
|
||||
$db->no_crypt();
|
||||
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
You can use this module for accessing a note database. There are currently
|
||||
two versions of this module, one version for a SQL database and one for a
|
||||
binary file (note's own database-format).
|
||||
However, both versions provides identical interfaces, which means, you do
|
||||
not need to change your code, if you want to switch to another database format.
|
||||
|
||||
Currently, NOTEDB module is only used by note itself. But feel free to use it
|
||||
within your own project! Perhaps someone want to implement a webinterface to
|
||||
note...
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
please see the section SYNOPSIS, it says it all.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Thomas Linden <tom@daemon.de>.
|
||||
|
||||
|
||||
|
||||
=cut
|
||||
@@ -1,261 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: dbm.pm,v 1.2 2000/06/25 19:51:11 scip Exp scip $
|
||||
# Perl module for note
|
||||
# DBM database backend. see docu: perldoc NOTEDB::dbm
|
||||
#
|
||||
|
||||
use DB_File;
|
||||
#use Data::Dumper;
|
||||
use strict;
|
||||
package NOTEDB;
|
||||
|
||||
BEGIN {
|
||||
# make sure, it works, although encryption
|
||||
# not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Globals:
|
||||
my ($dbm_dir, $notefile, $timefile, $version, $cipher, %note, %date);
|
||||
$notefile = "note.dbm";
|
||||
$timefile = "date.dbm";
|
||||
|
||||
$version = "(NOTEDB::dbm, 1.1)";
|
||||
|
||||
sub new
|
||||
{
|
||||
my($this, $dbdriver, $dbm_dir) = @_;
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
|
||||
tie %note, "DB_File", "$dbm_dir/$notefile" || die $!;
|
||||
tie %date, "DB_File", "$dbm_dir/$timefile" || die $!;
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
untie %note, %date;
|
||||
}
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
}
|
||||
|
||||
sub no_crypt {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
|
||||
sub use_crypt {
|
||||
my($this, $key, $method) = @_;
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date);
|
||||
return ude ($note{$num}), ude($date{$num});
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my($this, $num, $note, $date, %res, $real);
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
$res{$num}->{'note'} = ude($note{$num});
|
||||
$res{$num}->{'date'} = ude($date{$num});
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my($this, $num);
|
||||
foreach (sort {$a <=> $b} keys %date) {
|
||||
$num = $_;
|
||||
}
|
||||
$num++;
|
||||
return $num;
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res);
|
||||
|
||||
foreach $num (sort {$a <=> $b} keys %date) {
|
||||
if (ude($note{$num}) =~ /\Q$searchstring\E/i) {
|
||||
$res{$num}->{'note'} = ude($note{$num});
|
||||
$res{$num}->{'date'} = ude($date{$num});
|
||||
}
|
||||
}
|
||||
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub set_recountnums
|
||||
{
|
||||
my $this = shift;
|
||||
my(%Note, %Date, $num, $setnum);
|
||||
$setnum = 1;
|
||||
foreach $num (sort {$a <=> $b} keys %note) {
|
||||
$Note{$setnum} = $note{$num};
|
||||
$Date{$setnum} = $date{$num};
|
||||
$setnum++;
|
||||
}
|
||||
%note = %Note;
|
||||
%date = %Date;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$note{$num} = uen($note);
|
||||
$date{$num} = uen($date);
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
$this->set_edit($num, $note, $date); # just the same thing
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
($note, $date) = $this->get_single($num);
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
delete $note{$num};
|
||||
delete $date{$num};
|
||||
}
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
my($this) = @_;
|
||||
%note = ();
|
||||
%date = ();
|
||||
return;
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
}
|
||||
|
||||
1; # keep this!
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NOTEDB::dbm - module lib for accessing a notedb from perl
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# include the module
|
||||
use NOTEDB;
|
||||
|
||||
# create a new NOTEDB object (the last 4 params are db table/field names)
|
||||
$db = new NOTEDB("mysql","note","/home/user/.notedb/");
|
||||
|
||||
# get a single note
|
||||
($note, $date) = $db->get_single(1);
|
||||
|
||||
# search for a certain note
|
||||
%matching_notes = $db->get_search("somewhat");
|
||||
# format of returned hash:
|
||||
#$matching_notes{$numberofnote}->{'note' => 'something', 'date' => '23.12.2000 10:33:02'}
|
||||
|
||||
# get all existing notes
|
||||
%all_notes = $db->get_all();
|
||||
# format of returnes hash like the one from get_search above
|
||||
|
||||
# get the next noteid available
|
||||
$next_num = $db->get_nextnum();
|
||||
|
||||
# recount all noteids starting by 1 (usefull after deleting one!)
|
||||
$db->set_recountnums();
|
||||
|
||||
# modify a certain note
|
||||
$db->set_edit(1, "any text", "23.12.2000 10:33:02");
|
||||
|
||||
# create a new note
|
||||
$db->set_new(5, "any new text", "23.12.2000 10:33:02");
|
||||
|
||||
# delete a certain note
|
||||
$db->set_del(5);
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
You can use this module for accessing a note database. This is the dbm module.
|
||||
It uses the DB_FILE module to store it's data and it uses DBM files for tis purpose.
|
||||
|
||||
Currently, NOTEDB module is only used by note itself. But feel free to use it
|
||||
within your own project! Perhaps someone want to implement a webinterface to
|
||||
note...
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
please see the section SYNOPSIS, it says it all.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Thomas Linden <tom@daemon.de>.
|
||||
|
||||
|
||||
|
||||
=cut
|
||||
@@ -1,349 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
# $Id: mysql.pm,v 1.5 2000/06/25 19:50:43 scip Exp scip $
|
||||
# Perl module for note
|
||||
# mysql database backend. see docu: perldoc NOTEDB::binary
|
||||
#
|
||||
|
||||
use DBI;
|
||||
use strict;
|
||||
use Data::Dumper;
|
||||
|
||||
package NOTEDB;
|
||||
|
||||
BEGIN {
|
||||
# make sure, it works, although encryption
|
||||
# not supported on this system!
|
||||
eval { require Crypt::CBC; };
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
else {
|
||||
$NOTEDB::crypt_supported = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# Globals:
|
||||
my ($DB, $table, $fnum, $fnote, $fdate, $version, $cipher);
|
||||
$table = "note";
|
||||
$fnum = "number";
|
||||
$fnote = "note";
|
||||
$fdate = "date";
|
||||
$version = "(NOTEDB::mysql, 1.4)";
|
||||
|
||||
# prepare some std statements... #####################################################################
|
||||
my $sql_getsingle = "SELECT $fnote,$fdate FROM $table WHERE $fnum = ?";
|
||||
my $sql_all = "SELECT $fnum,$fnote,$fdate FROM $table";
|
||||
my $sql_nextnum = "SELECT max($fnum) FROM $table";
|
||||
my $sql_incrnum = "SELECT $fnum FROM $table ORDER BY $fnum";
|
||||
my $sql_search = "SELECT DISTINCT $fnum,$fnote,$fdate FROM $table WHERE $fnote LIKE ?";
|
||||
|
||||
my $sql_setnum = "UPDATE $table SET $fnum = ? WHERE $fnum = ?";
|
||||
my $sql_edit = "UPDATE $table SET $fnote = ?, $fdate = ? WHERE $fnum = ?";
|
||||
|
||||
my $sql_insertnew = "INSERT INTO $table VALUES (?, ?, ?)";
|
||||
|
||||
my $sql_del = "DELETE FROM $table WHERE $fnum = ?";
|
||||
my $sql_del_all = "DELETE FROM $table";
|
||||
######################################################################################################
|
||||
|
||||
sub new
|
||||
{
|
||||
# no prototype, because of the bin-version, which takes only a filename!
|
||||
my($this, $dbdriver, $dbname, $dbhost, $dbuser, $dbpasswd) = @_;
|
||||
|
||||
my $class = ref($this) || $this;
|
||||
my $self = {};
|
||||
bless($self,$class);
|
||||
my $database = "DBI:$dbdriver:$dbname;host=$dbhost";
|
||||
|
||||
$DB = DBI->connect($database, $dbuser, $dbpasswd) || die DBI->errstr();
|
||||
|
||||
# LOCK the database!
|
||||
my $lock = $DB->prepare("LOCK TABLES $table WRITE") || die $DB->errstr();
|
||||
$lock->execute() || die $DB->errstr();
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
sub DESTROY
|
||||
{
|
||||
# clean the desk!
|
||||
my $unlock = $DB->prepare("UNLOCK TABLES") || die $DB->errstr;
|
||||
$unlock->execute() || die $DB->errstr();
|
||||
$DB->disconnect || die $DB->errstr;
|
||||
}
|
||||
|
||||
sub version {
|
||||
return $version;
|
||||
}
|
||||
|
||||
sub no_crypt {
|
||||
$NOTEDB::crypt_supported = 0;
|
||||
}
|
||||
|
||||
sub use_crypt {
|
||||
my($this, $key, $method) = @_;
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$cipher = new Crypt::CBC($key, $method);
|
||||
};
|
||||
if($@) {
|
||||
$NOTEDB::crypt_supported == 0;
|
||||
}
|
||||
}
|
||||
else{
|
||||
print "warning: Crypt::CBC not supported by system!\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub get_single
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date);
|
||||
my $statement = $DB->prepare($sql_getsingle) || die $DB->errstr();
|
||||
|
||||
$statement->execute($num) || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($note, $date)) || die $DB->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
return ude($note), ude($date);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub get_all
|
||||
{
|
||||
my($this, $num, $note, $date, %res);
|
||||
my $statement = $DB->prepare($sql_all) || die $DB->errstr();
|
||||
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num, $note, $date)) || die $DB->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
$res{$num}->{'note'} = ude($note);
|
||||
$res{$num}->{'date'} = ude($date);
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
sub get_nextnum
|
||||
{
|
||||
my($this, $num);
|
||||
my $statement = $DB->prepare($sql_nextnum) || die $DB->errstr();
|
||||
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $DB->errstr();
|
||||
|
||||
while($statement->fetch) {
|
||||
return $num+1;
|
||||
}
|
||||
}
|
||||
|
||||
sub get_search
|
||||
{
|
||||
my($this, $searchstring) = @_;
|
||||
my($num, $note, $date, %res);
|
||||
if($NOTEDB::crypt_supported != 1) {
|
||||
$searchstring = "\%$searchstring\%";
|
||||
my $statement = $DB->prepare($sql_search) || die $DB->errstr();
|
||||
$statement->execute($searchstring) || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num, $note, $date))
|
||||
|| die $DB->errstr();
|
||||
while($statement->fetch) {
|
||||
$res{$num}->{'note'} = $note;
|
||||
$res{$num}->{'date'} = $date;
|
||||
}
|
||||
}
|
||||
else {
|
||||
my %res = $this->get_all();
|
||||
foreach $num (sort { $a <=> $b } keys %res) {
|
||||
$note = ude($res{$num}->{'note'});
|
||||
$date = ude($res{$num}->{'date'});
|
||||
if($note =~ /\Q$searchstring\E/i)
|
||||
{
|
||||
$res{$num}->{'note'} = $note;
|
||||
$res{$num}->{'date'} = $date;
|
||||
}
|
||||
}
|
||||
}
|
||||
return %res;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
sub set_edit
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
|
||||
my $statement = $DB->prepare($sql_edit) || die $DB->errstr();
|
||||
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute(uen($note), uen($date), $num) || die $DB->errstr();
|
||||
}
|
||||
|
||||
|
||||
sub set_new
|
||||
{
|
||||
my($this, $num, $note, $date) = @_;
|
||||
|
||||
my $statement = $DB->prepare($sql_insertnew) || die $DB->errstr();
|
||||
|
||||
$note =~ s/'/\'/g;
|
||||
$note =~ s/\\/\\\\/g;
|
||||
$statement->execute($num, uen($note), uen($date)) || die $DB->errstr();
|
||||
}
|
||||
|
||||
|
||||
sub set_del
|
||||
{
|
||||
my($this, $num) = @_;
|
||||
my($note, $date, $T);
|
||||
|
||||
($note, $date) = $this->get_single($num);
|
||||
|
||||
return "ERROR" if ($date !~ /^\d/);
|
||||
|
||||
# delete record!
|
||||
my $statement = $DB->prepare($sql_del) || die $DB->errstr();
|
||||
$statement->execute($num) || die $DB->errstr();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub set_del_all
|
||||
{
|
||||
my($this) = @_;
|
||||
my $statement = $DB->prepare($sql_del_all) || die $DB->errstr();
|
||||
$statement->execute() || die $DB->errstr();
|
||||
return;
|
||||
}
|
||||
|
||||
sub set_recountnums
|
||||
{
|
||||
my $this = shift;
|
||||
my(@count, $i, $num, $setnum, $pos);
|
||||
$setnum = 1;
|
||||
$pos=0; $i=0; @count = ();
|
||||
|
||||
my $statement = $DB->prepare($sql_incrnum) || die $DB->errstr();
|
||||
$statement->execute || die $DB->errstr();
|
||||
$statement->bind_columns(undef, \($num)) || die $DB->errstr();
|
||||
# store real id's in an array!
|
||||
while($statement->fetch) {
|
||||
$count[$i] = $num;
|
||||
$i++;
|
||||
}
|
||||
|
||||
# now recount them!
|
||||
my $sub_statement = $DB->prepare($sql_setnum) || die $DB->errstr();
|
||||
for($pos=0;$pos<$i;$pos++) {
|
||||
$setnum = $pos +1;
|
||||
$sub_statement->execute($setnum,$count[$pos]) || die $DB->errstr();
|
||||
}
|
||||
}
|
||||
|
||||
sub uen
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = pack("u", $cipher->encrypt($_[0]));
|
||||
};
|
||||
}
|
||||
else {
|
||||
$T = $_[0];
|
||||
}
|
||||
chomp $T;
|
||||
return $T;
|
||||
}
|
||||
|
||||
sub ude
|
||||
{
|
||||
my($T);
|
||||
if($NOTEDB::crypt_supported == 1) {
|
||||
eval {
|
||||
$T = $cipher->decrypt(unpack("u",$_[0]))
|
||||
};
|
||||
return $T;
|
||||
}
|
||||
else {
|
||||
return $_[0];
|
||||
}
|
||||
}
|
||||
|
||||
1; # keep this!
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
NOTEDB::mysql - module lib for accessing a notedb from perl
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# include the module
|
||||
use NOTEDB;
|
||||
|
||||
# create a new NOTEDB object (the last 4 params are db table/field names)
|
||||
$db = new NOTEDB("mysql","note","localhost","username","password","note","number","note","date");
|
||||
|
||||
# get a single note
|
||||
($note, $date) = $db->get_single(1);
|
||||
|
||||
# search for a certain note
|
||||
%matching_notes = $db->get_search("somewhat");
|
||||
# format of returned hash:
|
||||
#$matching_notes{$numberofnote}->{'note' => 'something', 'date' => '23.12.2000 10:33:02'}
|
||||
|
||||
# get all existing notes
|
||||
%all_notes = $db->get_all();
|
||||
# format of returnes hash like the one from get_search above
|
||||
|
||||
# get the next noteid available
|
||||
$next_num = $db->get_nextnum();
|
||||
|
||||
# recount all noteids starting by 1 (usefull after deleting one!)
|
||||
$db->set_recountnums();
|
||||
|
||||
# modify a certain note
|
||||
$db->set_edit(1, "any text", "23.12.2000 10:33:02");
|
||||
|
||||
# create a new note
|
||||
$db->set_new(5, "any new text", "23.12.2000 10:33:02");
|
||||
|
||||
# delete a certain note
|
||||
$db->set_del(5);
|
||||
|
||||
# turn on encryption. CryptMethod must be IDEA, DES or BLOWFISH
|
||||
$db->use_crypt("passphrase", "CryptMethod");
|
||||
|
||||
# turn off encryption. This is the default.
|
||||
$db->no_crypt();
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
You can use this module for accessing a note database. There are currently
|
||||
two versions of this module, one version for a SQL database and one for a
|
||||
binary file (note's own database-format).
|
||||
However, both versions provides identical interfaces, which means, you do
|
||||
not need to change your code, if you want to switch to another database format.
|
||||
|
||||
Currently, NOTEDB module is only used by note itself. But feel free to use it
|
||||
within your own project! Perhaps someone want to implement a webinterface to
|
||||
note...
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
please see the section SYNOPSIS, it says it all.
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Thomas Linden <tom@daemon.de>.
|
||||
|
||||
|
||||
|
||||
=cut
|
||||
@@ -1,517 +0,0 @@
|
||||
note 1.0.7 by Thomas Linden, 27/06/2000
|
||||
=======================================
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
This is a small console program written in
|
||||
perl, which allows you to manage notes similar
|
||||
to programs like "knotes" from commandline.
|
||||
|
||||
There are currently three different database backends,
|
||||
which you can use with note:
|
||||
o NOTEDB::binary - this is the default backend
|
||||
and uses a binary file to store your notes.
|
||||
o NOTEDB::mysql - this backend uses a mysql
|
||||
database to store your notes. You can switch
|
||||
easily to another DBMS since this module uses
|
||||
the Perl standard module "DBI" for database-
|
||||
access. See below for more info on this topic!
|
||||
o NOTEDB::dbm - this module uses two DBM files
|
||||
for data storage and requires the module DB_FILE,
|
||||
which is part of the perl standard distribution.
|
||||
See below for more details about the DBM module.
|
||||
|
||||
|
||||
|
||||
Where to get?
|
||||
=============
|
||||
|
||||
By now at
|
||||
http://www.daemon.de/software.html
|
||||
or
|
||||
ftp://www.0c49.org/pub/scip/note/
|
||||
|
||||
You may also try your nearest tucows mirror.
|
||||
|
||||
|
||||
|
||||
|
||||
Features
|
||||
========
|
||||
|
||||
o Three different database backends, mysql(DBI), dbm, binary(bin file).
|
||||
o Commandline interface using the standard perl module
|
||||
Getopt::Long, which allows you to use short or long
|
||||
command-line options.
|
||||
o Interactive interface(pure ascii), the following functions
|
||||
are available in interactive mode: list, display, topic,
|
||||
delete, edit, help.
|
||||
o Highly confiurable using a perlish configfile ~/.noterc.
|
||||
although it is configurable it is not required, note can
|
||||
run without a configfile using useful default presets.
|
||||
o Colourized output is supported using ASCII Escape-Sequences.
|
||||
o The user can customize the color for each item.
|
||||
o Data can be stored in various different database backends,
|
||||
since all database access is excluded from the program itself
|
||||
in perl modules.
|
||||
o Notes can be deleted, edited and you can search trough your notes.
|
||||
o Notes can be categorized. Each category(topic) can contain multiple
|
||||
notes and even more sup-topics. There is no limitation about
|
||||
sub topics.
|
||||
o You can view all notes in a list and it is possible only to view
|
||||
notes under a certain topic.
|
||||
o There is a tree-view, which allows you to get an overview of your
|
||||
topic-hierarchy.
|
||||
o Notes can be encrypted using DES or IDEA algorythms and Crypt::CBC.
|
||||
o You can dump the contents of your note database into a plain text
|
||||
file, which can later be imported. Imports can be appended or it can
|
||||
overwrite an existing database (-o).
|
||||
o Note has scripting capabilities, you can create a new note by piping
|
||||
another commands output to note, you can also import a notedump from
|
||||
stdin as well es duming to stdout instead a file. Additional, there
|
||||
is an option --raw available, which prints everything out completely
|
||||
without formatting.
|
||||
o It can be installed without root-privileges.
|
||||
o Last, a while ago a user stated: "... it simply does, what it says ..."
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
You need the following things:
|
||||
o perl installed (5.004x)
|
||||
o The module IO::Seekable and Fcntl, which should be
|
||||
already installed with your perl distributuion if
|
||||
you want to use the binary database backend.
|
||||
o DBI module and DBI::mysql if you want to use the
|
||||
mysql database backend.
|
||||
o The module DB_FILE if you want to use the DBM module.
|
||||
o Getopt::Long (part of perl std ditribution)
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
Unpack the tar-ball and issue the command:
|
||||
$ perl Makefile.PL
|
||||
It will ask you a few questions about file destinations.
|
||||
The script will find itself the proper destinations for
|
||||
the files. So, if you agree with it, simply press ENTER.
|
||||
However, you may decide to use other destinations. In this
|
||||
case, enter it, when asked. This maybe usefull, if you are
|
||||
installing it in your ome-directory and if you are not root!
|
||||
|
||||
For installation instructions for the mysql database installation
|
||||
see mysql/README.
|
||||
|
||||
If want to use another SQL database, i.e. postgresql then set
|
||||
the option "DbDriver" to the name of the responding DBI-driver
|
||||
and create a symlink of this name like this:
|
||||
/usr/lib/perl5/siteperl/NOTEDB $ ln -s mysql.pm oracle.pm
|
||||
The functionality is the same, but not the name!
|
||||
|
||||
The default binary file backend does not need any special installation
|
||||
procedure, you need only to spceify a filename in your config file.
|
||||
|
||||
The DBM backend(NOTEDB::dbm) requires the existence of a directory,
|
||||
which you must specify in your config using the option "DbName".
|
||||
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
This version of note doesn't neccessarily need
|
||||
a configuration file. But you can have one and change
|
||||
some default values. Take a look to the file config/noterc
|
||||
provided with this tarball. There are detailed instructions
|
||||
about every available parameter.
|
||||
Simply copy this file into your home-directory and name it
|
||||
.noterc
|
||||
If you decide not to use the default database backend (a binary
|
||||
file), you will *need* a configuration!
|
||||
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
If you don't know, how to run note, try "note -h" first.
|
||||
It will tell you all available commandline options.
|
||||
|
||||
To create a new note, simply run "note". You can enter
|
||||
the note (the length is by default limited to 4096 bytes,
|
||||
which you can change from your config file if you are using
|
||||
the binary backend, therwise there is no limitation).
|
||||
End by typing a . on a line itself. note will tell you the
|
||||
number of the note.
|
||||
|
||||
If you want to view the note, type "note 1", if the notenumber
|
||||
was 1.
|
||||
|
||||
If you want to get an overview of all notes, type "note -l".
|
||||
You will get a list of all notes, containing the number,
|
||||
the first line and the creation date. If topic-support is
|
||||
turned on (which is by default), then all subtopics under the
|
||||
current topic will be displayed first.
|
||||
If you want to get a listing of all
|
||||
If you want to see the timestamps, use "-L" instead of "-l".
|
||||
Read more about topics below in the section "Topics".
|
||||
You can also specify the topic which notes you want to see:
|
||||
"-l mytopic" does the trick.
|
||||
Additional, you might want to get an overview of your topic-
|
||||
strcture. You can use the command "-t" in this case, which
|
||||
will display a tree-view of your tpic-structure. You can
|
||||
use the command "-T" if you want to see the notes under each
|
||||
topic too. "-T" will also show the number of each note.
|
||||
|
||||
To edit a certain note, type "note -e 1". It will invoke your
|
||||
editor (vi or pico). You can edit it, after saving, note
|
||||
will store the changed note to the database.
|
||||
|
||||
Of course you can drop a certain note: "note -d 1" deletes
|
||||
note number 1. If a note in the middle or the beginning of
|
||||
the database will be deleted, note will recount the other
|
||||
existent notes. For example there are 3 notes, number 1, 2
|
||||
and 3. If you delete number 2, then number 3 will become
|
||||
number 2.
|
||||
You can also make use of the extended delete-syntax:
|
||||
To delete note 1 and 2, use "-d 1,2"
|
||||
To delete note 1,2 and 3, use "-d 1-3".
|
||||
|
||||
If you cannot remember, which note you are looking for, you
|
||||
can use the search capability of note: "note -s <searchstring>".
|
||||
note will search the whole note database case insensitive for
|
||||
an occurence of this string and tell you the number and first-
|
||||
line it have.
|
||||
|
||||
Instead of using note from the commandline you can use the
|
||||
interactive mode. Run note with "note -i". If you need assistance
|
||||
type "?" or "h" at the ">" prompt. The interactive mode
|
||||
provides you the most functions of note.
|
||||
|
||||
You can also dump the contents of your note-database into a
|
||||
ASCII-textfile(-D). You can use this file later to import it into
|
||||
your note-database(-I). This is usefull, if you want quickly trans-
|
||||
fer your notes from one host to another (i.e. you could mail
|
||||
your note-dump form your office to home and import it there
|
||||
for further use).
|
||||
The dumps from the two versions of note are in the same format.
|
||||
Using dumps it is also possible to reinitialize your database. You
|
||||
can use the "-o" switch whcih causes note to overwrite your existing
|
||||
database. This is very handy if you changed heavily your config. And
|
||||
it is required, if you changed: encryption, db-driver, (binary-format)
|
||||
and the password. You can use the following command for reinitializing:
|
||||
$ note -D - | note -o -I -
|
||||
What the hell, does it?! Step by step:
|
||||
o "note -D -" creates a note-database dump and prints it out
|
||||
to stantdard output.
|
||||
o "|" this is the shell's pipe command. It takes the output
|
||||
of the left program and gives it to the right program as standard
|
||||
input.
|
||||
o "note -o -I -" imports a note-database dump from standard input
|
||||
and overwrites an existing database.
|
||||
Before you use the "-o" switch, I consider yuo to make a backup!
|
||||
|
||||
|
||||
|
||||
|
||||
Topics
|
||||
======
|
||||
|
||||
If topic-support is turned on (which is by default), the various
|
||||
notes are sorted under various topics. There is no special database
|
||||
field for the topic. Instead the topic will be stored right in the
|
||||
note.
|
||||
If the first line of your note contains some text bordered by slashes
|
||||
(or whatever you prefer, set "TopicSeparator" in your config! default is slash),
|
||||
then note will consider it as the topic of this certain note. For examle:
|
||||
/TodoList/
|
||||
If you are using topics, no data after the topic is allowed, if there
|
||||
is any text, note will consider it as a subtopic! Therefore, don't for-
|
||||
get to put a newline after the topic-line.
|
||||
|
||||
If you are in interactive mode, you can "cd" to a different note simply
|
||||
by typing it's name at the command-prompt, or you can use the well-known
|
||||
syntax "cd topic".
|
||||
The list-command will only show you notes under this topic. If you create
|
||||
a new note, it will automagically inserted under the current topic (note
|
||||
will prepend the string "/topicname/" to the text of your note).
|
||||
|
||||
You can create at any time from any point a new topic. Just create a new
|
||||
note and type the name of the new topic bordered by slashes (or TopicSeparator)
|
||||
at the first line of this note. After saving, there will be available a
|
||||
new topic with one note in it.
|
||||
|
||||
You can create as many subtopics as you like, the format is similar to a
|
||||
filesystem-path. An example, say, you want to create such a structure:
|
||||
|
||||
(root - top level)
|
||||
|
|
||||
|----test
|
||||
| |----subtopic
|
||||
| | |--note 1
|
||||
| | |--note 2
|
||||
| |
|
||||
| |--note 4
|
||||
|
|
||||
|--note 3
|
||||
|
||||
Then you may create those 4 new notes:
|
||||
--- snip ---
|
||||
/test/subtopic/
|
||||
note 1
|
||||
--- snip ---
|
||||
/test/subtopic/
|
||||
note 2
|
||||
--- snip ---
|
||||
note 3
|
||||
--- snip ---
|
||||
/test/
|
||||
note 4
|
||||
--- snip ---
|
||||
|
||||
I hope, you got the point ;-)
|
||||
|
||||
|
||||
|
||||
If a note does not contain the "magic" /topic/ construction on the first
|
||||
line, it will be listed under the "root" of note, that is the point you are
|
||||
at the startup of note.
|
||||
|
||||
You can subsequently move a note without a topic to a certain topic. Simply
|
||||
edit it and insert at the first line the above mentioned construction.
|
||||
|
||||
Note: Please don't forget the prepending and appending a slash of a topic.
|
||||
You will get strange results without it!
|
||||
|
||||
|
||||
|
||||
|
||||
Formatting of notes
|
||||
===================
|
||||
|
||||
Another very nice feature is the possibility to format the note-text (as much as
|
||||
shell allows it). First, you can use the note-internal "magic-strings" for color-
|
||||
izing. Those strings looks much like HTML:
|
||||
"<green>here is a green line of text</green> no more green."
|
||||
As you see, the beginning of another color starts with a tag(kinda) of the color
|
||||
<colorname> and ens with an end tag </colorname>.
|
||||
|
||||
The following colors are available:
|
||||
black, red, green, yellow, blue, magenta, cyan and white.
|
||||
|
||||
Beside colorizing text, you can also create bold or underlined text! If you decide
|
||||
to use this (additional) feature, you need to set the Config-Option "FormatNotes"
|
||||
to 1 which turns it on.
|
||||
Usage is very straightforward, if a word (a word is defined as some text with at least
|
||||
one space surrounded) is between a magic mark-character. Here are the available
|
||||
things, you can do:
|
||||
|
||||
bold: **word**
|
||||
underlined: __word__
|
||||
inverse: {{word}}
|
||||
|
||||
The text will be formatted using the actually note-color.
|
||||
|
||||
|
||||
|
||||
|
||||
Scripting
|
||||
=========
|
||||
|
||||
Since version 1.0.3 there are some additions which allows you to use note in
|
||||
scripts, without user-interaction. You might run a special script as cronjob,
|
||||
which adds a note under a certain topic every week. Or the like.
|
||||
|
||||
Here are the possibilies you have:
|
||||
|
||||
You can add a new note through a pipe, another commands output becomes
|
||||
note's input:
|
||||
$ cat /var/spool/news/daily | note -
|
||||
This command adds the content of a file "daily" as a new note. Note the dash.
|
||||
it stands for "Standard Input". Note will be completely silent and it will not
|
||||
ask for something.
|
||||
|
||||
Suppose you are using encryption. You might wonder, how note will get your
|
||||
passphrase? The solution: You need to set up an environment variable which
|
||||
contains the password:
|
||||
$ export NOTE_PASSWD=secret
|
||||
If the variable is present, note will not ask you for a passphrase!
|
||||
|
||||
Another thingy you might find useful is the -r (--raw) command-line flag. This
|
||||
turns note into raw mode , which means it will only print the
|
||||
data without any formatting. Raw mode is available for list and display,
|
||||
since it makes no sense, interactive mode doe not support raw mode.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Format of the notedb (binary backend)
|
||||
=====================================
|
||||
|
||||
The database where the notes are stored is a binary fixed record length file
|
||||
of the following format:
|
||||
It consists of three fixed length fields per entry. The fields
|
||||
have the following types:
|
||||
o Number: Integer (1 byte)
|
||||
o Note: String (default 1024 bytes)
|
||||
o Time: String (default 64 bytes)
|
||||
You can change the sizes of the fields "Note" and "Time" in
|
||||
the configfile "~/.noterc". If it does not exist, the above
|
||||
defaults will be used.
|
||||
If the data to be stored is smaller then the size of the field,
|
||||
it will be filled with ZERO's ("\0"). The Note and the Time
|
||||
fields will be uuencoded before storage. Of course, this is
|
||||
no security, never mind...
|
||||
|
||||
|
||||
|
||||
The note-database (mysql backend)
|
||||
=================================
|
||||
|
||||
The sql-database for the mysql version has the following design:
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
| number | int(10) | | PRI | 0 | auto_increment |
|
||||
| note | text | YES | | NULL | |
|
||||
| date | text | YES | | NULL | |
|
||||
+--------+---------+------+-----+---------+----------------+
|
||||
|
||||
|
||||
|
||||
Format of the ASCII-dump file (note -D)
|
||||
=======================================
|
||||
|
||||
The dump of a note-database (if you use note -D) has the following
|
||||
format:
|
||||
|
||||
--- snip ---
|
||||
Number: 1
|
||||
Timestamp: 14.01.2000 00:25:01
|
||||
This is a sample text
|
||||
in a sample note.
|
||||
|
||||
Number: 2
|
||||
Timestamp: 14.01.2000 02:37:40
|
||||
And this is another sample
|
||||
of a note.
|
||||
--- snip ---
|
||||
|
||||
You can reimport a dump into your note-database with "note -I <file>"
|
||||
Existing notes will not overwritten, note will append the imported
|
||||
data to your note-database.
|
||||
|
||||
|
||||
|
||||
|
||||
Security
|
||||
========
|
||||
|
||||
If you are using the MySQL driver, refer to the mysql
|
||||
manual for more informations about security of mysql databases:
|
||||
http://www.mysql.org/Manual_chapter/manual_Privilege_system.html
|
||||
|
||||
If you are using notes proprietary binary driver, then
|
||||
the permission 0600 of the file "~/.notedb" is strongly required!
|
||||
|
||||
Additional, you can turn on encryption from the config file.
|
||||
Simply set UseEncryption to 1. Please note, that you need
|
||||
to decide, if you want to use encryption before the first use
|
||||
of note! If have already a note database and want to "migrate"
|
||||
to encryption, I suggest you to follow the directions in the
|
||||
file UPGRADE!
|
||||
|
||||
You can choose from different encryption algorythms. The default
|
||||
is IDEA, but DES or BLOWFISH is also possible. You need to have
|
||||
installed the following additional perl-modules on your system:
|
||||
MD5
|
||||
Crypt::IDEA
|
||||
Crypt::DES
|
||||
Crypt::CBC
|
||||
|
||||
After turning on encryption, note will ask you for a passphrase
|
||||
everytime it runs! It will *not* store this passphrase!
|
||||
So, don't forget it! Be careful!
|
||||
|
||||
Once note have encrypted some data using this passphrase, you
|
||||
cannot simply switch to another passphrase, because all data
|
||||
within the database needs to be encrypted using the same passphrase!
|
||||
If you want to change the passphrase for any reason, please read
|
||||
the file UPGRADE and follow it's directions!
|
||||
Someday I will add a "change passwd" function, which will do all
|
||||
these things for you. Someday, I said...
|
||||
For now you can use the "re-initialze database" functionality, mentioned
|
||||
earlier in the "Usage" section (at the end of the section).
|
||||
|
||||
Note: To make sure, the encrypted data can be stored properly,
|
||||
it will be uuencoded after encryption.
|
||||
|
||||
Note: *If* you forgot your passphrase and *if* you don't have
|
||||
a backup of your database without encryption, PLEASE
|
||||
don't bother me with "helpme" emails! If you don't know
|
||||
the phrase, then the data can't be decrypted. Even if it
|
||||
is possible - I am not responsible for that!
|
||||
|
||||
Note: How does note know, if the passphrase was incorrect? It uses the
|
||||
specified phrase and encodes at least one note (the first one)
|
||||
and checks if the decrypted timestamp field matches the following
|
||||
expression: "^\d+\.\d+". Translated from perl to human:
|
||||
the timestamp must begin with minimum one digit (possibly more),
|
||||
followed by one dot, followed by minimum one digit (possibly more).
|
||||
Chances are bad, that a wrong passphrase will cause a timestamp
|
||||
matching the rule above. If you have other experiences, please
|
||||
drop me a mail!
|
||||
|
||||
|
||||
Comments
|
||||
========
|
||||
|
||||
You can send any comments to Thomas Linden <tom@daemon.de>.
|
||||
If you find a bug or if you have a suggestion for improvement of the script
|
||||
feel free to send me a patch ;-)
|
||||
|
||||
|
||||
|
||||
License
|
||||
=======
|
||||
|
||||
This script comes with absolutely NO WARRANTY. It is distributed under the
|
||||
terms of the GNU General Public License. Use it at your own risk :-)
|
||||
You can read the complete GPL at: http://www.gnu.org/copyleft/gpl.html
|
||||
|
||||
|
||||
|
||||
Author and Copyright
|
||||
====================
|
||||
|
||||
The author is Thomas Linden.
|
||||
note is Copyright of Thomas Linden.
|
||||
|
||||
|
||||
|
||||
|
||||
Contributors / Credits
|
||||
======================
|
||||
|
||||
Shouts to those guys who helped me to enhance note: THANKS A LOT!
|
||||
|
||||
Jens Heunemann <jens.heunemann@consol.de> - sub tree.
|
||||
Peter Palmreuther - various additions.
|
||||
|
||||
And many other people who sended bug reports, feature requests. If you feel that
|
||||
I forgot your name in this list, then please send me an email and I'll add you.
|
||||
|
||||
|
||||
|
||||
Last changed
|
||||
============
|
||||
|
||||
27/06/2000
|
||||
@@ -1,73 +0,0 @@
|
||||
1.0.5 important note upgrade information
|
||||
========================================
|
||||
|
||||
If you are upgrading from previous versions of note, you
|
||||
will need to create a new config file, since the format of
|
||||
that file has completely changed!
|
||||
|
||||
Take a look at the sample in config/noterc for details.
|
||||
|
||||
note will NOT work with an existing database and an old config.
|
||||
You have to create a new config based on your old settings.
|
||||
|
||||
|
||||
Please don't forget to make a backup of your database before
|
||||
upgrading! I am not responsible for data loss!
|
||||
|
||||
I told ya...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thomas Linden <tom@daemon.de>
|
||||
READ THIS FILE, IF YOU ARE UPGRADING FROM 0.9 TO 1.0.x
|
||||
======================================================
|
||||
|
||||
|
||||
In any case: BACKUP your existing note database!!!!!!!
|
||||
The format has not changed, but some default values
|
||||
(see the new config file-sample). Use this command
|
||||
to save your note database with your *old* version
|
||||
of note:
|
||||
"note -D"
|
||||
This works with both the mysql and the binary version.
|
||||
|
||||
You need to reedit your configfile. Please refer to the
|
||||
sample config in config/noterc.
|
||||
|
||||
======================================================
|
||||
|
||||
This version of note has now encryption support build in.
|
||||
If you decide to use it, you need to re-initialize your
|
||||
note database. That's why, because your current database
|
||||
is unencrypted and *if* you want to secure your data, you
|
||||
need to secure everything. That means, your existing data
|
||||
must be encrypted before you can use this new capability!
|
||||
|
||||
Follow this steps:
|
||||
o backup existing db:
|
||||
$ note -D
|
||||
o backup the db:
|
||||
$ cp .notedb .notedb.save
|
||||
or (for mysql users!):
|
||||
$ cp -r /usr/local/mysql/data/notedb ~/notedb.mysql.save
|
||||
o go into note and delete all existing notes:
|
||||
$ note -d 1-20 (or however)
|
||||
o now upgrade your note installation:
|
||||
$ perl Makefile.PL; make install
|
||||
o re-configure note. Turn $USE_CRYPT on by setting it
|
||||
to "YES".
|
||||
o re-initialize your database:
|
||||
$ note -I note.dump.2323 (or whatever)
|
||||
note will prompt you for a passphrase. It will be used
|
||||
by Crypt::CBC for encrypting your data.
|
||||
From now on, your data is encrypted. You will need the passphrase
|
||||
you set above for decrypting it! So - don't forget it!
|
||||
|
||||
======================================================
|
||||
|
||||
AGAIN: YOU HAVE BEEN WARNED! DO NOT UPGRADE WITHOUT MADE A
|
||||
BACKUP OF YOUR DATABASE! I AM NOT RESPONSIBLE IF YOU
|
||||
LOOSE DATA!
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1.0.6
|
||||
1662
note-1.0.7/bin/note
@@ -1,148 +0,0 @@
|
||||
# 1.0.6 -*- sh -*-
|
||||
# This is a sample config for the note script
|
||||
# There are useful defaults set in note itself.
|
||||
#
|
||||
# Copy it to your $HOME as .noterc
|
||||
#
|
||||
# note is Copyright (c) 1999-2000 Thomas Linden.
|
||||
# You can contact me per email: <tom@daemon.de>
|
||||
#
|
||||
# comments start with #, empty lines will be ignored.
|
||||
# 1 turns an option on, 0 turns it off.
|
||||
# An option consists of an atribute-value pair separated
|
||||
# by minimum one space (more spaces and/or tabs are allowed)
|
||||
|
||||
|
||||
# Your home directory, better do not change it!
|
||||
# can be an environment variable or a path
|
||||
Home $ENV{'HOME'}
|
||||
|
||||
|
||||
# specify the path, where the NOTEDB lib directory
|
||||
# resides. This will only used if it is not
|
||||
# installed inside the perl-lib directory structure!
|
||||
LibPath /usr/local/lib
|
||||
|
||||
|
||||
# you need to decide which database backend you want
|
||||
# to use. Please refer to the corresponding documentation
|
||||
# for closer information about the certain backend!
|
||||
# Currently supported types: "binary", "dbm" or "mysql".
|
||||
# You must also edit/uncomment one section below for the
|
||||
# backend you want to use!
|
||||
DbDriver binary
|
||||
|
||||
|
||||
# backend specific settings for sql backend
|
||||
#DbHost localhost
|
||||
#DbUser you
|
||||
#DbPasswd
|
||||
#DbName mynotes
|
||||
#DbTable note
|
||||
#FieldNumber number
|
||||
#FieldNote note
|
||||
#FieldDate date
|
||||
#### specific end ###
|
||||
|
||||
|
||||
# backend specific settings for binary(default) backend
|
||||
NoteDb ~/.notedb
|
||||
# Define the maximum bytes fields can have in a
|
||||
# note-entry. Do not change MaxTimeByte to less than 64!
|
||||
|
||||
MaxNoteByte 4096
|
||||
MaxTimeByte 64
|
||||
#### specific end ###
|
||||
|
||||
|
||||
# backend specific settings for DBM backend
|
||||
# this must be an existing directory!
|
||||
#DbName /home/you/.notedbm
|
||||
#### specific end ###
|
||||
|
||||
# You can use encryption with note, that means notes and
|
||||
# timestamps will be stored encrypted. This is supported
|
||||
# by every db-backend.
|
||||
# Set to 1 to turn it on. The Default is 0 (off)
|
||||
UseEncryption 0
|
||||
|
||||
# Specify the encryption protocol. The appropriate perl
|
||||
# module needs to be installed. Possible velues are
|
||||
# IDEA, DES or BLOWFISH, the default is IDEA.
|
||||
CryptMethod IDEA
|
||||
|
||||
|
||||
# You can run note always in interactive mode by simply
|
||||
# typing "note". Set this option to 1 to turn it on.
|
||||
# The default is 0 (off).
|
||||
AlwaysInteractive 0
|
||||
|
||||
|
||||
# In interactive mode, note issues a list command if you
|
||||
# simply hit enter. By turning this on, it will issue a
|
||||
# longlist command instead if you hit just enter.
|
||||
# The default is 0 (off)
|
||||
DefaultLong 0
|
||||
|
||||
|
||||
|
||||
# You can use an external editor everytime from note instead
|
||||
# of STDIN for creating new notes. Set to 1 to turn it on.
|
||||
# The default is 0 (off).
|
||||
AlwaysEditor 0
|
||||
|
||||
|
||||
# uncomment and edit it, if you want to use another
|
||||
# editor than the default $EDITOR or as fallback vi.
|
||||
#PreferredEditor emacs
|
||||
|
||||
|
||||
# If you dont prefer that note updates the timestamp of a
|
||||
# note after editing, turn this on. It will
|
||||
# keep the original timestamp if this option is set.
|
||||
# The default is 0(off), to turn it on set to 1.
|
||||
KeepTimeStamp 0
|
||||
|
||||
|
||||
# You can specify your own topic separator here.
|
||||
# the default topic separator is a normal slash: "/"
|
||||
# see README for details about topics!
|
||||
TopicSeparator /
|
||||
|
||||
|
||||
# The maximum width for displaying a note, in CHARS.
|
||||
# Depends on your screen-size. You can set it to
|
||||
# "auto", if you wish that note sould determine the
|
||||
# available size, but it experimental, be aware!
|
||||
MaxLen 30
|
||||
|
||||
|
||||
# note can use colors for output, set this option to
|
||||
# 1, if you don't want it, or if your terminal does
|
||||
# not support it, set to 0. The default is 1 (on).
|
||||
UseColors 1
|
||||
|
||||
|
||||
# Color-definitions of the various items. Will only
|
||||
# take effect, if "UseColors" is turned on!
|
||||
BorderColor BLACK
|
||||
NumberColor blue
|
||||
NoteColor green
|
||||
TimeColor black
|
||||
TopicColor BLACK
|
||||
# The following colors are available:
|
||||
# black, red, green, yellow, blue, magenta, cyan and white.
|
||||
# for bold color write it uppercase (BLACK will be bold black)
|
||||
# for underlined color append an underscore (blue_ will be underlined blue)
|
||||
# for inverted color append an "I" (greenI will be inverted green)
|
||||
|
||||
|
||||
# Additional to colors, you can also do a little bit of formatting your
|
||||
# notes (bold, underlined, italic), see README!
|
||||
# You need to set this Option to 1, if you decide to make use of this
|
||||
# capabily
|
||||
FormatText 1
|
||||
|
||||
# That's all about it for now.
|
||||
# If you still have any questiosn, please feel free to contact
|
||||
# me by email: Thomas Linden <tom@daemon.de>
|
||||
@@ -1,62 +0,0 @@
|
||||
README for the mysql database installation for note
|
||||
|
||||
Requirements
|
||||
============
|
||||
|
||||
You need the following things:
|
||||
o perl installed (5.004x)
|
||||
o mysql database installed and running
|
||||
o Mysql perlmodule (you can find it on
|
||||
http://www.mysql.org) PLEASE NOTE:
|
||||
It needs the Module "Mysql". The install.sh
|
||||
script will install it for you directly from
|
||||
CPAN if you like. Newer versions
|
||||
are DBI, which you can also use to access
|
||||
mysql databases. If you want to use it, you
|
||||
have to rewrite the program. Please let me
|
||||
know, if you did it :-)
|
||||
o permissions to create a new database and
|
||||
to write data to this database.
|
||||
|
||||
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
First, make sure all these things above are ok.
|
||||
You can use the script "install.sh" to create a new
|
||||
database and the table structure. You might edit
|
||||
the script before running it.
|
||||
|
||||
If you are getting trouble, i.e. if you have not the
|
||||
required permissions to do that, please make sure,
|
||||
you can.
|
||||
As user root, you have to give your user the
|
||||
neccessary permissions. Please refer to the mysql
|
||||
documentation, how to do that.
|
||||
After that repeat the step above.
|
||||
|
||||
You can find a sample config file within the subdirectory
|
||||
"config" named noterc. There are some special values
|
||||
which you can use to connect to a different database
|
||||
then the default.
|
||||
install.sh will create the following database:
|
||||
name: user_note
|
||||
Maintable: note
|
||||
Number: number(int 10)
|
||||
Note: note(text)
|
||||
Date: date(text)
|
||||
|
||||
You can use the file "permissions" as a template for
|
||||
modifying a users permissions to her database. Please
|
||||
note, that there are different version of mysql out
|
||||
there with different access privilege systems, which
|
||||
are not compatible, refer to the documentation shipped
|
||||
with your mysql installation to learn, how many fields
|
||||
are available and what they are for.
|
||||
|
||||
You may also take a look to:
|
||||
http://www.mysql.org/Manual_chapter/manual_Privilege_system.html
|
||||
|
||||
|
||||
This should be all.
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/sh
|
||||
# installs note
|
||||
# This is the installer for the mysql version only!
|
||||
|
||||
echo "Welcome to note `cat VERSION` installation."
|
||||
echo "the install script will ask you a view questions,"
|
||||
echo "make sure to answer them correctly!"
|
||||
echo
|
||||
|
||||
/bin/echo -n "creating the note database..."
|
||||
NAME="_note"
|
||||
DBNAME="$USER$NAME"
|
||||
echo "DBNAME=$DBNAME"
|
||||
mysqladmin create $DBNAME
|
||||
echo "done."
|
||||
/bin/echo -n "creating the table structure using defaults..."
|
||||
mysql $DBNAME < sql
|
||||
|
||||
echo "Shall I try to install the required MySQL driver from CPAN?"
|
||||
read YESNO
|
||||
|
||||
case $YESNO in
|
||||
"y" | "Y")
|
||||
if [ $UID != 0 ] ; then
|
||||
echo "You should be root for that!"
|
||||
exit
|
||||
fi
|
||||
perl -MCPAN -e shell cpan> install mysql
|
||||
;;
|
||||
esac
|
||||
echo "done."
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
insert into user values
|
||||
('localhost','','','Y','Y','Y','Y','Y','Y','N','N','N','N','N','N','N','Y');
|
||||
@@ -1,8 +0,0 @@
|
||||
CREATE TABLE note (
|
||||
number int(10) DEFAULT '0' NOT NULL auto_increment,
|
||||
note text,
|
||||
date text,
|
||||
PRIMARY KEY (number)
|
||||
);
|
||||
# sample grant statement:
|
||||
#GRANT ALL PRIVILEGES ON tom_note TO tom@localhost IDENTIFIED BY 'password';
|
||||
1639
note-1.0.7/note
@@ -1,55 +0,0 @@
|
||||
#!/bin/sh
|
||||
# create notes with topics which then represents the corresponding
|
||||
# directory structure. Depending on how many files the directory
|
||||
# contains, the resulting note-database may become very large.
|
||||
# It will then have thousands of notes!
|
||||
STARTDIR=$1
|
||||
case $STARTDIR in
|
||||
"")
|
||||
echo "usage: stresstest.sh <directory>"
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
LOCPFAD=`echo $STARTDIR | grep "^[a-zA-Z0-9.]"`
|
||||
case $LOCPFAD in
|
||||
"")
|
||||
#echo nix
|
||||
;;
|
||||
*)
|
||||
STARTDIR=`echo $STARTDIR | sed 's/^\.*//'`
|
||||
STARTDIR="`pwd`/$STARTDIR"
|
||||
STARTDIR=`echo $STARTDIR | sed 's/\/\//\//g'`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
stress ()
|
||||
{
|
||||
FILES=""
|
||||
for file in `ls $1|sort`
|
||||
do
|
||||
echo "$1/$file"
|
||||
if [ -d "$1/$file" ] ; then
|
||||
stress "$1/$file"
|
||||
else
|
||||
#echo "$1/" > /tmp/$$
|
||||
#echo $file >> /tmp/$$
|
||||
#`cat /tmp/$$ | note -`
|
||||
FILES="$FILES $file"
|
||||
fi
|
||||
done
|
||||
echo "$1/" > /tmp/$$
|
||||
echo "$FILES" >> /tmp/$$
|
||||
case $FILES in
|
||||
"")
|
||||
;;
|
||||
*)
|
||||
RES=`cat /tmp/$$ | note -`
|
||||
;;
|
||||
esac
|
||||
FILES=""
|
||||
}
|
||||
|
||||
stress $STARTDIR
|
||||