Nailblog-2.x by Martin Wikström
http://www.waxjism.org/nail/

Content ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

User documentation
 * About
 * Installation
 * Changelog

API documentation
 * Core PHP functions
 * Core PHP variables
 * Core CSS classes
 * Core JavaScript functions
 * Core JavaScript variables

About ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The Nailblog is a simple modular content management system which
only depends on php to function. It is suitable for small sites
with no access to a database.

Installation ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 * Extract the files in public_html or document root or any
   place reachable through the web server.
 * Create a folder for generated data files anywhere and grant
   the web server write access to it.
 * Edit the file nailblog/sets.php and set the variable
   $nailblog_data to point to the created folder.
 * Browse to index.php and log in using username="admin" and
   password="admin".

Notes:
 * Readme's for modules are found in the module directory.
 * In case of a module conflict the system will be rendered
   unusable and you can't login unless it is in safe mode.
   To enable safe mode goto the page "?safemode=1". In safe mode
   you can disable the conflicting module on page
   "?act=admin&open=system".

Changelog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Milestones for beta4
 * A blog module.
 * A links module.

Milestones for beta3
 * A page module.
 * A file manager.

090806-nailblog-2.0.0-beta2
 * nailblog/nailblog.php
   Changed $nailblog_version to "2.0.0-beta2".
 * nailblog/modules/data.php
   Added translations to the data module.
   Created function data_getrow($entryid) which returns parsed
   rowdata.
   Added support for translated content.
 * nailblog/modules/data.en.lang
   Added english translations for the data module.
 * nailblog/modules/data.sv.lang
   Added swedish translations for the data module.
 * nailblog/modules/menu.php
   Added support for translated content.
 * nailblog/modules/data.txt
   Updated the documentation.
 * nailblog/modules/system.php
   Created function system_main() for replacing the site title,
   header and footer with translated content when available.
   Added support for translated content.
 * nailblog/modules/system.txt
   Updated the documentation.
 * nailblog/templates/default/template.php
   Added the <title> tag which displays $nailblog_title in the
   page title.

090716-nailblog-2.0.0-beta1
 * nailblog/modules/user.php
   Continued work on the translations.
 * nailblog/modules/user.en.lang
   Continued work on the translations.
 * nailblog/modules/user.sv.lang
   Added swedish translations for the user module.
 * nailblog/modules/menu.php
   Added translation support to the menu module.
 * nailblog/modules/menu.en.lang
   Added english translations for the menu module.
 * nailblog/modules/menu.sv.lang
   Added swedish translations for the menu module.

090712-nailblog-2.0.0-beta1
 * nailblog/core.php
   Added variable $nailblog_lang which tells the system which
   language is in use.
   Added a row for default language (row 8) to system.txt.
   Added function nailblog_trans($id) which returns text in the
   selected language.
   Added function nailblog_setlang() which sets the sessions
   language to $_GET['lang'].
   Added variable $nailblog_curlang, which is the sessions
   current language.
 * nailblog/core.en.lang
   Created core.en.php which contains the english translation
   data for core.php and nailblog.php.
 * nailblog/core.sv.lang
   Created core.sv.lang which contains the swedish translation
   data for core.php and nailblog.php.
 * nailblog/nailblog.php
   Moved all non-debug messages to core.en.php.
   The system will now load a language specific version of the
   template when available.
 * nailblog/modules/system.en.lang
   Created system.en.lang which contains the english translation
   data for system.php.
 * nailblog/modules/system.php
   Added support for the language row in system.txt.
   Moved all text to system.en.lang.
 * nailblog/modules/menu.php
   Added available languages to the quick links list.
 * nailblog/modules/user.en.lang
   Created user.en.lang which contains the english translation
   data for user.php.
 * nailblog/modules/user.php
   Moved text to user.en.lang (not finished).

090608-nailblog-2.0.0-beta1
 * nailblog/core.php
   Added variable $nailblog_forcemodules which contains the same
   values $nailblog_modules contains before the system is
   inited. This array is used in safe mode.
   Added variable $nailblog_safemode which tells the system
   whether it should load the predefined modules or the modules
   specified on disk.
   Added function nailblog_safemode() which reads or sets
   the value for safe mode in a session variable. Visit the page
   "?safemode=1" and "?safemode=0" to turn safe mode on and off.
   Added a safe mode message that is displayed while in safe
   mode.
   Added nailblog_getrow($filepath,$defaultvalue,$headersiz,$id)
   for getting one row of tab separated data identified by first
   row.
 * nailblog/nailblog.php
   Made the module loader honor $nailblog_safemode.
   Changed $nailblog_version to "2.0.0-beta1".
 * nailblog/modules/menu.php
   Updated menu_getentry($entryid) to use
   nailblog_getrow($filepath,$defaultvalue,$headersize,$id).
 * nailblog/modules/data.php
   Created a module for displaying static HTML on the site.
 * nailblog/modules/data.txt
   Created a readme file for the data module.
 * nailblog/modules/user.php
   Added function user_nailtags() which is called during post
   processing. It replaces the following tags (nailtags) with
   active content:
    * <nailblog>user_id</nailblog>
    * <nailblog>user_login</nailblog>
    * <nailblog>user_name</nailblog>
    * <nailblog>user_groups</nailblog>
    * <nailblog>user_ip</nailblog>
 * nailblog/modules/user.txt
   Added documentation about the nailtags.
 * nailblog/modules/system.php
   Added function user_nailtags() which is called during post
   processing. It replaces the following tags (nailtags) with
   active content:
    * <nailblog>system_version</nailblog>
    * <nailblog>system_template</nailblog>
 * nailblog/modules/system.txt
   Added documentation about the nailtags.

090607-nailblog-2.0.0-alpha3
 * nailblog/nailblog.php
   Changed $nailblog_version to nailblog-2.0.0-alpha3.
 * nailblog/modules/user.txt
   Continued work on the user authentication module
   documentation.
 * nailblog/modules/user.php
   Fixed a minor cosmetic detail in the user_admin() function.
   Added a link to user.txt from the user admin page.
   Added a page for users to change their password and name.
 * nailblog/modules/user.js
   Added function user_validatesets() for validating and
   encrypting new passwords (checking if two passwords are the
   same)
 * nailblog/modules/menu.php
   Added a link to menu.txt from the menu admin page.

090605-nailblog-2.0.0-alpha2
 * nailblog/modules/menu.txt
   Continued work on the menu module documentation.

090604-nailblog-2.0.0-alpha2
 * nailblog/core.php
   Added read-only mode.
   Added function nailblog_deleterecursive($startpath) for
   deleting all data from a given directory.
   Added function nailblog_deleteall($startpath,$deletethis) for
   deleting files and directories from the data directory.
 * nailblog/modules/system.php
   Removed function system_deleteall($startpath) and made it use
   nailblog_deletall instead.
   Added links to module documentation when available.
   Added link to the main readme file.
 * nailblog/modules/menu.txt
   Added a documentation file for the menu module.
 * nailblog/modules/user.txt
   Added a documentation file for the user module.
 * nailblog/modules/system.txt
   Added a documentation file for the system module.

090601-nailblog-2.0.0-alpha2
 * index.php
   Redefined index.php's functionality to also contain the
   default overrides previously found in sets.php.
 * nailblog/sets.php
   Removed the file sets.php and moved its functionality to
   index.php.
 * nailblog/nailblog.php
   Moved the main file to nailblog.php. It must now be included
   into a host file (index.php) in order to work.
 * nailblog/templates/default/style.css
   Fixed some minor cosmetic issues.
 * nailblog/templates/default/template.php
   Fixed some minor cosmetic issues.
 * nailblog/core.php
   Fixed the rule parser in nailblog_getprivs(...).

090531-nailblog-2.0.0-alpha2
 * nailblog.php
   Updated $nailblog_version to "2.0.0-alpha2".
 * nailblog/core.php
   Added nailblog_quicklist($trg,$vals,$titl,$ind,$repl) for
   creating dropdown lists.
   Fixed one bug in the rule parser in
   nailblog_getprivs($access,$rules,$groups,$owner).
 * nailblog/core.js
   Added function nailblog_appendinput(from,to) for appending
   values from one input box to another. This is mainly used by
   the PHP function nailblog_quicklist(...).
 * nailblog/modules/menu.php
   Added a quicklist for menu entry positions to menu_edit().
   Added a quicklist for menu entry href to menu_edit().
   Added move functionality to the menu entry list.
 * nailblog/modules/user.php
   Added a quicklist for group values to user_edit().
 * nailblog/modules/system.php
   Added move functionality to the module list.
 * nailblog/templates/default/style.css
   Added styles for left and right column.

090530-nailblog-2.0.0-alpha1
 * nailblog/modules/menu.php
   Continued work on the menu module.
 * nailblog/modules/system.php
   All relevant functions check if user authentication is
   enabled before validating access now.
 * nailblog/core.php
   Added nailblog_getprivs($access,$rules,$groups,$owner) for
   validating access privileges.
   Added variables $nailblog_top, $nailblog_left,
   $nailblog_right and $nailblog_bottom for output control.

090529-nailblog-2.0.0-alpha1
 * nailblog.php
   The system now checks if a user authentication module and
   a system administration module is activated. If not it
   provides a method for activating the default versions of
   these modules. This way the admin will not get locked out by
   mistake.
 * nailblog/core.php
   Added variables $nailblog_header, $nailblog_footer,
   $nailblog_systemversion and $nailblog_template.
   Added function nailblog_readsystem() for loading system
   settings from disk.
   Updated nailblog_redir($target) to send a message to
   nailblog_error($message) if $nailblog_errors is true.
 * nailblog/modules/system.php
   Created a module for administering then core system.
 * nailblog/templates/default/template.php
   Added output for $nailblog_header and $nailblog_footer.
 * nailblog/templates/default/style.css
   Added styles for header and footer.
 * nailblog/modules/menu.php
   Started working on a menu module.
 * nailblog/modules/user.php
   Fixed user_class method ingroups($groups). You now don't have
   to be in every group to pass. Just one.

090528-nailblog-2.0.0-alpha1
 * nailblog.php
   Made common JavaScript files load before module loaded ones.
 * nailblog/modules/user.php
   Continued work on the user authentication module.
 * nailblog/modules/user.js
   Added function user_md5(fieldid) for encrypting passwords.
 * nailblog/core.php
   Added function nailblog_getnextid($idpath,$startid) for
   getting a new, unused id.
   Added function nailblog_tabsafe($data) for prepairing data
   for storage in tab-separated-data files.
   Added function nailblog_savedata($filepath,$data) for
   writing data to disk.

090527-nailblog-2.0.0-alpha1
 * nailblog/modules/user.php
   Continued work on the user authentication module.
 * nailblog/modules/user.js
   Fixed an error in function user_md5salt where the password
   was encrypted incorrectly.
 * nailblog/core.php
   Added function nailblog_redir($target) for redirecting to
   other pages.
   Added variable $nailblog_title for specifying the document
   title.
 * nailblog/templates/default/template.php
   Created a default template.
 * nailblog/templates/default/style.css
   Created a stylesheet for the default template.

090526-nailblog-2.0.0-alpha1
 * index.php
   Renamed index.php to nailblog.php and made index.php include
   nailblog.php instead. This adds support for multiple Nailblog
   versions in the same installation directory.
 * nailblog.php
   Renamed from index.php, added support for variable $nailblog
   which is the system path.
 * nailblog/core.php
   Added function nailblog_tosession($varname,$value).
 * nailblog/modules/user.php
   Continued work on the user authentication module.
 * nailblog/modules/user.js
   Created a JavaScript file for the user module.

090518-nailblog-2.0.0-alpha1
 * index.php
   Created the index.php file.
 * nailblog/readme.txt
   Created this readme file.
 * nailblog/sets.php
   Created a file for default overrides.
 * nailblog/core.php
   Created a file for core functions and variables.
 * nailblog/modules/user.php
   Created a module for user authentication.

Core PHP functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 * nailblog_error($message)
   Prints the message if $nailblog_errors==true.
 * nailblog_commonjs($filename)
   Loads common JavaScript files.
 * nailblog_tosession($varname,$value)
   Store a value in a session variable.
 * nailblog_fromsession($varname,$default)
   Restores a value from a session variable.
 * nailblog_alert($message)
   Outputs an alert message.
 * nailblog_unmagic($data)
   Fix magic quotes if they are enabled.
 * nailblog_readdata($filepath,$default)
   Reads data from disk.
 * nailblog_parsedata($data)
   Converts tab separated data into an array unless the data is
   an array.
 * nailblog_redir($target)
   Redirects to another page.
 * nailblog_adminbox($module,$groups,$title)
   Header for an toolbox on the admin page.
 * nailblog_getnextid($idpath,$startid)
   Returns a new, unused Id stored in the specified file.
 * nailblog_tabsafe($data)
   Converts posted data to tab-separated-data.
 * nailblog_savedata($filepath,$data)
   Writes data to disk.
 * nailblog_appenddata($filepath,$data,$header)
   Appends data to a file. If file does not exist create it with
   $header and then append $data.
 * nailblog_readsystem()
   Reads system settings from disk.
 * nailblog_getprivs($access,$rules,$groups,$owner)
   Validates access privileges.
 * nailblog_quicklist($target,$values,$titles,$indent,$replace)
   Creates a dropdown list where a user can select values for
   a target input.
 * nailblog_deleterecursive($startpath)
   Deletes all data in a given directory.
 * nailblog_deleteall($startpath,$deletethis)
   Deletes files and direcotires in the data directory. If
   $deletethis is true then the file or directory at $startpath
   is also deleted.
 * nailblog_safemode()
   This fuction is called during init and parses
   $nailblog_safemode. If $nailblog_safemode is "activated" or
   "deactivated" it changes the mode accordingly and stores it
   in a session variable. Otherwise it sets $nailblog_safemode
   to whatever is stored in the session variable.
 * nailblog_getrow($filepath,$defaultvalue,$headersize,$entryid)
   Returns one row of tab separated data as an array, identified
   by the Id in the first row.

Core PHP variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 * $nailblog
   Path to system folder (relative to the index file)
 * $nailblog_data
   Path to generated data.
 * $nailblog_modules
   Default modules.
 * $nailblog_errors
   Debugging.
 * $nailblog_readonly
   Set to true to prevent all data changes.
 * $nailblog_session
   Session variable prefix.
 * $nailblog_maincalls
   Main functions calls.
 * $nailblog_postcalls
   Post processing functions calls.
 * $nailblog_head
   Document header output.
 * $nailblog_header
   Page header content output.
 * $nailblog_top
   "Breadcrumb" top bar content output.
 * $nailblog_left
   Left column content output.
 * $nailblog_right
   Right column content output.
 * $nailblog_center
   Center content output.
 * $nailblog_bottom
   Bottom breadcrumb content output.
 * $nailblog_footer
   Footer content output.
 * $nailblog_forcemodules
   This variable contains the same value $nailblog_modules has
   before the system is initialized and settings are read from
   disk. The variable is used in safe mode instead of
   $nailblog_modules when loading the modules.
 * $nailblog_safemode
   Variable which tells the system whether safe mode is
   activated or not.
 * $nailblog_lang
   This variable tells the system which language is in use.

Core CSS classes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 * p.nailblog_alert
   Used for displaying important messages.
 * div.nailblog_adminbox
   Used for containing admin tools. These may take up more
   horizontal space than available so the style needs to support
   that with scrollbars or something similar.
 * div.nailblog_menu
   This is used as a container for menus.
 * span.nailblog_menuitem
   Container for one menu item.
 * div.nailblog_item
   Container for normal content.
 * div.nailblog_itemheader
   Container for the item header.
 * div.nailblog_itemmenu
   Container for item-connected menu.
 * div.nailblog_itemcontent
   Container for item content.
 * div.nailblog_itemfooter
   Container for item footer.

Core JavaScript functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Note: the Nailblog uses one external JavaScript file for
      creating md5 hashes used in the password encryption.
      The file, nailblog/md5.js, is distributed under the BSD
      license. Credits goes to Paul Johnston, Greg Holt,
      Andrew Kepert, Ydnar and Lostinet.
      See http://pajhome.org.uk/crypt/md5 for more info.

 * nailblog_init()
   Calls functions when page loads.
 * nailblog_copyinput(from,to)
   Copies the value of one input box to another.
 * nailblog_appendinput(from,to)
   Appends the value of one input box to another.

Core JavaScript variables ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 * nailblog_onload
   Array containing references to functions to call when page
   loads.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

