Item12839: require authentication for rest handler

also:

- fixed use of uninitialized variable
- fixed returned output 

TODO: 
- this plugin should split its code into a separate Core.pm 
- fix the way Foswiki::cfg is read using good defaults
- ignore igp_ and genpdf_ files in pub by default
- provide a way to only update attachments to a single topic, not all of a web



git-svn-id: http://svn.foswiki.org/trunk@17534 0b4bb1d4-4e5a-0410-9cc4-b2b747904278