Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 416)
+++ trunk/CHANGELOG	(revision 417)
@@ -1,559 +1,561 @@
-Change Log
-===============================================================================
-Please note: This change log may not be accurate
-
-$Id$
-
-Legend:
-+ = Added
-- = Removed
-# = Bugfix
-! = Update/Change
-
-------------------------------------- 2.7.0 -------------------------------------
-21-Jan-2007 Matthias Gallas
-#	Fixed issue in the search table entries of form modul
-13-Jan-2007 Matthias Gallas
-#	Fixed some bugs in rss.php
-07-Jan-2007 Matthias Gallas
-#	Fixed error when uninstalling the news modul
-02-Jan-2007 Matthias Gallas
-+   Added id keywords to all missing files
-#	Fixed issue with Permissions for pages sections
-27-Dec-2006 Matthias Gallas
-#	Fixed form modul stores empty records
-------------------------------------- 2.6.5 -------------------------------------
-25-Dec-2006 Ryan Djurovich
-!	Changed links to WB help website
-24-Dec-2006 Matthias Gallas
-#	Fixed some minor javascript errors in admin (thanks to pcwacht)
-#	Fixed root_parent doesn't get updated when moving item in menu (#305)
-!	Changed all copyright notices to include now 2007
-23-Dec-2006 Matthias Gallas
-#	Fixed IE allows to set a page as parent of itself (#320)
-#	Fixed problem with Page Title has to be escaped (#287)
-#	Fixed the possibility to call the index.php of the templates directly in the browser (#291)
-21-Dec-2006 Matthias Gallas
-#	Fixed missing message when adding a site without page title (#300)
-21-Dec-2006 Ryan Djurovich
-#	Fixed bug with captcha script (#346)
-20-Dec-2006 Matthias Gallas
-#	Fixed Return to Search Results Page (#365)
-!	Set Version to 2.6.5
--	Removed Changeset 365 because this will be a part of WB 2.7.x
-#	Fixed a little typo error in class.admin.php (#364)
-26-Nov-2006 Ryan Djurovich
-+	Added new script that could possibly be apart of 2.7.x as a replacement
-	for having the pages directory 
-17-Nov-2006 Matthias Gallas
-#	Fixed fatal error in line 46 news/comment.php (thanks to eki)(#358)
-15-Nov-2006 Matthias Gallas
-#	Fixed again intropage doesn't work (#71)
-20-Oct-2006 Matthias Gallas
-+	Added phpmailer class (thanks to doc)
-+	Added Remember-expanded-pages-in-admin (thanks to ephraimt)
-+	Added List sorting in admin area (thanks to rsmith)
-#	Fixed table width 100% are wrong displayed in container templates
-	when IE is used (#350)
-#	Fixed large space between menupoints in IE (#349)
-#	Fixed Website description is not displayed when no page description
-	available (#348)
-#	Fixed group images in news modul cannot be stored (#342)
-#	Fixed Typo in form/save_field.php (#341)
-#	Fixed files in /pages/posts folder are not deleted (#340)
-#	Fixed specialchars problem in the news modul (#339)
-#	Fixed news modul stores empty records (#338)
-#	Fixed Captcha didn't work in news comments (#337)
-#	Fixed various php notices (#334)
-+	Added new upgrade_function (thanks to kozmoz)
-#	Fixed addons table isn't updated when a modul is updated (#332)
-#	Fixed spelling errors in the signup2.php (#330)
-#	Fixed MySQL 5.x missing default values for INT fields in all system
-	and modules tables (#329)
-#	Fixed installer does not insert admin user (#328)
-+	Added support for getting page ID of page that referred search
-	request (#327) (thanks to brofield)
-#	Fixed search results generate invalid XHTML and notify warnings (#326)
-Stefan Braunewell
-#	Fixed Field 'last_reset' doesn't have a default value (#313)
-+	Added get_post_escaped to wb class which automatically calls add_slashes
-	on get_post output and used it in form/save_field.php
-------------------------------------- 2.6.4 -------------------------------------
-20-May-2006 Ryan Djurovich
-#	Fixed security issues related to #237
-#	Fixed typo in news save comment page (#282)
-#	Fixed typo in news delete post page (#283)
-!	Added multi-submission protection to form module (#119)
-#	Added notice for when PHP Session Support appears to be disabled in installer,
-	even if it is enabled and the problem actually lies in the users browser (#154)
-19-May-2006 Ryan Djurovich
-#	Fixed problem in forgotten login form where email field is too short (#207)
-#	Fixed typo in forgotten login details email (#190)
-15-May-2006 Stefan Braunewell
-#	Fixed security issues (#237)
-03-May-2006 Stefan Braunewell
-#	Fixed problems with pre-2.6.0 modules in section list
-#	Fixed e-mail bug caused by From: headers in internal mail function calls
-	(#189)
-#	E-mail validation in install script now accepts new top-level domains
-	(#162)
-#	Error status is now overwritten by next database query (#182)
-#	Fixed obscure problem in htmlarea install script
-------------------------------------- 2.6.3 -------------------------------------
-19-Mar-2006 Stefan Braunewell
-#	Fixed ticket #146: problems removing groups from viewers list of a page
-16-Mar-2006 Stefan Braunewell
-!	Changed link target selection. Now self, top and new. (Ticket #145)
-#	Fixed ticket #143. Charset setting is now used in admin login and forgot
-	password pages.
-#	Some changes to the SQL code in the install script for improved 
-	compatibility with new MySQL versions
-#	Fixed ticket #134 - error on browsing media.
-+	Improved backup module: new choice between full database or WB-related
-	backup.
-#	Fixed ticket #141 - admin now sees all folders in media
-#	Fixed e-mail sending problems due to additional parameter in mail call.
-#	Applied fix regarding ticket #138: new users now get deleted if
-	sending e-mail fails.
-#	Fixed ticket #137: Last Reset timer not reset in frontend forgotten 
-	password process
-#	Removed duplicate expression from modules/news/install.php which caused
-	problems in installation
-
-01-Mar-2006 Stefan Braunewell
-#	Fixed ticket #68 - Safari problem with displaying all parents.
-#	Fixed ticket #136 - mailing forgotten password in admin login screen leads 
-	to fatal error.
-!	Renamed tag [PROCESSTIME] to [PROCESS_TIME]
-------------------------------------- 2.6.2 -------------------------------------
-03-Feb-2006 Stefan Braunewell (very big special thanks to John and Alex)
-#	Fixed ticket #104 - commas in form field descriptions not allowed.
-#	Cookie REMEMBER_KEY wasn't cleared in account/logout 
-	and expiration date is now set to time in the past.
-#	Smart login not working.
-!	Changed mail calls to new function $wb->mail.
-#	Form: ticket 124 added captcha settings check 
-#	Ticket 118 added formfield type to check for email/text 
-#	Ticket 115 changed comparision /modules/form/view.php 
-#	Added correct timecheck in form submissions
-!	Changed captcha.php call to include timestamp
-!	Changed the e-mail validation code and added a mail function to class wb.
-!	Forgotten password: if sending of e-mail fails, restore old password.
-	Ticket #110
-!	Added more charset options. Ticket #102 - thanks to ruebenwurzel!
-!	Character encoding setting also affects admin backend.
-	Mentioned in ticket #102.
-!	Reintroduced page languages setting. If switched to off, page
-	languages are only used to determine the language file for the
-	universal texts. If on, displayed page and menu are affected by
-	the language session variable.
-#	Fixed bugs in show_breadcrumbs code and added parameter "depth"
-	to set the number of levels to be show.
-#	Fixed a bug where access settings of registered and private pages
-	were displayed incorrectly.
-#	Fixed captcha being cached.
-#	Added an exit call after every heading("Location:...")
-	redirector to prevent unwanted execution of code.
-#	Bug #122. Replaced empty field check by check that setting name is
-	not "wb_version".
-#	Replaced all remaining occurrences of '/media' by MEDIA_DIRECTORY - bug #108.
-#	Fixed bug #99 and two additional instances of typo 
-	catpcha instead of captcha.
-#	Fixed some typos
-#	Fixed some notices and warnings.
-#	Fixed bug #105 - back buttons in addon detail pages not editable.
-!	Replace 'admin' by 'wb' in all account pages. 
-!/#	Moved print_success and print_error code to class.wb.php.
-	Added correct parameters to these functions in account pages. 
-------------------------------------- 2.6.1 -------------------------------------
-12-Dec-2005 Ryan Djurovich
-#	Fixed security vulnerability in class.login.php
-#	Fixed typo in EN language file
-#	Fixed captcha problems (when feature is disabled) in form module and sign-up
-!	Added charset encoding to admin templates
-!	Added extra code to check for selection of addon upon uninstalling
-#	Fixed bugs in RSS news feeder
-#	Fixed bug with PAGE_DESCRIPTION not being set on any page
-------------------------------------- 2.6.0 -------------------------------------
-28-Nov-2005 Ryan Djurovich
-+	Added default charset option to (advanced) settings
-#	Form module email fields now have email address validation
-#	Fixed spacing in form submissions
-27-Nov-2005 Ryan Djurovich
-+	Added captcha verification to sign-up form
-+	Added Captcha to News module
-24-Nov-2005 Stefan Braunewell
-!	Applied aportale's patch to use label instead of javascript toggle code
-20-Nov-2005 Ryan Djurovich
-!	News mod now hides read more link if no need for it (see ticket #56)
-+	Added support for mailto: links in the menu link mod
-#	Added direct-access redirection on some files (see ticket #37)
-+	Added extra characters to convert.php (see ticket #64)
-#	Fixed ticket #65 (last_reset check in account/forgot_form.php)
-29-Sep-2005 Ryan Djurovich
-!	Cleaned up form buttons in Settings
-!	Moved some options into Advanced Settings
-#	Semi-disabled "separate" page trash option
-+	Created a backup module/tool for backing-up the database
-	(thanks to John (pcwacht) for the original code)
-+	Created new "blank template", which can be used in case where you don't
-	want anything wrapping page-content.
-19-Sep-2005 Ryan Djurovich
-+	Added _license field for all add-ons to specify a license
-!	Renamed _designed_for variables (for all addons) to _platform
-+	Created addons table for faster internal referencing of installed addons
-!	Fixed some links, including the "Help" button in Admin
-#	Used nl2br to display body correctly when viewing form-submissions
-15-Sep-2005 Stefan Braunewell
-+	Added table module with columns 'name','type' and 'directory' as an
-	index.
-+	Added entry to settings table 'wb_version' which holds the version
-	number and can be utilized in future upgrade scripts.
-!	Added upgrade functionality also for templates and languages.
-#/!	Template/modules installation now respects paths.
-!	Moved updates from config.php to database.
-	Created initialize.php (required by config.php) to read settings.
-11-Sep-2005 Stefan Braunewell
-!	HTMLArea is now a module instead of a core component. Files moved
-	from "include" to "modules".
-+	Implemented Installation of modules on top of an older version. This is 
-	done via checking $module_version. Instead of install.php, upgrade.php
-	is then called if it exists in the module package. 
-	For module developers: $module_version and $new_module_version are 
-	accessible in upgrade.php to find out what upgrade steps need to be taken.
-!	Changed column names in mod_news_posts from short,long to content_short,
-	content_long.
-09-Sep-2005 Stefan Braunewell
-+	Added new advanced setting "Rename Files On Upload". File extensions can be
-	given so that respective files will have a ".txt" appended on media upload.
-#	Fixed "None found" message bug when user has no top level page edit
-	rights.
-#	Fixed missing parent option 'none' - ticket #12 - and a minor scope bug.
-+	Added breadcrumbs code. Call using $wb->breadcrumbs().
-+	Added utf-8 character encoding meta tag into all stock templates.
-#	Fixed bug when changing a page's parent
-!	Changed the way blocks are treated. Added new frontend class attribute
-	default_block_content that controls what is shown on pages such as
-	search, login, etc. (Ticket #16)
-+	Added support for WYSIWYG editor modules (wysiwygmod)
-+	When trying to access a registered page, user is automatically redirected
-	there on successful login.
-#	Fixed various issues with system search (mainly related to stripslashes()
-#	Removed stripslashes() in many places in the code. Added check for
-	magic_quotes_gpc to new wb class method add_slashes(). Now database contest
-	is independent of magic_quotes setting..
-05-Sep-2005 Stefan Braunewell
-#	Fixed bug concerning direct access of preferences page.
-#	Reworked page visibility and menu item visibility code (frontend login
-	problem).
-#	Pages in link list in htmlarea popup are now correctly ordered.
-#	Fixed bug where group with existing name can be added.
-04-Sep-2005 Ryan Djurovich
-+	Added and RSS newsfeed script to the News module
-04-Sep-2005 Stefan Braunewell
-!	Rewrote menu function. Parameters are now given as attributes to frontend class.
-#	Fixed some occurrences of potential direct access path disclosure
-#	Added directory check to browse.php to prevent xss exploit by trusted users.
-!	Updated code to reflect move to Subversion repository system.
-27-Aug-2005 Stefan Braunewell
-#	Fixed bugs 4,5,6,8,9 in bug tracker
-!	Removed 'USER_LANGUAGE' and 'GET_LANGUAGE' constants.
-	A GET['lang'] now sets the session language variable.
-26-Aug-2005 Stefan Braunewell
-!	Moved redundant code into the new class functions. Created 
-	'compatibility.php' for backward compatibility with
-	modules and templates. Variables and functions can still be accessed
-	in the old way.
-!/+	Reorganized core frontend files, added new base class 'wb' from
-	which 'admin' and the new 'frontend' class inherit. Moved all frontend
-	function into new class. Completely rewrote core index.php.
-	Now all variables and functions that are available to templates and
-	modules are attributes and methods of the frontend and the wb classes
-------------------------------------- 2.5.2 -------------------------------------
-23-Jun-2005 Ryan Djurovich
-!	create_access_file now creates all parent directories if needed
-#	Fixed bug when moving page with subpages to another level
-#	Fixed bug when saving "Settings" (in Admin) on Windows/IIS
-#	Fixed bug where query was not setting error correctly in class.database.php
-22-Jun-2005 Ryan Djurovich
-#	Fixed bug where template permissions were not saved when a adding group
-21-Jun-2005 Ryan Djurovich
-#	Added htmlspecialchars for modifying WYSIWYG, news, etc. modules (Bug #78)
-#	Fixed language problems in some area's of Admin. (Bug #70)
-#	Added a space in website/page keywords (Bug #69)
-#	Fixed bugs on settings2.php (Bug #52)
-!	Links inserted with HTMLArea now use [wblink--PAGE_ID--] instead of raw URL
-13-Jun-2005 Ryan Djurovich
-#	Fixed bug (#88) with news module
-!	Title of Administration login page now taken from language file (Bug #72)
-#	Fixed redirection admin/home to admin/start on admin/index.php
-#	Fixed bug with forgotten password page in admin (Bug #81)
-25-Apr-2005 Ryan Djurovich
-#	Fixed numerous bugs with module uninstallation
-#	Fixed bug when uploading files in Administration -> Media
-!	Installer no-longer requires you to accept the GNU GPL
-------------------------------------- 2.5.1 -------------------------------------
-16-Apr-2005 Ryan Djurovich
-#	Fixed two bugs with account login/logout
-------------------------------------- 2.5.1 -------------------------------------
-15-Apr-2005 Ryan Djurovich
-#	Fixed bug where non-english characters can get used in page filenames. Many
-	measuers have been added (including a new file: wb/framework/convert.php),
-	to prevent any possible errors that can occur in page filenames.
-#	Fixed invalid meta tags in stock templates (meta tags were not closed)
-#	Removed lines 401, 402, and 425 of wb/index.php - not needed
-#	Fixed bug where search and account pages are shown in every block
-	that is in a template
-#	Fixed numerous bugs with media home directories feature
-10-Apr-2005 Ryan Djurovich
-#	Fixed bugs in account/login.php and logout.php where users
-	gets redirected to /pages
-------------------------------------- 2.5.0 -------------------------------------
-08-Apr-2005 Ryan Djurovich
--	Removed section language feature
-+	Added page language feature (replaces need for sections language feature)
-#	Fixed bug where pages using menu_link module can have the URL changed
--	Page directory no longer stored in link field in pages table, it is now added
-	when the page_link function is called - this makes changing the pages
-	directory much easier and quicker
-!	Pages with visibility of "none" are now no longer directly accessable
-+	Added new visibility setting "hidden", acts exactly like none did previously
-!	Template info file can now specify number of menu's available and relative names
-!	Template info file can now specify number of blocks's available and relative names
-------------------------------------- 2.4.3 -------------------------------------
-07-Apr-2005 Ryan Djurovich
-#	page_filename function has been rewritten using str_replace
-	function, which should be faster and will allow characters
-	from other languages into filenames
-!	Created new media_filename function, which is now used
-	by all media functions (create,upload,rename) to determine
-	which characters should be removed from a desired filename
-+	New button in Administration page list to view specific page
-#	Updated the page_link function to now be compatible with menu link
-	module when setting pages directory to root
-#	Fixed bugs in search when using "Any Words" option
-#	Fixed bug with news module when pages directory set to root
-!	Changed URL of documentation website on Administration Start page
-------------------------------------- 2.4.2 -------------------------------------
-05-Apr-2005 Ryan Djurovich
-#	Fixed bug where file could be renamed to nothing in Media
-!	Optimised Media create folder, upload file, and rename functions
-#	Fixed bug where stripslashes not run on news post titles in admin
-05-Apr-2005 Stefan Braunewell
-#	Fixed bug concerning usage of the private_sql variable
-#	Fixed bug conerning sub-pages being displayed in menus incorrectly
-------------------------------------- 2.4.1 -------------------------------------
-04-Apr-2005 Ryan Djurovich
-!	Pages with visibility of "none" are again directly accessable
-#	Fixed bugs regarding renaming files and directories in Media section
-!	When home folders disabled, all folders now visible in Media section
-------------------------------------- 2.4.0 -------------------------------------
-03-Apr-2005 Ryan Djurovich
--	Removed recently added visibility setting of "heading", and relative config vars
-+	Added new "menu" field to pages table, and new setting "multiple menus"
-	which replaces the need for the menu headings feature
-+	Added links to top of groups and users sections, linking to each other
-!	Change menu width in "Round" template to 170px (was 150px)
-#	Change page "are you sure" deletion message to mention that it will delete
-	all sub-pages as well
-#	Fixed many bugs with news module when viewing posts by group
-!	Pages with visibility of "none" are now no longer directly accessable
-02-Apr-2005 Ryan Djurovich
--	Removed need to specify DB_URL when calling database class
-#	Stopped fields without a type specified from being shown in form mod
-#	Changed '/media' to MEDIA_DIRECTORY on HTMLArea popup windows
-	for insert link and insert image
-+	Added setting which allows you to specify the default WYSIWYG style
-+	Added "Server Email" option, to specify what is used in "From" field when
-	sending emails using the PHP mail function. Default is admins email address.
-#	Search now excludes pages which have a visibility of none or heading
-!	Pages are now given modified_when and modified_by when added
-01-Apr-2005 Ryan Djurovich
-+	Added option to News module to specify how many posts should be listed
-	per page (by default it is set to unlimited, which functions like previous version)
-#	Added stripslashes when display page titles in search
-+	Page descriptions and last updated date now shown in search by default
-30-Mar-2005 Ryan Djurovich
-+	Added new feature for Media home folders, where a folder can be specified
-	for a specific user or group of users only
-!	Changed URL of Help button to http://www.websitebaker.org/docs/
-+	Added new feature for "Page Trash" - two modes available: inline and separate
-!	When pages are deleted, all sub-pages are now deleted (instead of being moved
-	up a level)
-29-Mar-2005 Ryan Djurovich
--	Removed Database Settings from Administration Settings (options will not be
-	available in 3.x, so trying to match interface with WB 3.x plans
-!	Changed the name of Path Settings to Filesystem Settings in Administration
-	Settings, and removed ability to change path/url options - matching interface
-	plans for WB 3.x
-+	Added same options for OS and file permissions as installer to Settings
-!	Sessions now named with APP_NAME.'_session_id' (e.g. default is wb_session_id)
-28-Mar-2005 Ryan Djurovich
-+	New functions available to templates to simplify creation of them. This aims
-	to "future-proof" templates for WB 3.x plans.
-!	Default templates updated to support some of the new functions
-+	Added field to pages table "page_trail" which stores a list of the pages
-	parents. This field was needed by the new page_menu function
-+	Added option for page visibility "heading" to enabled support for multiple
-	menu's. Also, this helps to "future-proof" templates for WB 3.x plans
-+	Added option for page visibility "registered", which acts a little like
-	private, but is still shown in the menu (although users need to log in to view
-	the pages content)
-+	Form module submissions now saved to database, and feature now added to
-	limit number of submissions per hour to prevent spamming
-+	New field for Form module: email. Allows you to specify their email in
-	"from" field on module settings.
-#	Fixed bug when displaying comments in News module (WB Bug #14)
-+	New "under contruction" message if no pages exist
-!	Cleaned-up wb/index.php
-27-Mar-2005 Ryan Djurovich
-+	Created advanced mkdir and chmod functions
-#	Fixed bug in media where wrong file/folder is deleted
-+	Complete overhall of installer - now only one step! It has been greatly
-	simplified in many ways, has much better validation, reports error much more
-	nicely, and automatically logs the user into the Administrations
-+	Must now specify OS type - allows for customizable file permission settings
-+	Sections can now have a language code assigned to them
-+	Sections can now have a block name/id assigned to them
-!	Home section of Administration renamed to Start, to save confusion with saying
-	Homepage (because this term could either mean the main website or Home section
-	in	Administration). Also, this aims to unify the interface with WB 3.x plans
-!	Moved Users and Groups sections under Access section. This aims to unify the
-	interface with WB 3.x plans, which help to unclutter the menu
-!	Interface for Settings section has been imporved for usability purposes
-#	Fixed HTMLArea where no scrollbar for "insert link" and "insert image" dialogs
-	by placing media list inside an iframe
-#	Fixed stripslashes problem for viewing news comments
-!	Added code from Formesque module (an advanced version of the original Form
-	module, modified by Rudolph Lartey from www.carbonect.com), and made further
-	interface improvements for select box/checkbox group/radio group options.
-#	Possibly fixed bugs where an S appears before file and dir modes
-#	Fixed bug where users can be added with same emails (in Administration)
--	Removed support for PEAR, as it was deemed an unnecessary addition which only
-	makes code more bulky, and removing it will decrease package size a lot
-+	New "homepage redirect" option so first page is included and not redirected to
-#	Fixed text not being shown when module uninstalled
-!	Imporved interface for basic group permissions
-26-Mar-2005 Stefan Braunewell
-#	Fixed bug with front-end logins
-#	Fixed bug when saving intro page 
-+	Added check on sign-up if e-mail exists (thanks to P. Melief)
-#	Fixed bugs concerning moving/deleting pages
-#	Fixed list of parents in page settings
-#	Fixed mkdir without mode parameter
-#	Added a check on install to ensure PHP 4.1.x compatibility (thanks to Wanderer)
-+	Added support for PAGES_DIRECTORY set to root
-+	Search form now supports quotes (thanks to Manafta)
-#	Fixed page section ordering
-#	News items are displayed with name of poster instead of "Unknown"
-#	Deletion confirmation popup window in media section now shows correct file name
-------------------------------------- 2.3.1 -------------------------------------
-03-Fed-2005 Ryan Djurovich
-+	Now there is two types of "filesystem modes", one for directories and one
-	for files. Having different settings is very common for most servers, so
-	this addition should fix many problems people had with 2.3.0.
--	Removed filesystem mode options from installation
-!	Removed duplicate text on installation step 3 for timezone
-!	All "access files" for the news module now stored in pages/posts instead
-	of a sub-dir relative to the page (this fixes many bugs)
-#	Fixed major bugs when deleting pages with sub-pages
-!	Removed the restrictions that prevent a user for changing a pages level
-#	Fixed bug with "toggle" plus/minus in IE for pages list
-#	Fixed some bugs where /pages was not replaced with PAGES_DIRECTORY constant
-------------------------------------- 2.3.0 -------------------------------------
-26-Jan-2005 Ryan Djurovich
-#	Fixed bug in framework/functions.php that made root parent always equal 8
-#	Added missing braces in lines 182 and 208 of admin/pages/settings2.php
-#	Fixed SQL-query on line 172, placing a / after $old_link
-#	Added eregi checks for PAGES_DIRECTORY on lines 140 and 150 of
-	admin/pages/settings2.php
-#	Added ordering cleaning to delete_post.php on line 53 for news module
-!	GMT option is selected for "Default Timezone" in the installer, instead
-	of the old "Please select" message (which had the same value as GMT)
-28-Jan-2005 Ryan Djurovich
-!	Ability to specify the chmod number when WB uploads files, etc.
-!	Modified file headers (copyright/license notice) so they now look almost the
-	same, independant of font. Also, it now covers copyright for 2005.
-30-Jan-2005 Ryan Djurovich
-#	Added code on wb/admin/pages/delete.php to remove sections from the sections
-	table when a page is deleted.
-+	New 'Smart Login' prevents users from using external password managers,
-	and can be set to remember the users password using cookies.
-!	SourceForge CVS module now called websitebaker2 (instead of just
-	websitebaker). Also, all file versions have been reset.
-01-Fed-2005 Ryan Djurovich
-!	Added code to prevent from changing a pages level (it simply disables
-	the select box), to prevent many possible bugs.
-------------------------------------- 2.2.4 -------------------------------------
-23-Dec-2004 Ryan Djurovich
-!	Change 'EXACT_PHRASE' to 'EXACT_MATCH' on line 261 of wb/languages/EN.php
-#	Fixed multi-language support in search
-+	Added more detailed options to list of PHP error reporting level's
--	Removed ability to change language and PHP error reporting level
-	on installation to make things easier for newbie's
-+	Ability to select custom spacer for page filename's
-!	Changed the way a language code is found on language installation
-+	Added template permissions to groups
-#	Fixed bug when trying to change email from Preferences (admin and frontend)
-#	Fixed bug with auto-selection of "System Default" for Preferences
-!	News module now use's WYSIWYG for modifying news posts
-+	Ability to specify both the pages and media target directories
------------------------------------- 2.2.3-c ------------------------------------
-22-Dec-2004 Ryan Djurovich
-#	Fixed problem with DB password being reset if Settings saved in basic mode
------------------------------------- 2.2.3-b ------------------------------------
-21-Dec-2004 Ryan Djurovich
-#	Fixed minor bug on admin templates section
-#	Fixed bug on rename.php and rename2.php in admin media section
-------------------------------------- 2.2.3 -------------------------------------
-20-Dec-2004 Ryan Djurovich
-+	Added WB release version in Administration (top right corner)
-!	New option to prevent users from adding level 0 pages
-#	Fixed bug when deleting post's in News module
-+	Added new field in pages table for "root" parent (level 0 parent), for
-	extra flexability in creating templates
-!	Round template now supports unlimited page levels
-------------------------------------- 2.2.2 -------------------------------------
-18-Dec-2004 Ryan Djurovich
-+	New option under Search Settings for selecting custom template for search
-+	New option when changing page settings to set the target
-#	Fixed error when saving a user after editing
-!	Users can now modify sub-page if they dont have permissions on the parent
-------------------------------------- 2.2.1 -------------------------------------
-15-Dec-2004 Ryan Djurovich
-#	Fixed bug when changing password on preferences form (front-end)
-#	Fixed bug when retrieving user details (administration)
-#	Added check to see if module, template, or language is in use when deleting
-#	Fixed up email that is sent to user from a submitted form
-#	Fixed major problem with module permissions which stopped it from working
-------------------------------------- 2.2.0 -------------------------------------
-14-Dec-2004 (Correct date[s] unkown) Ryan Djurovich
-+	Multiple-level page support
-+	Multiple section's for pages (including interface)
-!	Removed text created using two words on all areas
-	(e.g. {Intro} {PAGE} is now {INTRO_PAGE})
-	this is for better language support
-+	Added Languages section
-!	Moved Templates and Modules under Add-ons section
-!	Changed name of "Default" template to "Round"
-+	Added "All CSS" template
-+	Added "Jump"
-+	Added 
-!	Modified "Box" template to support multiple page levels
-+	Added "Menu Link" module
-+	Added "News" module
-+	Added "Code" module
-+	Added "Form" module
-+	Added "Wrapper" module
-!	Changed name of "Normal Page" module to "WYSIWYG"
-+	Created new admin wrapper script to ease module develpment
-+	Media now automatically creates index.php file for every
-	sub-folder made (for security purposes)
-!	Change "Help" link in Administration menu so it now directs
-	to the the new Website Baker documentation website found at:
-	http://www.websitebaker.org/documentation
-!	Password is now required to change email in preferences
-+	User can now select custom Language and Date & Time Formats
-+	Added search functionality, with three different "methods":
-	1. Using all words  2. Using any words  3. Exact match
-+	Added native MySQL database support
+Change Log
+===============================================================================
+Please note: This change log may not be accurate
+
+$Id$
+
+Legend:
++ = Added
+- = Removed
+# = Bugfix
+! = Update/Change
+
+------------------------------------- 2.7.0 -------------------------------------
+24-Jan-2007 Christian Sommer
+!	Replaced some core files to allow configuration of wbmailer via admin settings panel
+21-Jan-2007 Matthias Gallas
+#	Fixed issue in the search table entries of form modul
+13-Jan-2007 Matthias Gallas
+#	Fixed some bugs in rss.php
+07-Jan-2007 Matthias Gallas
+#	Fixed error when uninstalling the news modul
+02-Jan-2007 Matthias Gallas
++   Added id keywords to all missing files
+#	Fixed issue with Permissions for pages sections
+27-Dec-2006 Matthias Gallas
+#	Fixed form modul stores empty records
+------------------------------------- 2.6.5 -------------------------------------
+25-Dec-2006 Ryan Djurovich
+!	Changed links to WB help website
+24-Dec-2006 Matthias Gallas
+#	Fixed some minor javascript errors in admin (thanks to pcwacht)
+#	Fixed root_parent doesn't get updated when moving item in menu (#305)
+!	Changed all copyright notices to include now 2007
+23-Dec-2006 Matthias Gallas
+#	Fixed IE allows to set a page as parent of itself (#320)
+#	Fixed problem with Page Title has to be escaped (#287)
+#	Fixed the possibility to call the index.php of the templates directly in the browser (#291)
+21-Dec-2006 Matthias Gallas
+#	Fixed missing message when adding a site without page title (#300)
+21-Dec-2006 Ryan Djurovich
+#	Fixed bug with captcha script (#346)
+20-Dec-2006 Matthias Gallas
+#	Fixed Return to Search Results Page (#365)
+!	Set Version to 2.6.5
+-	Removed Changeset 365 because this will be a part of WB 2.7.x
+#	Fixed a little typo error in class.admin.php (#364)
+26-Nov-2006 Ryan Djurovich
++	Added new script that could possibly be apart of 2.7.x as a replacement
+	for having the pages directory 
+17-Nov-2006 Matthias Gallas
+#	Fixed fatal error in line 46 news/comment.php (thanks to eki)(#358)
+15-Nov-2006 Matthias Gallas
+#	Fixed again intropage doesn't work (#71)
+20-Oct-2006 Matthias Gallas
++	Added phpmailer class (thanks to doc)
++	Added Remember-expanded-pages-in-admin (thanks to ephraimt)
++	Added List sorting in admin area (thanks to rsmith)
+#	Fixed table width 100% are wrong displayed in container templates
+	when IE is used (#350)
+#	Fixed large space between menupoints in IE (#349)
+#	Fixed Website description is not displayed when no page description
+	available (#348)
+#	Fixed group images in news modul cannot be stored (#342)
+#	Fixed Typo in form/save_field.php (#341)
+#	Fixed files in /pages/posts folder are not deleted (#340)
+#	Fixed specialchars problem in the news modul (#339)
+#	Fixed news modul stores empty records (#338)
+#	Fixed Captcha didn't work in news comments (#337)
+#	Fixed various php notices (#334)
++	Added new upgrade_function (thanks to kozmoz)
+#	Fixed addons table isn't updated when a modul is updated (#332)
+#	Fixed spelling errors in the signup2.php (#330)
+#	Fixed MySQL 5.x missing default values for INT fields in all system
+	and modules tables (#329)
+#	Fixed installer does not insert admin user (#328)
++	Added support for getting page ID of page that referred search
+	request (#327) (thanks to brofield)
+#	Fixed search results generate invalid XHTML and notify warnings (#326)
+Stefan Braunewell
+#	Fixed Field 'last_reset' doesn't have a default value (#313)
++	Added get_post_escaped to wb class which automatically calls add_slashes
+	on get_post output and used it in form/save_field.php
+------------------------------------- 2.6.4 -------------------------------------
+20-May-2006 Ryan Djurovich
+#	Fixed security issues related to #237
+#	Fixed typo in news save comment page (#282)
+#	Fixed typo in news delete post page (#283)
+!	Added multi-submission protection to form module (#119)
+#	Added notice for when PHP Session Support appears to be disabled in installer,
+	even if it is enabled and the problem actually lies in the users browser (#154)
+19-May-2006 Ryan Djurovich
+#	Fixed problem in forgotten login form where email field is too short (#207)
+#	Fixed typo in forgotten login details email (#190)
+15-May-2006 Stefan Braunewell
+#	Fixed security issues (#237)
+03-May-2006 Stefan Braunewell
+#	Fixed problems with pre-2.6.0 modules in section list
+#	Fixed e-mail bug caused by From: headers in internal mail function calls
+	(#189)
+#	E-mail validation in install script now accepts new top-level domains
+	(#162)
+#	Error status is now overwritten by next database query (#182)
+#	Fixed obscure problem in htmlarea install script
+------------------------------------- 2.6.3 -------------------------------------
+19-Mar-2006 Stefan Braunewell
+#	Fixed ticket #146: problems removing groups from viewers list of a page
+16-Mar-2006 Stefan Braunewell
+!	Changed link target selection. Now self, top and new. (Ticket #145)
+#	Fixed ticket #143. Charset setting is now used in admin login and forgot
+	password pages.
+#	Some changes to the SQL code in the install script for improved 
+	compatibility with new MySQL versions
+#	Fixed ticket #134 - error on browsing media.
++	Improved backup module: new choice between full database or WB-related
+	backup.
+#	Fixed ticket #141 - admin now sees all folders in media
+#	Fixed e-mail sending problems due to additional parameter in mail call.
+#	Applied fix regarding ticket #138: new users now get deleted if
+	sending e-mail fails.
+#	Fixed ticket #137: Last Reset timer not reset in frontend forgotten 
+	password process
+#	Removed duplicate expression from modules/news/install.php which caused
+	problems in installation
+
+01-Mar-2006 Stefan Braunewell
+#	Fixed ticket #68 - Safari problem with displaying all parents.
+#	Fixed ticket #136 - mailing forgotten password in admin login screen leads 
+	to fatal error.
+!	Renamed tag [PROCESSTIME] to [PROCESS_TIME]
+------------------------------------- 2.6.2 -------------------------------------
+03-Feb-2006 Stefan Braunewell (very big special thanks to John and Alex)
+#	Fixed ticket #104 - commas in form field descriptions not allowed.
+#	Cookie REMEMBER_KEY wasn't cleared in account/logout 
+	and expiration date is now set to time in the past.
+#	Smart login not working.
+!	Changed mail calls to new function $wb->mail.
+#	Form: ticket 124 added captcha settings check 
+#	Ticket 118 added formfield type to check for email/text 
+#	Ticket 115 changed comparision /modules/form/view.php 
+#	Added correct timecheck in form submissions
+!	Changed captcha.php call to include timestamp
+!	Changed the e-mail validation code and added a mail function to class wb.
+!	Forgotten password: if sending of e-mail fails, restore old password.
+	Ticket #110
+!	Added more charset options. Ticket #102 - thanks to ruebenwurzel!
+!	Character encoding setting also affects admin backend.
+	Mentioned in ticket #102.
+!	Reintroduced page languages setting. If switched to off, page
+	languages are only used to determine the language file for the
+	universal texts. If on, displayed page and menu are affected by
+	the language session variable.
+#	Fixed bugs in show_breadcrumbs code and added parameter "depth"
+	to set the number of levels to be show.
+#	Fixed a bug where access settings of registered and private pages
+	were displayed incorrectly.
+#	Fixed captcha being cached.
+#	Added an exit call after every heading("Location:...")
+	redirector to prevent unwanted execution of code.
+#	Bug #122. Replaced empty field check by check that setting name is
+	not "wb_version".
+#	Replaced all remaining occurrences of '/media' by MEDIA_DIRECTORY - bug #108.
+#	Fixed bug #99 and two additional instances of typo 
+	catpcha instead of captcha.
+#	Fixed some typos
+#	Fixed some notices and warnings.
+#	Fixed bug #105 - back buttons in addon detail pages not editable.
+!	Replace 'admin' by 'wb' in all account pages. 
+!/#	Moved print_success and print_error code to class.wb.php.
+	Added correct parameters to these functions in account pages. 
+------------------------------------- 2.6.1 -------------------------------------
+12-Dec-2005 Ryan Djurovich
+#	Fixed security vulnerability in class.login.php
+#	Fixed typo in EN language file
+#	Fixed captcha problems (when feature is disabled) in form module and sign-up
+!	Added charset encoding to admin templates
+!	Added extra code to check for selection of addon upon uninstalling
+#	Fixed bugs in RSS news feeder
+#	Fixed bug with PAGE_DESCRIPTION not being set on any page
+------------------------------------- 2.6.0 -------------------------------------
+28-Nov-2005 Ryan Djurovich
++	Added default charset option to (advanced) settings
+#	Form module email fields now have email address validation
+#	Fixed spacing in form submissions
+27-Nov-2005 Ryan Djurovich
++	Added captcha verification to sign-up form
++	Added Captcha to News module
+24-Nov-2005 Stefan Braunewell
+!	Applied aportale's patch to use label instead of javascript toggle code
+20-Nov-2005 Ryan Djurovich
+!	News mod now hides read more link if no need for it (see ticket #56)
++	Added support for mailto: links in the menu link mod
+#	Added direct-access redirection on some files (see ticket #37)
++	Added extra characters to convert.php (see ticket #64)
+#	Fixed ticket #65 (last_reset check in account/forgot_form.php)
+29-Sep-2005 Ryan Djurovich
+!	Cleaned up form buttons in Settings
+!	Moved some options into Advanced Settings
+#	Semi-disabled "separate" page trash option
++	Created a backup module/tool for backing-up the database
+	(thanks to John (pcwacht) for the original code)
++	Created new "blank template", which can be used in case where you don't
+	want anything wrapping page-content.
+19-Sep-2005 Ryan Djurovich
++	Added _license field for all add-ons to specify a license
+!	Renamed _designed_for variables (for all addons) to _platform
++	Created addons table for faster internal referencing of installed addons
+!	Fixed some links, including the "Help" button in Admin
+#	Used nl2br to display body correctly when viewing form-submissions
+15-Sep-2005 Stefan Braunewell
++	Added table module with columns 'name','type' and 'directory' as an
+	index.
++	Added entry to settings table 'wb_version' which holds the version
+	number and can be utilized in future upgrade scripts.
+!	Added upgrade functionality also for templates and languages.
+#/!	Template/modules installation now respects paths.
+!	Moved updates from config.php to database.
+	Created initialize.php (required by config.php) to read settings.
+11-Sep-2005 Stefan Braunewell
+!	HTMLArea is now a module instead of a core component. Files moved
+	from "include" to "modules".
++	Implemented Installation of modules on top of an older version. This is 
+	done via checking $module_version. Instead of install.php, upgrade.php
+	is then called if it exists in the module package. 
+	For module developers: $module_version and $new_module_version are 
+	accessible in upgrade.php to find out what upgrade steps need to be taken.
+!	Changed column names in mod_news_posts from short,long to content_short,
+	content_long.
+09-Sep-2005 Stefan Braunewell
++	Added new advanced setting "Rename Files On Upload". File extensions can be
+	given so that respective files will have a ".txt" appended on media upload.
+#	Fixed "None found" message bug when user has no top level page edit
+	rights.
+#	Fixed missing parent option 'none' - ticket #12 - and a minor scope bug.
++	Added breadcrumbs code. Call using $wb->breadcrumbs().
++	Added utf-8 character encoding meta tag into all stock templates.
+#	Fixed bug when changing a page's parent
+!	Changed the way blocks are treated. Added new frontend class attribute
+	default_block_content that controls what is shown on pages such as
+	search, login, etc. (Ticket #16)
++	Added support for WYSIWYG editor modules (wysiwygmod)
++	When trying to access a registered page, user is automatically redirected
+	there on successful login.
+#	Fixed various issues with system search (mainly related to stripslashes()
+#	Removed stripslashes() in many places in the code. Added check for
+	magic_quotes_gpc to new wb class method add_slashes(). Now database contest
+	is independent of magic_quotes setting..
+05-Sep-2005 Stefan Braunewell
+#	Fixed bug concerning direct access of preferences page.
+#	Reworked page visibility and menu item visibility code (frontend login
+	problem).
+#	Pages in link list in htmlarea popup are now correctly ordered.
+#	Fixed bug where group with existing name can be added.
+04-Sep-2005 Ryan Djurovich
++	Added and RSS newsfeed script to the News module
+04-Sep-2005 Stefan Braunewell
+!	Rewrote menu function. Parameters are now given as attributes to frontend class.
+#	Fixed some occurrences of potential direct access path disclosure
+#	Added directory check to browse.php to prevent xss exploit by trusted users.
+!	Updated code to reflect move to Subversion repository system.
+27-Aug-2005 Stefan Braunewell
+#	Fixed bugs 4,5,6,8,9 in bug tracker
+!	Removed 'USER_LANGUAGE' and 'GET_LANGUAGE' constants.
+	A GET['lang'] now sets the session language variable.
+26-Aug-2005 Stefan Braunewell
+!	Moved redundant code into the new class functions. Created 
+	'compatibility.php' for backward compatibility with
+	modules and templates. Variables and functions can still be accessed
+	in the old way.
+!/+	Reorganized core frontend files, added new base class 'wb' from
+	which 'admin' and the new 'frontend' class inherit. Moved all frontend
+	function into new class. Completely rewrote core index.php.
+	Now all variables and functions that are available to templates and
+	modules are attributes and methods of the frontend and the wb classes
+------------------------------------- 2.5.2 -------------------------------------
+23-Jun-2005 Ryan Djurovich
+!	create_access_file now creates all parent directories if needed
+#	Fixed bug when moving page with subpages to another level
+#	Fixed bug when saving "Settings" (in Admin) on Windows/IIS
+#	Fixed bug where query was not setting error correctly in class.database.php
+22-Jun-2005 Ryan Djurovich
+#	Fixed bug where template permissions were not saved when a adding group
+21-Jun-2005 Ryan Djurovich
+#	Added htmlspecialchars for modifying WYSIWYG, news, etc. modules (Bug #78)
+#	Fixed language problems in some area's of Admin. (Bug #70)
+#	Added a space in website/page keywords (Bug #69)
+#	Fixed bugs on settings2.php (Bug #52)
+!	Links inserted with HTMLArea now use [wblink--PAGE_ID--] instead of raw URL
+13-Jun-2005 Ryan Djurovich
+#	Fixed bug (#88) with news module
+!	Title of Administration login page now taken from language file (Bug #72)
+#	Fixed redirection admin/home to admin/start on admin/index.php
+#	Fixed bug with forgotten password page in admin (Bug #81)
+25-Apr-2005 Ryan Djurovich
+#	Fixed numerous bugs with module uninstallation
+#	Fixed bug when uploading files in Administration -> Media
+!	Installer no-longer requires you to accept the GNU GPL
+------------------------------------- 2.5.1 -------------------------------------
+16-Apr-2005 Ryan Djurovich
+#	Fixed two bugs with account login/logout
+------------------------------------- 2.5.1 -------------------------------------
+15-Apr-2005 Ryan Djurovich
+#	Fixed bug where non-english characters can get used in page filenames. Many
+	measuers have been added (including a new file: wb/framework/convert.php),
+	to prevent any possible errors that can occur in page filenames.
+#	Fixed invalid meta tags in stock templates (meta tags were not closed)
+#	Removed lines 401, 402, and 425 of wb/index.php - not needed
+#	Fixed bug where search and account pages are shown in every block
+	that is in a template
+#	Fixed numerous bugs with media home directories feature
+10-Apr-2005 Ryan Djurovich
+#	Fixed bugs in account/login.php and logout.php where users
+	gets redirected to /pages
+------------------------------------- 2.5.0 -------------------------------------
+08-Apr-2005 Ryan Djurovich
+-	Removed section language feature
++	Added page language feature (replaces need for sections language feature)
+#	Fixed bug where pages using menu_link module can have the URL changed
+-	Page directory no longer stored in link field in pages table, it is now added
+	when the page_link function is called - this makes changing the pages
+	directory much easier and quicker
+!	Pages with visibility of "none" are now no longer directly accessable
++	Added new visibility setting "hidden", acts exactly like none did previously
+!	Template info file can now specify number of menu's available and relative names
+!	Template info file can now specify number of blocks's available and relative names
+------------------------------------- 2.4.3 -------------------------------------
+07-Apr-2005 Ryan Djurovich
+#	page_filename function has been rewritten using str_replace
+	function, which should be faster and will allow characters
+	from other languages into filenames
+!	Created new media_filename function, which is now used
+	by all media functions (create,upload,rename) to determine
+	which characters should be removed from a desired filename
++	New button in Administration page list to view specific page
+#	Updated the page_link function to now be compatible with menu link
+	module when setting pages directory to root
+#	Fixed bugs in search when using "Any Words" option
+#	Fixed bug with news module when pages directory set to root
+!	Changed URL of documentation website on Administration Start page
+------------------------------------- 2.4.2 -------------------------------------
+05-Apr-2005 Ryan Djurovich
+#	Fixed bug where file could be renamed to nothing in Media
+!	Optimised Media create folder, upload file, and rename functions
+#	Fixed bug where stripslashes not run on news post titles in admin
+05-Apr-2005 Stefan Braunewell
+#	Fixed bug concerning usage of the private_sql variable
+#	Fixed bug conerning sub-pages being displayed in menus incorrectly
+------------------------------------- 2.4.1 -------------------------------------
+04-Apr-2005 Ryan Djurovich
+!	Pages with visibility of "none" are again directly accessable
+#	Fixed bugs regarding renaming files and directories in Media section
+!	When home folders disabled, all folders now visible in Media section
+------------------------------------- 2.4.0 -------------------------------------
+03-Apr-2005 Ryan Djurovich
+-	Removed recently added visibility setting of "heading", and relative config vars
++	Added new "menu" field to pages table, and new setting "multiple menus"
+	which replaces the need for the menu headings feature
++	Added links to top of groups and users sections, linking to each other
+!	Change menu width in "Round" template to 170px (was 150px)
+#	Change page "are you sure" deletion message to mention that it will delete
+	all sub-pages as well
+#	Fixed many bugs with news module when viewing posts by group
+!	Pages with visibility of "none" are now no longer directly accessable
+02-Apr-2005 Ryan Djurovich
+-	Removed need to specify DB_URL when calling database class
+#	Stopped fields without a type specified from being shown in form mod
+#	Changed '/media' to MEDIA_DIRECTORY on HTMLArea popup windows
+	for insert link and insert image
++	Added setting which allows you to specify the default WYSIWYG style
++	Added "Server Email" option, to specify what is used in "From" field when
+	sending emails using the PHP mail function. Default is admins email address.
+#	Search now excludes pages which have a visibility of none or heading
+!	Pages are now given modified_when and modified_by when added
+01-Apr-2005 Ryan Djurovich
++	Added option to News module to specify how many posts should be listed
+	per page (by default it is set to unlimited, which functions like previous version)
+#	Added stripslashes when display page titles in search
++	Page descriptions and last updated date now shown in search by default
+30-Mar-2005 Ryan Djurovich
++	Added new feature for Media home folders, where a folder can be specified
+	for a specific user or group of users only
+!	Changed URL of Help button to http://www.websitebaker.org/docs/
++	Added new feature for "Page Trash" - two modes available: inline and separate
+!	When pages are deleted, all sub-pages are now deleted (instead of being moved
+	up a level)
+29-Mar-2005 Ryan Djurovich
+-	Removed Database Settings from Administration Settings (options will not be
+	available in 3.x, so trying to match interface with WB 3.x plans
+!	Changed the name of Path Settings to Filesystem Settings in Administration
+	Settings, and removed ability to change path/url options - matching interface
+	plans for WB 3.x
++	Added same options for OS and file permissions as installer to Settings
+!	Sessions now named with APP_NAME.'_session_id' (e.g. default is wb_session_id)
+28-Mar-2005 Ryan Djurovich
++	New functions available to templates to simplify creation of them. This aims
+	to "future-proof" templates for WB 3.x plans.
+!	Default templates updated to support some of the new functions
++	Added field to pages table "page_trail" which stores a list of the pages
+	parents. This field was needed by the new page_menu function
++	Added option for page visibility "heading" to enabled support for multiple
+	menu's. Also, this helps to "future-proof" templates for WB 3.x plans
++	Added option for page visibility "registered", which acts a little like
+	private, but is still shown in the menu (although users need to log in to view
+	the pages content)
++	Form module submissions now saved to database, and feature now added to
+	limit number of submissions per hour to prevent spamming
++	New field for Form module: email. Allows you to specify their email in
+	"from" field on module settings.
+#	Fixed bug when displaying comments in News module (WB Bug #14)
++	New "under contruction" message if no pages exist
+!	Cleaned-up wb/index.php
+27-Mar-2005 Ryan Djurovich
++	Created advanced mkdir and chmod functions
+#	Fixed bug in media where wrong file/folder is deleted
++	Complete overhall of installer - now only one step! It has been greatly
+	simplified in many ways, has much better validation, reports error much more
+	nicely, and automatically logs the user into the Administrations
++	Must now specify OS type - allows for customizable file permission settings
++	Sections can now have a language code assigned to them
++	Sections can now have a block name/id assigned to them
+!	Home section of Administration renamed to Start, to save confusion with saying
+	Homepage (because this term could either mean the main website or Home section
+	in	Administration). Also, this aims to unify the interface with WB 3.x plans
+!	Moved Users and Groups sections under Access section. This aims to unify the
+	interface with WB 3.x plans, which help to unclutter the menu
+!	Interface for Settings section has been imporved for usability purposes
+#	Fixed HTMLArea where no scrollbar for "insert link" and "insert image" dialogs
+	by placing media list inside an iframe
+#	Fixed stripslashes problem for viewing news comments
+!	Added code from Formesque module (an advanced version of the original Form
+	module, modified by Rudolph Lartey from www.carbonect.com), and made further
+	interface improvements for select box/checkbox group/radio group options.
+#	Possibly fixed bugs where an S appears before file and dir modes
+#	Fixed bug where users can be added with same emails (in Administration)
+-	Removed support for PEAR, as it was deemed an unnecessary addition which only
+	makes code more bulky, and removing it will decrease package size a lot
++	New "homepage redirect" option so first page is included and not redirected to
+#	Fixed text not being shown when module uninstalled
+!	Imporved interface for basic group permissions
+26-Mar-2005 Stefan Braunewell
+#	Fixed bug with front-end logins
+#	Fixed bug when saving intro page 
++	Added check on sign-up if e-mail exists (thanks to P. Melief)
+#	Fixed bugs concerning moving/deleting pages
+#	Fixed list of parents in page settings
+#	Fixed mkdir without mode parameter
+#	Added a check on install to ensure PHP 4.1.x compatibility (thanks to Wanderer)
++	Added support for PAGES_DIRECTORY set to root
++	Search form now supports quotes (thanks to Manafta)
+#	Fixed page section ordering
+#	News items are displayed with name of poster instead of "Unknown"
+#	Deletion confirmation popup window in media section now shows correct file name
+------------------------------------- 2.3.1 -------------------------------------
+03-Fed-2005 Ryan Djurovich
++	Now there is two types of "filesystem modes", one for directories and one
+	for files. Having different settings is very common for most servers, so
+	this addition should fix many problems people had with 2.3.0.
+-	Removed filesystem mode options from installation
+!	Removed duplicate text on installation step 3 for timezone
+!	All "access files" for the news module now stored in pages/posts instead
+	of a sub-dir relative to the page (this fixes many bugs)
+#	Fixed major bugs when deleting pages with sub-pages
+!	Removed the restrictions that prevent a user for changing a pages level
+#	Fixed bug with "toggle" plus/minus in IE for pages list
+#	Fixed some bugs where /pages was not replaced with PAGES_DIRECTORY constant
+------------------------------------- 2.3.0 -------------------------------------
+26-Jan-2005 Ryan Djurovich
+#	Fixed bug in framework/functions.php that made root parent always equal 8
+#	Added missing braces in lines 182 and 208 of admin/pages/settings2.php
+#	Fixed SQL-query on line 172, placing a / after $old_link
+#	Added eregi checks for PAGES_DIRECTORY on lines 140 and 150 of
+	admin/pages/settings2.php
+#	Added ordering cleaning to delete_post.php on line 53 for news module
+!	GMT option is selected for "Default Timezone" in the installer, instead
+	of the old "Please select" message (which had the same value as GMT)
+28-Jan-2005 Ryan Djurovich
+!	Ability to specify the chmod number when WB uploads files, etc.
+!	Modified file headers (copyright/license notice) so they now look almost the
+	same, independant of font. Also, it now covers copyright for 2005.
+30-Jan-2005 Ryan Djurovich
+#	Added code on wb/admin/pages/delete.php to remove sections from the sections
+	table when a page is deleted.
++	New 'Smart Login' prevents users from using external password managers,
+	and can be set to remember the users password using cookies.
+!	SourceForge CVS module now called websitebaker2 (instead of just
+	websitebaker). Also, all file versions have been reset.
+01-Fed-2005 Ryan Djurovich
+!	Added code to prevent from changing a pages level (it simply disables
+	the select box), to prevent many possible bugs.
+------------------------------------- 2.2.4 -------------------------------------
+23-Dec-2004 Ryan Djurovich
+!	Change 'EXACT_PHRASE' to 'EXACT_MATCH' on line 261 of wb/languages/EN.php
+#	Fixed multi-language support in search
++	Added more detailed options to list of PHP error reporting level's
+-	Removed ability to change language and PHP error reporting level
+	on installation to make things easier for newbie's
++	Ability to select custom spacer for page filename's
+!	Changed the way a language code is found on language installation
++	Added template permissions to groups
+#	Fixed bug when trying to change email from Preferences (admin and frontend)
+#	Fixed bug with auto-selection of "System Default" for Preferences
+!	News module now use's WYSIWYG for modifying news posts
++	Ability to specify both the pages and media target directories
+------------------------------------ 2.2.3-c ------------------------------------
+22-Dec-2004 Ryan Djurovich
+#	Fixed problem with DB password being reset if Settings saved in basic mode
+------------------------------------ 2.2.3-b ------------------------------------
+21-Dec-2004 Ryan Djurovich
+#	Fixed minor bug on admin templates section
+#	Fixed bug on rename.php and rename2.php in admin media section
+------------------------------------- 2.2.3 -------------------------------------
+20-Dec-2004 Ryan Djurovich
++	Added WB release version in Administration (top right corner)
+!	New option to prevent users from adding level 0 pages
+#	Fixed bug when deleting post's in News module
++	Added new field in pages table for "root" parent (level 0 parent), for
+	extra flexability in creating templates
+!	Round template now supports unlimited page levels
+------------------------------------- 2.2.2 -------------------------------------
+18-Dec-2004 Ryan Djurovich
++	New option under Search Settings for selecting custom template for search
++	New option when changing page settings to set the target
+#	Fixed error when saving a user after editing
+!	Users can now modify sub-page if they dont have permissions on the parent
+------------------------------------- 2.2.1 -------------------------------------
+15-Dec-2004 Ryan Djurovich
+#	Fixed bug when changing password on preferences form (front-end)
+#	Fixed bug when retrieving user details (administration)
+#	Added check to see if module, template, or language is in use when deleting
+#	Fixed up email that is sent to user from a submitted form
+#	Fixed major problem with module permissions which stopped it from working
+------------------------------------- 2.2.0 -------------------------------------
+14-Dec-2004 (Correct date[s] unkown) Ryan Djurovich
++	Multiple-level page support
++	Multiple section's for pages (including interface)
+!	Removed text created using two words on all areas
+	(e.g. {Intro} {PAGE} is now {INTRO_PAGE})
+	this is for better language support
++	Added Languages section
+!	Moved Templates and Modules under Add-ons section
+!	Changed name of "Default" template to "Round"
++	Added "All CSS" template
++	Added "Jump"
++	Added 
+!	Modified "Box" template to support multiple page levels
++	Added "Menu Link" module
++	Added "News" module
++	Added "Code" module
++	Added "Form" module
++	Added "Wrapper" module
+!	Changed name of "Normal Page" module to "WYSIWYG"
++	Created new admin wrapper script to ease module develpment
++	Media now automatically creates index.php file for every
+	sub-folder made (for security purposes)
+!	Change "Help" link in Administration menu so it now directs
+	to the the new Website Baker documentation website found at:
+	http://www.websitebaker.org/documentation
+!	Password is now required to change email in preferences
++	User can now select custom Language and Date & Time Formats
++	Added search functionality, with three different "methods":
+	1. Using all words  2. Using any words  3. Exact match
++	Added native MySQL database support
Index: trunk/wb/install/save.php
===================================================================
--- trunk/wb/install/save.php	(revision 416)
+++ trunk/wb/install/save.php	(revision 417)
@@ -1,688 +1,662 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Start a session
-if(!defined('SESSION_STARTED')) {
-	session_name('wb_session_id');
-	session_start();
-	define('SESSION_STARTED', true);
-}
-
-// Function to set error
-function set_error($message) {
-	global $_POST;
-	if(isset($message) AND $message != '') {
-		// Copy values entered into session so user doesn't have to re-enter everything
-		if(isset($_POST['website_title'])) {
-			$_SESSION['wb_url'] = $_POST['wb_url'];
-			$_SESSION['wb_path'] = $_POST['wb_path'];
-			$_SESSION['default_timezone'] = $_POST['default_timezone'];
-			if(!isset($_POST['operating_system'])) {
-				$_SESSION['operating_system'] = 'linux';
-			} else {
-				$_SESSION['operating_system'] = $_POST['operating_system'];
-			}
-			if(!isset($_POST['world_writeable'])) {
-				$_SESSION['world_writeable'] = false;
-			} else {
-				$_SESSION['world_writeable'] = true;
-			}
-			$_SESSION['database_host'] = $_POST['database_host'];
-			$_SESSION['database_username'] = $_POST['database_username'];
-			$_SESSION['database_password'] = $_POST['database_password'];
-			$_SESSION['database_name'] = $_POST['database_name'];
-			$_SESSION['table_prefix'] = $_POST['table_prefix'];
-			if(!isset($_POST['install_tables'])) {
-				$_SESSION['install_tables'] = false;
-			} else {
-				$_SESSION['install_tables'] = true;
-			}
-			$_SESSION['website_title'] = $_POST['website_title'];
-			$_SESSION['admin_username'] = $_POST['admin_username'];
-			$_SESSION['admin_email'] = $_POST['admin_email'];
-			$_SESSION['admin_password'] = $_POST['admin_password'];
-
-			if(!isset($_POST['outgoing_mails'])) {
-				$_SESSION['outgoing_mails'] = 'php';
-			} else {
-				$_SESSION['outgoing_mails'] = $_POST['outgoing_mails'];
-			}
-			$_SESSION['smtp_server'] = $_POST['smtp_server'];
-
-		}
-		// Set the message
-		$_SESSION['message'] = $message;
-		// Specify that session support is enabled
-		$_SESSION['session_support'] = '<font class="good">Enabled</font>';
-		// Redirect to first page again and exit
-		header('Location: index.php?sessions_checked=true');
-		exit();
-	}
-}
-
-// Dummy class to allow modules' install scripts to call $admin->print_error
-class admin_dummy
-{
-	var $error='';
-	function print_error($message)
-	{
-		$this->error=$message;
-	}
-}
-
-// Function to workout what the default permissions are for files created by the webserver
-function default_file_mode($temp_dir) {
-	$v = explode(".",PHP_VERSION);
-	$v = $v[0].$v[1];
-	if($v > 41 AND is_writable($temp_dir)) {
-		$filename = $temp_dir.'/test_permissions.txt';
-		$handle = fopen($filename, 'w');
-		fwrite($handle, 'This file is to get the default file permissions');
-		fclose($handle);
-		$default_file_mode = '0'.substr(sprintf('%o', fileperms($filename)), -3);
-		unlink($filename);
-	} else {
-		$default_file_mode = '0777';
-	}
-	return $default_file_mode;
-}
-
-// Function to workout what the default permissions are for directories created by the webserver
-function default_dir_mode($temp_dir) {
-	$v = explode(".",PHP_VERSION);
-	$v = $v[0].$v[1];
-	if($v > 41 AND is_writable($temp_dir)) {
-		$dirname = $temp_dir.'/test_permissions/';
-		mkdir($dirname);
-		$default_dir_mode = '0'.substr(sprintf('%o', fileperms($dirname)), -3);
-		rmdir($dirname);
-	} else {
-		$default_dir_mode = '0777';
-	}
-	return $default_dir_mode;
-}
-
-function add_slashes($input) {
-		if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
-			return $input;
-		}
-		$output = addslashes($input);
-		return $output;
-	}
-
-// Begin check to see if form was even submitted
-// Set error if no post vars found
-if(!isset($_POST['website_title'])) {
-	set_error('Please fill-in the form below');
-}
-// End check to see if form was even submitted
-
-// Begin path and timezone details code
-
-// Check if user has entered the installation url
-if(!isset($_POST['wb_url']) OR $_POST['wb_url'] == '') {
-	set_error('Please enter an absolute URL');
-} else {
-	$wb_url = $_POST['wb_url'];
-}
-// Remove any slashes at the end of the URL
-if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
-	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
-}
-if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
-	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
-}
-if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
-	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
-}
-if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
-	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
-}
-// Get the default time zone
-if(!isset($_POST['default_timezone']) OR !is_numeric($_POST['default_timezone'])) {
-	set_error('Please select a valid default timezone');
-} else {
-	$default_timezone = $_POST['default_timezone']*60*60;
-}
-// End path and timezone details code
-
-// Begin operating system specific code
-// Get operating system
-if(!isset($_POST['operating_system']) OR $_POST['operating_system'] != 'linux' AND $_POST['operating_system'] != 'windows') {
-	set_error('Please select a valid operating system');
-} else {
-	$operating_system = $_POST['operating_system'];
-}
-// Work-out file permissions
-if($operating_system == 'windows') {
-	$file_mode = '0777';
-	$dir_mode = '0777';
-} elseif(isset($_POST['world_writeable']) AND $_POST['world_writeable'] == 'true') {
-	$file_mode = '0777';
-	$dir_mode = '0777';
-} else {
-	$file_mode = default_file_mode('../temp');
-	$dir_mode = default_dir_mode('../temp');
-}
-// End operating system specific code
-
-// Begin database details code
-// Check if user has entered a database host
-if(!isset($_POST['database_host']) OR $_POST['database_host'] == '') {
-	set_error('Please enter a database host name');
-} else {
-	$database_host = $_POST['database_host'];
-}
-// Check if user has entered a database username
-if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') {
-	set_error('Please enter a database username');
-} else {
-	$database_username = $_POST['database_username'];
-}
-// Check if user has entered a database password
-if(!isset($_POST['database_password'])) {
-	set_error('Please enter a database password');
-} else {
-	$database_password = $_POST['database_password'];
-}
-// Check if user has entered a database name
-if(!isset($_POST['database_name']) OR $_POST['database_name'] == '') {
-	set_error('Please enter a database name');
-} else {
-	$database_name = $_POST['database_name'];
-}
-// Get table prefix
-$table_prefix = $_POST['table_prefix'];
-// Find out if the user wants to install tables and data
-if(isset($_POST['install_tables']) AND $_POST['install_tables'] == 'true') {
-	$install_tables = true;
-} else {
-	$install_tables = false;
-}
-// End database details code
-
-// Begin website title code
-// Get website title
-if(!isset($_POST['website_title']) OR $_POST['website_title'] == '') {
-	set_error('Please enter a website title');
-} else {
-	$website_title = add_slashes($_POST['website_title']);
-}
-// End website title code
-
-// Begin admin user details code
-// Get admin username
-if(!isset($_POST['admin_username']) OR $_POST['admin_username'] == '') {
-	set_error('Please enter a username for the Administrator account');
-} else {
-	$admin_username = $_POST['admin_username'];
-}
-// Get admin email and validate it
-if(!isset($_POST['admin_email']) OR $_POST['admin_email'] == '') {
-	set_error('Please enter an email for the Administrator account');
-} else {
-	if(eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['admin_email'])) {
-		$admin_email = $_POST['admin_email'];
-	} else {
-		set_error('Please enter a valid email address for the Administrator account');
-	}
-}
-// Get the two admin passwords entered, and check that they match
-if(!isset($_POST['admin_password']) OR $_POST['admin_password'] == '') {
-	set_error('Please enter a password for the Administrator account');
-} else {
-	$admin_password = $_POST['admin_password'];
-}
-if(!isset($_POST['admin_repassword']) OR $_POST['admin_repassword'] == '') {
-	set_error('Please make sure you re-enter the password for the Administrator account');
-} else {
-	$admin_repassword = $_POST['admin_repassword'];
-}
-if($admin_password != $admin_repassword) {
-	set_error('Sorry, the two Administrator account passwords you entered do not match');
-}
-// End admin user details code
-
-// Get the SMTP server settings and check if valid
-$smtp_server_used = "mail.example.com";
-if(isset($_POST['outgoing_mails']) AND $_POST['outgoing_mails']=="smtp") {
-	if($_POST['smtp_server'] == "" || $_POST['smtp_server'] == "mail.example.com") {
-		set_error('Please define the SMTP host (Step 7) of your domain or choose option PHP mail().');
-	} else {
-		$smtp_server_used = $_POST['smtp_server'];
-	}
-}
-
-// Create SMTP server output string for the config.php file
-if($smtp_server_used == "mail.example.com") {
-	$smtp_server_used = "// define('WBMAILER_SMTP_HOST', '" .$smtp_server_used ."');\n";
-} else {
-	$smtp_server_used = "define('WBMAILER_SMTP_HOST', '" .$smtp_server_used ."');\n";
-}   
-// End SMTP server settings
-
-// Try and write settings to config file
-$config_content = "" .
-"<?php\n".
-"\n".
-"define('DB_TYPE', 'mysql');\n".
-"define('DB_HOST', '$database_host');\n".
-"define('DB_USERNAME', '$database_username');\n".
-"define('DB_PASSWORD', '$database_password');\n".
-"define('DB_NAME', '$database_name');\n".
-"define('TABLE_PREFIX', '$table_prefix');\n".
-"\n".
-"define('WB_PATH', dirname(__FILE__));\n".
-"define('WB_URL', '$wb_url');\n".
-"define('ADMIN_PATH', WB_PATH.'/admin');\n".
-"define('ADMIN_URL', '$wb_url/admin');\n".
-"\n".
-"// some mail provider do not deliver mails send via PHP mail() function as SMTP authentification is missing\n".
-"// in that case activate SMTP for outgoing mails: un-comment next line and specify SMTP host of your domain\n".
-$smtp_server_used.
-"\n".
-"require_once(WB_PATH.'/framework/initialize.php');\n".
-"\n".
-"?>";
-
-$config_filename = '../config.php';
-
-// Check if the file exists and is writable first.
-if(file_exists($config_filename) AND is_writable($config_filename)) {
-	if(!$handle = fopen($config_filename, 'w')) {
-		set_error("Cannot open the configuration file ($config_filename)");
-	} else {
-		if (fwrite($handle, $config_content) === FALSE) {
-			set_error("Cannot write to the configuration file ($config_filename)");
-		}
-		// Close file
-		fclose($handle);
-	}
-} else {
-	set_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
-}
-
-// Define configuration vars
-define('DB_TYPE', 'mysql');
-define('DB_HOST', $database_host);
-define('DB_USERNAME', $database_username);
-define('DB_PASSWORD', $database_password);
-define('DB_NAME', $database_name);
-define('TABLE_PREFIX', $table_prefix);
-define('WB_PATH', str_replace(array('/install','\install'), '',dirname(__FILE__)));
-define('WB_URL', $wb_url);
-define('ADMIN_PATH', WB_PATH.'/admin');
-define('ADMIN_URL', $wb_url.'/admin');
-
-// Check if the user has entered a correct path
-if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
-	set_error('It appears the Absolute path that you entered is incorrect');
-}
-
-// Try connecting to database	
-if(!mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) {
-	set_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
-}
-
-// Try to create the database
-mysql_query('CREATE DATABASE '.$database_name);
-
-// Close the mysql connection
-mysql_close();
-
-// Include WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Re-connect to the database, this time using in-build database class
-require_once(WB_PATH.'/framework/class.login.php');
-$database=new database();
-
-// Check if we should install tables
-if($install_tables == true) {
-	
-	// Remove tables if they exist
-
-	// Pages table
-	$pages = "DROP TABLE IF EXISTS `".TABLE_PREFIX."pages`";
-	$database->query($pages);
-	// Sections table
-	$sections = "DROP TABLE IF EXISTS `".TABLE_PREFIX."sections`";
-	$database->query($sections);
-	// Settings table
-	$settings = "DROP TABLE IF EXISTS `".TABLE_PREFIX."settings`";
-	$database->query($settings);
-	// Users table
-	$users = "DROP TABLE IF EXISTS `".TABLE_PREFIX."users`";
-	$database->query($users);
-	// Groups table
-	$groups = "DROP TABLE IF EXISTS `".TABLE_PREFIX."groups`";
-	$database->query($groups);
-	// Search table
-	$search = "DROP TABLE IF EXISTS `".TABLE_PREFIX."search`";
-	$database->query($search);
-	// Addons table
-	$addons = "DROP TABLE IF EXISTS `".TABLE_PREFIX."addons`";
-	$database->query($addons);
-				
-	// Try installing tables
-	
-	// Pages table
-	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'pages` ( `page_id` INT NOT NULL auto_increment,'
-	       . ' `parent` INT NOT NULL DEFAULT \'0\','
-	       . ' `root_parent` INT NOT NULL DEFAULT \'0\','
-	       . ' `level` INT NOT NULL DEFAULT \'0\','
-	       . ' `link` TEXT NOT NULL,'
-	       . ' `target` VARCHAR( 7 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `page_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `menu_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `description` TEXT NOT NULL ,'
-	       . ' `keywords` TEXT NOT NULL ,'
-	       . ' `page_trail` TEXT NOT NULL  ,'
-	       . ' `template` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `visibility` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `position` INT NOT NULL DEFAULT \'0\','
-	       . ' `menu` INT NOT NULL DEFAULT \'0\','
-	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `searching` INT NOT NULL DEFAULT \'0\','
-	       . ' `admin_groups` TEXT NOT NULL ,'
-	       . ' `admin_users` TEXT NOT NULL ,'
-	       . ' `viewing_groups` TEXT NOT NULL ,'
-	       . ' `viewing_users` TEXT NOT NULL ,'
-	       . ' `modified_when` INT NOT NULL DEFAULT \'0\','
-	       . ' `modified_by` INT NOT NULL  DEFAULT \'0\','
-	       . ' PRIMARY KEY ( `page_id` ) '
-	       . ' )';
-	$database->query($pages);
-	
-	// Sections table
-	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'sections` ( `section_id` INT NOT NULL auto_increment,'
-	       . ' `page_id` INT NOT NULL DEFAULT \'0\','
-	       . ' `position` INT NOT NULL DEFAULT \'0\','
-	       . ' `module` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `block` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' PRIMARY KEY ( `section_id` ) '
-	       . ' )';
-	$database->query($pages);
-	
-	require(WB_PATH.'/admin/interface/version.php');
-	
-	// Settings table
-	$settings='CREATE TABLE `'.TABLE_PREFIX.'settings` ( `setting_id` INT NOT NULL auto_increment,'
-		. ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-		. ' `value` TEXT NOT NULL ,'
-		. ' PRIMARY KEY ( `setting_id` ) '
-		. ' )';
-	$database->query($settings);
-
-	$settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` "
-	." (name, value) VALUES "
-	." ('wb_version', '".VERSION."'),"
-	." ('website_title', '$website_title'),"
-	." ('website_description', ''),"
-	." ('website_keywords', ''),"
-	." ('website_header', ''),"
-	." ('website_footer', ''),"
-	." ('wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'),"
-	." ('rename_files_on_upload', 'php,asp,phpx,aspx'),"
-	." ('er_level', ''),"
-	." ('default_language', 'EN'),"
-	." ('app_name', 'wb'),"
-	." ('default_timezone', '$default_timezone'),"
-	." ('default_date_format', 'M d Y'),"
-	." ('default_time_format', 'g:i A'),"
-	." ('home_folders', 'true'),"
-	." ('default_template', 'round'),"
-	." ('default_charset', 'utf-8'),"
-	." ('multiple_menus', 'false'),"
-	." ('page_level_limit', '4'),"
-	." ('intro_page', 'false'),"
-	." ('page_trash', 'disabled'),"
-	." ('homepage_redirection', 'false'),"
-	." ('page_languages', 'false'),"
-	." ('wysiwyg_editor', 'htmlarea'),"
-	." ('manage_sections', 'true'),"
-	." ('section_blocks', 'false'),"
-	." ('smart_login', 'false'),"
-	." ('captcha_verification', 'true'),"
-	." ('frontend_login', 'false'),"
-	." ('frontend_signup', 'false'),"
-	." ('server_email', '$admin_email'),"
-	." ('search', 'public'),"
-	." ('page_extension', '.php'),"
-	." ('page_spacer', '-'),"
-	." ('pages_directory', '/pages'),"
-	." ('media_directory', '/media'),"
-	." ('operating_system', '$operating_system'),"
-	." ('string_file_mode', '$file_mode'),"
-	." ('string_dir_mode', '$dir_mode')";
-	$database->query($settings_rows);
-	
-	
-	// Users table
-	$users = 'CREATE TABLE `'.TABLE_PREFIX.'users` ( `user_id` INT NOT NULL auto_increment,'
-	       . ' `group_id` INT NOT NULL DEFAULT \'0\','
-	       . ' `active` INT NOT NULL DEFAULT \'0\','
-	       . ' `username` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `password` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `remember_key` VARCHAR( 255 ) NOT NULL DEFAULT \'\','
-	       . ' `last_reset` INT NOT NULL DEFAULT \'0\','
-	       . ' `display_name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `email` TEXT NOT NULL ,'
-	       . ' `timezone` INT NOT NULL DEFAULT \'0\','
-	       . ' `date_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `time_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
-	       . ' `home_folder` TEXT NOT NULL ,'
-	       . ' `login_when` INT NOT NULL  DEFAULT \'0\','
-	       . ' `login_ip` VARCHAR( 15 ) NOT NULL DEFAULT \'\' ,'
-	       . ' PRIMARY KEY ( `user_id` ) '
-	       . ' )';
-	$database->query($users);
-	
-	// Groups table
-	$groups = 'CREATE TABLE `'.TABLE_PREFIX.'groups` ( `group_id` INT NOT NULL auto_increment,'
-	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	        . ' `system_permissions` TEXT NOT NULL ,'
-	        . ' `module_permissions` TEXT NOT NULL ,'
-	        . ' `template_permissions` TEXT NOT NULL ,'
-	        . ' PRIMARY KEY ( `group_id` ) '
-	        . ' )';
-	$database->query($groups);
-	
-	// Search settings table
-	$search = 'CREATE TABLE `'.TABLE_PREFIX.'search` ( `search_id` INT NOT NULL auto_increment,'
-	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-	        . ' `value` TEXT NOT NULL ,'
-	        . ' `extra` TEXT NOT NULL ,'
-	        . ' PRIMARY KEY ( `search_id` ) '
-	        . ' )';
-	$database->query($search);
-	
-	// Addons table
-	$addons = 'CREATE TABLE `'.TABLE_PREFIX.'addons` ( '
-			.'`addon_id` INT NOT NULL auto_increment ,'
-			.'`type` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`directory` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`description` TEXT NOT NULL ,'
-			.'`function` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`version` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`platform` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`author` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.'`license` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
-			.' PRIMARY KEY ( `addon_id` ) '
-			.' )';
-	$database->query($addons);
-
-	// Insert default data
-	
-	// Admin group
-	$full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete';
-	$insert_admin_group = "INSERT INTO `".TABLE_PREFIX."groups` VALUES ('1', 'Administrators', '$full_system_permissions', '', '')";
-	$database->query($insert_admin_group);
-	// Admin user
-	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` (user_id,group_id,active,username,password,email,display_name) VALUES ('1','1','1','$admin_username','".md5($admin_password)."','$admin_email','Administrator')";
-	$database->query($insert_admin_user);
-	
-	// Search header
-	$search_header = addslashes('
-<h1>Search</h1>
-
-<form name="search" action="[WB_URL]/search/index[PAGE_EXTENSION]" method="get">
-<table cellpadding="3" cellspacing="0" border="0" width="500">
-<tr>
-<td>
-<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />
-</td>
-<td width="150">
-<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />
-</td>
-</tr>
-<tr>
-<td colspan="2">
-<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />
-<label for="match_all">[TEXT_ALL_WORDS]</label>
-<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />
-<label for="match_any">[TEXT_ANY_WORDS]</label>
-<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />
-<label for="match_exact">[TEXT_EXACT_MATCH]</label>
-</td>
-</tr>
-</table>
-
-</form>
-
-<hr />
-	');
-	$insert_search_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'header', '$search_header', '')";
-	$database->query($insert_search_header);
-	// Search footer
-	$search_footer = addslashes('');
-	$insert_search_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'footer', '$search_footer', '')";
-	$database->query($insert_search_footer);
-	// Search results header
-	$search_results_header = addslashes(''.
-'[TEXT_RESULTS_FOR] \'<b>[SEARCH_STRING]</b>\':
-<table cellpadding="2" cellspacing="0" border="0" width="100%" style="padding-top: 10px;">');
-	$insert_search_results_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_header', '$search_results_header', '')";
-	$database->query($insert_search_results_header);
-	// Search results loop
-	$search_results_loop = addslashes(''.
-'<tr style="background-color: #F0F0F0;">
-<td><a href="[LINK]">[TITLE]</a></td>
-<td align="right">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [DATE]</td>
-</tr>
-<tr><td colspan="2" style="text-align: justify; padding-bottom: 10px;">[DESCRIPTION]</td></tr>');
-
-	$insert_search_results_loop = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_loop', '$search_results_loop', '')";
-	$database->query($insert_search_results_loop);
-	// Search results footer
-	$search_results_footer = addslashes("</table>");
-	$insert_search_results_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_footer', '$search_results_footer', '')";
-	$database->query($insert_search_results_footer);
-	// Search no results
-	$search_no_results = addslashes('<br />No results found');
-	$insert_search_no_results = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'no_results', '$search_no_results', '')";
-	$database->query($insert_search_no_results);
-	// Search template
-	$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')");
-		
-	require_once(WB_PATH.'/framework/initialize.php');
-	
-	// Include the PclZip class file (thanks to 
-	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
-			
-	// Install add-ons
-	if(file_exists(WB_PATH.'/install/modules')) {
-		// Unpack pre-packaged modules
-			
-	}
-	if(file_exists(WB_PATH.'/install/templates')) {
-		// Unpack pre-packaged templates
-		
-	}
-	if(file_exists(WB_PATH.'/install/languages')) {
-		// Unpack pre-packaged languages
-		
-	}
-	
-	$admin=new admin_dummy();
-	// Load addons into DB
-	$dirs['modules'] = WB_PATH.'/modules/';
-	$dirs['templates'] = WB_PATH.'/templates/';
-	$dirs['languages'] = WB_PATH.'/languages/';
-	foreach($dirs AS $type => $dir) {
-		if($handle = opendir($dir)) {
-			while(false !== ($file = readdir($handle))) {
-				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
-					// Get addon type
-					if($type == 'modules') {
-						load_module($dir.'/'.$file, true);
-						// Pretty ugly hack to let modules run $admin->set_error
-						// See dummy class definition admin_dummy above
-						if ($admin->error!='') {
-							set_error($admin->error);
-						}
-					} elseif($type == 'templates') {
-						load_template($dir.'/'.$file);
-					} elseif($type == 'languages') {
-						load_language($dir.'/'.$file);
-					}
-				}
-			}
-		closedir($handle);
-		}
-	}
-	
-	// Check if there was a database error
-	if($database->is_error()) {
-		set_error($database->get_error());
-	}
-	
-}
-
-// Log the user in and go to Website Baker Administration
-$thisApp = new Login(
-							array(
-									"MAX_ATTEMPS" => "50",
-									"WARNING_URL" => ADMIN_URL."/login/warning.html",
-									"USERNAME_FIELDNAME" => 'admin_username',
-									"PASSWORD_FIELDNAME" => 'admin_password',
-									"REMEMBER_ME_OPTION" => SMART_LOGIN,
-									"MIN_USERNAME_LEN" => "2",
-									"MIN_PASSWORD_LEN" => "2",
-									"MAX_USERNAME_LEN" => "30",
-									"MAX_PASSWORD_LEN" => "30",
-									'LOGIN_URL' => ADMIN_URL."/login/index.php",
-									'DEFAULT_URL' => ADMIN_URL."/start/index.php",
-									'TEMPLATE_DIR' => ADMIN_PATH."/login",
-									'TEMPLATE_FILE' => "template.html",
-									'FRONTEND' => false,
-									'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
-									'USERS_TABLE' => TABLE_PREFIX."users",
-									'GROUPS_TABLE' => TABLE_PREFIX."groups",
-							)
-					);
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Start a session
+if(!defined('SESSION_STARTED')) {
+	session_name('wb_session_id');
+	session_start();
+	define('SESSION_STARTED', true);
+}
+
+// Function to set error
+function set_error($message) {
+	global $_POST;
+	if(isset($message) AND $message != '') {
+		// Copy values entered into session so user doesn't have to re-enter everything
+		if(isset($_POST['website_title'])) {
+			$_SESSION['wb_url'] = $_POST['wb_url'];
+			$_SESSION['wb_path'] = $_POST['wb_path'];
+			$_SESSION['default_timezone'] = $_POST['default_timezone'];
+			if(!isset($_POST['operating_system'])) {
+				$_SESSION['operating_system'] = 'linux';
+			} else {
+				$_SESSION['operating_system'] = $_POST['operating_system'];
+			}
+			if(!isset($_POST['world_writeable'])) {
+				$_SESSION['world_writeable'] = false;
+			} else {
+				$_SESSION['world_writeable'] = true;
+			}
+			$_SESSION['database_host'] = $_POST['database_host'];
+			$_SESSION['database_username'] = $_POST['database_username'];
+			$_SESSION['database_password'] = $_POST['database_password'];
+			$_SESSION['database_name'] = $_POST['database_name'];
+			$_SESSION['table_prefix'] = $_POST['table_prefix'];
+			if(!isset($_POST['install_tables'])) {
+				$_SESSION['install_tables'] = false;
+			} else {
+				$_SESSION['install_tables'] = true;
+			}
+			$_SESSION['website_title'] = $_POST['website_title'];
+			$_SESSION['admin_username'] = $_POST['admin_username'];
+			$_SESSION['admin_email'] = $_POST['admin_email'];
+			$_SESSION['admin_password'] = $_POST['admin_password'];
+		}
+		// Set the message
+		$_SESSION['message'] = $message;
+		// Specify that session support is enabled
+		$_SESSION['session_support'] = '<font class="good">Enabled</font>';
+		// Redirect to first page again and exit
+		header('Location: index.php?sessions_checked=true');
+		exit();
+	}
+}
+
+// Dummy class to allow modules' install scripts to call $admin->print_error
+class admin_dummy
+{
+	var $error='';
+	function print_error($message)
+	{
+		$this->error=$message;
+	}
+}
+
+// Function to workout what the default permissions are for files created by the webserver
+function default_file_mode($temp_dir) {
+	$v = explode(".",PHP_VERSION);
+	$v = $v[0].$v[1];
+	if($v > 41 AND is_writable($temp_dir)) {
+		$filename = $temp_dir.'/test_permissions.txt';
+		$handle = fopen($filename, 'w');
+		fwrite($handle, 'This file is to get the default file permissions');
+		fclose($handle);
+		$default_file_mode = '0'.substr(sprintf('%o', fileperms($filename)), -3);
+		unlink($filename);
+	} else {
+		$default_file_mode = '0777';
+	}
+	return $default_file_mode;
+}
+
+// Function to workout what the default permissions are for directories created by the webserver
+function default_dir_mode($temp_dir) {
+	$v = explode(".",PHP_VERSION);
+	$v = $v[0].$v[1];
+	if($v > 41 AND is_writable($temp_dir)) {
+		$dirname = $temp_dir.'/test_permissions/';
+		mkdir($dirname);
+		$default_dir_mode = '0'.substr(sprintf('%o', fileperms($dirname)), -3);
+		rmdir($dirname);
+	} else {
+		$default_dir_mode = '0777';
+	}
+	return $default_dir_mode;
+}
+
+function add_slashes($input) {
+		if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
+			return $input;
+		}
+		$output = addslashes($input);
+		return $output;
+	}
+
+// Begin check to see if form was even submitted
+// Set error if no post vars found
+if(!isset($_POST['website_title'])) {
+	set_error('Please fill-in the form below');
+}
+// End check to see if form was even submitted
+
+// Begin path and timezone details code
+
+// Check if user has entered the installation url
+if(!isset($_POST['wb_url']) OR $_POST['wb_url'] == '') {
+	set_error('Please enter an absolute URL');
+} else {
+	$wb_url = $_POST['wb_url'];
+}
+// Remove any slashes at the end of the URL
+if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
+	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
+}
+if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
+	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
+}
+if(substr($wb_url, strlen($wb_url)-1, 1) == "/") {
+	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
+}
+if(substr($wb_url, strlen($wb_url)-1, 1) == "\\") {
+	$wb_url = substr($wb_url, 0, strlen($wb_url)-1);
+}
+// Get the default time zone
+if(!isset($_POST['default_timezone']) OR !is_numeric($_POST['default_timezone'])) {
+	set_error('Please select a valid default timezone');
+} else {
+	$default_timezone = $_POST['default_timezone']*60*60;
+}
+// End path and timezone details code
+
+// Begin operating system specific code
+// Get operating system
+if(!isset($_POST['operating_system']) OR $_POST['operating_system'] != 'linux' AND $_POST['operating_system'] != 'windows') {
+	set_error('Please select a valid operating system');
+} else {
+	$operating_system = $_POST['operating_system'];
+}
+// Work-out file permissions
+if($operating_system == 'windows') {
+	$file_mode = '0777';
+	$dir_mode = '0777';
+} elseif(isset($_POST['world_writeable']) AND $_POST['world_writeable'] == 'true') {
+	$file_mode = '0777';
+	$dir_mode = '0777';
+} else {
+	$file_mode = default_file_mode('../temp');
+	$dir_mode = default_dir_mode('../temp');
+}
+// End operating system specific code
+
+// Begin database details code
+// Check if user has entered a database host
+if(!isset($_POST['database_host']) OR $_POST['database_host'] == '') {
+	set_error('Please enter a database host name');
+} else {
+	$database_host = $_POST['database_host'];
+}
+// Check if user has entered a database username
+if(!isset($_POST['database_username']) OR $_POST['database_username'] == '') {
+	set_error('Please enter a database username');
+} else {
+	$database_username = $_POST['database_username'];
+}
+// Check if user has entered a database password
+if(!isset($_POST['database_password'])) {
+	set_error('Please enter a database password');
+} else {
+	$database_password = $_POST['database_password'];
+}
+// Check if user has entered a database name
+if(!isset($_POST['database_name']) OR $_POST['database_name'] == '') {
+	set_error('Please enter a database name');
+} else {
+	$database_name = $_POST['database_name'];
+}
+// Get table prefix
+$table_prefix = $_POST['table_prefix'];
+// Find out if the user wants to install tables and data
+if(isset($_POST['install_tables']) AND $_POST['install_tables'] == 'true') {
+	$install_tables = true;
+} else {
+	$install_tables = false;
+}
+// End database details code
+
+// Begin website title code
+// Get website title
+if(!isset($_POST['website_title']) OR $_POST['website_title'] == '') {
+	set_error('Please enter a website title');
+} else {
+	$website_title = add_slashes($_POST['website_title']);
+}
+// End website title code
+
+// Begin admin user details code
+// Get admin username
+if(!isset($_POST['admin_username']) OR $_POST['admin_username'] == '') {
+	set_error('Please enter a username for the Administrator account');
+} else {
+	$admin_username = $_POST['admin_username'];
+}
+// Get admin email and validate it
+if(!isset($_POST['admin_email']) OR $_POST['admin_email'] == '') {
+	set_error('Please enter an email for the Administrator account');
+} else {
+	if(eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $_POST['admin_email'])) {
+		$admin_email = $_POST['admin_email'];
+	} else {
+		set_error('Please enter a valid email address for the Administrator account');
+	}
+}
+// Get the two admin passwords entered, and check that they match
+if(!isset($_POST['admin_password']) OR $_POST['admin_password'] == '') {
+	set_error('Please enter a password for the Administrator account');
+} else {
+	$admin_password = $_POST['admin_password'];
+}
+if(!isset($_POST['admin_repassword']) OR $_POST['admin_repassword'] == '') {
+	set_error('Please make sure you re-enter the password for the Administrator account');
+} else {
+	$admin_repassword = $_POST['admin_repassword'];
+}
+if($admin_password != $admin_repassword) {
+	set_error('Sorry, the two Administrator account passwords you entered do not match');
+}
+// End admin user details code
+
+// Try and write settings to config file
+$config_content = "" .
+"<?php\n".
+"\n".
+"define('DB_TYPE', 'mysql');\n".
+"define('DB_HOST', '$database_host');\n".
+"define('DB_USERNAME', '$database_username');\n".
+"define('DB_PASSWORD', '$database_password');\n".
+"define('DB_NAME', '$database_name');\n".
+"define('TABLE_PREFIX', '$table_prefix');\n".
+"\n".
+"define('WB_PATH', dirname(__FILE__));\n".
+"define('WB_URL', '$wb_url');\n".
+"define('ADMIN_PATH', WB_PATH.'/admin');\n".
+"define('ADMIN_URL', '$wb_url/admin');\n".
+"\n".
+"require_once(WB_PATH.'/framework/initialize.php');\n".
+"\n".
+"?>";
+
+$config_filename = '../config.php';
+
+// Check if the file exists and is writable first.
+if(file_exists($config_filename) AND is_writable($config_filename)) {
+	if(!$handle = fopen($config_filename, 'w')) {
+		set_error("Cannot open the configuration file ($config_filename)");
+	} else {
+		if (fwrite($handle, $config_content) === FALSE) {
+			set_error("Cannot write to the configuration file ($config_filename)");
+		}
+		// Close file
+		fclose($handle);
+	}
+} else {
+	set_error("The configuration file $config_filename is not writable. Change its permissions so it is, then re-run step 4.");
+}
+
+// Define configuration vars
+define('DB_TYPE', 'mysql');
+define('DB_HOST', $database_host);
+define('DB_USERNAME', $database_username);
+define('DB_PASSWORD', $database_password);
+define('DB_NAME', $database_name);
+define('TABLE_PREFIX', $table_prefix);
+define('WB_PATH', str_replace(array('/install','\install'), '',dirname(__FILE__)));
+define('WB_URL', $wb_url);
+define('ADMIN_PATH', WB_PATH.'/admin');
+define('ADMIN_URL', $wb_url.'/admin');
+
+// Check if the user has entered a correct path
+if(!file_exists(WB_PATH.'/framework/class.admin.php')) {
+	set_error('It appears the Absolute path that you entered is incorrect');
+}
+
+// Try connecting to database	
+if(!mysql_connect(DB_HOST, DB_USERNAME, DB_PASSWORD)) {
+	set_error('Database host name, username and/or password incorrect. MySQL Error:<br />'.mysql_error());
+}
+
+// Try to create the database
+mysql_query('CREATE DATABASE '.$database_name);
+
+// Close the mysql connection
+mysql_close();
+
+// Include WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Re-connect to the database, this time using in-build database class
+require_once(WB_PATH.'/framework/class.login.php');
+$database=new database();
+
+// Check if we should install tables
+if($install_tables == true) {
+	
+	// Remove tables if they exist
+
+	// Pages table
+	$pages = "DROP TABLE IF EXISTS `".TABLE_PREFIX."pages`";
+	$database->query($pages);
+	// Sections table
+	$sections = "DROP TABLE IF EXISTS `".TABLE_PREFIX."sections`";
+	$database->query($sections);
+	// Settings table
+	$settings = "DROP TABLE IF EXISTS `".TABLE_PREFIX."settings`";
+	$database->query($settings);
+	// Users table
+	$users = "DROP TABLE IF EXISTS `".TABLE_PREFIX."users`";
+	$database->query($users);
+	// Groups table
+	$groups = "DROP TABLE IF EXISTS `".TABLE_PREFIX."groups`";
+	$database->query($groups);
+	// Search table
+	$search = "DROP TABLE IF EXISTS `".TABLE_PREFIX."search`";
+	$database->query($search);
+	// Addons table
+	$addons = "DROP TABLE IF EXISTS `".TABLE_PREFIX."addons`";
+	$database->query($addons);
+				
+	// Try installing tables
+	
+	// Pages table
+	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'pages` ( `page_id` INT NOT NULL auto_increment,'
+	       . ' `parent` INT NOT NULL DEFAULT \'0\','
+	       . ' `root_parent` INT NOT NULL DEFAULT \'0\','
+	       . ' `level` INT NOT NULL DEFAULT \'0\','
+	       . ' `link` TEXT NOT NULL,'
+	       . ' `target` VARCHAR( 7 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `page_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `menu_title` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `description` TEXT NOT NULL ,'
+	       . ' `keywords` TEXT NOT NULL ,'
+	       . ' `page_trail` TEXT NOT NULL  ,'
+	       . ' `template` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `visibility` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `position` INT NOT NULL DEFAULT \'0\','
+	       . ' `menu` INT NOT NULL DEFAULT \'0\','
+	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `searching` INT NOT NULL DEFAULT \'0\','
+	       . ' `admin_groups` TEXT NOT NULL ,'
+	       . ' `admin_users` TEXT NOT NULL ,'
+	       . ' `viewing_groups` TEXT NOT NULL ,'
+	       . ' `viewing_users` TEXT NOT NULL ,'
+	       . ' `modified_when` INT NOT NULL DEFAULT \'0\','
+	       . ' `modified_by` INT NOT NULL  DEFAULT \'0\','
+	       . ' PRIMARY KEY ( `page_id` ) '
+	       . ' )';
+	$database->query($pages);
+	
+	// Sections table
+	$pages = 'CREATE TABLE `'.TABLE_PREFIX.'sections` ( `section_id` INT NOT NULL auto_increment,'
+	       . ' `page_id` INT NOT NULL DEFAULT \'0\','
+	       . ' `position` INT NOT NULL DEFAULT \'0\','
+	       . ' `module` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `block` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' PRIMARY KEY ( `section_id` ) '
+	       . ' )';
+	$database->query($pages);
+	
+	require(WB_PATH.'/admin/interface/version.php');
+	
+	// Settings table
+	$settings='CREATE TABLE `'.TABLE_PREFIX.'settings` ( `setting_id` INT NOT NULL auto_increment,'
+		. ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+		. ' `value` TEXT NOT NULL ,'
+		. ' PRIMARY KEY ( `setting_id` ) '
+		. ' )';
+	$database->query($settings);
+
+	$settings_rows=	"INSERT INTO `".TABLE_PREFIX."settings` "
+	." (name, value) VALUES "
+	." ('wb_version', '".VERSION."'),"
+	." ('website_title', '$website_title'),"
+	." ('website_description', ''),"
+	." ('website_keywords', ''),"
+	." ('website_header', ''),"
+	." ('website_footer', ''),"
+	." ('wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'),"
+	." ('rename_files_on_upload', 'php,asp,phpx,aspx'),"
+	." ('er_level', ''),"
+	." ('default_language', 'EN'),"
+	." ('app_name', 'wb'),"
+	." ('default_timezone', '$default_timezone'),"
+	." ('default_date_format', 'M d Y'),"
+	." ('default_time_format', 'g:i A'),"
+	." ('home_folders', 'true'),"
+	." ('default_template', 'round'),"
+	." ('default_charset', 'utf-8'),"
+	." ('multiple_menus', 'false'),"
+	." ('page_level_limit', '4'),"
+	." ('intro_page', 'false'),"
+	." ('page_trash', 'disabled'),"
+	." ('homepage_redirection', 'false'),"
+	." ('page_languages', 'false'),"
+	." ('wysiwyg_editor', 'htmlarea'),"
+	." ('manage_sections', 'true'),"
+	." ('section_blocks', 'false'),"
+	." ('smart_login', 'false'),"
+	." ('captcha_verification', 'true'),"
+	." ('frontend_login', 'false'),"
+	." ('frontend_signup', 'false'),"
+	." ('server_email', '$admin_email'),"
+	." ('search', 'public'),"
+	." ('page_extension', '.php'),"
+	." ('page_spacer', '-'),"
+	." ('pages_directory', '/pages'),"
+	." ('media_directory', '/media'),"
+	." ('operating_system', '$operating_system'),"
+	." ('string_file_mode', '$file_mode'),"
+	." ('string_dir_mode', '$dir_mode'),"
+	." ('wbmailer_routine', 'phpmail'),"
+	." ('wbmailer_smtp_host', ''),"
+	." ('wbmailer_smtp_auth', ''),"
+	." ('wbmailer_smtp_username', ''),"
+	." ('wbmailer_smtp_password', '')";
+	$database->query($settings_rows);
+	
+	// Users table
+	$users = 'CREATE TABLE `'.TABLE_PREFIX.'users` ( `user_id` INT NOT NULL auto_increment,'
+	       . ' `group_id` INT NOT NULL DEFAULT \'0\','
+	       . ' `active` INT NOT NULL DEFAULT \'0\','
+	       . ' `username` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `password` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `remember_key` VARCHAR( 255 ) NOT NULL DEFAULT \'\','
+	       . ' `last_reset` INT NOT NULL DEFAULT \'0\','
+	       . ' `display_name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `email` TEXT NOT NULL ,'
+	       . ' `timezone` INT NOT NULL DEFAULT \'0\','
+	       . ' `date_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `time_format` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `language` VARCHAR( 5 ) NOT NULL DEFAULT \'\' ,'
+	       . ' `home_folder` TEXT NOT NULL ,'
+	       . ' `login_when` INT NOT NULL  DEFAULT \'0\','
+	       . ' `login_ip` VARCHAR( 15 ) NOT NULL DEFAULT \'\' ,'
+	       . ' PRIMARY KEY ( `user_id` ) '
+	       . ' )';
+	$database->query($users);
+	
+	// Groups table
+	$groups = 'CREATE TABLE `'.TABLE_PREFIX.'groups` ( `group_id` INT NOT NULL auto_increment,'
+	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	        . ' `system_permissions` TEXT NOT NULL ,'
+	        . ' `module_permissions` TEXT NOT NULL ,'
+	        . ' `template_permissions` TEXT NOT NULL ,'
+	        . ' PRIMARY KEY ( `group_id` ) '
+	        . ' )';
+	$database->query($groups);
+	
+	// Search settings table
+	$search = 'CREATE TABLE `'.TABLE_PREFIX.'search` ( `search_id` INT NOT NULL auto_increment,'
+	        . ' `name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+	        . ' `value` TEXT NOT NULL ,'
+	        . ' `extra` TEXT NOT NULL ,'
+	        . ' PRIMARY KEY ( `search_id` ) '
+	        . ' )';
+	$database->query($search);
+	
+	// Addons table
+	$addons = 'CREATE TABLE `'.TABLE_PREFIX.'addons` ( '
+			.'`addon_id` INT NOT NULL auto_increment ,'
+			.'`type` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`directory` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`name` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`description` TEXT NOT NULL ,'
+			.'`function` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`version` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`platform` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`author` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.'`license` VARCHAR( 255 ) NOT NULL DEFAULT \'\' ,'
+			.' PRIMARY KEY ( `addon_id` ) '
+			.' )';
+	$database->query($addons);
+
+	// Insert default data
+	
+	// Admin group
+	$full_system_permissions = 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete';
+	$insert_admin_group = "INSERT INTO `".TABLE_PREFIX."groups` VALUES ('1', 'Administrators', '$full_system_permissions', '', '')";
+	$database->query($insert_admin_group);
+	// Admin user
+	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` (user_id,group_id,active,username,password,email,display_name) VALUES ('1','1','1','$admin_username','".md5($admin_password)."','$admin_email','Administrator')";
+	$database->query($insert_admin_user);
+	
+	// Search header
+	$search_header = addslashes('
+<h1>Search</h1>
+
+<form name="search" action="[WB_URL]/search/index[PAGE_EXTENSION]" method="get">
+<table cellpadding="3" cellspacing="0" border="0" width="500">
+<tr>
+<td>
+<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />
+</td>
+<td width="150">
+<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />
+</td>
+</tr>
+<tr>
+<td colspan="2">
+<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />
+<label for="match_all">[TEXT_ALL_WORDS]</label>
+<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />
+<label for="match_any">[TEXT_ANY_WORDS]</label>
+<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />
+<label for="match_exact">[TEXT_EXACT_MATCH]</label>
+</td>
+</tr>
+</table>
+
+</form>
+
+<hr />
+	');
+	$insert_search_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'header', '$search_header', '')";
+	$database->query($insert_search_header);
+	// Search footer
+	$search_footer = addslashes('');
+	$insert_search_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'footer', '$search_footer', '')";
+	$database->query($insert_search_footer);
+	// Search results header
+	$search_results_header = addslashes(''.
+'[TEXT_RESULTS_FOR] \'<b>[SEARCH_STRING]</b>\':
+<table cellpadding="2" cellspacing="0" border="0" width="100%" style="padding-top: 10px;">');
+	$insert_search_results_header = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_header', '$search_results_header', '')";
+	$database->query($insert_search_results_header);
+	// Search results loop
+	$search_results_loop = addslashes(''.
+'<tr style="background-color: #F0F0F0;">
+<td><a href="[LINK]">[TITLE]</a></td>
+<td align="right">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] ([USERNAME]) [TEXT_ON] [DATE]</td>
+</tr>
+<tr><td colspan="2" style="text-align: justify; padding-bottom: 10px;">[DESCRIPTION]</td></tr>');
+
+	$insert_search_results_loop = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_loop', '$search_results_loop', '')";
+	$database->query($insert_search_results_loop);
+	// Search results footer
+	$search_results_footer = addslashes("</table>");
+	$insert_search_results_footer = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'results_footer', '$search_results_footer', '')";
+	$database->query($insert_search_results_footer);
+	// Search no results
+	$search_no_results = addslashes('<br />No results found');
+	$insert_search_no_results = "INSERT INTO `".TABLE_PREFIX."search` VALUES ('', 'no_results', '$search_no_results', '')";
+	$database->query($insert_search_no_results);
+	// Search template
+	$database->query("INSERT INTO `".TABLE_PREFIX."search` (name) VALUES ('template')");
+		
+	require_once(WB_PATH.'/framework/initialize.php');
+	
+	// Include the PclZip class file (thanks to 
+	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
+			
+	// Install add-ons
+	if(file_exists(WB_PATH.'/install/modules')) {
+		// Unpack pre-packaged modules
+			
+	}
+	if(file_exists(WB_PATH.'/install/templates')) {
+		// Unpack pre-packaged templates
+		
+	}
+	if(file_exists(WB_PATH.'/install/languages')) {
+		// Unpack pre-packaged languages
+		
+	}
+	
+	$admin=new admin_dummy();
+	// Load addons into DB
+	$dirs['modules'] = WB_PATH.'/modules/';
+	$dirs['templates'] = WB_PATH.'/templates/';
+	$dirs['languages'] = WB_PATH.'/languages/';
+	foreach($dirs AS $type => $dir) {
+		if($handle = opendir($dir)) {
+			while(false !== ($file = readdir($handle))) {
+				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
+					// Get addon type
+					if($type == 'modules') {
+						load_module($dir.'/'.$file, true);
+						// Pretty ugly hack to let modules run $admin->set_error
+						// See dummy class definition admin_dummy above
+						if ($admin->error!='') {
+							set_error($admin->error);
+						}
+					} elseif($type == 'templates') {
+						load_template($dir.'/'.$file);
+					} elseif($type == 'languages') {
+						load_language($dir.'/'.$file);
+					}
+				}
+			}
+		closedir($handle);
+		}
+	}
+	
+	// Check if there was a database error
+	if($database->is_error()) {
+		set_error($database->get_error());
+	}
+	
+}
+
+// Log the user in and go to Website Baker Administration
+$thisApp = new Login(
+							array(
+									"MAX_ATTEMPS" => "50",
+									"WARNING_URL" => ADMIN_URL."/login/warning.html",
+									"USERNAME_FIELDNAME" => 'admin_username',
+									"PASSWORD_FIELDNAME" => 'admin_password',
+									"REMEMBER_ME_OPTION" => SMART_LOGIN,
+									"MIN_USERNAME_LEN" => "2",
+									"MIN_PASSWORD_LEN" => "2",
+									"MAX_USERNAME_LEN" => "30",
+									"MAX_PASSWORD_LEN" => "30",
+									'LOGIN_URL' => ADMIN_URL."/login/index.php",
+									'DEFAULT_URL' => ADMIN_URL."/start/index.php",
+									'TEMPLATE_DIR' => ADMIN_PATH."/login",
+									'TEMPLATE_FILE' => "template.html",
+									'FRONTEND' => false,
+									'FORGOTTEN_DETAILS_APP' => ADMIN_URL."/login/forgot/index.php",
+									'USERS_TABLE' => TABLE_PREFIX."users",
+									'GROUPS_TABLE' => TABLE_PREFIX."groups",
+							)
+					);
 ?>
\ No newline at end of file
Index: trunk/wb/install/index.php
===================================================================
--- trunk/wb/install/index.php	(revision 416)
+++ trunk/wb/install/index.php	(revision 417)
@@ -1,420 +1,375 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Start a session
-if(!defined('SESSION_STARTED')) {
-	session_name('wb_session_id');
-	session_start();
-	define('SESSION_STARTED', true);
-}
-
-// Check if the page has been reloaded
-if(!isset($_GET['sessions_checked']) OR $_GET['sessions_checked'] != 'true') {
-	// Set session variable
-	$_SESSION['session_support'] = '<font class="good">Enabled</font>';
-	// Reload page
-	header('Location: index.php?sessions_checked=true');
-	exit(0);
-} else {
-	// Check if session variable has been saved after reload
-	if(isset($_SESSION['session_support'])) {
-		$session_support = $_SESSION['session_support'];
-	} else {   
-		$session_support = '<font class="bad">Disabled</font>';
-	}
-}
-
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<title>Website Baker Installation Wizard</title>
-<link href="stylesheet.css" rel="stylesheet" type="text/css">
-<script language="javascript" type="text/javascript">
-
-function confirm_link(message, url) {
-	if(confirm(message)) location.href = url;
-}
-function change_os(type) {
-	if(type == 'linux') {
-		document.getElementById('operating_system_linux').checked = true;
-		document.getElementById('operating_system_windows').checked = false;
-		document.getElementById('file_perms_box').style.display = 'block';
-	} else if(type == 'windows') {
-		document.getElementById('operating_system_linux').checked = false;
-		document.getElementById('operating_system_windows').checked = true;
-		document.getElementById('file_perms_box').style.display = 'none';
-	}
-}
-function change_mail_type(type) {
-	if(type == 'php') {
-		document.getElementById('outgoing_mails_php').checked = true;
-		document.getElementById('outgoing_mails_smtp').checked = false;
-		document.getElementById('smtp_server').style.display = 'none';
-		document.getElementById('caption_smtp_server').style.color = '#FFF';
-	} else if(type == 'smtp') {
-		document.getElementById('outgoing_mails_php').checked = false;
-		document.getElementById('outgoing_mails_smtp').checked = true;
-		document.getElementById('smtp_server').style.display = 'block';
-		document.getElementById('caption_smtp_server').style.color = '#666';
-	}
-}
-
-</script>
-</head>
-<body>
-
-<table cellpadding="0" cellspacing="0" border="0" width="750" align="center">
-<tr>
-	<td width="60" valign="top">
-		<img src="../admin/interface/logo.png" width="60" height="60" alt="Logo" />
-	</td>
-	<td width="5">&nbsp;</td>
-	<td style="font-size: 20px;">
-		<font style="color: #FFFFFF;">Website Baker</font> 
-		<font style="color: #DDDDDD;">Installation Wizard</font>
-	</td>
-</tr>
-</table>
-
-<form name="website_baker_installation_wizard" action="save.php" method="post">
-<input type="hidden" name="url" value="" />
-<input type="hidden" name="username_fieldname" value="admin_username" />
-<input type="hidden" name="password_fieldname" value="admin_password" />
-<input type="hidden" name="remember" id="remember" value="true" />
-
-<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;">
-<tr>
-	<td class="content">
-	
-		<center style="padding: 5px;">
-			Welcome to the Website Baker Installation Wizard.
-		</center>
-		
-		<?php
-		if(isset($_SESSION['message']) AND $_SESSION['message'] != '') {
-			?><div style="width: 700px; padding: 10px; margin-bottom: 5px; border: 1px solid #FF0000; background-color: #FFDBDB;"><b>Error:</b> <?php echo $_SESSION['message']; ?></div><?php
-		}
-		?>
-		<table cellpadding="3" cellspacing="0" width="100%" align="center">
-		<tr>
-			<td colspan="8"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td>
-		</tr>
-		<?php if($session_support != '<font class="good">Enabled</font>') { ?>
-		<tr>
-			<td colspan="8" style="font-size: 10px;" class="bad">Please note: PHP Session Support may appear disabled if your browser does not support cookies.</td>
-		</tr>
-		<?php } ?>
-		<tr>
-			<td width="140" style="color: #666666;">PHP Version > 4.1.0</td>
-			<td width="35">
-				<?php
-				$phpversion = substr(PHP_VERSION, 0, 6);
-				if($phpversion > 4.1) {
-					?><font class="good">Yes</font><?php
-				} else {
-					?><font class="bad">No</font><?php
-				}
-				?>
-			</td>
-			<td width="140" style="color: #666666;">PHP Session Support</td>
-			<td width="115"><?php echo $session_support; ?></td>
-			<td width="105" style="color: #666666;">PHP Safe Mode</td>
-			<td>
-				<?php
-				if(ini_get('safe_mode')) {
-					?><font class="bad">Enabled</font><?php
-				} else {
-					?><font class="good">Disabled</font><?php
-				}	
-				?>
-			</td>
-		</tr>
-		</table>
-		<table cellpadding="3" cellspacing="0" width="100%" align="center">
-		<tr>
-			<td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">wb/config.php</td>
-			<td><?php if(is_writable('../config.php')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../config.php')) { echo '<font class="bad">File Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td style="color: #666666;">wb/pages/</td>
-			<td><?php if(is_writable('../pages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../pages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td style="color: #666666;">wb/media/</td>
-			<td><?php if(is_writable('../media/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../media/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td style="color: #666666;">wb/templates/</td>
-			<td><?php if(is_writable('../templates/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../templates/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">wb/modules/</td>
-			<td><?php if(is_writable('../modules/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../modules/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td style="color: #666666;">wb/languages/</td>
-			<td><?php if(is_writable('../languages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../languages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td style="color: #666666;">wb/temp/</td>
-			<td><?php if(is_writable('../temp/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../temp/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
-			<td>&nbsp;</td>
-			<td>&nbsp;</td>
-		</tr>
-		</table>
-		<table cellpadding="3" cellspacing="0" width="100%" align="center">
-		<tr>
-			<td colspan="2"><h1>Step 3</h1>Please check your path settings, and select your default timezone...</td>
-		</tr>
-		<tr>
-			<td width="125" style="color: #666666;">
-				Absolute URL:
-			</td>
-			<td>
-				<?php
-				// Try to guess installation URL
-				$guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
-				$guessed_url = rtrim(dirname($guessed_url), 'install');
-				?>
-				<input type="text" tabindex="1" name="wb_url" style="width: 99%;" value="<?php if(isset($_SESSION['wb_url'])) { echo $_SESSION['wb_url']; } else { echo $guessed_url; } ?>" />
-			</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">
-				Default Timezone:
-			</td>
-			<td>
-				<select tabindex="3" name="default_timezone" style="width: 100%;">
-					<?php
-					$TIMEZONES['-12'] = 'GMT - 12 Hours';
-					$TIMEZONES['-11'] = 'GMT -11 Hours';
-					$TIMEZONES['-10'] = 'GMT -10 Hours';
-					$TIMEZONES['-9'] = 'GMT -9 Hours';
-					$TIMEZONES['-8'] = 'GMT -8 Hours';
-					$TIMEZONES['-7'] = 'GMT -7 Hours';
-					$TIMEZONES['-6'] = 'GMT -6 Hours';
-					$TIMEZONES['-5'] = 'GMT -5 Hours';
-					$TIMEZONES['-4'] = 'GMT -4 Hours';
-					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
-					$TIMEZONES['-3'] = 'GMT -3 Hours';
-					$TIMEZONES['-2'] = 'GMT -2 Hours';
-					$TIMEZONES['-1'] = 'GMT -1 Hour';
-					$TIMEZONES['0'] = 'GMT';
-					$TIMEZONES['1'] = 'GMT +1 Hour';
-					$TIMEZONES['2'] = 'GMT +2 Hours';
-					$TIMEZONES['3'] = 'GMT +3 Hours';
-					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
-					$TIMEZONES['4'] = 'GMT +4 Hours';
-					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
-					$TIMEZONES['5'] = 'GMT +5 Hours';
-					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
-					$TIMEZONES['6'] = 'GMT +6 Hours';
-					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
-					$TIMEZONES['7'] = 'GMT +7 Hours';
-					$TIMEZONES['8'] = 'GMT +8 Hours';
-					$TIMEZONES['9'] = 'GMT +9 Hours';
-					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
-					$TIMEZONES['10'] = 'GMT +10 Hours';
-					$TIMEZONES['11'] = 'GMT +11 Hours';
-					$TIMEZONES['12'] = 'GMT +12 Hours';
-					$TIMEZONES['13'] = 'GMT +13 Hours';
-					foreach($TIMEZONES AS $hour_offset => $title) {
-						?>
-							<option value="<?php echo $hour_offset; ?>"<?php if(isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == $hour_offset) { echo ' selected'; } elseif(!isset($_SESSION['default_timezone']) AND $hour_offset == 0) { echo 'selected'; } ?>><?php echo $title; ?></option>
-						<?php
-					}
-					?>
-				</select>
-			</td>
-		</tr>
-		</table>
-		<table cellpadding="5" cellspacing="0" width="100%" align="center">
-		<tr>
-			<td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td>
-		</tr>
-		<tr height="50">
-			<td width="170">
-				Server Operating System:
-			</td>
-			<td width="180">
-				<input type="radio" tabindex="4" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux"<?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { echo ' checked'; } ?> />
-				<font style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</font>
-				<br />
-				<input type="radio" tabindex="5" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows"<?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo ' checked'; } ?> />
-				<font style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</font>
-			</td>
-			<td>
-				<div name="file_perms_box" id="file_perms_box" style="margin: 0; padding: 0; display: <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo 'none'; } else { echo 'block'; } ?>;">
-					<input type="checkbox" tabindex="6" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> />
-					<label for="world_writeable">
-						World-writeable file permissions (777)
-					</label>
-					<br />
-					<font class="note">(Please note: this is only recommended for testing environments)</font>
-				</div>
-			</td>
-		</tr>
-		</table>
-		<table cellpadding="5" cellspacing="0" width="100%" align="center">
-		<tr>
-			<td colspan="5">Please enter your MySQL database server details below...</td>
-		</tr>
-		<tr>
-			<td width="120" style="color: #666666;">Host Name:</td>
-			<td width="230">
-				<input type="text" tabindex="7" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" />
-			</td>
-			<td width="7">&nbsp;</td>
-			<td width="70" style="color: #666666;">Username:</td>
-			<td>
-				<input type="text" tabindex="9" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; } ?>" />
-			</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">Database Name:</td>
-			<td>
-				<input type="text" tabindex="8" name="database_name" style="width: 98%;" value="<?php if(isset($_SESSION['database_name'])) { echo $_SESSION['database_name']; } else { echo 'wb'; } ?>" />
-			</td>
-			<td>&nbsp;</td>
-			<td style="color: #666666;">Password:</td>
-			<td>
-				<input type="password" tabindex="10" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> />
-			</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">Table Prefix:</td>
-			<td>
-				<input type="text" tabindex="11" name="table_prefix" style="width: 250px;"<?php if(isset($_SESSION['table_prefix'])) { echo ' value = "'.$_SESSION['table_prefix'].'"'; } ?> />
-			</td>
-			<td>&nbsp;</td>
-			<td colspan="2">
-				<input type="checkbox" tabindex="12" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { echo ' checked'; } elseif($_SESSION['install_tables'] == 'true') { echo ' checked'; } ?> />
-				<label for="install_tables" style="color: #666666;">Install Tables</label>
-				<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-				<span style="font-size: 10px; color: #666666;">(Please note: May remove existing tables and data)</span></td>		
-			</td>
-		</tr>
-		<tr>
-			<td colspan="5"><h1>Step 5</h1>Please enter your website title below...</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;" colspan="1">Website Title:</td>
-			<td colspan="4">
-				<input type="text" tabindex="13" name="website_title" style="width: 99%;" value="<?php if(isset($_SESSION['website_title'])) { echo $_SESSION['website_title']; } ?>" />
-			</td>
-		</tr>
-		<tr>
-			<td colspan="5"><h1>Step 6</h1>Please enter your Administrator account details below...</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">Username:</td>
-			<td>
-				<input type="text" tabindex="14" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />
-			</td>
-			<td>&nbsp;</td>
-			<td style="color: #666666;">Password:</td>
-			<td>
-				<input type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
-			</td>
-		</tr>
-		<tr>
-			<td style="color: #666666;">Email:</td>
-			<td>
-				<input type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> />
-			</td>
-			<td>&nbsp;</td>
-			<td style="color: #666666;">Re-Password:</td>
-			<td>
-				<input type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
-			</td>
-		</tr>
-		<tr>
-			<td colspan="5"><h1>Step 7 (optional)</h1>Please specify options for outgoing mails below...</td>
-		</tr>
-		<tr>
-			<td width="170">
-				Send outgoing mails via:
-			</td>
-			<td>
-				<input type="radio" tabindex="18" name="outgoing_mails" id="outgoing_mails_php" onclick="document.getElementById('smtp_server').style.display = 'none';" value="php"<?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo ' checked'; } ?> />
-				<font style="cursor: pointer;" onclick="javascript: change_mail_type('php');">PHP mail()</font> 
-				<br />
-				<input type="radio" tabindex="19" name="outgoing_mails" id="outgoing_mails_smtp" onclick="document.getElementById('smtp_server').style.display = 'block';" value="smtp"<?php if(isset($_SESSION['outgoing_mails']) AND $_SESSION['outgoing_mails'] == 'smtp') { echo ' checked'; } ?> />
-				<font style="cursor: pointer;" onclick="javascript: change_mail_type('smtp');">SMTP</font> 
-			</td>
-			<td id="caption_smtp_server" colspan="2" style="color: <?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo '#FFF'; } else { echo '#666'; } ?>;">SMTP host:</td>
-			<td>
-				<input type="text" tabindex="20" id="smtp_server" name="smtp_server" style="display: <?php if(!isset($_SESSION['outgoing_mails']) OR $_SESSION['outgoing_mails'] == 'php') { echo 'none'; } else { echo 'block'; } ?>;" value="<?php if(isset($_SESSION['smtp_server'])) { echo $_SESSION['smtp_server']; } else { echo 'mail.example.com'; } ?>" />
-			</td>
-		</tr>
-		<tr>
-			<td colspan="5">
-				<div style="border: 1px solid #CCC; background-color: #EEE; padding: 5px;">
-				<strong> Please Note:</strong>
-				<br \>
-				Some service providers do not support sending mail via PHP.
-				If your provider requires you to use SMTP for sending mail, you must know the SMTP host address.
-				If you are not sure about these settings, or you do not know the SMTP host of your domain, use the default "PHP mail()" setting.
-				You can change the settings	later if needed.
-				</div>
-			</td>
-		</tr>
-		<tr>
-			<td colspan="5" style="padding: 10px; padding-bottom: 0;"><h1 style="font-size: 0px;">&nbsp;</h1></td>
-		</tr>
-		<tr>
-			<td colspan="4">
-				<table cellpadding="0" cellspacing="0" width="100%" border="0">
-				<tr valign="top">
-					<td>Please note: &nbsp;</td>
-					<td>
-						Website Baker is released under the 
-						<a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="19">GNU General Public License</a>
-						<br />
-						By clicking install, you are accepting the license.
-					</td>
-				</tr>
-				</table>
-			</td>
-			<td colspan="1" align="right">
-				<input type="submit" tabindex="20" name="submit" value="Install Website Baker" class="submit" />
-			</td>
-		</tr>
-		</table>
-	
-	</td>
-</tr>
-</table>
-
-</form>
-
-<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
-<tr>
-	<td align="center" style="font-size: 10px;">
-		<!-- Please note: the below reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
-		<a href="http://www.websitebaker.org/" style="color: #000000;" target="_blank">Website Baker</a>
-		is	released under the
-		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
-		<!-- Please note: the above reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
-	</td>
-</tr>
-</table>
-
-</body>
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Start a session
+if(!defined('SESSION_STARTED')) {
+	session_name('wb_session_id');
+	session_start();
+	define('SESSION_STARTED', true);
+}
+
+// Check if the page has been reloaded
+if(!isset($_GET['sessions_checked']) OR $_GET['sessions_checked'] != 'true') {
+	// Set session variable
+	$_SESSION['session_support'] = '<font class="good">Enabled</font>';
+	// Reload page
+	header('Location: index.php?sessions_checked=true');
+	exit(0);
+} else {
+	// Check if session variable has been saved after reload
+	if(isset($_SESSION['session_support'])) {
+		$session_support = $_SESSION['session_support'];
+	} else {   
+		$session_support = '<font class="bad">Disabled</font>';
+	}
+}
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<title>Website Baker Installation Wizard</title>
+<link href="stylesheet.css" rel="stylesheet" type="text/css">
+<script language="javascript" type="text/javascript">
+
+function confirm_link(message, url) {
+	if(confirm(message)) location.href = url;
+}
+function change_os(type) {
+	if(type == 'linux') {
+		document.getElementById('operating_system_linux').checked = true;
+		document.getElementById('operating_system_windows').checked = false;
+		document.getElementById('file_perms_box').style.display = 'block';
+	} else if(type == 'windows') {
+		document.getElementById('operating_system_linux').checked = false;
+		document.getElementById('operating_system_windows').checked = true;
+		document.getElementById('file_perms_box').style.display = 'none';
+	}
+}
+
+</script>
+</head>
+<body>
+
+<table cellpadding="0" cellspacing="0" border="0" width="750" align="center">
+<tr>
+	<td width="60" valign="top">
+		<img src="../admin/interface/logo.png" width="60" height="60" alt="Logo" />
+	</td>
+	<td width="5">&nbsp;</td>
+	<td style="font-size: 20px;">
+		<font style="color: #FFFFFF;">Website Baker</font> 
+		<font style="color: #DDDDDD;">Installation Wizard</font>
+	</td>
+</tr>
+</table>
+
+<form name="website_baker_installation_wizard" action="save.php" method="post">
+<input type="hidden" name="url" value="" />
+<input type="hidden" name="username_fieldname" value="admin_username" />
+<input type="hidden" name="password_fieldname" value="admin_password" />
+<input type="hidden" name="remember" id="remember" value="true" />
+
+<table cellpadding="0" cellspacing="0" border="0" width="750" align="center" style="margin-top: 10px;">
+<tr>
+	<td class="content">
+	
+		<center style="padding: 5px;">
+			Welcome to the Website Baker Installation Wizard.
+		</center>
+		
+		<?php
+		if(isset($_SESSION['message']) AND $_SESSION['message'] != '') {
+			?><div style="width: 700px; padding: 10px; margin-bottom: 5px; border: 1px solid #FF0000; background-color: #FFDBDB;"><b>Error:</b> <?php echo $_SESSION['message']; ?></div><?php
+		}
+		?>
+		<table cellpadding="3" cellspacing="0" width="100%" align="center">
+		<tr>
+			<td colspan="8"><h1>Step 1</h1>Please check the following requirements are met before continuing...</td>
+		</tr>
+		<?php if($session_support != '<font class="good">Enabled</font>') { ?>
+		<tr>
+			<td colspan="8" style="font-size: 10px;" class="bad">Please note: PHP Session Support may appear disabled if your browser does not support cookies.</td>
+		</tr>
+		<?php } ?>
+		<tr>
+			<td width="140" style="color: #666666;">PHP Version > 4.1.0</td>
+			<td width="35">
+				<?php
+				$phpversion = substr(PHP_VERSION, 0, 6);
+				if($phpversion > 4.1) {
+					?><font class="good">Yes</font><?php
+				} else {
+					?><font class="bad">No</font><?php
+				}
+				?>
+			</td>
+			<td width="140" style="color: #666666;">PHP Session Support</td>
+			<td width="115"><?php echo $session_support; ?></td>
+			<td width="105" style="color: #666666;">PHP Safe Mode</td>
+			<td>
+				<?php
+				if(ini_get('safe_mode')) {
+					?><font class="bad">Enabled</font><?php
+				} else {
+					?><font class="good">Disabled</font><?php
+				}	
+				?>
+			</td>
+		</tr>
+		</table>
+		<table cellpadding="3" cellspacing="0" width="100%" align="center">
+		<tr>
+			<td colspan="8"><h1>Step 2</h1>Please check the following files/folders are writeable before continuing...</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">wb/config.php</td>
+			<td><?php if(is_writable('../config.php')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../config.php')) { echo '<font class="bad">File Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td style="color: #666666;">wb/pages/</td>
+			<td><?php if(is_writable('../pages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../pages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td style="color: #666666;">wb/media/</td>
+			<td><?php if(is_writable('../media/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../media/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td style="color: #666666;">wb/templates/</td>
+			<td><?php if(is_writable('../templates/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../templates/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">wb/modules/</td>
+			<td><?php if(is_writable('../modules/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../modules/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td style="color: #666666;">wb/languages/</td>
+			<td><?php if(is_writable('../languages/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../languages/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td style="color: #666666;">wb/temp/</td>
+			<td><?php if(is_writable('../temp/')) { echo '<font class="good">Writeable</font>'; } elseif(!file_exists('../temp/')) { echo '<font class="bad">Directory Not Found</font>'; } else { echo '<font class="bad">Unwriteable</font>'; } ?></td>
+			<td>&nbsp;</td>
+			<td>&nbsp;</td>
+		</tr>
+		</table>
+		<table cellpadding="3" cellspacing="0" width="100%" align="center">
+		<tr>
+			<td colspan="2"><h1>Step 3</h1>Please check your path settings, and select your default timezone...</td>
+		</tr>
+		<tr>
+			<td width="125" style="color: #666666;">
+				Absolute URL:
+			</td>
+			<td>
+				<?php
+				// Try to guess installation URL
+				$guessed_url = 'http://'.$_SERVER["SERVER_NAME"].$_SERVER["SCRIPT_NAME"];
+				$guessed_url = rtrim(dirname($guessed_url), 'install');
+				?>
+				<input type="text" tabindex="1" name="wb_url" style="width: 99%;" value="<?php if(isset($_SESSION['wb_url'])) { echo $_SESSION['wb_url']; } else { echo $guessed_url; } ?>" />
+			</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">
+				Default Timezone:
+			</td>
+			<td>
+				<select tabindex="3" name="default_timezone" style="width: 100%;">
+					<?php
+					$TIMEZONES['-12'] = 'GMT - 12 Hours';
+					$TIMEZONES['-11'] = 'GMT -11 Hours';
+					$TIMEZONES['-10'] = 'GMT -10 Hours';
+					$TIMEZONES['-9'] = 'GMT -9 Hours';
+					$TIMEZONES['-8'] = 'GMT -8 Hours';
+					$TIMEZONES['-7'] = 'GMT -7 Hours';
+					$TIMEZONES['-6'] = 'GMT -6 Hours';
+					$TIMEZONES['-5'] = 'GMT -5 Hours';
+					$TIMEZONES['-4'] = 'GMT -4 Hours';
+					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
+					$TIMEZONES['-3'] = 'GMT -3 Hours';
+					$TIMEZONES['-2'] = 'GMT -2 Hours';
+					$TIMEZONES['-1'] = 'GMT -1 Hour';
+					$TIMEZONES['0'] = 'GMT';
+					$TIMEZONES['1'] = 'GMT +1 Hour';
+					$TIMEZONES['2'] = 'GMT +2 Hours';
+					$TIMEZONES['3'] = 'GMT +3 Hours';
+					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
+					$TIMEZONES['4'] = 'GMT +4 Hours';
+					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
+					$TIMEZONES['5'] = 'GMT +5 Hours';
+					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
+					$TIMEZONES['6'] = 'GMT +6 Hours';
+					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
+					$TIMEZONES['7'] = 'GMT +7 Hours';
+					$TIMEZONES['8'] = 'GMT +8 Hours';
+					$TIMEZONES['9'] = 'GMT +9 Hours';
+					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
+					$TIMEZONES['10'] = 'GMT +10 Hours';
+					$TIMEZONES['11'] = 'GMT +11 Hours';
+					$TIMEZONES['12'] = 'GMT +12 Hours';
+					$TIMEZONES['13'] = 'GMT +13 Hours';
+					foreach($TIMEZONES AS $hour_offset => $title) {
+						?>
+							<option value="<?php echo $hour_offset; ?>"<?php if(isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == $hour_offset) { echo ' selected'; } elseif(!isset($_SESSION['default_timezone']) AND $hour_offset == 0) { echo 'selected'; } ?>><?php echo $title; ?></option>
+						<?php
+					}
+					?>
+				</select>
+			</td>
+		</tr>
+		</table>
+		<table cellpadding="5" cellspacing="0" width="100%" align="center">
+		<tr>
+			<td colspan="3"><h1>Step 4</h1>Please specify your operating system information below...</td>
+		</tr>
+		<tr height="50">
+			<td width="170">
+				Server Operating System:
+			</td>
+			<td width="180">
+				<input type="radio" tabindex="4" name="operating_system" id="operating_system_linux" onclick="document.getElementById('file_perms_box').style.display = 'block';" value="linux"<?php if(!isset($_SESSION['operating_system']) OR $_SESSION['operating_system'] == 'linux') { echo ' checked'; } ?> />
+				<font style="cursor: pointer;" onclick="javascript: change_os('linux');">Linux/Unix based</font>
+				<br />
+				<input type="radio" tabindex="5" name="operating_system" id="operating_system_windows" onclick="document.getElementById('file_perms_box').style.display = 'none';" value="windows"<?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo ' checked'; } ?> />
+				<font style="cursor: pointer;" onclick="javascript: change_os('windows');">Windows</font>
+			</td>
+			<td>
+				<div name="file_perms_box" id="file_perms_box" style="margin: 0; padding: 0; display: <?php if(isset($_SESSION['operating_system']) AND $_SESSION['operating_system'] == 'windows') { echo 'none'; } else { echo 'block'; } ?>;">
+					<input type="checkbox" tabindex="6" name="world_writeable" id="world_writeable" value="true"<?php if(isset($_SESSION['world_writeable']) AND $_SESSION['world_writeable'] == true) { echo 'checked'; } ?> />
+					<label for="world_writeable">
+						World-writeable file permissions (777)
+					</label>
+					<br />
+					<font class="note">(Please note: this is only recommended for testing environments)</font>
+				</div>
+			</td>
+		</tr>
+		</table>
+		<table cellpadding="5" cellspacing="0" width="100%" align="center">
+		<tr>
+			<td colspan="5">Please enter your MySQL database server details below...</td>
+		</tr>
+		<tr>
+			<td width="120" style="color: #666666;">Host Name:</td>
+			<td width="230">
+				<input type="text" tabindex="7" name="database_host" style="width: 98%;" value="<?php if(isset($_SESSION['database_host'])) { echo $_SESSION['database_host']; } else { echo 'localhost'; } ?>" />
+			</td>
+			<td width="7">&nbsp;</td>
+			<td width="70" style="color: #666666;">Username:</td>
+			<td>
+				<input type="text" tabindex="9" name="database_username" style="width: 98%;" value="<?php if(isset($_SESSION['database_username'])) { echo $_SESSION['database_username']; } else { echo 'root'; } ?>" />
+			</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">Database Name:</td>
+			<td>
+				<input type="text" tabindex="8" name="database_name" style="width: 98%;" value="<?php if(isset($_SESSION['database_name'])) { echo $_SESSION['database_name']; } else { echo 'wb'; } ?>" />
+			</td>
+			<td>&nbsp;</td>
+			<td style="color: #666666;">Password:</td>
+			<td>
+				<input type="password" tabindex="10" name="database_password" style="width: 98%;"<?php if(isset($_SESSION['database_password'])) { echo ' value = "'.$_SESSION['database_password'].'"'; } ?> />
+			</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">Table Prefix:</td>
+			<td>
+				<input type="text" tabindex="11" name="table_prefix" style="width: 250px;"<?php if(isset($_SESSION['table_prefix'])) { echo ' value = "'.$_SESSION['table_prefix'].'"'; } ?> />
+			</td>
+			<td>&nbsp;</td>
+			<td colspan="2">
+				<input type="checkbox" tabindex="12" name="install_tables" id="install_tables" value="true"<?php if(!isset($_SESSION['install_tables'])) { echo ' checked'; } elseif($_SESSION['install_tables'] == 'true') { echo ' checked'; } ?> />
+				<label for="install_tables" style="color: #666666;">Install Tables</label>
+				<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+				<span style="font-size: 10px; color: #666666;">(Please note: May remove existing tables and data)</span></td>		
+			</td>
+		</tr>
+		<tr>
+			<td colspan="5"><h1>Step 5</h1>Please enter your website title below...</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;" colspan="1">Website Title:</td>
+			<td colspan="4">
+				<input type="text" tabindex="13" name="website_title" style="width: 99%;" value="<?php if(isset($_SESSION['website_title'])) { echo $_SESSION['website_title']; } ?>" />
+			</td>
+		</tr>
+		<tr>
+			<td colspan="5"><h1>Step 6</h1>Please enter your Administrator account details below...</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">Username:</td>
+			<td>
+				<input type="text" tabindex="14" name="admin_username" style="width: 98%;" value="<?php if(isset($_SESSION['admin_username'])) { echo $_SESSION['admin_username']; } else { echo 'admin'; } ?>" />
+			</td>
+			<td>&nbsp;</td>
+			<td style="color: #666666;">Password:</td>
+			<td>
+				<input type="password" tabindex="16" name="admin_password" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
+			</td>
+		</tr>
+		<tr>
+			<td style="color: #666666;">Email:</td>
+			<td>
+				<input type="text" tabindex="15" name="admin_email" style="width: 98%;"<?php if(isset($_SESSION['admin_email'])) { echo ' value = "'.$_SESSION['admin_email'].'"'; } ?> />
+			</td>
+			<td>&nbsp;</td>
+			<td style="color: #666666;">Re-Password:</td>
+			<td>
+				<input type="password" tabindex="17" name="admin_repassword" style="width: 98%;"<?php if(isset($_SESSION['admin_password'])) { echo ' value = "'.$_SESSION['admin_password'].'"'; } ?> />
+			</td>
+		</tr>
+		<tr>
+			<td colspan="5" style="padding: 10px; padding-bottom: 0;"><h1 style="font-size: 0px;">&nbsp;</h1></td>
+		</tr>
+		<tr>
+			<td colspan="4">
+				<table cellpadding="0" cellspacing="0" width="100%" border="0">
+				<tr valign="top">
+					<td>Please note: &nbsp;</td>
+					<td>
+						Website Baker is released under the 
+						<a href="http://www.gnu.org/licenses/gpl.html" target="_blank" tabindex="19">GNU General Public License</a>
+						<br />
+						By clicking install, you are accepting the license.
+					</td>
+				</tr>
+				</table>
+			</td>
+			<td colspan="1" align="right">
+				<input type="submit" tabindex="20" name="submit" value="Install Website Baker" class="submit" />
+			</td>
+		</tr>
+		</table>
+	</td>
+</tr>
+</table>
+
+</form>
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%" style="padding: 10px 0px 10px 0px;">
+<tr>
+	<td align="center" style="font-size: 10px;">
+		<!-- Please note: the below reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
+		<a href="http://www.websitebaker.org/" style="color: #000000;" target="_blank">Website Baker</a>
+		is	released under the
+		<a href="http://www.gnu.org/licenses/gpl.html" style="color: #000000;" target="_blank">GNU General Public License</a>
+		<!-- Please note: the above reference to the GNU GPL should not be removed, as it provides a link for users to read about warranty, etc. -->
+	</td>
+</tr>
+</table>
+
+</body>
 </html>
\ No newline at end of file
Index: trunk/wb/languages/EN.php
===================================================================
--- trunk/wb/languages/EN.php	(revision 416)
+++ trunk/wb/languages/EN.php	(revision 417)
@@ -1,535 +1,544 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-// Define that this file is loaded
-if(!defined('LANGUAGE_LOADED')) {
-	define('LANGUAGE_LOADED', true);
-}
-
-// Set the language information
-$language_code = 'EN';
-$language_name = 'English';
-$language_version = '2.6';
-$language_platform = '2.6.x';
-$language_author = 'Ryan Djurovich';
-$language_license = 'GNU General Public License';
-
-// Menu titles
-$MENU['START'] = 'Start';
-$MENU['PAGES'] = 'Pages';
-$MENU['MEDIA'] = 'Media';
-$MENU['ADDONS'] = 'Add-ons';
-$MENU['MODULES'] = 'Modules';
-$MENU['TEMPLATES'] = 'Templates';
-$MENU['LANGUAGES'] = 'Languages';
-$MENU['PREFERENCES'] = 'Preferences';
-$MENU['SETTINGS'] = 'Settings';
-$MENU['ACCESS'] = 'Access';
-$MENU['USERS'] = 'Users';
-$MENU['GROUPS'] = 'Groups';
-$MENU['HELP'] = 'Help';
-$MENU['VIEW'] = 'View';
-$MENU['LOGOUT'] = 'Log-out';
-$MENU['LOGIN'] = 'Login';
-$MENU['FORGOT'] = 'Retrieve Login Details';
-
-// Section overviews
-$OVERVIEW['START'] = 'Administration overview';
-$OVERVIEW['PAGES'] = 'Manage your websites pages...';
-$OVERVIEW['MEDIA'] = 'Manage files stored in the media folder...';
-$OVERVIEW['MODULES'] = 'Manage Website Baker modules...';
-$OVERVIEW['TEMPLATES'] = 'Change the look and feel of your website with templates...';
-$OVERVIEW['LANGUAGES'] = 'Manage Website Baker languages...';
-$OVERVIEW['PREFERENCES'] = 'Change preferences such as email address, password, etc... ';
-$OVERVIEW['SETTINGS'] = 'Changes settings for Website Baker...';
-$OVERVIEW['USERS'] = 'Manage users who can log-in to Website Baker...';
-$OVERVIEW['GROUPS'] = 'Manage user groups and their system permissions...';
-$OVERVIEW['HELP'] = 'Got a questions? Find your answer...';
-$OVERVIEW['VIEW'] = 'Quickly view and browse your website in a new window...';
-
-// Headings
-$HEADING['MODIFY_DELETE_PAGE'] = 'Modify/Delete Page';
-$HEADING['DELETED_PAGES'] = 'Deleted Pages';
-$HEADING['ADD_PAGE'] = 'Add Page';
-$HEADING['ADD_HEADING'] = 'Add Heading';
-$HEADING['MODIFY_PAGE'] = 'Modify Page';
-$HEADING['MODIFY_PAGE_SETTINGS'] = 'Modify Page Settings';
-$HEADING['MODIFY_ADVANCED_PAGE_SETTINGS'] = 'Modify Advanced Page Settings';
-$HEADING['MANAGE_SECTIONS'] = 'Manage Sections';
-$HEADING['MODIFY_INTRO_PAGE'] = 'Modify Intro Page';
-
-$HEADING['BROWSE_MEDIA'] = 'Browse Media';
-$HEADING['CREATE_FOLDER'] = 'Create Folder';
-$HEADING['UPLOAD_FILES'] = 'Upload File(s)';
-
-$HEADING['INSTALL_MODULE'] = 'Install Module';
-$HEADING['UNINSTALL_MODULE'] = 'Uninstall Module';
-$HEADING['MODULE_DETAILS'] = 'Module Details';
-
-$HEADING['INSTALL_TEMPLATE'] = 'Install Template';
-$HEADING['UNINSTALL_TEMPLATE'] = 'Uninstall Template';
-$HEADING['TEMPLATE_DETAILS'] = 'Template Details';
-
-$HEADING['INSTALL_LANGUAGE'] = 'Install Language';
-$HEADING['UNINSTALL_LANGUAGE'] = 'Uninstall Language';
-$HEADING['LANGUAGE_DETAILS'] = 'Language Details';
-
-$HEADING['MY_SETTINGS'] = 'My Settings';
-$HEADING['MY_EMAIL'] = 'My Email';
-$HEADING['MY_PASSWORD'] = 'My Password';
-
-$HEADING['GENERAL_SETTINGS'] = 'General Settings';
-$HEADING['DEFAULT_SETTINGS'] = 'Default Settings';
-$HEADING['SEARCH_SETTINGS'] = 'Search Settings';
-$HEADING['FILESYSTEM_SETTINGS'] = 'Filesystem Settings';
-$HEADING['SERVER_SETTINGS'] = 'Server Settings';
-$HEADING['ADMINISTRATION_TOOLS'] = 'Administration Tools';
-
-$HEADING['MODIFY_DELETE_USER'] = 'Modify/Delete User';
-$HEADING['ADD_USER'] = 'Add User';
-$HEADING['MODIFY_USER'] = 'Modify User';
-
-$HEADING['MODIFY_DELETE_GROUP'] = 'Modify/Delete Group';
-$HEADING['ADD_GROUP'] = 'Add Group';
-$HEADING['MODIFY_GROUP'] = 'Modify Group';
-
-// Other text
-$TEXT['ADD'] = 'Add';
-$TEXT['MODIFY'] = 'Modify';
-$TEXT['SETTINGS'] = 'Settings';
-$TEXT['DELETE'] = 'Delete';
-$TEXT['SAVE'] = 'Save';
-$TEXT['RESET'] = 'Reset';
-$TEXT['LOGIN'] = 'Login';
-$TEXT['RELOAD'] = 'Reload';
-$TEXT['CANCEL'] = 'Cancel';
-$TEXT['NAME'] = 'Name';
-$TEXT['PLEASE_SELECT'] = 'Please select';
-$TEXT['TITLE'] = 'Title';
-$TEXT['PARENT'] = 'Parent';
-$TEXT['TYPE'] = 'Type';
-$TEXT['VISIBILITY'] = 'Visibility';
-$TEXT['PRIVATE'] = 'Private';
-$TEXT['PUBLIC'] = 'Public';
-$TEXT['NONE'] = 'None';
-$TEXT['NONE_FOUND'] = 'None Found';
-$TEXT['CURRENT'] = 'Current';
-$TEXT['CHANGE'] = 'Change';
-$TEXT['WINDOW'] = 'Window';
-$TEXT['DESCRIPTION'] = 'Description';
-$TEXT['KEYWORDS'] = 'Keywords';
-$TEXT['ADMINISTRATORS'] = 'Administrators';
-$TEXT['PRIVATE_VIEWERS'] = 'Private Viewers';
-$TEXT['EXPAND'] = 'Expand';
-$TEXT['COLLAPSE'] = 'Collapse';
-$TEXT['MOVE_UP'] = 'Move Up';
-$TEXT['MOVE_DOWN'] = 'Move Down';
-$TEXT['RENAME'] = 'Rename';
-$TEXT['MODIFY_SETTINGS'] = 'Modify Settings';
-$TEXT['MODIFY_CONTENT'] = 'Modify Content';
-$TEXT['VIEW'] = 'View';
-$TEXT['UP'] = 'Up';
-$TEXT['FORGOTTEN_DETAILS'] = 'Forgotten your details?';
-$TEXT['NEED_TO_LOGIN'] = 'Need to log-in?';
-$TEXT['SEND_DETAILS'] = 'Send Details';
-$TEXT['USERNAME'] = 'Username';
-$TEXT['PASSWORD'] = 'Password';
-$TEXT['HOME'] = 'Home';
-$TEXT['TARGET_FOLDER'] = 'Target folder';
-$TEXT['OVERWRITE_EXISTING'] = 'Overwrite existing';
-$TEXT['FILE'] = 'File';
-$TEXT['FILES'] = 'Files';
-$TEXT['FOLDER'] = 'Folder';
-$TEXT['FOLDERS'] = 'Folders';
-$TEXT['CREATE_FOLDER'] = 'Create Folder';
-$TEXT['UPLOAD_FILES'] = 'Upload File(s)';
-$TEXT['CURRENT_FOLDER'] = 'Current Folder';
-$TEXT['TO'] = 'To';
-$TEXT['FROM'] = 'From';
-$TEXT['INSTALL'] = 'Install';
-$TEXT['UNINSTALL'] = 'Uninstall';
-$TEXT['VIEW_DETAILS'] = 'View Details';
-$TEXT['DISPLAY_NAME'] = 'Display Name';
-$TEXT['AUTHOR'] = 'Author';
-$TEXT['VERSION'] = 'Version';
-$TEXT['DESIGNED_FOR'] = 'Designed For';
-$TEXT['DESCRIPTION'] = 'Description';
-$TEXT['EMAIL'] = 'Email';
-$TEXT['LANGUAGE'] = 'Language';
-$TEXT['TIMEZONE'] = 'Timezone';
-$TEXT['CURRENT_PASSWORD'] = 'Current Password';
-$TEXT['NEW_PASSWORD'] = 'New Password';
-$TEXT['RETYPE_NEW_PASSWORD'] = 'Re-type New Password';
-$TEXT['ACTIVE'] = 'Active';
-$TEXT['DISABLED'] = 'Disabled';
-$TEXT['ENABLED'] = 'Enabled';
-$TEXT['RETYPE_PASSWORD'] = 'Re-type Password';
-$TEXT['GROUP'] = 'Group';
-$TEXT['SYSTEM_PERMISSIONS'] = 'System Permissions';
-$TEXT['MODULE_PERMISSIONS'] = 'Module Permissions';
-$TEXT['SHOW_ADVANCED'] = 'Show Advanced Options';
-$TEXT['HIDE_ADVANCED'] = 'Hide Advanced Options';
-$TEXT['BASIC'] = 'Basic';
-$TEXT['ADVANCED'] = 'Advanced';
-$TEXT['WEBSITE'] = 'Website';
-$TEXT['DEFAULT'] = 'Default';
-$TEXT['KEYWORDS'] = 'Keywords';
-$TEXT['TEXT'] = 'Text';
-$TEXT['HEADER'] = 'Header';
-$TEXT['FOOTER'] = 'Footer';
-$TEXT['TEMPLATE'] = 'Template';
-$TEXT['INSTALLATION'] = 'Installation';
-$TEXT['DATABASE'] = 'Database';
-$TEXT['HOST'] = 'Host';
-$TEXT['INTRO'] = 'Intro';
-$TEXT['PAGE'] = 'Page';
-$TEXT['SIGNUP'] = 'Sign-up';
-$TEXT['PHP_ERROR_LEVEL'] = 'PHP Error Reporting Level';
-$TEXT['ADMIN'] = 'Admin';
-$TEXT['PATH'] = 'Path';
-$TEXT['URL'] = 'URL';
-$TEXT['FRONTEND'] = 'Front-end';
-$TEXT['EXTENSION'] = 'Extension';
-$TEXT['TABLE_PREFIX'] = 'Table Prefix';
-$TEXT['CHANGES'] = 'Changes';
-$TEXT['ADMINISTRATION'] = 'Administration';
-$TEXT['FORGOT_DETAILS'] = 'Forgot Details?';
-$TEXT['LOGGED_IN'] = 'Logged-In';
-$TEXT['WELCOME_BACK'] = 'Welcome back';
-$TEXT['FULL_NAME'] = 'Full Name';
-$TEXT['ACCOUNT_SIGNUP'] = 'Account Sign-Up';
-$TEXT['LINK'] = 'Link';
-$TEXT['TARGET'] = 'Target';
-$TEXT['NEW_WINDOW'] = 'New Window';
-$TEXT['SAME_WINDOW'] = 'Same Window';
-$TEXT['TOP_FRAME'] = 'Top Frame';
-$TEXT['PAGE_LEVEL_LIMIT'] = 'Page Level Limit';
-$TEXT['SUCCESS'] = 'Success';
-$TEXT['ERROR'] = 'Error';
-$TEXT['ARE_YOU_SURE'] = 'Are you sure?';
-$TEXT['YES'] = 'Yes';
-$TEXT['NO'] = 'No';
-$TEXT['SYSTEM_DEFAULT'] = 'System Default';
-$TEXT['PAGE_TITLE'] = 'Page Title';
-$TEXT['MENU_TITLE'] = 'Menu Title';
-$TEXT['ACTIONS'] = 'Actions';
-$TEXT['UNKNOWN'] = 'Unknown';
-$TEXT['BLOCK'] = 'Block';
-$TEXT['SEARCH'] = 'Search';
-$TEXT['SEARCHING'] = 'Searching';
-$TEXT['POST'] = 'Post';
-$TEXT['COMMENT'] = 'Comment';
-$TEXT['COMMENTS'] = 'Comments';
-$TEXT['COMMENTING'] = 'Commenting';
-$TEXT['SHORT'] = 'Short';
-$TEXT['LONG'] = 'Long';
-$TEXT['LOOP'] = 'Loop';
-$TEXT['FIELD'] = 'Field';
-$TEXT['REQUIRED'] = 'Required';
-$TEXT['LENGTH'] = 'Length';
-$TEXT['MESSAGE'] = 'Message';
-$TEXT['SUBJECT'] = 'Subject';
-$TEXT['MATCH'] = 'Match';
-$TEXT['ALL_WORDS'] = 'All Words';
-$TEXT['ANY_WORDS'] = 'Any Words';
-$TEXT['EXACT_MATCH'] = 'Exact Match';
-$TEXT['SHOW'] = 'Show';
-$TEXT['HIDE'] = 'Hide';
-$TEXT['START_PUBLISHING'] = 'Start Publishing';
-$TEXT['FINISH_PUBLISHING'] = 'Finish Publishing';
-$TEXT['DATE'] = 'Date';
-$TEXT['START'] = 'Start';
-$TEXT['END'] = 'End';
-$TEXT['IMAGE'] = 'Image';
-$TEXT['ICON'] = 'Icon';
-$TEXT['SECTION'] = 'Section';
-$TEXT['DATE_FORMAT'] = 'Date Format';
-$TEXT['TIME_FORMAT'] = 'Time Format';
-$TEXT['RESULTS'] = 'Results';
-$TEXT['RESIZE'] = 'Re-size';
-$TEXT['MANAGE'] = 'Manage';
-$TEXT['CODE'] = 'Code';
-$TEXT['WIDTH'] = 'Width';
-$TEXT['HEIGHT'] = 'Height';
-$TEXT['MORE'] = 'More';
-$TEXT['READ_MORE'] = 'Read More';
-$TEXT['CHANGE_SETTINGS'] = 'Change Settings';
-$TEXT['CURRENT_PAGE'] = 'Current Page';
-$TEXT['CLOSE'] = 'Close';
-$TEXT['INTRO_PAGE'] = 'Intro Page';
-$TEXT['INSTALLATION_URL'] = 'Installation URL';
-$TEXT['INSTALLATION_PATH'] = 'Installation Path';
-$TEXT['PAGE_EXTENSION'] = 'Page Extension';
-$TEXT['NO_RESULTS'] = 'No Results';
-$TEXT['WEBSITE_TITLE'] = 'Website Title';
-$TEXT['WEBSITE_DESCRIPTION'] = 'Website Description';
-$TEXT['WEBSITE_KEYWORDS'] = 'Website Keywords';
-$TEXT['WEBSITE_HEADER'] = 'Website Header';
-$TEXT['WEBSITE_FOOTER'] = 'Website Footer';
-$TEXT['RESULTS_HEADER'] = 'Results Header';
-$TEXT['RESULTS_LOOP'] = 'Results Loop';
-$TEXT['RESULTS_FOOTER'] = 'Results Footer';
-$TEXT['LEVEL'] = 'Level';
-$TEXT['NOT_FOUND'] = 'Not Found';
-$TEXT['PAGE_SPACER'] = 'Page Spacer';
-$TEXT['MATCHING'] = 'Matching';
-$TEXT['TEMPLATE_PERMISSIONS'] = 'Template Permissions';
-$TEXT['PAGES_DIRECTORY'] = 'Pages Directory';
-$TEXT['MEDIA_DIRECTORY'] = 'Media Directory';
-$TEXT['FILE_MODE'] = 'File Mode';
-$TEXT['USER'] = 'User';
-$TEXT['OTHERS'] = 'Others';
-$TEXT['READ'] = 'Read';
-$TEXT['WRITE'] = 'Write';
-$TEXT['EXECUTE'] = 'Execute';
-$TEXT['SMART_LOGIN'] = 'Smart Login';
-$TEXT['REMEMBER_ME'] = 'Remember Me';
-$TEXT['FILESYSTEM_PERMISSIONS'] = 'Filesystem Permissions';
-$TEXT['DIRECTORIES'] = 'Directories';
-$TEXT['DIRECTORY_MODE'] = 'Directory Mode';
-$TEXT['LIST_OPTIONS'] = 'List Options';
-$TEXT['OPTION'] = 'Option';
-$TEXT['ALLOW_MULTIPLE_SELECTIONS'] = 'Allow Multiple Selections';
-$TEXT['TEXTFIELD'] = 'Textfield';
-$TEXT['TEXTAREA'] = 'Textarea';
-$TEXT['SELECT_BOX'] = 'Select Box';
-$TEXT['CHECKBOX_GROUP'] = 'Checkbox Group';
-$TEXT['RADIO_BUTTON_GROUP'] = 'Radio Button Group';
-$TEXT['SIZE'] = 'Size';
-$TEXT['DEFAULT_TEXT'] = 'Default Text';
-$TEXT['SEPERATOR'] = 'Separator';
-$TEXT['BACK'] = 'Back';
-$TEXT['UNDER_CONSTRUCTION'] = 'Under Construction';
-$TEXT['MULTISELECT'] = 'Multi-select';
-$TEXT['SHORT_TEXT'] = 'Short Text';
-$TEXT['LONG_TEXT'] = 'Long Text';
-$TEXT['HOMEPAGE_REDIRECTION'] = 'Homepage Redirection';
-$TEXT['HEADING'] = 'Heading';
-$TEXT['MULTIPLE_MENUS'] = 'Multiple Menus';
-$TEXT['REGISTERED'] = 'Registered';
-$TEXT['START'] = 'Start';
-$TEXT['SECTION_BLOCKS'] = 'Section Blocks';
-$TEXT['REGISTERED_VIEWERS'] = 'Registered Viewers';
-$TEXT['ALLOWED_VIEWERS'] = 'Allowed Viewers';
-$TEXT['SUBMISSION_ID'] = 'Submission ID';
-$TEXT['SUBMISSIONS'] = 'Submissions';
-$TEXT['SUBMITTED'] = 'Submitted';
-$TEXT['MAX_SUBMISSIONS_PER_HOUR'] = 'Max. Submissions Per Hour';
-$TEXT['SUBMISSIONS_STORED_IN_DATABASE'] = 'Submissions Stored In Database';
-$TEXT['EMAIL_ADDRESS'] = 'Email Address';
-$TEXT['CUSTOM'] = 'Custom';
-$TEXT['ANONYMOUS'] = 'Anonymous';
-$TEXT['SERVER_OPERATING_SYSTEM'] = 'Server Operating System';
-$TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'] = 'World-writeable file permissions';
-$TEXT['LINUX_UNIX_BASED'] = 'Linux/Unix based';
-$TEXT['WINDOWS'] = 'Windows';
-$TEXT['HOME_FOLDER'] = 'Home Folder';
-$TEXT['HOME_FOLDERS'] = 'Home Folders';
-$TEXT['PAGE_TRASH'] = 'Page Trash';
-$TEXT['INLINE'] = 'In-line';
-$TEXT['SEPARATE'] = 'Separate';
-$TEXT['DELETED'] = 'Deleted';
-$TEXT['VIEW_DELETED_PAGES'] = 'View Deleted Pages';
-$TEXT['EMPTY_TRASH'] = 'Empty Trash';
-$TEXT['TRASH_EMPTIED'] = 'Trash Emptied';
-$TEXT['ADD_SECTION'] = 'Add Section';
-$TEXT['POST_HEADER'] = 'Post Header';
-$TEXT['POST_FOOTER'] = 'Post Footer';
-$TEXT['POSTS_PER_PAGE'] = 'Posts Per Page';
-$TEXT['RESIZE_IMAGE_TO'] = 'Resize Image To';
-$TEXT['UNLIMITED'] = 'Unlimited';
-$TEXT['OF'] = 'Of';
-$TEXT['OUT_OF'] = 'Out Of';
-$TEXT['NEXT'] = 'Next';
-$TEXT['PREVIOUS'] = 'Previous';
-$TEXT['NEXT_PAGE'] = 'Next Page';
-$TEXT['PREVIOUS_PAGE'] = 'Previous Page';
-$TEXT['ON'] = 'On';
-$TEXT['LAST_UPDATED_BY'] = 'Last Updated By';
-$TEXT['RESULTS_FOR'] = 'Results For';
-$TEXT['TIME'] = 'Time';
-$TEXT['WYSIWYG_STYLE'] = 'WYSIWYG Style';
-$TEXT['WYSIWYG_EDITOR'] = "WYSIWYG Editor";
-$TEXT['SERVER_EMAIL'] = 'Server Email';
-$TEXT['MENU'] = 'Menu';
-$TEXT['MANAGE_GROUPS'] = 'Manage Groups';
-$TEXT['MANAGE_USERS'] = 'Manage Users';
-$TEXT['PAGE_LANGUAGES'] = 'Page Languages';
-$TEXT['HIDDEN'] = 'Hidden';
-$TEXT['MAIN'] = 'Main';
-$TEXT['RENAME_FILES_ON_UPLOAD'] = 'Rename Files On Upload';
-$TEXT['APP_NAME'] = 'Application Name';
-$TEXT['SESSION_IDENTIFIER'] = 'Session Identifier';
-$TEXT['BACKUP'] = 'Backup';
-$TEXT['RESTORE'] = 'Restore';
-$TEXT['BACKUP_DATABASE'] = 'Backup Database';
-$TEXT['RESTORE_DATABASE'] = 'Restore Database';
-$TEXT['BACKUP_ALL_TABLES'] = 'Backup all tables in database';
-$TEXT['BACKUP_WB_SPECIFIC'] = 'Backup only WB-specific tables';
-$TEXT['BACKUP_MEDIA'] = 'Backup Media';
-$TEXT['RESTORE_MEDIA'] = 'Restore Media';
-$TEXT['ADMINISTRATION_TOOL'] = 'Administration tool';
-$TEXT['CAPTCHA_VERIFICATION'] = 'Captcha Verification';
-$TEXT['VERIFICATION'] = 'Verification';
-$TEXT['DEFAULT_CHARSET'] = 'Default Charset';
-$TEXT['CHARSET'] = 'Charset';
-
-
-// Success/error messages
-$MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'] = 'Sorry, you do not have permissions to view this page';
-
-$MESSAGE['ADMIN']['INSUFFICIENT_PRIVELLIGES'] = 'Insufficient privelliges to be here';
-
-$MESSAGE['LOGIN']['BOTH_BLANK'] = 'Please enter your username and password below';
-$MESSAGE['LOGIN']['USERNAME_BLANK'] = 'Please enter a username';
-$MESSAGE['LOGIN']['PASSWORD_BLANK'] = 'Please enter a password';
-$MESSAGE['LOGIN']['USERNAME_TOO_SHORT'] = 'Supplied username to short';
-$MESSAGE['LOGIN']['PASSWORD_TOO_SHORT'] = 'Supplied password to short';
-$MESSAGE['LOGIN']['USERNAME_TOO_LONG'] = 'Supplied username to long';
-$MESSAGE['LOGIN']['PASSWORD_TOO_LONG'] = 'Supplied password to long';
-$MESSAGE['LOGIN']['AUTHENTICATION_FAILED'] = 'Username or password incorrect';
-
-$MESSAGE['SIGNUP']['NO_EMAIL'] = 'You must enter an email address';
-
-$MESSAGE['FORGOT_PASS']['NO_DATA'] = 'Please enter your email address below';
-$MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'] = 'The email that you entered cannot be found in the database';
-$MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'] = 'Unable to email password, please contact system administrator';
-$MESSAGE['FORGOT_PASS']['PASSWORD_RESET'] = 'Your username and password have been sent to your email address';
-$MESSAGE['FORGOT_PASS']['ALREADY_RESET'] = 'Password cannot be reset more than once per hour, sorry';
-
-$MESSAGE['START']['WELCOME_MESSAGE'] = 'Welcome to Website Baker Administration';
-$MESSAGE['START']['INSTALL_DIR_EXISTS'] = 'Warning, Installation Directory Still Exists!';
-$MESSAGE['START']['CURRENT_USER'] = 'You are currently logged in as:';
-
-$MESSAGE['SETTINGS']['UNABLE_OPEN_CONFIG'] = 'Unable to open the configuration file';
-$MESSAGE['SETTINGS']['UNABLE_WRITE_CONFIG'] = 'Cannot write to configuration file';
-$MESSAGE['SETTINGS']['SAVED'] = 'Settings saved successfully';
-$MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'] = 'Please Note: Pressing this button resets all unsaved changes';
-$MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'] = 'Please note: this is only recommended for testing environments';
-
-$MESSAGE['USERS']['ADDED'] = 'User added successfully';
-$MESSAGE['USERS']['SAVED'] = 'User saved successfully';
-$MESSAGE['USERS']['DELETED'] = 'User deleted successfully';
-$MESSAGE['USERS']['NO_GROUP'] = 'No group was selected';
-$MESSAGE['USERS']['USERNAME_TOO_SHORT'] = 'The username you entered was too short';
-$MESSAGE['USERS']['PASSWORD_TOO_SHORT'] = 'The password you entered was too short';
-$MESSAGE['USERS']['PASSWORD_MISMATCH'] = 'The passwords you entered do not match';
-$MESSAGE['USERS']['INVALID_EMAIL'] = 'The email address you entered is invalid';
-$MESSAGE['USERS']['EMAIL_TAKEN'] = 'The email you entered is already in use';
-$MESSAGE['USERS']['USERNAME_TAKEN'] = 'The username you entered is already taken';
-$MESSAGE['USERS']['CHANGING_PASSWORD'] = 'Please note: You should only enter values in the above fields if you wish to change this users password';
-$MESSAGE['USERS']['CONFIRM_DELETE'] = 'Are you sure you want to delete the selected user?';
-
-$MESSAGE['GROUPS']['ADDED'] = 'Group added successfully';
-$MESSAGE['GROUPS']['SAVED'] = 'Group saved successfully';
-$MESSAGE['GROUPS']['DELETED'] = 'Group deleted successfully';
-$MESSAGE['GROUPS']['GROUP_NAME_BLANK'] = 'Group name is blank';
-$MESSAGE['GROUPS']['CONFIRM_DELETE'] = 'Are you sure you want to delete the selected group (and any users that belong to it)?';
-$MESSAGE['GROUPS']['NO_GROUPS_FOUND'] = 'No groups found';
-$MESSAGE['GROUPS']['GROUP_NAME_EXISTS'] = 'Group name already exists';
-
-$MESSAGE['PREFERENCES']['DETAILS_SAVED'] = 'Details saved successfully';
-$MESSAGE['PREFERENCES']['EMAIL_UPDATED'] = 'Email updated successfully';
-$MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'] = 'The (current) password you entered is incorrect';
-$MESSAGE['PREFERENCES']['PASSWORD_CHANGED'] = 'Password changed successfully';
-
-$MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE'] = 'Please note: to change the template you must go to the Settings section';
-
-$MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'] = 'Cannot include ../ in the folder name';
-$MESSAGE['MEDIA']['DIR_DOES_NOT_EXIST'] = 'Directory does not exist';
-$MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH'] = 'Cannot have ../ in the folder target';
-$MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'] = 'Cannot include ../ in the name';
-$MESSAGE['MEDIA']['NAME_INDEX_PHP'] = 'Cannot use index.php as the name';
-$MESSAGE['MEDIA']['NONE_FOUND'] = 'No media found in the current folder';
-$MESSAGE['MEDIA']['FILE_NOT_FOUND'] = 'File not found';
-$MESSAGE['MEDIA']['DELETED_FILE'] = 'File deleted successfully';
-$MESSAGE['MEDIA']['DELETED_DIR'] = 'Folder deleted successfully';
-$MESSAGE['MEDIA']['CONFIRM_DELETE'] = 'Are you sure you want to delete the following file or folder?';
-$MESSAGE['MEDIA']['CANNOT_DELETE_FILE'] = 'Cannot delete the selected file';
-$MESSAGE['MEDIA']['CANNOT_DELETE_DIR'] = 'Cannot delete the selected folder';
-$MESSAGE['MEDIA']['BLANK_NAME'] = 'You did not enter a new name';
-$MESSAGE['MEDIA']['BLANK_EXTENSION'] = 'You did not enter a file extension';
-$MESSAGE['MEDIA']['RENAMED'] = 'Rename successful';
-$MESSAGE['MEDIA']['CANNOT_RENAME'] = 'Rename unsuccessful';
-$MESSAGE['MEDIA']['FILE_EXISTS'] = 'A file matching the name you entered already exists';
-$MESSAGE['MEDIA']['DIR_EXISTS'] = 'A folder matching the name you entered already exists';
-$MESSAGE['MEDIA']['DIR_MADE'] = 'Folder created successfully';
-$MESSAGE['MEDIA']['DIR_NOT_MADE'] = 'Unable to create folder';
-$MESSAGE['MEDIA']['SINGLE_UPLOADED'] = ' file was successfully uploaded';
-$MESSAGE['MEDIA']['UPLOADED'] = ' files were successfully uploaded';
-
-$MESSAGE['PAGES']['ADDED'] = 'Page added successfully';
-$MESSAGE['PAGES']['ADDED_HEADING'] = 'Page heading added successfully';
-$MESSAGE['PAGES']['PAGE_EXISTS'] = 'A page with the same or similar title exists';
-$MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE'] = 'Error creating access file in the /pages directory (insufficient privileges)';
-$MESSAGE['PAGES']['CANNOT_DELETE_ACCESS_FILE'] = 'Error deleting access file in the /pages directory (insufficient privileges)';
-$MESSAGE['PAGES']['NOT_FOUND'] = 'Page not found';
-$MESSAGE['PAGES']['SAVED'] = 'Page saved successfully';
-$MESSAGE['PAGES']['SAVED_SETTINGS'] = 'Page settings saved successfully';
-$MESSAGE['PAGES']['NOT_SAVED'] = 'Error saving page';
-$MESSAGE['PAGES']['DELETE_CONFIRM'] = 'Are you sure you want to delete the selected page (and all of its sub-pages)';
-$MESSAGE['PAGES']['DELETED'] = 'Page deleted successfully';
-$MESSAGE['PAGES']['RESTORED'] = 'Page restored successfully';
-$MESSAGE['PAGES']['BLANK_PAGE_TITLE'] = 'Please enter a page title';
-$MESSAGE['PAGES']['BLANK_MENU_TITLE'] = 'Please enter a menu title';
-$MESSAGE['PAGES']['REORDERED'] = 'Page re-ordered successfully';
-$MESSAGE['PAGES']['CANNOT_REORDER'] = 'Error re-ordering page';
-$MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS'] = 'You do not have permissions to modify this page';
-$MESSAGE['PAGES']['INTRO_NOT_WRITABLE'] = 'Cannot write to file /pages/intro.php (insufficient privileges)';
-$MESSAGE['PAGES']['INTRO_SAVED'] = 'Intro page saved successfully';
-$MESSAGE['PAGES']['LAST_MODIFIED'] = 'Last modification by';
-$MESSAGE['PAGES']['INTRO_LINK'] = 'Click HERE to modify the intro page';
-$MESSAGE['PAGES']['SECTIONS_PROPERTIES_SAVED'] = 'Section properties saved successfully';
-$MESSAGE['PAGES']['RETURN_TO_PAGES'] = 'Return to pages';
-
-$MESSAGE['GENERIC']['FILL_IN_ALL'] = 'Please go back and fill-in all fields';
-$MESSAGE['GENERIC']['FILE_TYPE'] = 'Please note that the file you upload must be of the following format:';
-$MESSAGE['GENERIC']['FILE_TYPES'] = 'Please note that the file you upload must be in one of the following formats:';
-$MESSAGE['GENERIC']['CANNOT_UPLOAD'] = 'Cannot upload file';
-$MESSAGE['GENERIC']['ALREADY_INSTALLED'] = 'Already installed';
-$MESSAGE['GENERIC']['NOT_INSTALLED'] = 'Not installed';
-$MESSAGE['GENERIC']['CANNOT_UNINSTALL'] = 'Cannot uninstall';
-$MESSAGE['GENERIC']['CANNOT_UNZIP'] = 'Cannot unzip file';
-$MESSAGE['GENERIC']['INSTALLED'] = 'Installed successfully';
-$MESSAGE['GENERIC']['UPGRADED'] = 'Upgraded successfully';
-$MESSAGE['GENERIC']['UNINSTALLED'] = 'Uninstalled successfully';
-$MESSAGE['GENERIC']['BAD_PERMISSIONS'] = 'Unable to write to the target directory';
-$MESSAGE['GENERIC']['INVALID'] = 'The file you uploaded is invalid';
-$MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE'] = 'Cannot Uninstall: the selected file is in use';
-$MESSAGE['GENERIC']['WEBSITE_UNDER_CONSTRUCTION'] = 'Website Under Construction';
-$MESSAGE['GENERIC']['PLEASE_CHECK_BACK_SOON'] = 'Please check back soon...';
-$MESSAGE['GENERIC']['PLEASE_BE_PATIENT'] = 'Please be patient, this might take a while.';
-$MESSAGE['GENERIC']['ERROR_OPENING_FILE'] = 'Error opening file.';
-
-$MESSAGE['MOD_FORM']['REQUIRED_FIELDS'] = 'You must enter details for the following fields';
-$MESSAGE['MOD_FORM']['EXCESS_SUBMISSIONS'] = 'Sorry, this form has been submitted too many times so far this hour. Please retry in the next hour.';
-$MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'] = 'The verification number (also known as Captcha) that you entered is incorrect. If you are having problems reading the Captcha, please email: '.SERVER_EMAIL;
-
-$MESSAGE['MOD_RELOAD']['PLEASE_SELECT'] = 'Please selected which add-ons you would like to have reloaded';
-$MESSAGE['MOD_RELOAD']['MODULES_RELOADED'] = 'Modules reloaded successfully';
-$MESSAGE['MOD_RELOAD']['TEMPLATES_RELOADED'] = 'Templates reloaded successfully';
-$MESSAGE['MOD_RELOAD']['LANGUAGES_RELOADED'] = 'Languages reloaded successfully';
-
-?>
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+// Define that this file is loaded
+if(!defined('LANGUAGE_LOADED')) {
+	define('LANGUAGE_LOADED', true);
+}
+
+// Set the language information
+$language_code = 'EN';
+$language_name = 'English';
+$language_version = '2.7';
+$language_platform = '2.7.x';
+$language_author = 'Ryan Djurovich, Christian Sommer';
+$language_license = 'GNU General Public License';
+
+// Menu titles
+$MENU['START'] = 'Start';
+$MENU['PAGES'] = 'Pages';
+$MENU['MEDIA'] = 'Media';
+$MENU['ADDONS'] = 'Add-ons';
+$MENU['MODULES'] = 'Modules';
+$MENU['TEMPLATES'] = 'Templates';
+$MENU['LANGUAGES'] = 'Languages';
+$MENU['PREFERENCES'] = 'Preferences';
+$MENU['SETTINGS'] = 'Settings';
+$MENU['ACCESS'] = 'Access';
+$MENU['USERS'] = 'Users';
+$MENU['GROUPS'] = 'Groups';
+$MENU['HELP'] = 'Help';
+$MENU['VIEW'] = 'View';
+$MENU['LOGOUT'] = 'Log-out';
+$MENU['LOGIN'] = 'Login';
+$MENU['FORGOT'] = 'Retrieve Login Details';
+
+// Section overviews
+$OVERVIEW['START'] = 'Administration overview';
+$OVERVIEW['PAGES'] = 'Manage your websites pages...';
+$OVERVIEW['MEDIA'] = 'Manage files stored in the media folder...';
+$OVERVIEW['MODULES'] = 'Manage Website Baker modules...';
+$OVERVIEW['TEMPLATES'] = 'Change the look and feel of your website with templates...';
+$OVERVIEW['LANGUAGES'] = 'Manage Website Baker languages...';
+$OVERVIEW['PREFERENCES'] = 'Change preferences such as email address, password, etc... ';
+$OVERVIEW['SETTINGS'] = 'Changes settings for Website Baker...';
+$OVERVIEW['USERS'] = 'Manage users who can log-in to Website Baker...';
+$OVERVIEW['GROUPS'] = 'Manage user groups and their system permissions...';
+$OVERVIEW['HELP'] = 'Got a questions? Find your answer...';
+$OVERVIEW['VIEW'] = 'Quickly view and browse your website in a new window...';
+
+// Headings
+$HEADING['MODIFY_DELETE_PAGE'] = 'Modify/Delete Page';
+$HEADING['DELETED_PAGES'] = 'Deleted Pages';
+$HEADING['ADD_PAGE'] = 'Add Page';
+$HEADING['ADD_HEADING'] = 'Add Heading';
+$HEADING['MODIFY_PAGE'] = 'Modify Page';
+$HEADING['MODIFY_PAGE_SETTINGS'] = 'Modify Page Settings';
+$HEADING['MODIFY_ADVANCED_PAGE_SETTINGS'] = 'Modify Advanced Page Settings';
+$HEADING['MANAGE_SECTIONS'] = 'Manage Sections';
+$HEADING['MODIFY_INTRO_PAGE'] = 'Modify Intro Page';
+
+$HEADING['BROWSE_MEDIA'] = 'Browse Media';
+$HEADING['CREATE_FOLDER'] = 'Create Folder';
+$HEADING['UPLOAD_FILES'] = 'Upload File(s)';
+
+$HEADING['INSTALL_MODULE'] = 'Install Module';
+$HEADING['UNINSTALL_MODULE'] = 'Uninstall Module';
+$HEADING['MODULE_DETAILS'] = 'Module Details';
+
+$HEADING['INSTALL_TEMPLATE'] = 'Install Template';
+$HEADING['UNINSTALL_TEMPLATE'] = 'Uninstall Template';
+$HEADING['TEMPLATE_DETAILS'] = 'Template Details';
+
+$HEADING['INSTALL_LANGUAGE'] = 'Install Language';
+$HEADING['UNINSTALL_LANGUAGE'] = 'Uninstall Language';
+$HEADING['LANGUAGE_DETAILS'] = 'Language Details';
+
+$HEADING['MY_SETTINGS'] = 'My Settings';
+$HEADING['MY_EMAIL'] = 'My Email';
+$HEADING['MY_PASSWORD'] = 'My Password';
+
+$HEADING['GENERAL_SETTINGS'] = 'General Settings';
+$HEADING['DEFAULT_SETTINGS'] = 'Default Settings';
+$HEADING['SEARCH_SETTINGS'] = 'Search Settings';
+$HEADING['FILESYSTEM_SETTINGS'] = 'Filesystem Settings';
+$HEADING['SERVER_SETTINGS'] = 'Server Settings';
+$HEADING['WBMAILER_SETTINGS'] = 'Mailer Settings';
+$HEADING['ADMINISTRATION_TOOLS'] = 'Administration Tools';
+
+$HEADING['MODIFY_DELETE_USER'] = 'Modify/Delete User';
+$HEADING['ADD_USER'] = 'Add User';
+$HEADING['MODIFY_USER'] = 'Modify User';
+
+$HEADING['MODIFY_DELETE_GROUP'] = 'Modify/Delete Group';
+$HEADING['ADD_GROUP'] = 'Add Group';
+$HEADING['MODIFY_GROUP'] = 'Modify Group';
+
+// Other text
+$TEXT['ADD'] = 'Add';
+$TEXT['MODIFY'] = 'Modify';
+$TEXT['SETTINGS'] = 'Settings';
+$TEXT['DELETE'] = 'Delete';
+$TEXT['SAVE'] = 'Save';
+$TEXT['RESET'] = 'Reset';
+$TEXT['LOGIN'] = 'Login';
+$TEXT['RELOAD'] = 'Reload';
+$TEXT['CANCEL'] = 'Cancel';
+$TEXT['NAME'] = 'Name';
+$TEXT['PLEASE_SELECT'] = 'Please select';
+$TEXT['TITLE'] = 'Title';
+$TEXT['PARENT'] = 'Parent';
+$TEXT['TYPE'] = 'Type';
+$TEXT['VISIBILITY'] = 'Visibility';
+$TEXT['PRIVATE'] = 'Private';
+$TEXT['PUBLIC'] = 'Public';
+$TEXT['NONE'] = 'None';
+$TEXT['NONE_FOUND'] = 'None Found';
+$TEXT['CURRENT'] = 'Current';
+$TEXT['CHANGE'] = 'Change';
+$TEXT['WINDOW'] = 'Window';
+$TEXT['DESCRIPTION'] = 'Description';
+$TEXT['KEYWORDS'] = 'Keywords';
+$TEXT['ADMINISTRATORS'] = 'Administrators';
+$TEXT['PRIVATE_VIEWERS'] = 'Private Viewers';
+$TEXT['EXPAND'] = 'Expand';
+$TEXT['COLLAPSE'] = 'Collapse';
+$TEXT['MOVE_UP'] = 'Move Up';
+$TEXT['MOVE_DOWN'] = 'Move Down';
+$TEXT['RENAME'] = 'Rename';
+$TEXT['MODIFY_SETTINGS'] = 'Modify Settings';
+$TEXT['MODIFY_CONTENT'] = 'Modify Content';
+$TEXT['VIEW'] = 'View';
+$TEXT['UP'] = 'Up';
+$TEXT['FORGOTTEN_DETAILS'] = 'Forgotten your details?';
+$TEXT['NEED_TO_LOGIN'] = 'Need to log-in?';
+$TEXT['SEND_DETAILS'] = 'Send Details';
+$TEXT['USERNAME'] = 'Username';
+$TEXT['PASSWORD'] = 'Password';
+$TEXT['HOME'] = 'Home';
+$TEXT['TARGET_FOLDER'] = 'Target folder';
+$TEXT['OVERWRITE_EXISTING'] = 'Overwrite existing';
+$TEXT['FILE'] = 'File';
+$TEXT['FILES'] = 'Files';
+$TEXT['FOLDER'] = 'Folder';
+$TEXT['FOLDERS'] = 'Folders';
+$TEXT['CREATE_FOLDER'] = 'Create Folder';
+$TEXT['UPLOAD_FILES'] = 'Upload File(s)';
+$TEXT['CURRENT_FOLDER'] = 'Current Folder';
+$TEXT['TO'] = 'To';
+$TEXT['FROM'] = 'From';
+$TEXT['INSTALL'] = 'Install';
+$TEXT['UNINSTALL'] = 'Uninstall';
+$TEXT['VIEW_DETAILS'] = 'View Details';
+$TEXT['DISPLAY_NAME'] = 'Display Name';
+$TEXT['AUTHOR'] = 'Author';
+$TEXT['VERSION'] = 'Version';
+$TEXT['DESIGNED_FOR'] = 'Designed For';
+$TEXT['DESCRIPTION'] = 'Description';
+$TEXT['EMAIL'] = 'Email';
+$TEXT['LANGUAGE'] = 'Language';
+$TEXT['TIMEZONE'] = 'Timezone';
+$TEXT['CURRENT_PASSWORD'] = 'Current Password';
+$TEXT['NEW_PASSWORD'] = 'New Password';
+$TEXT['RETYPE_NEW_PASSWORD'] = 'Re-type New Password';
+$TEXT['ACTIVE'] = 'Active';
+$TEXT['DISABLED'] = 'Disabled';
+$TEXT['ENABLED'] = 'Enabled';
+$TEXT['RETYPE_PASSWORD'] = 'Re-type Password';
+$TEXT['GROUP'] = 'Group';
+$TEXT['SYSTEM_PERMISSIONS'] = 'System Permissions';
+$TEXT['MODULE_PERMISSIONS'] = 'Module Permissions';
+$TEXT['SHOW_ADVANCED'] = 'Show Advanced Options';
+$TEXT['HIDE_ADVANCED'] = 'Hide Advanced Options';
+$TEXT['BASIC'] = 'Basic';
+$TEXT['ADVANCED'] = 'Advanced';
+$TEXT['WEBSITE'] = 'Website';
+$TEXT['DEFAULT'] = 'Default';
+$TEXT['KEYWORDS'] = 'Keywords';
+$TEXT['TEXT'] = 'Text';
+$TEXT['HEADER'] = 'Header';
+$TEXT['FOOTER'] = 'Footer';
+$TEXT['TEMPLATE'] = 'Template';
+$TEXT['INSTALLATION'] = 'Installation';
+$TEXT['DATABASE'] = 'Database';
+$TEXT['HOST'] = 'Host';
+$TEXT['INTRO'] = 'Intro';
+$TEXT['PAGE'] = 'Page';
+$TEXT['SIGNUP'] = 'Sign-up';
+$TEXT['PHP_ERROR_LEVEL'] = 'PHP Error Reporting Level';
+$TEXT['ADMIN'] = 'Admin';
+$TEXT['PATH'] = 'Path';
+$TEXT['URL'] = 'URL';
+$TEXT['FRONTEND'] = 'Front-end';
+$TEXT['EXTENSION'] = 'Extension';
+$TEXT['TABLE_PREFIX'] = 'Table Prefix';
+$TEXT['CHANGES'] = 'Changes';
+$TEXT['ADMINISTRATION'] = 'Administration';
+$TEXT['FORGOT_DETAILS'] = 'Forgot Details?';
+$TEXT['LOGGED_IN'] = 'Logged-In';
+$TEXT['WELCOME_BACK'] = 'Welcome back';
+$TEXT['FULL_NAME'] = 'Full Name';
+$TEXT['ACCOUNT_SIGNUP'] = 'Account Sign-Up';
+$TEXT['LINK'] = 'Link';
+$TEXT['TARGET'] = 'Target';
+$TEXT['NEW_WINDOW'] = 'New Window';
+$TEXT['SAME_WINDOW'] = 'Same Window';
+$TEXT['TOP_FRAME'] = 'Top Frame';
+$TEXT['PAGE_LEVEL_LIMIT'] = 'Page Level Limit';
+$TEXT['SUCCESS'] = 'Success';
+$TEXT['ERROR'] = 'Error';
+$TEXT['ARE_YOU_SURE'] = 'Are you sure?';
+$TEXT['YES'] = 'Yes';
+$TEXT['NO'] = 'No';
+$TEXT['SYSTEM_DEFAULT'] = 'System Default';
+$TEXT['PAGE_TITLE'] = 'Page Title';
+$TEXT['MENU_TITLE'] = 'Menu Title';
+$TEXT['ACTIONS'] = 'Actions';
+$TEXT['UNKNOWN'] = 'Unknown';
+$TEXT['BLOCK'] = 'Block';
+$TEXT['SEARCH'] = 'Search';
+$TEXT['SEARCHING'] = 'Searching';
+$TEXT['POST'] = 'Post';
+$TEXT['COMMENT'] = 'Comment';
+$TEXT['COMMENTS'] = 'Comments';
+$TEXT['COMMENTING'] = 'Commenting';
+$TEXT['SHORT'] = 'Short';
+$TEXT['LONG'] = 'Long';
+$TEXT['LOOP'] = 'Loop';
+$TEXT['FIELD'] = 'Field';
+$TEXT['REQUIRED'] = 'Required';
+$TEXT['LENGTH'] = 'Length';
+$TEXT['MESSAGE'] = 'Message';
+$TEXT['SUBJECT'] = 'Subject';
+$TEXT['MATCH'] = 'Match';
+$TEXT['ALL_WORDS'] = 'All Words';
+$TEXT['ANY_WORDS'] = 'Any Words';
+$TEXT['EXACT_MATCH'] = 'Exact Match';
+$TEXT['SHOW'] = 'Show';
+$TEXT['HIDE'] = 'Hide';
+$TEXT['START_PUBLISHING'] = 'Start Publishing';
+$TEXT['FINISH_PUBLISHING'] = 'Finish Publishing';
+$TEXT['DATE'] = 'Date';
+$TEXT['START'] = 'Start';
+$TEXT['END'] = 'End';
+$TEXT['IMAGE'] = 'Image';
+$TEXT['ICON'] = 'Icon';
+$TEXT['SECTION'] = 'Section';
+$TEXT['DATE_FORMAT'] = 'Date Format';
+$TEXT['TIME_FORMAT'] = 'Time Format';
+$TEXT['RESULTS'] = 'Results';
+$TEXT['RESIZE'] = 'Re-size';
+$TEXT['MANAGE'] = 'Manage';
+$TEXT['CODE'] = 'Code';
+$TEXT['WIDTH'] = 'Width';
+$TEXT['HEIGHT'] = 'Height';
+$TEXT['MORE'] = 'More';
+$TEXT['READ_MORE'] = 'Read More';
+$TEXT['CHANGE_SETTINGS'] = 'Change Settings';
+$TEXT['CURRENT_PAGE'] = 'Current Page';
+$TEXT['CLOSE'] = 'Close';
+$TEXT['INTRO_PAGE'] = 'Intro Page';
+$TEXT['INSTALLATION_URL'] = 'Installation URL';
+$TEXT['INSTALLATION_PATH'] = 'Installation Path';
+$TEXT['PAGE_EXTENSION'] = 'Page Extension';
+$TEXT['NO_RESULTS'] = 'No Results';
+$TEXT['WEBSITE_TITLE'] = 'Website Title';
+$TEXT['WEBSITE_DESCRIPTION'] = 'Website Description';
+$TEXT['WEBSITE_KEYWORDS'] = 'Website Keywords';
+$TEXT['WEBSITE_HEADER'] = 'Website Header';
+$TEXT['WEBSITE_FOOTER'] = 'Website Footer';
+$TEXT['RESULTS_HEADER'] = 'Results Header';
+$TEXT['RESULTS_LOOP'] = 'Results Loop';
+$TEXT['RESULTS_FOOTER'] = 'Results Footer';
+$TEXT['LEVEL'] = 'Level';
+$TEXT['NOT_FOUND'] = 'Not Found';
+$TEXT['PAGE_SPACER'] = 'Page Spacer';
+$TEXT['MATCHING'] = 'Matching';
+$TEXT['TEMPLATE_PERMISSIONS'] = 'Template Permissions';
+$TEXT['PAGES_DIRECTORY'] = 'Pages Directory';
+$TEXT['MEDIA_DIRECTORY'] = 'Media Directory';
+$TEXT['FILE_MODE'] = 'File Mode';
+$TEXT['USER'] = 'User';
+$TEXT['OTHERS'] = 'Others';
+$TEXT['READ'] = 'Read';
+$TEXT['WRITE'] = 'Write';
+$TEXT['EXECUTE'] = 'Execute';
+$TEXT['SMART_LOGIN'] = 'Smart Login';
+$TEXT['REMEMBER_ME'] = 'Remember Me';
+$TEXT['FILESYSTEM_PERMISSIONS'] = 'Filesystem Permissions';
+$TEXT['DIRECTORIES'] = 'Directories';
+$TEXT['DIRECTORY_MODE'] = 'Directory Mode';
+$TEXT['LIST_OPTIONS'] = 'List Options';
+$TEXT['OPTION'] = 'Option';
+$TEXT['ALLOW_MULTIPLE_SELECTIONS'] = 'Allow Multiple Selections';
+$TEXT['TEXTFIELD'] = 'Textfield';
+$TEXT['TEXTAREA'] = 'Textarea';
+$TEXT['SELECT_BOX'] = 'Select Box';
+$TEXT['CHECKBOX_GROUP'] = 'Checkbox Group';
+$TEXT['RADIO_BUTTON_GROUP'] = 'Radio Button Group';
+$TEXT['SIZE'] = 'Size';
+$TEXT['DEFAULT_TEXT'] = 'Default Text';
+$TEXT['SEPERATOR'] = 'Separator';
+$TEXT['BACK'] = 'Back';
+$TEXT['UNDER_CONSTRUCTION'] = 'Under Construction';
+$TEXT['MULTISELECT'] = 'Multi-select';
+$TEXT['SHORT_TEXT'] = 'Short Text';
+$TEXT['LONG_TEXT'] = 'Long Text';
+$TEXT['HOMEPAGE_REDIRECTION'] = 'Homepage Redirection';
+$TEXT['HEADING'] = 'Heading';
+$TEXT['MULTIPLE_MENUS'] = 'Multiple Menus';
+$TEXT['REGISTERED'] = 'Registered';
+$TEXT['START'] = 'Start';
+$TEXT['SECTION_BLOCKS'] = 'Section Blocks';
+$TEXT['REGISTERED_VIEWERS'] = 'Registered Viewers';
+$TEXT['ALLOWED_VIEWERS'] = 'Allowed Viewers';
+$TEXT['SUBMISSION_ID'] = 'Submission ID';
+$TEXT['SUBMISSIONS'] = 'Submissions';
+$TEXT['SUBMITTED'] = 'Submitted';
+$TEXT['MAX_SUBMISSIONS_PER_HOUR'] = 'Max. Submissions Per Hour';
+$TEXT['SUBMISSIONS_STORED_IN_DATABASE'] = 'Submissions Stored In Database';
+$TEXT['EMAIL_ADDRESS'] = 'Email Address';
+$TEXT['CUSTOM'] = 'Custom';
+$TEXT['ANONYMOUS'] = 'Anonymous';
+$TEXT['SERVER_OPERATING_SYSTEM'] = 'Server Operating System';
+$TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'] = 'World-writeable file permissions';
+$TEXT['LINUX_UNIX_BASED'] = 'Linux/Unix based';
+$TEXT['WINDOWS'] = 'Windows';
+$TEXT['HOME_FOLDER'] = 'Home Folder';
+$TEXT['HOME_FOLDERS'] = 'Home Folders';
+$TEXT['PAGE_TRASH'] = 'Page Trash';
+$TEXT['INLINE'] = 'In-line';
+$TEXT['SEPARATE'] = 'Separate';
+$TEXT['DELETED'] = 'Deleted';
+$TEXT['VIEW_DELETED_PAGES'] = 'View Deleted Pages';
+$TEXT['EMPTY_TRASH'] = 'Empty Trash';
+$TEXT['TRASH_EMPTIED'] = 'Trash Emptied';
+$TEXT['ADD_SECTION'] = 'Add Section';
+$TEXT['POST_HEADER'] = 'Post Header';
+$TEXT['POST_FOOTER'] = 'Post Footer';
+$TEXT['POSTS_PER_PAGE'] = 'Posts Per Page';
+$TEXT['RESIZE_IMAGE_TO'] = 'Resize Image To';
+$TEXT['UNLIMITED'] = 'Unlimited';
+$TEXT['OF'] = 'Of';
+$TEXT['OUT_OF'] = 'Out Of';
+$TEXT['NEXT'] = 'Next';
+$TEXT['PREVIOUS'] = 'Previous';
+$TEXT['NEXT_PAGE'] = 'Next Page';
+$TEXT['PREVIOUS_PAGE'] = 'Previous Page';
+$TEXT['ON'] = 'On';
+$TEXT['LAST_UPDATED_BY'] = 'Last Updated By';
+$TEXT['RESULTS_FOR'] = 'Results For';
+$TEXT['TIME'] = 'Time';
+$TEXT['WYSIWYG_STYLE'] = 'WYSIWYG Style';
+$TEXT['WYSIWYG_EDITOR'] = "WYSIWYG Editor";
+$TEXT['SERVER_EMAIL'] = 'Server Email';
+$TEXT['MENU'] = 'Menu';
+$TEXT['MANAGE_GROUPS'] = 'Manage Groups';
+$TEXT['MANAGE_USERS'] = 'Manage Users';
+$TEXT['PAGE_LANGUAGES'] = 'Page Languages';
+$TEXT['HIDDEN'] = 'Hidden';
+$TEXT['MAIN'] = 'Main';
+$TEXT['RENAME_FILES_ON_UPLOAD'] = 'Rename Files On Upload';
+$TEXT['APP_NAME'] = 'Application Name';
+$TEXT['SESSION_IDENTIFIER'] = 'Session Identifier';
+$TEXT['BACKUP'] = 'Backup';
+$TEXT['RESTORE'] = 'Restore';
+$TEXT['BACKUP_DATABASE'] = 'Backup Database';
+$TEXT['RESTORE_DATABASE'] = 'Restore Database';
+$TEXT['BACKUP_ALL_TABLES'] = 'Backup all tables in database';
+$TEXT['BACKUP_WB_SPECIFIC'] = 'Backup only WB-specific tables';
+$TEXT['BACKUP_MEDIA'] = 'Backup Media';
+$TEXT['RESTORE_MEDIA'] = 'Restore Media';
+$TEXT['ADMINISTRATION_TOOL'] = 'Administration tool';
+$TEXT['CAPTCHA_VERIFICATION'] = 'Captcha Verification';
+$TEXT['VERIFICATION'] = 'Verification';
+$TEXT['DEFAULT_CHARSET'] = 'Default Charset';
+$TEXT['CHARSET'] = 'Charset';
+$TEXT['WBMAILER_NOTICE'] = 'Some service providers do not support sending mail via PHP. If your provider requires you to use SMTP for sending mail, you must know the SMTP host address. If you are not sure about these settings, or you do not know the SMTP host of your domain, use the default "PHP mail()" setting. You can change the settings	later if needed.';
+$TEXT['WBMAILER_FUNCTION'] = 'Mail routine';
+$TEXT['WBMAILER_SMTP_HOST'] = 'SMTP host';
+$TEXT['WBMAILER_PHP'] = 'PHP MAIL';
+$TEXT['WBMAILER_SMTP'] = 'SMTP';
+$TEXT['WBMAILER_SMTP_AUTH'] = 'SMTP authentification';
+$TEXT['WBMAILER_SMTP_AUTH_NOTICE'] = 'only activate if your SMTP host requires authentification';
+$TEXT['WBMAILER_SMTP_USERNAME'] = 'SMTP username';
+$TEXT['WBMAILER_SMTP_PASSWORD'] = 'SMTP password';
+
+// Success/error messages
+$MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'] = 'Sorry, you do not have permissions to view this page';
+
+$MESSAGE['ADMIN']['INSUFFICIENT_PRIVELLIGES'] = 'Insufficient privelliges to be here';
+
+$MESSAGE['LOGIN']['BOTH_BLANK'] = 'Please enter your username and password below';
+$MESSAGE['LOGIN']['USERNAME_BLANK'] = 'Please enter a username';
+$MESSAGE['LOGIN']['PASSWORD_BLANK'] = 'Please enter a password';
+$MESSAGE['LOGIN']['USERNAME_TOO_SHORT'] = 'Supplied username to short';
+$MESSAGE['LOGIN']['PASSWORD_TOO_SHORT'] = 'Supplied password to short';
+$MESSAGE['LOGIN']['USERNAME_TOO_LONG'] = 'Supplied username to long';
+$MESSAGE['LOGIN']['PASSWORD_TOO_LONG'] = 'Supplied password to long';
+$MESSAGE['LOGIN']['AUTHENTICATION_FAILED'] = 'Username or password incorrect';
+
+$MESSAGE['SIGNUP']['NO_EMAIL'] = 'You must enter an email address';
+
+$MESSAGE['FORGOT_PASS']['NO_DATA'] = 'Please enter your email address below';
+$MESSAGE['FORGOT_PASS']['EMAIL_NOT_FOUND'] = 'The email that you entered cannot be found in the database';
+$MESSAGE['FORGOT_PASS']['CANNOT_EMAIL'] = 'Unable to email password, please contact system administrator';
+$MESSAGE['FORGOT_PASS']['PASSWORD_RESET'] = 'Your username and password have been sent to your email address';
+$MESSAGE['FORGOT_PASS']['ALREADY_RESET'] = 'Password cannot be reset more than once per hour, sorry';
+
+$MESSAGE['START']['WELCOME_MESSAGE'] = 'Welcome to Website Baker Administration';
+$MESSAGE['START']['INSTALL_DIR_EXISTS'] = 'Warning, Installation Directory Still Exists!';
+$MESSAGE['START']['CURRENT_USER'] = 'You are currently logged in as:';
+
+$MESSAGE['SETTINGS']['UNABLE_OPEN_CONFIG'] = 'Unable to open the configuration file';
+$MESSAGE['SETTINGS']['UNABLE_WRITE_CONFIG'] = 'Cannot write to configuration file';
+$MESSAGE['SETTINGS']['SAVED'] = 'Settings saved successfully';
+$MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'] = 'Please Note: Pressing this button resets all unsaved changes';
+$MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING'] = 'Please note: this is only recommended for testing environments';
+
+$MESSAGE['USERS']['ADDED'] = 'User added successfully';
+$MESSAGE['USERS']['SAVED'] = 'User saved successfully';
+$MESSAGE['USERS']['DELETED'] = 'User deleted successfully';
+$MESSAGE['USERS']['NO_GROUP'] = 'No group was selected';
+$MESSAGE['USERS']['USERNAME_TOO_SHORT'] = 'The username you entered was too short';
+$MESSAGE['USERS']['PASSWORD_TOO_SHORT'] = 'The password you entered was too short';
+$MESSAGE['USERS']['PASSWORD_MISMATCH'] = 'The passwords you entered do not match';
+$MESSAGE['USERS']['INVALID_EMAIL'] = 'The email address you entered is invalid';
+$MESSAGE['USERS']['EMAIL_TAKEN'] = 'The email you entered is already in use';
+$MESSAGE['USERS']['USERNAME_TAKEN'] = 'The username you entered is already taken';
+$MESSAGE['USERS']['CHANGING_PASSWORD'] = 'Please note: You should only enter values in the above fields if you wish to change this users password';
+$MESSAGE['USERS']['CONFIRM_DELETE'] = 'Are you sure you want to delete the selected user?';
+
+$MESSAGE['GROUPS']['ADDED'] = 'Group added successfully';
+$MESSAGE['GROUPS']['SAVED'] = 'Group saved successfully';
+$MESSAGE['GROUPS']['DELETED'] = 'Group deleted successfully';
+$MESSAGE['GROUPS']['GROUP_NAME_BLANK'] = 'Group name is blank';
+$MESSAGE['GROUPS']['CONFIRM_DELETE'] = 'Are you sure you want to delete the selected group (and any users that belong to it)?';
+$MESSAGE['GROUPS']['NO_GROUPS_FOUND'] = 'No groups found';
+$MESSAGE['GROUPS']['GROUP_NAME_EXISTS'] = 'Group name already exists';
+
+$MESSAGE['PREFERENCES']['DETAILS_SAVED'] = 'Details saved successfully';
+$MESSAGE['PREFERENCES']['EMAIL_UPDATED'] = 'Email updated successfully';
+$MESSAGE['PREFERENCES']['CURRENT_PASSWORD_INCORRECT'] = 'The (current) password you entered is incorrect';
+$MESSAGE['PREFERENCES']['PASSWORD_CHANGED'] = 'Password changed successfully';
+
+$MESSAGE['TEMPLATES']['CHANGE_TEMPLATE_NOTICE'] = 'Please note: to change the template you must go to the Settings section';
+
+$MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'] = 'Cannot include ../ in the folder name';
+$MESSAGE['MEDIA']['DIR_DOES_NOT_EXIST'] = 'Directory does not exist';
+$MESSAGE['MEDIA']['TARGET_DOT_DOT_SLASH'] = 'Cannot have ../ in the folder target';
+$MESSAGE['MEDIA']['NAME_DOT_DOT_SLASH'] = 'Cannot include ../ in the name';
+$MESSAGE['MEDIA']['NAME_INDEX_PHP'] = 'Cannot use index.php as the name';
+$MESSAGE['MEDIA']['NONE_FOUND'] = 'No media found in the current folder';
+$MESSAGE['MEDIA']['FILE_NOT_FOUND'] = 'File not found';
+$MESSAGE['MEDIA']['DELETED_FILE'] = 'File deleted successfully';
+$MESSAGE['MEDIA']['DELETED_DIR'] = 'Folder deleted successfully';
+$MESSAGE['MEDIA']['CONFIRM_DELETE'] = 'Are you sure you want to delete the following file or folder?';
+$MESSAGE['MEDIA']['CANNOT_DELETE_FILE'] = 'Cannot delete the selected file';
+$MESSAGE['MEDIA']['CANNOT_DELETE_DIR'] = 'Cannot delete the selected folder';
+$MESSAGE['MEDIA']['BLANK_NAME'] = 'You did not enter a new name';
+$MESSAGE['MEDIA']['BLANK_EXTENSION'] = 'You did not enter a file extension';
+$MESSAGE['MEDIA']['RENAMED'] = 'Rename successful';
+$MESSAGE['MEDIA']['CANNOT_RENAME'] = 'Rename unsuccessful';
+$MESSAGE['MEDIA']['FILE_EXISTS'] = 'A file matching the name you entered already exists';
+$MESSAGE['MEDIA']['DIR_EXISTS'] = 'A folder matching the name you entered already exists';
+$MESSAGE['MEDIA']['DIR_MADE'] = 'Folder created successfully';
+$MESSAGE['MEDIA']['DIR_NOT_MADE'] = 'Unable to create folder';
+$MESSAGE['MEDIA']['SINGLE_UPLOADED'] = ' file was successfully uploaded';
+$MESSAGE['MEDIA']['UPLOADED'] = ' files were successfully uploaded';
+
+$MESSAGE['PAGES']['ADDED'] = 'Page added successfully';
+$MESSAGE['PAGES']['ADDED_HEADING'] = 'Page heading added successfully';
+$MESSAGE['PAGES']['PAGE_EXISTS'] = 'A page with the same or similar title exists';
+$MESSAGE['PAGES']['CANNOT_CREATE_ACCESS_FILE'] = 'Error creating access file in the /pages directory (insufficient privileges)';
+$MESSAGE['PAGES']['CANNOT_DELETE_ACCESS_FILE'] = 'Error deleting access file in the /pages directory (insufficient privileges)';
+$MESSAGE['PAGES']['NOT_FOUND'] = 'Page not found';
+$MESSAGE['PAGES']['SAVED'] = 'Page saved successfully';
+$MESSAGE['PAGES']['SAVED_SETTINGS'] = 'Page settings saved successfully';
+$MESSAGE['PAGES']['NOT_SAVED'] = 'Error saving page';
+$MESSAGE['PAGES']['DELETE_CONFIRM'] = 'Are you sure you want to delete the selected page (and all of its sub-pages)';
+$MESSAGE['PAGES']['DELETED'] = 'Page deleted successfully';
+$MESSAGE['PAGES']['RESTORED'] = 'Page restored successfully';
+$MESSAGE['PAGES']['BLANK_PAGE_TITLE'] = 'Please enter a page title';
+$MESSAGE['PAGES']['BLANK_MENU_TITLE'] = 'Please enter a menu title';
+$MESSAGE['PAGES']['REORDERED'] = 'Page re-ordered successfully';
+$MESSAGE['PAGES']['CANNOT_REORDER'] = 'Error re-ordering page';
+$MESSAGE['PAGES']['INSUFFICIENT_PERMISSIONS'] = 'You do not have permissions to modify this page';
+$MESSAGE['PAGES']['INTRO_NOT_WRITABLE'] = 'Cannot write to file /pages/intro.php (insufficient privileges)';
+$MESSAGE['PAGES']['INTRO_SAVED'] = 'Intro page saved successfully';
+$MESSAGE['PAGES']['LAST_MODIFIED'] = 'Last modification by';
+$MESSAGE['PAGES']['INTRO_LINK'] = 'Click HERE to modify the intro page';
+$MESSAGE['PAGES']['SECTIONS_PROPERTIES_SAVED'] = 'Section properties saved successfully';
+$MESSAGE['PAGES']['RETURN_TO_PAGES'] = 'Return to pages';
+
+$MESSAGE['GENERIC']['FILL_IN_ALL'] = 'Please go back and fill-in all fields';
+$MESSAGE['GENERIC']['FILE_TYPE'] = 'Please note that the file you upload must be of the following format:';
+$MESSAGE['GENERIC']['FILE_TYPES'] = 'Please note that the file you upload must be in one of the following formats:';
+$MESSAGE['GENERIC']['CANNOT_UPLOAD'] = 'Cannot upload file';
+$MESSAGE['GENERIC']['ALREADY_INSTALLED'] = 'Already installed';
+$MESSAGE['GENERIC']['NOT_INSTALLED'] = 'Not installed';
+$MESSAGE['GENERIC']['CANNOT_UNINSTALL'] = 'Cannot uninstall';
+$MESSAGE['GENERIC']['CANNOT_UNZIP'] = 'Cannot unzip file';
+$MESSAGE['GENERIC']['INSTALLED'] = 'Installed successfully';
+$MESSAGE['GENERIC']['UPGRADED'] = 'Upgraded successfully';
+$MESSAGE['GENERIC']['UNINSTALLED'] = 'Uninstalled successfully';
+$MESSAGE['GENERIC']['BAD_PERMISSIONS'] = 'Unable to write to the target directory';
+$MESSAGE['GENERIC']['INVALID'] = 'The file you uploaded is invalid';
+$MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE'] = 'Cannot Uninstall: the selected file is in use';
+$MESSAGE['GENERIC']['WEBSITE_UNDER_CONSTRUCTION'] = 'Website Under Construction';
+$MESSAGE['GENERIC']['PLEASE_CHECK_BACK_SOON'] = 'Please check back soon...';
+$MESSAGE['GENERIC']['PLEASE_BE_PATIENT'] = 'Please be patient, this might take a while.';
+$MESSAGE['GENERIC']['ERROR_OPENING_FILE'] = 'Error opening file.';
+
+$MESSAGE['MOD_FORM']['REQUIRED_FIELDS'] = 'You must enter details for the following fields';
+$MESSAGE['MOD_FORM']['EXCESS_SUBMISSIONS'] = 'Sorry, this form has been submitted too many times so far this hour. Please retry in the next hour.';
+$MESSAGE['MOD_FORM']['INCORRECT_CAPTCHA'] = 'The verification number (also known as Captcha) that you entered is incorrect. If you are having problems reading the Captcha, please email: '.SERVER_EMAIL;
+
+$MESSAGE['MOD_RELOAD']['PLEASE_SELECT'] = 'Please selected which add-ons you would like to have reloaded';
+$MESSAGE['MOD_RELOAD']['MODULES_RELOADED'] = 'Modules reloaded successfully';
+$MESSAGE['MOD_RELOAD']['TEMPLATES_RELOADED'] = 'Templates reloaded successfully';
+$MESSAGE['MOD_RELOAD']['LANGUAGES_RELOADED'] = 'Languages reloaded successfully';
+
+?>
Index: trunk/wb/admin/settings/index.php
===================================================================
--- trunk/wb/admin/settings/index.php	(revision 416)
+++ trunk/wb/admin/settings/index.php	(revision 417)
@@ -1,599 +1,631 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-require('../../config.php');
-require_once(WB_PATH.'/framework/class.admin.php');
-if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
-	$admin = new admin('Settings', 'settings_advanced');
-} else {
-	$admin = new admin('Settings', 'settings_basic');
-}
-
-// Include the WB functions file
-require_once(WB_PATH.'/framework/functions.php');
-
-// Create new template object
-$template = new Template(ADMIN_PATH.'/settings');
-$template->set_file('page', 'template.html');
-$template->set_block('page', 'main_block', 'main');
-
-// Query current settings in the db, then loop through them and print them
-$query = "SELECT * FROM ".TABLE_PREFIX."settings";
-$results = $database->query($query);
-while($setting = $results->fetchRow()) {
-	$setting_name = $setting['name'];
-	$setting_value = htmlspecialchars($setting['value']);
-	$template->set_var(strtoupper($setting_name),$setting_value);
-}
-
-// Query current settings in the db, then loop through them and print them
-$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
-$results = $database->query($query);
-while($setting = $results->fetchRow()) {
-	$setting_name = $setting['name'];
-	$setting_value = htmlspecialchars(($setting['value']));
-	switch($setting_name) {
-		// Search header
-		case 'header':
-			$template->set_var('SEARCH_HEADER', $setting_value);
-		break;
-		// Search results header
-		case 'results_header':
-			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
-		break;
-		// Search results loop
-		case 'results_loop':
-			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
-		break;
-		// Search results footer
-		case 'results_footer':
-			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
-		break;
-		// Search no results
-		case 'no_results':
-			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
-		break;
-		// Search footer
-		case 'footer':
-			$template->set_var('SEARCH_FOOTER', $setting_value);
-		break;
-		// Search template
-		case 'template':
-			$search_template = $setting_value;
-		break;
-	}
-}
-
-// Do the same for settings stored in config file as with ones in db
-$database_type = '';
-
-// Tell the browser whether or not to show advanced options
-if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
-	$template->set_var('DISPLAY_ADVANCED', '');
-	$template->set_var('ADVANCED', 'yes');
-	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
-	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
-	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
-	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
-} else {
-	$template->set_var('DISPLAY_ADVANCED', 'none');
-	$template->set_var('ADVANCED', 'no');
-	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
-	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
-	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
-	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
-}
-
-$template->set_var(array(	
-									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
-									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
-									'PAGE_EXTENSION' => PAGE_EXTENSION,
-									'PAGE_SPACER' => PAGE_SPACER,
-									'WB_PATH' => WB_PATH,
-									'WB_URL' => WB_URL,
-									'ADMIN_PATH' => ADMIN_PATH,
-									'ADMIN_URL' => ADMIN_URL,
-									'DATABASE_TYPE' => DB_TYPE,
-									'DATABASE_HOST' => DB_HOST,
-									'DATABASE_USERNAME' => DB_USERNAME,
-									'DATABASE_NAME' => DB_NAME,
-									'TABLE_PREFIX' => TABLE_PREFIX
-								 )
-						 );
-
-// Insert tools into tool list
-$template->set_block('main_block', 'tool_list_block', 'tool_list');
-$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool'");
-if($results->numRows() > 0) {
-	while($tool = $results->fetchRow()) {
-		$template->set_var('TOOL_NAME', $tool['name']);
-		$template->set_var('TOOL_DIR', $tool['directory']);
-		$template->set_var('TOOL_DESCRIPTION', $tool['description']);
-		$template->parse('tool_list', 'tool_list_block', true);
-	}
-} else {
-	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);	
-}
-
-// Insert language values
-$template->set_block('main_block', 'language_list_block', 'language_list');
-$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by directory");
-if($result->numRows() > 0) {
-	while ($addon = $result->fetchRow()) {
-		// Insert code and name
-		$template->set_var(array(
-								'CODE' => $addon['directory'],
-								'NAME' => $addon['name']
-								));
-		// Check if it is selected
-		if(DEFAULT_LANGUAGE == $addon['directory']) {
-			$template->set_var('SELECTED', ' selected');
-		} else {
-			$template->set_var('SELECTED', '');
-		}
-		$template->parse('language_list', 'language_list_block', true);
-	}
-}
-
-// Insert default timezone values
-require(ADMIN_PATH.'/interface/timezones.php');
-$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
-foreach($TIMEZONES AS $hour_offset => $title) {
-	// Make sure we dont list "System Default" as we are setting this value!
-	if($hour_offset != '-20') {
-		$template->set_var('VALUE', $hour_offset);
-		$template->set_var('NAME', $title);
-		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
-			$template->set_var('SELECTED', 'selected');
-		} else {
-			$template->set_var('SELECTED', '');
-		}
-		$template->parse('timezone_list', 'timezone_list_block', true);
-	}
-}
-
-// Insert default charset values
-require(ADMIN_PATH.'/interface/charsets.php');
-$template->set_block('main_block', 'charset_list_block', 'charset_list');
-foreach($CHARSETS AS $code => $title) {
-	$template->set_var('VALUE', $code);
-	$template->set_var('NAME', $title);
-	if(DEFAULT_CHARSET == $code) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('charset_list', 'charset_list_block', true);
-}
-
-// Insert date format list
-require(ADMIN_PATH.'/interface/date_formats.php');
-$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
-foreach($DATE_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(DEFAULT_DATE_FORMAT == $format) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('date_format_list', 'date_format_list_block', true);
-}
-
-// Insert time format list
-require(ADMIN_PATH.'/interface/time_formats.php');
-$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
-foreach($TIME_FORMATS AS $format => $title) {
-	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
-	if($format != 'system_default') {
-		$template->set_var('VALUE', $format);
-	} else {
-		$template->set_var('VALUE', '');
-	}
-	$template->set_var('NAME', $title);
-	if(DEFAULT_TIME_FORMAT == $format) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('time_format_list', 'time_format_list_block', true);
-}
-
-// Insert templates
-$template->set_block('main_block', 'template_list_block', 'template_list');
-$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
-if($result->numRows() > 0) {
-	while($addon = $result->fetchRow()) {
-		$template->set_var('FILE', $addon['directory']);
-		$template->set_var('NAME', $addon['name']);
-		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected' : $selected = '');
-		$template->set_var('SELECTED', $selected);
-		$template->parse('template_list', 'template_list_block', true);
-	}
-}
-
-// Insert WYSIWYG modules
-$template->set_block('main_block', 'editor_list_block', 'editor_list');
-$file='none';  
-$module_name=$TEXT['NONE'];  
-$template->set_var('FILE', $file);  
-$template->set_var('NAME', $module_name);  
-if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');  
-$template->set_var('SELECTED', $selected);  
-$template->parse('editor_list', 'editor_list_block', true);  
-$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
-if($result->numRows() > 0) {
-	while($addon = $result->fetchRow()) {
-		$template->set_var('FILE', $addon['directory']);
-		$template->set_var('NAME', $addon['name']);
-		if((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');
-		$template->set_var('SELECTED', $selected);
-		$template->parse('editor_list', 'editor_list_block', true);
-	}
-}
-
-// Insert templates for search settings
-$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
-if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
-$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
-$template->parse('search_template_list', 'search_template_list_block', true);
-$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
-if($result->numRows() > 0) {
-	while($addon = $result->fetchRow()) {
-		$template->set_var('FILE', $addon['directory']);
-		$template->set_var('NAME', $addon['name']);
-		if($addon['directory'] == $search_template ? $selected = ' selected' : $selected = '');
-		$template->set_var('SELECTED', $selected);
-		$template->parse('search_template_list', 'search_template_list_block', true);
-	}
-}
-
-// Insert default error reporting values
-require(ADMIN_PATH.'/interface/er_levels.php');
-$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
-foreach($ER_LEVELS AS $value => $title) {
-	$template->set_var('VALUE', $value);
-	$template->set_var('NAME', $title);
-	if(ER_LEVEL == $value) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
-}
-
-// Insert permissions values
-if($admin->get_permission('settings_advanced') != true) {
-	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
-}
-
-// Insert page level limits
-$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
-for($i = 1; $i <= 10; $i++) {
-	$template->set_var('NUMBER', $i);
-	if(PAGE_LEVEL_LIMIT == $i) {
-		$template->set_var('SELECTED', 'selected');
-	} else {
-		$template->set_var('SELECTED', '');
-	}
-	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
-}
-
-// Work-out if multiple menus feature is enabled
-if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
-	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
-} else {
-	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
-}
-
-// Work-out if page languages feature is enabled
-if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
-        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
-} else {
-        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
-}
-
-// Work-out if smart login feature is enabled
-if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
-	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
-} else {
-	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
-}
-
-// Work-out if captcha verification feature is enabled
-if(defined('CAPTCHA_VERIFICATION') AND CAPTCHA_VERIFICATION == true) {
-	$template->set_var('CAPTCHA_VERIFICATION_ENABLED', ' checked');
-} else {
-	$template->set_var('CAPTCHA_VERIFICATION_DISABLED', ' checked');
-}
-if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
-	$template->set_var('GD_EXTENSION_ENABLED', '');
-} else {
-	$template->set_var('GD_EXTENSION_ENABLED', 'none');
-}
-
-// Work-out if section blocks feature is enabled
-if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
-	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
-} else {
-	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
-}
-
-// Work-out if homepage redirection feature is enabled
-if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
-	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
-} else {
-	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
-}
-
-// Work-out which server os should be checked
-if(OPERATING_SYSTEM == 'linux') {
-	$template->set_var('LINUX_SELECTED', ' checked');
-} elseif(OPERATING_SYSTEM == 'windows') {
-	$template->set_var('WINDOWS_SELECTED', ' checked');
-}
-
-// Work-out if manage sections feature is enabled
-if(MANAGE_SECTIONS) {
-	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
-} else {
-	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
-}
-
-// Work-out if intro feature is enabled
-if(INTRO_PAGE) {
-	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
-} else {
-	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
-}
-
-// Work-out if frontend login feature is enabled
-if(FRONTEND_LOGIN) {
-	$template->set_var('PRIVATE_ENABLED', ' checked');
-} else {
-	$template->set_var('PRIVATE_DISABLED', ' checked');
-}
-
-// Work-out if page trash feature is disabled, in-line, or separate
-if(PAGE_TRASH == 'disabled') {
-	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
-	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
-} elseif(PAGE_TRASH == 'inline') {
-	$template->set_var('PAGE_TRASH_INLINE', ' checked');
-	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
-} elseif(PAGE_TRASH == 'separate') {
-	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
-	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
-}
-
-// Work-out if media home folde feature is enabled
-if(HOME_FOLDERS) {
-	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
-} else {
-	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
-}
-
-// Insert search select
-if(SEARCH == 'private') {
-	$template->set_var('PRIVATE_SEARCH', 'selected');
-} elseif(SEARCH == 'registered') {
-	$template->set_var('REGISTERED_SEARCH', 'selected');
-} elseif(SEARCH == 'none') {
-	$template->set_var('NONE_SEARCH', 'selected');
-}
-
-// Work-out if 777 permissions are set
-if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
-	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
-}
-
-// Work-out which file mode boxes are checked
-if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
-	$template->set_var('FILE_U_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
-	$template->set_var('FILE_U_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
-	$template->set_var('FILE_U_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
-	$template->set_var('FILE_G_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
-	$template->set_var('FILE_G_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
-	$template->set_var('FILE_G_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
-	$template->set_var('FILE_O_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
-	$template->set_var('FILE_O_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
-	$template->set_var('FILE_O_E_CHECKED', 'checked');
-}
-// Work-out which dir mode boxes are checked
-if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
-	$template->set_var('DIR_U_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
-	$template->set_var('DIR_U_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
-	$template->set_var('DIR_U_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
-	$template->set_var('DIR_G_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
-	$template->set_var('DIR_G_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
-	$template->set_var('DIR_G_E_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
-	$template->set_var('DIR_O_R_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
-	$template->set_var('DIR_O_W_CHECKED', 'checked');
-}
-if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
-	$template->set_var('DIR_O_E_CHECKED', 'checked');
-}
-
-// Insert Server Email value into template
-$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
-
-// Insert groups into signup list
-$template->set_block('main_block', 'group_list_block', 'group_list');
-$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
-if($results->numRows() > 0) {
-	while($group = $results->fetchRow()) {
-		$template->set_var('ID', $group['group_id']);
-		$template->set_var('NAME', $group['name']);
-		if(FRONTEND_SIGNUP == $group['group_id']) {
-			$template->set_var('SELECTED', 'selected');
-		} else {
-			$template->set_var('SELECTED', '');
-		}
-		$template->parse('group_list', 'group_list_block', true);
-	}
-} else {
-	$template->set_var('ID', 'disabled');
-	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
-	$template->parse('group_list', 'group_list_block', true);
-}
-
-// Insert language headings
-$template->set_var(array(
-								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
-								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
-								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
-								'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
-								'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
-								)
-						);
-// Insert language text and messages
-$template->set_var(array(
-								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
-								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
-								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
-								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
-								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
-								'TEXT_HEADER' => $TEXT['HEADER'],
-								'TEXT_FOOTER' => $TEXT['FOOTER'],
-								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
-								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
-								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
-								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
-								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
-								'TEXT_TEXT' => $TEXT['TEXT'],
-								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
-								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
-								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
-								'TEXT_CHARSET' => $TEXT['CHARSET'],
-								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
-								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
-								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
-								'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
-								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
-								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
-								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
-								'TEXT_LOGIN' => $TEXT['LOGIN'],
-								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
-								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
-								'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
-								'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
-								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
-								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
-								'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
-								'TEXT_APP_NAME' => $TEXT['APP_NAME'],
-								'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
-								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
-								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
-								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
-								'TEXT_ADMIN' => $TEXT['ADMIN'],
-								'TEXT_TYPE' => $TEXT['TYPE'],
-								'TEXT_DATABASE' => $TEXT['DATABASE'],
-								'TEXT_HOST' => $TEXT['HOST'],
-								'TEXT_USERNAME' => $TEXT['USERNAME'],
-								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
-								'TEXT_NAME' => $TEXT['NAME'],
-								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
-								'TEXT_SAVE' => $TEXT['SAVE'],
-								'TEXT_RESET' => $TEXT['RESET'],
-								'TEXT_CHANGES' => $TEXT['CHANGES'],
-								'TEXT_ENABLED' => $TEXT['ENABLED'],
-								'TEXT_DISABLED' => $TEXT['DISABLED'],
-								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
-								'TEXT_MANAGE' => $TEXT['MANAGE'],
-								'TEXT_SEARCH' => $TEXT['SEARCH'],
-								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
-								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
-								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
-								'TEXT_NONE' => $TEXT['NONE'],
-								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
-								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
-								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
-								'TEXT_USER' => $TEXT['USER'],
-								'TEXT_GROUP' => $TEXT['GROUP'],
-								'TEXT_OTHERS' => $TEXT['OTHERS'],
-								'TEXT_READ' => $TEXT['READ'],
-								'TEXT_WRITE' => $TEXT['WRITE'],
-								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
-								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
-								'TEXT_CAPTCHA_VERIFICATION' => $TEXT['CAPTCHA_VERIFICATION'],
-								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
-								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
-								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
-								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
-								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
-								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
-								'TEXT_INLINE' => $TEXT['INLINE'],
-								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
-								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
-								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
-								'TEXT_SERVER_EMAIL' => $TEXT['SERVER_EMAIL'],
-								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
-								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
-								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING']
-								)
-						);
-
-// Parse template objects output
-$template->parse('main', 'main_block', false);
-$template->pparse('output', 'page');
-
-$admin->print_footer();
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+require('../../config.php');
+require_once(WB_PATH.'/framework/class.admin.php');
+if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
+	$admin = new admin('Settings', 'settings_advanced');
+} else {
+	$admin = new admin('Settings', 'settings_basic');
+}
+
+// Include the WB functions file
+require_once(WB_PATH.'/framework/functions.php');
+
+// Create new template object
+$template = new Template(ADMIN_PATH.'/settings');
+$template->set_file('page', 'template.html');
+$template->set_block('page', 'main_block', 'main');
+
+// Query current settings in the db, then loop through them and print them
+$query = "SELECT * FROM ".TABLE_PREFIX."settings";
+$results = $database->query($query);
+while($setting = $results->fetchRow()) {
+	$setting_name = $setting['name'];
+	$setting_value = htmlspecialchars($setting['value']);
+	$template->set_var(strtoupper($setting_name),$setting_value);
+}
+
+// Query current settings in the db, then loop through them and print them
+$query = "SELECT * FROM ".TABLE_PREFIX."search WHERE extra = ''";
+$results = $database->query($query);
+while($setting = $results->fetchRow()) {
+	$setting_name = $setting['name'];
+	$setting_value = htmlspecialchars(($setting['value']));
+	switch($setting_name) {
+		// Search header
+		case 'header':
+			$template->set_var('SEARCH_HEADER', $setting_value);
+		break;
+		// Search results header
+		case 'results_header':
+			$template->set_var('SEARCH_RESULTS_HEADER', $setting_value);
+		break;
+		// Search results loop
+		case 'results_loop':
+			$template->set_var('SEARCH_RESULTS_LOOP', $setting_value);
+		break;
+		// Search results footer
+		case 'results_footer':
+			$template->set_var('SEARCH_RESULTS_FOOTER', $setting_value);
+		break;
+		// Search no results
+		case 'no_results':
+			$template->set_var('SEARCH_NO_RESULTS', $setting_value);
+		break;
+		// Search footer
+		case 'footer':
+			$template->set_var('SEARCH_FOOTER', $setting_value);
+		break;
+		// Search template
+		case 'template':
+			$search_template = $setting_value;
+		break;
+	}
+}
+
+// Do the same for settings stored in config file as with ones in db
+$database_type = '';
+
+// Tell the browser whether or not to show advanced options
+if(isset($_GET['advanced']) AND $_GET['advanced'] == 'yes') {
+	$template->set_var('DISPLAY_ADVANCED', '');
+	$template->set_var('ADVANCED', 'yes');
+	$template->set_var('ADVANCED_BUTTON', '<< '.$TEXT['HIDE_ADVANCED']);
+	$template->set_var('ADVANCED_LINK', 'index.php?advanced=no');
+	$template->set_var('BASIC_FILE_PERMS_ID', 'hide');
+	$template->set_var('ADVANCED_FILE_PERMS_ID', 'file_perms_box');
+} else {
+	$template->set_var('DISPLAY_ADVANCED', 'none');
+	$template->set_var('ADVANCED', 'no');
+	$template->set_var('ADVANCED_BUTTON', $TEXT['SHOW_ADVANCED'].' >>');
+	$template->set_var('ADVANCED_LINK', 'index.php?advanced=yes');
+	$template->set_var('BASIC_FILE_PERMS_ID', 'file_perms_box');
+	$template->set_var('ADVANCED_FILE_PERMS_ID', 'hide');
+}
+
+$template->set_var(array(	
+									'PAGES_DIRECTORY' => PAGES_DIRECTORY,
+									'MEDIA_DIRECTORY' => MEDIA_DIRECTORY,
+									'PAGE_EXTENSION' => PAGE_EXTENSION,
+									'PAGE_SPACER' => PAGE_SPACER,
+									'WB_PATH' => WB_PATH,
+									'WB_URL' => WB_URL,
+									'ADMIN_PATH' => ADMIN_PATH,
+									'ADMIN_URL' => ADMIN_URL,
+									'DATABASE_TYPE' => DB_TYPE,
+									'DATABASE_HOST' => DB_HOST,
+									'DATABASE_USERNAME' => DB_USERNAME,
+									'DATABASE_NAME' => DB_NAME,
+									'TABLE_PREFIX' => TABLE_PREFIX
+								 )
+						 );
+
+// Insert tools into tool list
+$template->set_block('main_block', 'tool_list_block', 'tool_list');
+$results = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool'");
+if($results->numRows() > 0) {
+	while($tool = $results->fetchRow()) {
+		$template->set_var('TOOL_NAME', $tool['name']);
+		$template->set_var('TOOL_DIR', $tool['directory']);
+		$template->set_var('TOOL_DESCRIPTION', $tool['description']);
+		$template->parse('tool_list', 'tool_list_block', true);
+	}
+} else {
+	$template->set_var('TOOL_LIST', $TEXT['NONE_FOUND']);	
+}
+
+// Insert language values
+$template->set_block('main_block', 'language_list_block', 'language_list');
+$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'language' order by directory");
+if($result->numRows() > 0) {
+	while ($addon = $result->fetchRow()) {
+		// Insert code and name
+		$template->set_var(array(
+								'CODE' => $addon['directory'],
+								'NAME' => $addon['name']
+								));
+		// Check if it is selected
+		if(DEFAULT_LANGUAGE == $addon['directory']) {
+			$template->set_var('SELECTED', ' selected');
+		} else {
+			$template->set_var('SELECTED', '');
+		}
+		$template->parse('language_list', 'language_list_block', true);
+	}
+}
+
+// Insert default timezone values
+require(ADMIN_PATH.'/interface/timezones.php');
+$template->set_block('main_block', 'timezone_list_block', 'timezone_list');
+foreach($TIMEZONES AS $hour_offset => $title) {
+	// Make sure we dont list "System Default" as we are setting this value!
+	if($hour_offset != '-20') {
+		$template->set_var('VALUE', $hour_offset);
+		$template->set_var('NAME', $title);
+		if(DEFAULT_TIMEZONE == $hour_offset*60*60) {
+			$template->set_var('SELECTED', 'selected');
+		} else {
+			$template->set_var('SELECTED', '');
+		}
+		$template->parse('timezone_list', 'timezone_list_block', true);
+	}
+}
+
+// Insert default charset values
+require(ADMIN_PATH.'/interface/charsets.php');
+$template->set_block('main_block', 'charset_list_block', 'charset_list');
+foreach($CHARSETS AS $code => $title) {
+	$template->set_var('VALUE', $code);
+	$template->set_var('NAME', $title);
+	if(DEFAULT_CHARSET == $code) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('charset_list', 'charset_list_block', true);
+}
+
+// Insert date format list
+require(ADMIN_PATH.'/interface/date_formats.php');
+$template->set_block('main_block', 'date_format_list_block', 'date_format_list');
+foreach($DATE_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(DEFAULT_DATE_FORMAT == $format) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('date_format_list', 'date_format_list_block', true);
+}
+
+// Insert time format list
+require(ADMIN_PATH.'/interface/time_formats.php');
+$template->set_block('main_block', 'time_format_list_block', 'time_format_list');
+foreach($TIME_FORMATS AS $format => $title) {
+	$format = str_replace('|', ' ', $format); // Add's white-spaces (not able to be stored in array key)
+	if($format != 'system_default') {
+		$template->set_var('VALUE', $format);
+	} else {
+		$template->set_var('VALUE', '');
+	}
+	$template->set_var('NAME', $title);
+	if(DEFAULT_TIME_FORMAT == $format) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('time_format_list', 'time_format_list_block', true);
+}
+
+// Insert templates
+$template->set_block('main_block', 'template_list_block', 'template_list');
+$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
+if($result->numRows() > 0) {
+	while($addon = $result->fetchRow()) {
+		$template->set_var('FILE', $addon['directory']);
+		$template->set_var('NAME', $addon['name']);
+		if(($addon['directory'] == DEFAULT_TEMPLATE) ? $selected = ' selected' : $selected = '');
+		$template->set_var('SELECTED', $selected);
+		$template->parse('template_list', 'template_list_block', true);
+	}
+}
+
+// Insert WYSIWYG modules
+$template->set_block('main_block', 'editor_list_block', 'editor_list');
+$file='none';  
+$module_name=$TEXT['NONE'];  
+$template->set_var('FILE', $file);  
+$template->set_var('NAME', $module_name);  
+if((!defined('WYSIWYG_EDITOR') OR $file == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');  
+$template->set_var('SELECTED', $selected);  
+$template->parse('editor_list', 'editor_list_block', true);  
+$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'wysiwyg'");
+if($result->numRows() > 0) {
+	while($addon = $result->fetchRow()) {
+		$template->set_var('FILE', $addon['directory']);
+		$template->set_var('NAME', $addon['name']);
+		if((defined('WYSIWYG_EDITOR') AND $addon['directory'] == WYSIWYG_EDITOR) ? $selected = ' selected' : $selected = '');
+		$template->set_var('SELECTED', $selected);
+		$template->parse('editor_list', 'editor_list_block', true);
+	}
+}
+
+// Insert templates for search settings
+$template->set_block('main_block', 'search_template_list_block', 'search_template_list');
+if($search_template == '') { $selected = ' selected'; } else { $selected = ''; }
+$template->set_var(array('FILE' => '', 'NAME' => $TEXT['SYSTEM_DEFAULT'], 'SELECTED' => $selected));
+$template->parse('search_template_list', 'search_template_list_block', true);
+$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'template' order by name");
+if($result->numRows() > 0) {
+	while($addon = $result->fetchRow()) {
+		$template->set_var('FILE', $addon['directory']);
+		$template->set_var('NAME', $addon['name']);
+		if($addon['directory'] == $search_template ? $selected = ' selected' : $selected = '');
+		$template->set_var('SELECTED', $selected);
+		$template->parse('search_template_list', 'search_template_list_block', true);
+	}
+}
+
+// Insert default error reporting values
+require(ADMIN_PATH.'/interface/er_levels.php');
+$template->set_block('main_block', 'error_reporting_list_block', 'error_reporting_list');
+foreach($ER_LEVELS AS $value => $title) {
+	$template->set_var('VALUE', $value);
+	$template->set_var('NAME', $title);
+	if(ER_LEVEL == $value) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('error_reporting_list', 'error_reporting_list_block', true);
+}
+
+// Insert permissions values
+if($admin->get_permission('settings_advanced') != true) {
+	$template->set_var('DISPLAY_ADVANCED_BUTTON', 'hide');
+}
+
+// Insert page level limits
+$template->set_block('main_block', 'page_level_limit_list_block', 'page_level_limit_list');
+for($i = 1; $i <= 10; $i++) {
+	$template->set_var('NUMBER', $i);
+	if(PAGE_LEVEL_LIMIT == $i) {
+		$template->set_var('SELECTED', 'selected');
+	} else {
+		$template->set_var('SELECTED', '');
+	}
+	$template->parse('page_level_limit_list', 'page_level_limit_list_block', true);
+}
+
+// Work-out if multiple menus feature is enabled
+if(defined('MULTIPLE_MENUS') AND MULTIPLE_MENUS == true) {
+	$template->set_var('MULTIPLE_MENUS_ENABLED', ' checked');
+} else {
+	$template->set_var('MULTIPLE_MENUS_DISABLED', ' checked');
+}
+
+// Work-out if page languages feature is enabled
+if(defined('PAGE_LANGUAGES') AND PAGE_LANGUAGES == true) {
+        $template->set_var('PAGE_LANGUAGES_ENABLED', ' checked');
+} else {
+        $template->set_var('PAGE_LANGUAGES_DISABLED', ' checked');
+}
+
+// Work-out if smart login feature is enabled
+if(defined('SMART_LOGIN') AND SMART_LOGIN == true) {
+	$template->set_var('SMART_LOGIN_ENABLED', ' checked');
+} else {
+	$template->set_var('SMART_LOGIN_DISABLED', ' checked');
+}
+
+// Work-out if captcha verification feature is enabled
+if(defined('CAPTCHA_VERIFICATION') AND CAPTCHA_VERIFICATION == true) {
+	$template->set_var('CAPTCHA_VERIFICATION_ENABLED', ' checked');
+} else {
+	$template->set_var('CAPTCHA_VERIFICATION_DISABLED', ' checked');
+}
+if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */
+	$template->set_var('GD_EXTENSION_ENABLED', '');
+} else {
+	$template->set_var('GD_EXTENSION_ENABLED', 'none');
+}
+
+// Work-out if section blocks feature is enabled
+if(defined('SECTION_BLOCKS') AND SECTION_BLOCKS == true) {
+	$template->set_var('SECTION_BLOCKS_ENABLED', ' checked');
+} else {
+	$template->set_var('SECTION_BLOCKS_DISABLED', ' checked');
+}
+
+// Work-out if homepage redirection feature is enabled
+if(defined('HOMEPAGE_REDIRECTION') AND HOMEPAGE_REDIRECTION == true) {
+	$template->set_var('HOMEPAGE_REDIRECTION_ENABLED', ' checked');
+} else {
+	$template->set_var('HOMEPAGE_REDIRECTION_DISABLED', ' checked');
+}
+
+// Work-out which server os should be checked
+if(OPERATING_SYSTEM == 'linux') {
+	$template->set_var('LINUX_SELECTED', ' checked');
+} elseif(OPERATING_SYSTEM == 'windows') {
+	$template->set_var('WINDOWS_SELECTED', ' checked');
+}
+
+// Work-out if manage sections feature is enabled
+if(MANAGE_SECTIONS) {
+	$template->set_var('MANAGE_SECTIONS_ENABLED', ' checked');
+} else {
+	$template->set_var('MANAGE_SECTIONS_DISABLED', ' checked');
+}
+
+// Work-out which wbmailer routine should be checked
+if(WBMAILER_ROUTINE == 'phpmail') {
+	$template->set_var('PHPMAIL_SELECTED', ' checked');
+	$template->set_var('SMTP_VISIBILITY', 'hidden');
+	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
+} elseif(WBMAILER_ROUTINE == 'smtp') {
+	$template->set_var('SMTPMAIL_SELECTED', ' checked');
+	$template->set_var('SMTP_VISIBILITY', 'visible');
+}
+
+// Work-out if SMTP authentification should be checked
+if(WBMAILER_SMTP_AUTH) {
+	$template->set_var('SMTP_AUTH_SELECTED', ' checked');
+	if(WBMAILER_ROUTINE == 'smtp') {
+		$template->set_var('SMTP_VISIBILITY_AUTH', 'visible');
+	} else {
+		$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
+	}
+} else {
+	$template->set_var('SMTP_VISIBILITY_AUTH', 'hidden');
+}
+
+// Work-out if intro feature is enabled
+if(INTRO_PAGE) {
+	$template->set_var('INTRO_PAGE_ENABLED', ' checked');
+} else {
+	$template->set_var('INTRO_PAGE_DISABLED', ' checked');
+}
+
+// Work-out if frontend login feature is enabled
+if(FRONTEND_LOGIN) {
+	$template->set_var('PRIVATE_ENABLED', ' checked');
+} else {
+	$template->set_var('PRIVATE_DISABLED', ' checked');
+}
+
+// Work-out if page trash feature is disabled, in-line, or separate
+if(PAGE_TRASH == 'disabled') {
+	$template->set_var('PAGE_TRASH_DISABLED', ' checked');
+	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
+} elseif(PAGE_TRASH == 'inline') {
+	$template->set_var('PAGE_TRASH_INLINE', ' checked');
+	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: none;');
+} elseif(PAGE_TRASH == 'separate') {
+	$template->set_var('PAGE_TRASH_SEPARATE', ' checked');
+	$template->set_var('DISPLAY_PAGE_TRASH_SEPARATE', ' display: inline;');
+}
+
+// Work-out if media home folde feature is enabled
+if(HOME_FOLDERS) {
+	$template->set_var('HOME_FOLDERS_ENABLED', ' checked');
+} else {
+	$template->set_var('HOME_FOLDERS_DISABLED', ' checked');
+}
+
+// Insert search select
+if(SEARCH == 'private') {
+	$template->set_var('PRIVATE_SEARCH', 'selected');
+} elseif(SEARCH == 'registered') {
+	$template->set_var('REGISTERED_SEARCH', 'selected');
+} elseif(SEARCH == 'none') {
+	$template->set_var('NONE_SEARCH', 'selected');
+}
+
+// Work-out if 777 permissions are set
+if(STRING_FILE_MODE == '0777' AND STRING_DIR_MODE == '0777') {
+	$template->set_var('WORLD_WRITEABLE_SELECTED', ' checked');
+}
+
+// Work-out which file mode boxes are checked
+if(extract_permission(STRING_FILE_MODE, 'u', 'r')) {
+	$template->set_var('FILE_U_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'u', 'w')) {
+	$template->set_var('FILE_U_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'u', 'e')) {
+	$template->set_var('FILE_U_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'r')) {
+	$template->set_var('FILE_G_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'w')) {
+	$template->set_var('FILE_G_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'g', 'e')) {
+	$template->set_var('FILE_G_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'r')) {
+	$template->set_var('FILE_O_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'w')) {
+	$template->set_var('FILE_O_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_FILE_MODE, 'o', 'e')) {
+	$template->set_var('FILE_O_E_CHECKED', 'checked');
+}
+// Work-out which dir mode boxes are checked
+if(extract_permission(STRING_DIR_MODE, 'u', 'r')) {
+	$template->set_var('DIR_U_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'u', 'w')) {
+	$template->set_var('DIR_U_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'u', 'e')) {
+	$template->set_var('DIR_U_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'r')) {
+	$template->set_var('DIR_G_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'w')) {
+	$template->set_var('DIR_G_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'g', 'e')) {
+	$template->set_var('DIR_G_E_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'r')) {
+	$template->set_var('DIR_O_R_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'w')) {
+	$template->set_var('DIR_O_W_CHECKED', 'checked');
+}
+if(extract_permission(STRING_DIR_MODE, 'o', 'e')) {
+	$template->set_var('DIR_O_E_CHECKED', 'checked');
+}
+
+// Insert Server Email value into template
+$template->set_var('SERVER_EMAIL', SERVER_EMAIL);
+
+// Insert groups into signup list
+$template->set_block('main_block', 'group_list_block', 'group_list');
+$results = $database->query("SELECT group_id, name FROM ".TABLE_PREFIX."groups WHERE group_id != '1'");
+if($results->numRows() > 0) {
+	while($group = $results->fetchRow()) {
+		$template->set_var('ID', $group['group_id']);
+		$template->set_var('NAME', $group['name']);
+		if(FRONTEND_SIGNUP == $group['group_id']) {
+			$template->set_var('SELECTED', 'selected');
+		} else {
+			$template->set_var('SELECTED', '');
+		}
+		$template->parse('group_list', 'group_list_block', true);
+	}
+} else {
+	$template->set_var('ID', 'disabled');
+	$template->set_var('NAME', $MESSAGE['GROUPS']['NO_GROUPS_FOUND']);
+	$template->parse('group_list', 'group_list_block', true);
+}
+
+// Insert language headings
+$template->set_var(array(
+								'HEADING_GENERAL_SETTINGS' => $HEADING['GENERAL_SETTINGS'],
+								'HEADING_DEFAULT_SETTINGS' => $HEADING['DEFAULT_SETTINGS'],
+								'HEADING_SEARCH_SETTINGS' => $HEADING['SEARCH_SETTINGS'],
+								'HEADING_SERVER_SETTINGS' => $HEADING['SERVER_SETTINGS'],
+								'HEADING_WBMAILER_SETTINGS' => $HEADING['WBMAILER_SETTINGS'],
+								'HEADING_ADMINISTRATION_TOOLS' => $HEADING['ADMINISTRATION_TOOLS']
+								)
+						);
+// Insert language text and messages
+$template->set_var(array(
+								'TEXT_WEBSITE_TITLE' => $TEXT['WEBSITE_TITLE'],
+								'TEXT_WEBSITE_DESCRIPTION' => $TEXT['WEBSITE_DESCRIPTION'],
+								'TEXT_WEBSITE_KEYWORDS' => $TEXT['WEBSITE_KEYWORDS'],
+								'TEXT_WEBSITE_HEADER' => $TEXT['WEBSITE_HEADER'],
+								'TEXT_WEBSITE_FOOTER' => $TEXT['WEBSITE_FOOTER'],
+								'TEXT_HEADER' => $TEXT['HEADER'],
+								'TEXT_FOOTER' => $TEXT['FOOTER'],
+								'TEXT_VISIBILITY' => $TEXT['VISIBILITY'],
+								'TEXT_RESULTS_HEADER' => $TEXT['RESULTS_HEADER'],
+								'TEXT_RESULTS_LOOP' => $TEXT['RESULTS_LOOP'],
+								'TEXT_RESULTS_FOOTER' => $TEXT['RESULTS_FOOTER'],
+								'TEXT_NO_RESULTS' => $TEXT['NO_RESULTS'],
+								'TEXT_TEXT' => $TEXT['TEXT'],
+								'TEXT_DEFAULT' => $TEXT['DEFAULT'],
+								'TEXT_LANGUAGE' => $TEXT['LANGUAGE'],
+								'TEXT_TIMEZONE' => $TEXT['TIMEZONE'],
+								'TEXT_CHARSET' => $TEXT['CHARSET'],
+								'TEXT_DATE_FORMAT' => $TEXT['DATE_FORMAT'],
+								'TEXT_TIME_FORMAT' => $TEXT['TIME_FORMAT'],
+								'TEXT_TEMPLATE' => $TEXT['TEMPLATE'],
+								'TEXT_WYSIWYG_EDITOR' => $TEXT['WYSIWYG_EDITOR'],
+								'TEXT_PAGE_LEVEL_LIMIT' => $TEXT['PAGE_LEVEL_LIMIT'],
+								'TEXT_INTRO_PAGE' => $TEXT['INTRO_PAGE'],
+								'TEXT_FRONTEND' => $TEXT['FRONTEND'],
+								'TEXT_LOGIN' => $TEXT['LOGIN'],
+								'TEXT_SIGNUP' => $TEXT['SIGNUP'],
+								'TEXT_PHP_ERROR_LEVEL' => $TEXT['PHP_ERROR_LEVEL'],
+								'TEXT_PAGES_DIRECTORY' => $TEXT['PAGES_DIRECTORY'],
+								'TEXT_MEDIA_DIRECTORY' => $TEXT['MEDIA_DIRECTORY'],
+								'TEXT_PAGE_EXTENSION' => $TEXT['PAGE_EXTENSION'],
+								'TEXT_PAGE_SPACER' => $TEXT['PAGE_SPACER'],
+								'TEXT_RENAME_FILES_ON_UPLOAD' => $TEXT['RENAME_FILES_ON_UPLOAD'],
+								'TEXT_APP_NAME' => $TEXT['APP_NAME'],
+								'TEXT_SESSION_IDENTIFIER' => $TEXT['SESSION_IDENTIFIER'],
+								'TEXT_SERVER_OPERATING_SYSTEM' => $TEXT['SERVER_OPERATING_SYSTEM'],
+								'TEXT_LINUX_UNIX_BASED' => $TEXT['LINUX_UNIX_BASED'],
+								'TEXT_WINDOWS' => $TEXT['WINDOWS'],
+								'TEXT_ADMIN' => $TEXT['ADMIN'],
+								'TEXT_TYPE' => $TEXT['TYPE'],
+								'TEXT_DATABASE' => $TEXT['DATABASE'],
+								'TEXT_HOST' => $TEXT['HOST'],
+								'TEXT_USERNAME' => $TEXT['USERNAME'],
+								'TEXT_PASSWORD' => $TEXT['PASSWORD'],
+								'TEXT_NAME' => $TEXT['NAME'],
+								'TEXT_TABLE_PREFIX' => $TEXT['TABLE_PREFIX'],
+								'TEXT_SAVE' => $TEXT['SAVE'],
+								'TEXT_RESET' => $TEXT['RESET'],
+								'TEXT_CHANGES' => $TEXT['CHANGES'],
+								'TEXT_ENABLED' => $TEXT['ENABLED'],
+								'TEXT_DISABLED' => $TEXT['DISABLED'],
+								'TEXT_MANAGE_SECTIONS' => $HEADING['MANAGE_SECTIONS'],
+								'TEXT_MANAGE' => $TEXT['MANAGE'],
+								'TEXT_SEARCH' => $TEXT['SEARCH'],
+								'TEXT_PUBLIC' => $TEXT['PUBLIC'],
+								'TEXT_PRIVATE' => $TEXT['PRIVATE'],
+								'TEXT_REGISTERED' => $TEXT['REGISTERED'],
+								'TEXT_NONE' => $TEXT['NONE'],
+								'TEXT_FILES' => strtoupper(substr($TEXT['FILES'], 0, 1)).substr($TEXT['FILES'], 1),
+								'TEXT_DIRECTORIES' => $TEXT['DIRECTORIES'],
+								'TEXT_FILESYSTEM_PERMISSIONS' => $TEXT['FILESYSTEM_PERMISSIONS'],
+								'TEXT_USER' => $TEXT['USER'],
+								'TEXT_GROUP' => $TEXT['GROUP'],
+								'TEXT_OTHERS' => $TEXT['OTHERS'],
+								'TEXT_READ' => $TEXT['READ'],
+								'TEXT_WRITE' => $TEXT['WRITE'],
+								'TEXT_EXECUTE' => $TEXT['EXECUTE'],
+								'TEXT_SMART_LOGIN' => $TEXT['SMART_LOGIN'],
+								'TEXT_CAPTCHA_VERIFICATION' => $TEXT['CAPTCHA_VERIFICATION'],
+								'TEXT_MULTIPLE_MENUS' => $TEXT['MULTIPLE_MENUS'],
+								'TEXT_HOMEPAGE_REDIRECTION' => $TEXT['HOMEPAGE_REDIRECTION'],
+								'TEXT_SECTION_BLOCKS' => $TEXT['SECTION_BLOCKS'],
+								'TEXT_PLEASE_SELECT' => $TEXT['PLEASE_SELECT'],
+								'TEXT_PAGE_TRASH' => $TEXT['PAGE_TRASH'],
+								'TEXT_PAGE_LANGUAGES' => $TEXT['PAGE_LANGUAGES'],
+								'TEXT_INLINE' => $TEXT['INLINE'],
+								'TEXT_SEPARATE' => $TEXT['SEPARATE'],
+								'TEXT_HOME_FOLDERS' => $TEXT['HOME_FOLDERS'],
+								'TEXT_WYSIWYG_STYLE' => $TEXT['WYSIWYG_STYLE'],
+								'TEXT_SERVER_EMAIL' => $TEXT['SERVER_EMAIL'],
+								'TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS' => $TEXT['WORLD_WRITEABLE_FILE_PERMISSIONS'],
+								'TEXT_WBMAILER_NOTICE' => $TEXT['WBMAILER_NOTICE'],
+								'TEXT_WBMAILER_FUNCTION' => $TEXT['WBMAILER_FUNCTION'],
+								'TEXT_WBMAILER_SMTP_HOST' => $TEXT['WBMAILER_SMTP_HOST'],
+								'TEXT_WBMAILER_PHP' => $TEXT['WBMAILER_PHP'],
+								'TEXT_WBMAILER_SMTP' => $TEXT['WBMAILER_SMTP'],
+								'TEXT_WBMAILER_SMTP_AUTH' => $TEXT['WBMAILER_SMTP_AUTH'],
+								'TEXT_WBMAILER_SMTP_AUTH_NOTICE' => $TEXT['WBMAILER_SMTP_AUTH_NOTICE'],
+								'TEXT_WBMAILER_SMTP_USERNAME' => $TEXT['WBMAILER_SMTP_USERNAME'],
+								'TEXT_WBMAILER_SMTP_PASSWORD' => $TEXT['WBMAILER_SMTP_PASSWORD'],
+								'MODE_SWITCH_WARNING' => $MESSAGE['SETTINGS']['MODE_SWITCH_WARNING'],
+								'WORLD_WRITEABLE_WARNING' => $MESSAGE['SETTINGS']['WORLD_WRITEABLE_WARNING']
+								)
+						);
+
+// Parse template objects output
+$template->parse('main', 'main_block', false);
+$template->pparse('output', 'page');
+
+$admin->print_footer();
+
 ?>
\ No newline at end of file
Index: trunk/wb/admin/settings/template.html
===================================================================
--- trunk/wb/admin/settings/template.html	(revision 416)
+++ trunk/wb/admin/settings/template.html	(revision 417)
@@ -1,614 +1,691 @@
-</div><!-- BEGIN main_block -->
-
-<script language="javascript" type="text/javascript">
-function change_os(type) {
-	if(type == 'linux') {
-		document.getElementById('file_perms_box1').style.display = 'block';
-		document.getElementById('file_perms_box2').style.display = 'block';
-		document.getElementById('file_perms_box3').style.display = 'block';
-	} else if(type == 'windows') {
-		document.getElementById('file_perms_box1').style.display = 'none';
-		document.getElementById('file_perms_box2').style.display = 'none';
-		document.getElementById('file_perms_box3').style.display = 'none';
-	}
-}
-</script>
-
-<style>
-.settings_table td {
-	vertical-align: top;
-	text-align: left;
-}
-.setting_name {
-	width: 180px;
-}
-.setting_value input, .setting_value select, .setting_value textarea {
-	width: 100%;
-}
-.setting_value textarea {
-	height: 50px;
-}
-#file_mode input {
-	width: 12px;
-	height: 12px;
-}
-#dir_mode input {
-	width: 12px;
-	height: 12px;
-}
-.advanced {
-	display: {DISPLAY_ADVANCED};
-}
-.save, .reset {
-	width: 100px;
-}
-#hide2 {
-	display: none;
-}
-</style>
-
-<form name="settings" action="save.php" method="post">
-<input type="hidden" name="advanced" value="{ADVANCED}" />
-
-<table cellpadding="3" cellspacing="0" border="0" align="center" width="100%" class="settings_table">
-<tr>
-	<td colspan="3">
-		<h2>{HEADING_GENERAL_SETTINGS}</h2>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_WEBSITE_TITLE}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="website_title" value="{WEBSITE_TITLE}" />
-	</td>
-	<script language="javascript" type="text/javascript">
-	document.settings.website_title.focus();
-	</script>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_WEBSITE_DESCRIPTION}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="website_description">{WEBSITE_DESCRIPTION}</textarea>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_WEBSITE_KEYWORDS}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="website_keywords">{WEBSITE_KEYWORDS}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_WEBSITE_HEADER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="website_header">{WEBSITE_HEADER}</textarea>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_WEBSITE_FOOTER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="website_footer">{WEBSITE_FOOTER}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_PAGE_LEVEL_LIMIT}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="page_level_limit">
-		<!-- BEGIN page_level_limit_list_block -->
-			<option value="{NUMBER}"{SELECTED}>{NUMBER}</option>
-		<!-- END page_level_limit_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_PAGE_TRASH}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="page_trash" id="page_trash_disabled" style="width: 14px; height: 14px;" value="disabled"{PAGE_TRASH_DISABLED} />
-		<label for="page_trash_disabled">{TEXT_DISABLED}</label>
-		<input type="radio" name="page_trash" id="page_trash_inline" style="width: 14px; height: 14px;" value="inline"{PAGE_TRASH_INLINE} />
-		<label for="page_trash_inline">{TEXT_INLINE}</label>
-		<div style="margin: 0; padding: 0;{DISPLAY_PAGE_TRASH_SEPARATE}">
-			<input type="radio" name="page_trash" id="page_trash_separate" style="width: 14px; height: 14px;" value="separate"{PAGE_TRASH_SEPARATE} />
-			<label for="page_trash_separate">{TEXT_SEPARATE}</label>
-		</div>
-	</td>
-</tr>
-<tr class="advanced">
-        <td class="setting_name">{TEXT_PAGE_LANGUAGES}:</td>
-        <td class="setting_value" colspan="2">
-                <input type="radio" name="page_languages" id="page_languages_true" style="width: 14px; height: 14px;" value="true"{PAGE_LANGUAGES_ENABLED} />
-                <label for="page_languages_true">{TEXT_ENABLED}</label>
-                <input type="radio" name="page_languages" id="page_languages_false" style="width: 14px; height: 14px;" value="false"{PAGE_LANGUAGES_DISABLED} />
-                <label for="page_languages_false">{TEXT_DISABLED}</label>
-		</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_MULTIPLE_MENUS}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="multiple_menus" id="multiple_menus_true" style="width: 14px; height: 14px;" value="true"{MULTIPLE_MENUS_ENABLED} />
-		<label for="multiple_menus_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="multiple_menus" id="multiple_menus_false" style="width: 14px; height: 14px;" value="false"{MULTIPLE_MENUS_DISABLED} />
-		<label for="multiple_menus_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_HOME_FOLDERS}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="home_folders" id="home_folders_true" style="width: 14px; height: 14px;" value="true"{HOME_FOLDERS_ENABLED} />
-		<label for="home_folders_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="home_folders" id="home_folders_false" style="width: 14px; height: 14px;" value="false"{HOME_FOLDERS_DISABLED} />
-		<label for="home_folders_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_MANAGE_SECTIONS}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="manage_sections" id="manage_sections_true" style="width: 14px; height: 14px;" value="true"{MANAGE_SECTIONS_ENABLED} />
-		<label for="manage_sections_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="manage_sections" id="manage_sections_false" style="width: 14px; height: 14px;" value="false"{MANAGE_SECTIONS_DISABLED} />
-		<label for="manage_sections_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_SECTION_BLOCKS}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="section_blocks" id="section_blocks_true" style="width: 14px; height: 14px;" value="true"{SECTION_BLOCKS_ENABLED} />
-		<label for="section_blocks_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="section_blocks" id="section_blocks_false" style="width: 14px; height: 14px;" value="false"{SECTION_BLOCKS_DISABLED} />
-		<label for="section_blocks_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_INTRO_PAGE}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="intro_page" id="intro_page_true" style="width: 14px; height: 14px;" value="true"{INTRO_PAGE_ENABLED} />
-		<label for="intro_page_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="intro_page" id="intro_page_false" style="width: 14px; height: 14px;" value="false"{INTRO_PAGE_DISABLED} />
-		<label for="intro_page_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_HOMEPAGE_REDIRECTION}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="homepage_redirection" id="homepage_redirection_true" style="width: 14px; height: 14px;" value="true"{HOMEPAGE_REDIRECTION_ENABLED} />
-		<label for="homepage_redirection_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="homepage_redirection" id="homepage_redirection_false" style="width: 14px; height: 14px;" value="false"{HOMEPAGE_REDIRECTION_DISABLED} />
-		<label for="homepage_redirection_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_SMART_LOGIN}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="smart_login" id="smart_login_true" style="width: 14px; height: 14px;" value="true"{SMART_LOGIN_ENABLED} />
-		<label for="smart_login_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="smart_login" id="smart_login_false" style="width: 14px; height: 14px;" value="false"{SMART_LOGIN_DISABLED} />
-		<label for="smart_login_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr class="advanced" style="display: {GD_EXTENSION_LOADED};">
-	<td class="setting_name">{TEXT_CAPTCHA_VERIFICATION}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="captcha_verification" id="captcha_verification_true" style="width: 14px; height: 14px;" value="true"{CAPTCHA_VERIFICATION_ENABLED} />
-		<label for="captcha_verification_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="captcha_verification" id="captcha_verification_false" style="width: 14px; height: 14px;" value="false"{CAPTCHA_VERIFICATION_DISABLED} />
-		<label for="captcha_verification_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_LOGIN}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="frontend_login" id="frontend_login_true" style="width: 14px; height: 14px;" value="true"{PRIVATE_ENABLED} />
-		<label for="frontend_login_true">{TEXT_ENABLED}</label>
-		<input type="radio" name="frontend_login" id="frontend_login_false" style="width: 14px; height: 14px;" value="false"{PRIVATE_DISABLED} />
-		<label for="frontend_login_false">{TEXT_DISABLED}</label>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_SIGNUP}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="frontend_signup">
-			<option value="false">{TEXT_DISABLED}</option>
-			<!-- BEGIN group_list_block -->
-				<option value="{ID}" {SELECTED}>{NAME}</option>
-			<!-- END group_list_block -->
-		</select>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_PHP_ERROR_LEVEL}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="er_level">
-			<option value="">{TEXT_PLEASE_SELECT}...</option>
-			<!-- BEGIN error_reporting_list_block -->
-				<option value="{VALUE}"{SELECTED}>{NAME}</option>
-			<!-- END error_reporting_list_block -->
-		</select>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_WYSIWYG_STYLE}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="wysiwyg_style" value="{WYSIWYG_STYLE}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_SERVER_EMAIL}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="server_email" value="{SERVER_EMAIL}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_WYSIWYG_EDITOR}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="wysiwyg_editor">
-		<!-- BEGIN editor_list_block -->
-			<option value="{FILE}"{SELECTED}>{NAME}</option>
-		<!-- END editor_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td>&nbsp;</td>
-	<td>
-		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
-		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
-	</td>
-	<td style="text-align: right;">
-		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
-	</td>
-</tr>
-<tr>
-	<td colspan="3" style="padding-top: 10px;">
-		<h2>{HEADING_DEFAULT_SETTINGS}</h2>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_LANGUAGE}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_language">
-			<!-- BEGIN language_list_block -->
-			<option value="{CODE}"{SELECTED}>{NAME} ({CODE})</option>
-			<!-- END language_list_block -->
-		</select>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_CHARSET}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_charset">
-			<option value="">{TEXT_PLEASE_SELECT}...</option>
-			<!-- BEGIN charset_list_block -->
-				<option value="{VALUE}" {SELECTED}>{NAME}</option>
-			<!-- END charset_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_TIMEZONE}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_timezone">
-			<option value="0">{TEXT_PLEASE_SELECT}...</option>
-			<!-- BEGIN timezone_list_block -->
-				<option value="{VALUE}" {SELECTED}>{NAME}</option>
-			<!-- END timezone_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_DATE_FORMAT}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_date_format">
-			<option value="M d Y">{TEXT_PLEASE_SELECT}...</option>
-			<!-- BEGIN date_format_list_block -->
-				<option value="{VALUE}" {SELECTED}>{NAME}</option>
-			<!-- END date_format_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_TIME_FORMAT}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_time_format">
-			<option value="g:i A">{TEXT_PLEASE_SELECT}...</option>
-			<!-- BEGIN time_format_list_block -->
-				<option value="{VALUE}" {SELECTED}>{NAME}</option>
-			<!-- END time_format_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_TEMPLATE}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="default_template">
-		<!-- BEGIN template_list_block -->
-			<option value="{FILE}"{SELECTED}>{NAME}</option>
-		<!-- END template_list_block -->
-		</select>
-	</td>
-</tr>
-<tr>
-	<td>&nbsp;</td>
-	<td>
-		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
-		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
-	</td>
-	<td style="text-align: right;">
-		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
-	</td>
-</tr>
-<tr>
-	<td colspan="3" style="padding-top: 10px;">
-		<h2>{HEADING_SEARCH_SETTINGS}</h2>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_VISIBILITY}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="search">
-			<option value="public">{TEXT_PUBLIC}</option>
-			<option value="private" {PRIVATE_SEARCH}>{TEXT_PRIVATE}</option>
-			<option value="registered" {REGISTERED_SEARCH}>{TEXT_REGISTERED}</option>
-			<option value="none" {NONE_SEARCH}>{TEXT_NONE}</option>
-		</select>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_TEMPLATE}:</td>
-	<td class="setting_value" colspan="2">
-		<select name="search_template">
-		<!-- BEGIN search_template_list_block -->
-			<option value="{FILE}"{SELECTED}>{NAME}</option>
-		<!-- END search_template_list_block -->
-		</select>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_HEADER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="search_header" style="height: 100px;">{SEARCH_HEADER}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_RESULTS_HEADER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="search_results_header">{SEARCH_RESULTS_HEADER}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_RESULTS_LOOP}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="search_results_loop">{SEARCH_RESULTS_LOOP}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_RESULTS_FOOTER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="search_results_footer">{SEARCH_RESULTS_FOOTER}</textarea>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_NO_RESULTS}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="search_no_results" value="{SEARCH_NO_RESULTS}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_FOOTER}:</td>
-	<td class="setting_value" colspan="2">
-		<textarea name="search_footer">{SEARCH_FOOTER}</textarea>
-	</td>
-</tr>
-<tr>
-	<td>&nbsp;</td>
-	<td>
-		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
-		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
-	</td>
-	<td style="text-align: right;">
-		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
-	</td>
-</tr>
-<tr>
-	<td colspan="3" style="padding-top: 10px;">
-		<h2>{HEADING_SERVER_SETTINGS}</h2>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name">{TEXT_SERVER_OPERATING_SYSTEM}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="radio" name="operating_system" id="operating_system_linux" onclick="javascript: change_os('linux');" style="width: 14px; height: 14px;" value="linux"{LINUX_SELECTED} />
-		<label for="operating_system_linux" onclick="javascript: change_os('linux');">{TEXT_LINUX_UNIX_BASED}</label>
-		<input type="radio" name="operating_system" id="operating_system_windows" onclick="javascript: change_os('windows');"" style="width: 14px; height: 14px;" value="windows"{WINDOWS_SELECTED} />
-		<label for="operating_system_windows" onclick="javascript: change_os('windows');">{TEXT_WINDOWS}</label>
-	</td>
-</tr>
-<tr>
-	<td class="setting_name"><div id="{BASIC_FILE_PERMS_ID}1" style="margin: 0; padding: 0;">&nbsp;</div></td>
-	<td class="setting_value" colspan="3">
-		<div id="{BASIC_FILE_PERMS_ID}2" style="margin: 0; padding: 0;">
-			<input type="checkbox" name="world_writeable" id="world_writeable" style="width: 14px; height: 14px;" value="true"{WORLD_WRITEABLE_SELECTED} />
-			<label for="world_writeable">
-				{TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS} (777)
-			</label>
-			<br />
-			<font class="note">({WORLD_WRITEABLE_WARNING})</font>
-		</div>
-		<div id="{BASIC_FILE_PERMS_ID}3" style="margin: 0; padding: 0;"></div>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name"><div id="{ADVANCED_FILE_PERMS_ID}1" style="margin: 0; padding: 0;">{TEXT_FILESYSTEM_PERMISSIONS}:</div></td>
-	<td class="setting_value" id="file_mode" align="left">
-		<table cellpadding="2" cellspacing="0" border="0" width="100%" style="border-right: 1px solid #DDDDDD;" id="{ADVANCED_FILE_PERMS_ID}2">
-		<tr>
-			<td colspan="3" style="text-align: center; font-weight: bold;">
-				{TEXT_FILES}:
-			</td>
-		</tr>
-		<tr>
-			<td>{TEXT_USER}:</td>
-			<td>{TEXT_GROUP}:</td>
-			<td>{TEXT_OTHERS}:</td>
-		</tr>
-		<tr>
-			<td>
-				<input type="checkbox" name="file_u_r" id="file_u_r" value="true"{FILE_U_R_CHECKED} />
-				<label for="file_u_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="file_u_w" id="file_u_w" value="true"{FILE_U_W_CHECKED} />
-				<label for="file_u_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="file_u_e" id="file_u_e" value="true"{FILE_U_E_CHECKED} />
-				<label for="file_u_e">{TEXT_EXECUTE}</label>
-			</td>
-			<td>
-				<input type="checkbox" name="file_g_r" id="file_g_r" value="true"{FILE_G_R_CHECKED} />
-				<label for="file_g_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="file_g_w" id="file_g_w" value="true"{FILE_G_W_CHECKED} />
-				<label for="file_g_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="file_g_e" id="file_g_e" value="true"{FILE_G_E_CHECKED} />
-				<label for="file_g_e">{TEXT_EXECUTE}</label>
-			</td>
-			<td>
-				<input type="checkbox" name="file_o_r" id="file_o_r" value="true"{FILE_O_R_CHECKED} />
-				<label for="file_o_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="file_o_w" id="file_o_w" value="true"{FILE_O_W_CHECKED} />
-				<label for="file_o_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="file_o_e" id="file_o_e" value="true"{FILE_O_E_CHECKED} />
-				<label for="file_o_e">{TEXT_EXECUTE}</label>
-			</td>
-		</tr>
-		</table>
-	</td>
-	<td class="setting_value" id="dir_mode" style="text-align: right;">
-		<table cellpadding="2" cellspacing="0" border="0" width="100%" id="{ADVANCED_FILE_PERMS_ID}3">
-		<tr>
-			<td colspan="3" style="text-align: center; font-weight: bold;">
-				{TEXT_DIRECTORIES}:
-			</td>
-		</tr>
-		<tr>
-			<td>{TEXT_USER}:</td>
-			<td>{TEXT_GROUP}:</td>
-			<td>{TEXT_OTHERS}:</td>
-		</tr>
-		<tr>
-			<td>
-				<input type="checkbox" name="dir_u_r" id="dir_u_r" value="true"{DIR_U_R_CHECKED} />
-				<label for="dir_u_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="dir_u_w" id="dir_u_w" value="true"{DIR_U_W_CHECKED} />
-				<label for="dir_u_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="dir_u_e" id="dir_u_e" value="true"{DIR_U_E_CHECKED} />
-				<label for="dir_u_e">{TEXT_EXECUTE}</label>
-			</td>
-			<td>
-				<input type="checkbox" name="dir_g_r" id="dir_g_r" value="true"{DIR_G_R_CHECKED} />
-				<label for="dir_g_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="dir_g_w" id="dir_g_w" value="true"{DIR_G_W_CHECKED} />
-				<label for="dir_g_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="dir_g_e" id="dir_g_e" value="true"{DIR_G_E_CHECKED} />
-				<label for="dir_g_e">{TEXT_EXECUTE}</label>
-			</td>
-			<td>
-				<input type="checkbox" name="dir_o_r" id="dir_o_r" value="true"{DIR_O_R_CHECKED} />
-				<label for="dir_o_r">{TEXT_READ}</label>
-				<br />
-				<input type="checkbox" name="dir_o_w" id="dir_o_w" value="true"{DIR_O_W_CHECKED} />
-				<label for="dir_o_w">{TEXT_WRITE}</label>
-				<br />
-				<input type="checkbox" name="dir_o_e" id="dir_o_e" value="true"{DIR_O_E_CHECKED} />
-				<label for="dir_o_e">{TEXT_EXECUTE}</label>
-			</td>
-		</tr>
-		</table>
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_PAGES_DIRECTORY}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="pages_directory" value="{PAGES_DIRECTORY}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_MEDIA_DIRECTORY}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="media_directory" value="{MEDIA_DIRECTORY}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_PAGE_EXTENSION}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="page_extension" value="{PAGE_EXTENSION}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_PAGE_SPACER}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="page_spacer" value="{PAGE_SPACER}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_RENAME_FILES_ON_UPLOAD}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="rename_files_on_upload" value="{RENAME_FILES_ON_UPLOAD}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td class="setting_name">{TEXT_SESSION_IDENTIFIER}:</td>
-	<td class="setting_value" colspan="2">
-		<input type="text" name="app_name" value="{APP_NAME}" />
-	</td>
-</tr>
-<tr class="advanced">
-	<td colspan="3" style="padding-top: 10px;">
-		<a name="administration_tools"></a>
-		<h2>{HEADING_ADMINISTRATION_TOOLS}</h2>
-	</td>
-</tr>
-<tr class="advanced">
-	<td colspan="3">
-		<ul style="margin: 0; padding: 0; margin-left: 20px; margin-bottom: 10px;">
-		<!-- BEGIN tool_list_block -->
-		<li style="padding-bottom: 5px;">
-		<a href="{ADMIN_URL}/settings/tool.php?tool={TOOL_DIR}">{TOOL_NAME}</a>
-		<br />{TOOL_DESCRIPTION}
-		</li>
-		<!-- END tool_list_block -->
-		</ul>
-		{TOOL_LIST}
-	</td>
-	<td>
-		&nbsp;
-	</td>
-	<td>&nbsp;</td>
-</tr>
-<tr>
-	<td>&nbsp;</td>
-	<td>
-		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
-		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
-	</td>
-	<td style="text-align: right;">
-		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
-	</td>
-</tr>
-</table>
-
-</form>
-
-<hr />
-
-<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
-
-<font class="{DISPLAY_ADVANCED_BUTTON}">
-&nbsp; {MODE_SWITCH_WARNING}
-</font>
-
+</div><!-- BEGIN main_block -->
+
+<script language="javascript" type="text/javascript">
+function change_os(type) {
+	if(type == 'linux') {
+		document.getElementById('file_perms_box1').style.display = 'block';
+		document.getElementById('file_perms_box2').style.display = 'block';
+		document.getElementById('file_perms_box3').style.display = 'block';
+	} else if(type == 'windows') {
+		document.getElementById('file_perms_box1').style.display = 'none';
+		document.getElementById('file_perms_box2').style.display = 'none';
+		document.getElementById('file_perms_box3').style.display = 'none';
+	}
+}
+
+function change_wbmailer(type) {
+	if(type == 'smtp') {
+		document.getElementById('wbmailer_smtp_host').style.visibility = 'visible';
+		document.getElementById('wbmailer_smtp_auth_mode').style.visibility = 'visible';
+		document.getElementById('wbmailer_smtp_username').style.visibility = 'visible';
+		document.getElementById('wbmailer_smtp_password').style.visibility = 'visible';
+		if( document.settings.wbmailer_smtp_auth.checked == true ) {
+			document.getElementById('wbmailer_smtp_username').style.visibility = 'visible';
+			document.getElementById('wbmailer_smtp_password').style.visibility = 'visible';
+		} else {
+			document.getElementById('wbmailer_smtp_username').style.visibility = 'hidden';
+			document.getElementById('wbmailer_smtp_password').style.visibility = 'hidden';
+		}
+	} else if(type == 'phpmail') {
+		document.getElementById('wbmailer_smtp_host').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_auth_mode').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_username').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_password').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_username').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_password').style.visibility = 'hidden';
+	}
+}
+
+function toggle_wbmailer_auth() {
+	if( document.settings.wbmailer_smtp_auth.checked == true ) {
+		document.getElementById('wbmailer_smtp_username').style.visibility = 'visible';
+		document.getElementById('wbmailer_smtp_password').style.visibility = 'visible';
+	} else {
+		document.getElementById('wbmailer_smtp_username').style.visibility = 'hidden';
+		document.getElementById('wbmailer_smtp_password').style.visibility = 'hidden';
+	}
+}
+</script>
+
+<style>
+.settings_table td {
+	vertical-align: top;
+	text-align: left;
+}
+.setting_name {
+	width: 180px;
+}
+.setting_value input, .setting_value select, .setting_value textarea {
+	width: 100%;
+}
+.setting_value textarea {
+	height: 50px;
+}
+#file_mode input {
+	width: 12px;
+	height: 12px;
+}
+#dir_mode input {
+	width: 12px;
+	height: 12px;
+}
+.advanced {
+	display: {DISPLAY_ADVANCED};
+}
+.save, .reset {
+	width: 100px;
+}
+#hide2 {
+	display: none;
+}
+</style>
+
+<form name="settings" action="save.php" method="post">
+<input type="hidden" name="advanced" value="{ADVANCED}" />
+
+<table cellpadding="3" cellspacing="0" border="0" align="center" width="100%" class="settings_table">
+<tr>
+	<td colspan="3">
+		<h2>{HEADING_GENERAL_SETTINGS}</h2>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_WEBSITE_TITLE}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="website_title" value="{WEBSITE_TITLE}" />
+	</td>
+	<script language="javascript" type="text/javascript">
+	document.settings.website_title.focus();
+	</script>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_WEBSITE_DESCRIPTION}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="website_description">{WEBSITE_DESCRIPTION}</textarea>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_WEBSITE_KEYWORDS}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="website_keywords">{WEBSITE_KEYWORDS}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_WEBSITE_HEADER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="website_header">{WEBSITE_HEADER}</textarea>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_WEBSITE_FOOTER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="website_footer">{WEBSITE_FOOTER}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_PAGE_LEVEL_LIMIT}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="page_level_limit">
+		<!-- BEGIN page_level_limit_list_block -->
+			<option value="{NUMBER}"{SELECTED}>{NUMBER}</option>
+		<!-- END page_level_limit_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_PAGE_TRASH}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="page_trash" id="page_trash_disabled" style="width: 14px; height: 14px;" value="disabled"{PAGE_TRASH_DISABLED} />
+		<label for="page_trash_disabled">{TEXT_DISABLED}</label>
+		<input type="radio" name="page_trash" id="page_trash_inline" style="width: 14px; height: 14px;" value="inline"{PAGE_TRASH_INLINE} />
+		<label for="page_trash_inline">{TEXT_INLINE}</label>
+		<div style="margin: 0; padding: 0;{DISPLAY_PAGE_TRASH_SEPARATE}">
+			<input type="radio" name="page_trash" id="page_trash_separate" style="width: 14px; height: 14px;" value="separate"{PAGE_TRASH_SEPARATE} />
+			<label for="page_trash_separate">{TEXT_SEPARATE}</label>
+		</div>
+	</td>
+</tr>
+<tr class="advanced">
+        <td class="setting_name">{TEXT_PAGE_LANGUAGES}:</td>
+        <td class="setting_value" colspan="2">
+                <input type="radio" name="page_languages" id="page_languages_true" style="width: 14px; height: 14px;" value="true"{PAGE_LANGUAGES_ENABLED} />
+                <label for="page_languages_true">{TEXT_ENABLED}</label>
+                <input type="radio" name="page_languages" id="page_languages_false" style="width: 14px; height: 14px;" value="false"{PAGE_LANGUAGES_DISABLED} />
+                <label for="page_languages_false">{TEXT_DISABLED}</label>
+		</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_MULTIPLE_MENUS}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="multiple_menus" id="multiple_menus_true" style="width: 14px; height: 14px;" value="true"{MULTIPLE_MENUS_ENABLED} />
+		<label for="multiple_menus_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="multiple_menus" id="multiple_menus_false" style="width: 14px; height: 14px;" value="false"{MULTIPLE_MENUS_DISABLED} />
+		<label for="multiple_menus_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_HOME_FOLDERS}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="home_folders" id="home_folders_true" style="width: 14px; height: 14px;" value="true"{HOME_FOLDERS_ENABLED} />
+		<label for="home_folders_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="home_folders" id="home_folders_false" style="width: 14px; height: 14px;" value="false"{HOME_FOLDERS_DISABLED} />
+		<label for="home_folders_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_MANAGE_SECTIONS}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="manage_sections" id="manage_sections_true" style="width: 14px; height: 14px;" value="true"{MANAGE_SECTIONS_ENABLED} />
+		<label for="manage_sections_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="manage_sections" id="manage_sections_false" style="width: 14px; height: 14px;" value="false"{MANAGE_SECTIONS_DISABLED} />
+		<label for="manage_sections_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_SECTION_BLOCKS}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="section_blocks" id="section_blocks_true" style="width: 14px; height: 14px;" value="true"{SECTION_BLOCKS_ENABLED} />
+		<label for="section_blocks_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="section_blocks" id="section_blocks_false" style="width: 14px; height: 14px;" value="false"{SECTION_BLOCKS_DISABLED} />
+		<label for="section_blocks_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_INTRO_PAGE}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="intro_page" id="intro_page_true" style="width: 14px; height: 14px;" value="true"{INTRO_PAGE_ENABLED} />
+		<label for="intro_page_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="intro_page" id="intro_page_false" style="width: 14px; height: 14px;" value="false"{INTRO_PAGE_DISABLED} />
+		<label for="intro_page_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_HOMEPAGE_REDIRECTION}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="homepage_redirection" id="homepage_redirection_true" style="width: 14px; height: 14px;" value="true"{HOMEPAGE_REDIRECTION_ENABLED} />
+		<label for="homepage_redirection_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="homepage_redirection" id="homepage_redirection_false" style="width: 14px; height: 14px;" value="false"{HOMEPAGE_REDIRECTION_DISABLED} />
+		<label for="homepage_redirection_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_SMART_LOGIN}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="smart_login" id="smart_login_true" style="width: 14px; height: 14px;" value="true"{SMART_LOGIN_ENABLED} />
+		<label for="smart_login_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="smart_login" id="smart_login_false" style="width: 14px; height: 14px;" value="false"{SMART_LOGIN_DISABLED} />
+		<label for="smart_login_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr class="advanced" style="display: {GD_EXTENSION_LOADED};">
+	<td class="setting_name">{TEXT_CAPTCHA_VERIFICATION}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="captcha_verification" id="captcha_verification_true" style="width: 14px; height: 14px;" value="true"{CAPTCHA_VERIFICATION_ENABLED} />
+		<label for="captcha_verification_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="captcha_verification" id="captcha_verification_false" style="width: 14px; height: 14px;" value="false"{CAPTCHA_VERIFICATION_DISABLED} />
+		<label for="captcha_verification_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_LOGIN}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="frontend_login" id="frontend_login_true" style="width: 14px; height: 14px;" value="true"{PRIVATE_ENABLED} />
+		<label for="frontend_login_true">{TEXT_ENABLED}</label>
+		<input type="radio" name="frontend_login" id="frontend_login_false" style="width: 14px; height: 14px;" value="false"{PRIVATE_DISABLED} />
+		<label for="frontend_login_false">{TEXT_DISABLED}</label>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_SIGNUP}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="frontend_signup">
+			<option value="false">{TEXT_DISABLED}</option>
+			<!-- BEGIN group_list_block -->
+				<option value="{ID}" {SELECTED}>{NAME}</option>
+			<!-- END group_list_block -->
+		</select>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_PHP_ERROR_LEVEL}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="er_level">
+			<option value="">{TEXT_PLEASE_SELECT}...</option>
+			<!-- BEGIN error_reporting_list_block -->
+				<option value="{VALUE}"{SELECTED}>{NAME}</option>
+			<!-- END error_reporting_list_block -->
+		</select>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_WYSIWYG_STYLE}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="wysiwyg_style" value="{WYSIWYG_STYLE}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_SERVER_EMAIL}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="server_email" value="{SERVER_EMAIL}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_WYSIWYG_EDITOR}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="wysiwyg_editor">
+		<!-- BEGIN editor_list_block -->
+			<option value="{FILE}"{SELECTED}>{NAME}</option>
+		<!-- END editor_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td>&nbsp;</td>
+	<td>
+		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
+		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
+	</td>
+	<td style="text-align: right;">
+		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
+	</td>
+</tr>
+<tr>
+	<td colspan="3" style="padding-top: 10px;">
+		<h2>{HEADING_DEFAULT_SETTINGS}</h2>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_LANGUAGE}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_language">
+			<!-- BEGIN language_list_block -->
+			<option value="{CODE}"{SELECTED}>{NAME} ({CODE})</option>
+			<!-- END language_list_block -->
+		</select>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_CHARSET}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_charset">
+			<option value="">{TEXT_PLEASE_SELECT}...</option>
+			<!-- BEGIN charset_list_block -->
+				<option value="{VALUE}" {SELECTED}>{NAME}</option>
+			<!-- END charset_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_TIMEZONE}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_timezone">
+			<option value="0">{TEXT_PLEASE_SELECT}...</option>
+			<!-- BEGIN timezone_list_block -->
+				<option value="{VALUE}" {SELECTED}>{NAME}</option>
+			<!-- END timezone_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_DATE_FORMAT}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_date_format">
+			<option value="M d Y">{TEXT_PLEASE_SELECT}...</option>
+			<!-- BEGIN date_format_list_block -->
+				<option value="{VALUE}" {SELECTED}>{NAME}</option>
+			<!-- END date_format_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_TIME_FORMAT}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_time_format">
+			<option value="g:i A">{TEXT_PLEASE_SELECT}...</option>
+			<!-- BEGIN time_format_list_block -->
+				<option value="{VALUE}" {SELECTED}>{NAME}</option>
+			<!-- END time_format_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_TEMPLATE}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="default_template">
+		<!-- BEGIN template_list_block -->
+			<option value="{FILE}"{SELECTED}>{NAME}</option>
+		<!-- END template_list_block -->
+		</select>
+	</td>
+</tr>
+<tr>
+	<td>&nbsp;</td>
+	<td>
+		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
+		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
+	</td>
+	<td style="text-align: right;">
+		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
+	</td>
+</tr>
+<tr>
+	<td colspan="3" style="padding-top: 10px;">
+		<h2>{HEADING_SEARCH_SETTINGS}</h2>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_VISIBILITY}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="search">
+			<option value="public">{TEXT_PUBLIC}</option>
+			<option value="private" {PRIVATE_SEARCH}>{TEXT_PRIVATE}</option>
+			<option value="registered" {REGISTERED_SEARCH}>{TEXT_REGISTERED}</option>
+			<option value="none" {NONE_SEARCH}>{TEXT_NONE}</option>
+		</select>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_TEMPLATE}:</td>
+	<td class="setting_value" colspan="2">
+		<select name="search_template">
+		<!-- BEGIN search_template_list_block -->
+			<option value="{FILE}"{SELECTED}>{NAME}</option>
+		<!-- END search_template_list_block -->
+		</select>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_HEADER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="search_header" style="height: 100px;">{SEARCH_HEADER}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_RESULTS_HEADER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="search_results_header">{SEARCH_RESULTS_HEADER}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_RESULTS_LOOP}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="search_results_loop">{SEARCH_RESULTS_LOOP}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_RESULTS_FOOTER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="search_results_footer">{SEARCH_RESULTS_FOOTER}</textarea>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_NO_RESULTS}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="search_no_results" value="{SEARCH_NO_RESULTS}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_FOOTER}:</td>
+	<td class="setting_value" colspan="2">
+		<textarea name="search_footer">{SEARCH_FOOTER}</textarea>
+	</td>
+</tr>
+<tr>
+	<td>&nbsp;</td>
+	<td>
+		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
+		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
+	</td>
+	<td style="text-align: right;">
+		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
+	</td>
+</tr>
+<tr>
+	<td colspan="3" style="padding-top: 10px;">
+		<h2>{HEADING_SERVER_SETTINGS}</h2>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_SERVER_OPERATING_SYSTEM}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="operating_system" id="operating_system_linux" onclick="javascript: change_os('linux');" style="width: 14px; height: 14px;" value="linux"{LINUX_SELECTED} />
+		<label for="operating_system_linux" onclick="javascript: change_os('linux');">{TEXT_LINUX_UNIX_BASED}</label>
+		<input type="radio" name="operating_system" id="operating_system_windows" onclick="javascript: change_os('windows');"" style="width: 14px; height: 14px;" value="windows"{WINDOWS_SELECTED} />
+		<label for="operating_system_windows" onclick="javascript: change_os('windows');">{TEXT_WINDOWS}</label>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name"><div id="{BASIC_FILE_PERMS_ID}1" style="margin: 0; padding: 0;">&nbsp;</div></td>
+	<td class="setting_value" colspan="3">
+		<div id="{BASIC_FILE_PERMS_ID}2" style="margin: 0; padding: 0;">
+			<input type="checkbox" name="world_writeable" id="world_writeable" style="width: 14px; height: 14px;" value="true"{WORLD_WRITEABLE_SELECTED} />
+			<label for="world_writeable">
+				{TEXT_WORLD_WRITEABLE_FILE_PERMISSIONS} (777)
+			</label>
+			<br />
+			<font class="note">({WORLD_WRITEABLE_WARNING})</font>
+		</div>
+		<div id="{BASIC_FILE_PERMS_ID}3" style="margin: 0; padding: 0;"></div>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name"><div id="{ADVANCED_FILE_PERMS_ID}1" style="margin: 0; padding: 0;">{TEXT_FILESYSTEM_PERMISSIONS}:</div></td>
+	<td class="setting_value" id="file_mode" align="left">
+		<table cellpadding="2" cellspacing="0" border="0" width="100%" style="border-right: 1px solid #DDDDDD;" id="{ADVANCED_FILE_PERMS_ID}2">
+		<tr>
+			<td colspan="3" style="text-align: center; font-weight: bold;">
+				{TEXT_FILES}:
+			</td>
+		</tr>
+		<tr>
+			<td>{TEXT_USER}:</td>
+			<td>{TEXT_GROUP}:</td>
+			<td>{TEXT_OTHERS}:</td>
+		</tr>
+		<tr>
+			<td>
+				<input type="checkbox" name="file_u_r" id="file_u_r" value="true"{FILE_U_R_CHECKED} />
+				<label for="file_u_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="file_u_w" id="file_u_w" value="true"{FILE_U_W_CHECKED} />
+				<label for="file_u_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="file_u_e" id="file_u_e" value="true"{FILE_U_E_CHECKED} />
+				<label for="file_u_e">{TEXT_EXECUTE}</label>
+			</td>
+			<td>
+				<input type="checkbox" name="file_g_r" id="file_g_r" value="true"{FILE_G_R_CHECKED} />
+				<label for="file_g_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="file_g_w" id="file_g_w" value="true"{FILE_G_W_CHECKED} />
+				<label for="file_g_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="file_g_e" id="file_g_e" value="true"{FILE_G_E_CHECKED} />
+				<label for="file_g_e">{TEXT_EXECUTE}</label>
+			</td>
+			<td>
+				<input type="checkbox" name="file_o_r" id="file_o_r" value="true"{FILE_O_R_CHECKED} />
+				<label for="file_o_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="file_o_w" id="file_o_w" value="true"{FILE_O_W_CHECKED} />
+				<label for="file_o_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="file_o_e" id="file_o_e" value="true"{FILE_O_E_CHECKED} />
+				<label for="file_o_e">{TEXT_EXECUTE}</label>
+			</td>
+		</tr>
+		</table>
+	</td>
+	<td class="setting_value" id="dir_mode" style="text-align: right;">
+		<table cellpadding="2" cellspacing="0" border="0" width="100%" id="{ADVANCED_FILE_PERMS_ID}3">
+		<tr>
+			<td colspan="3" style="text-align: center; font-weight: bold;">
+				{TEXT_DIRECTORIES}:
+			</td>
+		</tr>
+		<tr>
+			<td>{TEXT_USER}:</td>
+			<td>{TEXT_GROUP}:</td>
+			<td>{TEXT_OTHERS}:</td>
+		</tr>
+		<tr>
+			<td>
+				<input type="checkbox" name="dir_u_r" id="dir_u_r" value="true"{DIR_U_R_CHECKED} />
+				<label for="dir_u_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="dir_u_w" id="dir_u_w" value="true"{DIR_U_W_CHECKED} />
+				<label for="dir_u_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="dir_u_e" id="dir_u_e" value="true"{DIR_U_E_CHECKED} />
+				<label for="dir_u_e">{TEXT_EXECUTE}</label>
+			</td>
+			<td>
+				<input type="checkbox" name="dir_g_r" id="dir_g_r" value="true"{DIR_G_R_CHECKED} />
+				<label for="dir_g_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="dir_g_w" id="dir_g_w" value="true"{DIR_G_W_CHECKED} />
+				<label for="dir_g_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="dir_g_e" id="dir_g_e" value="true"{DIR_G_E_CHECKED} />
+				<label for="dir_g_e">{TEXT_EXECUTE}</label>
+			</td>
+			<td>
+				<input type="checkbox" name="dir_o_r" id="dir_o_r" value="true"{DIR_O_R_CHECKED} />
+				<label for="dir_o_r">{TEXT_READ}</label>
+				<br />
+				<input type="checkbox" name="dir_o_w" id="dir_o_w" value="true"{DIR_O_W_CHECKED} />
+				<label for="dir_o_w">{TEXT_WRITE}</label>
+				<br />
+				<input type="checkbox" name="dir_o_e" id="dir_o_e" value="true"{DIR_O_E_CHECKED} />
+				<label for="dir_o_e">{TEXT_EXECUTE}</label>
+			</td>
+		</tr>
+		</table>
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_PAGES_DIRECTORY}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="pages_directory" value="{PAGES_DIRECTORY}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_MEDIA_DIRECTORY}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="media_directory" value="{MEDIA_DIRECTORY}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_PAGE_EXTENSION}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="page_extension" value="{PAGE_EXTENSION}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_PAGE_SPACER}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="page_spacer" value="{PAGE_SPACER}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_RENAME_FILES_ON_UPLOAD}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="rename_files_on_upload" value="{RENAME_FILES_ON_UPLOAD}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td class="setting_name">{TEXT_SESSION_IDENTIFIER}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="app_name" value="{APP_NAME}" />
+	</td>
+</tr>
+<tr>
+	<td colspan="3" style="padding-top: 10px;">
+		<h2>{HEADING_WBMAILER_SETTINGS}</h2>
+		<div style="border: 1px solid #CCC; background-color: #EEE; padding: 5px;">
+			<strong> Please Note:</strong>
+			<br \>
+			{TEXT_WBMAILER_NOTICE}
+		</div>
+	</td>
+</tr>
+<tr>
+	<td class="setting_name">{TEXT_WBMAILER_FUNCTION}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="radio" name="wbmailer_routine" id="wbmailer_routine_phpmail" onclick="javascript: change_wbmailer('phpmail');" style="width: 14px; height: 14px;" value="phpmail"{PHPMAIL_SELECTED} />
+		<label for="wbmailer_routine_phpmail" onclick="javascript: change_wbmailer('phpmail');">{TEXT_WBMAILER_PHP}</label>
+		<input type="radio" name="wbmailer_routine" id="wbmailer_routine_smtp" onclick="javascript: change_wbmailer('smtp');"" style="width: 14px; height: 14px;" value="smtp"{SMTPMAIL_SELECTED} />
+		<label for="wbmailer_routine_smtp" onclick="javascript: change_wbmailer('smtp');">{TEXT_WBMAILER_SMTP}</label>
+	</td>
+</tr>
+<tr id="wbmailer_smtp_host" style="visibility:{SMTP_VISIBILITY};">
+	<td class="setting_name">{TEXT_WBMAILER_SMTP_HOST}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="wbmailer_smtp_host" value="{WBMAILER_SMTP_HOST}" />
+	</td>
+</tr>
+<tr id="wbmailer_smtp_auth_mode" style="visibility:{SMTP_VISIBILITY};">
+	<td class="setting_name">{TEXT_WBMAILER_SMTP_AUTH}:</td>
+	<td class="setting_value" colspan="3">
+		<input type="checkbox" name="wbmailer_smtp_auth" id="wbmailer_smtp_auth" onclick="javascript: toggle_wbmailer_auth();" style="width: 14px; height: 14px;" value="true"{SMTP_AUTH_SELECTED} />
+		<label for="wbmailer_smtp_auth" onclick="javascript: toggle_wbmailer_auth(this.value);">({TEXT_WBMAILER_SMTP_AUTH_NOTICE})</label>
+	</td>
+</tr>
+<tr id="wbmailer_smtp_username" style="visibility:{SMTP_VISIBILITY_AUTH};">
+	<td class="setting_name">{TEXT_WBMAILER_SMTP_USERNAME}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="text" name="wbmailer_smtp_username" value="{WBMAILER_SMTP_USERNAME}" />
+	</td>
+</tr>
+<tr id="wbmailer_smtp_password" style="visibility:{SMTP_VISIBILITY_AUTH};">
+	<td class="setting_name">{TEXT_WBMAILER_SMTP_PASSWORD}:</td>
+	<td class="setting_value" colspan="2">
+		<input type="password" name="wbmailer_smtp_password" value="{WBMAILER_SMTP_PASSWORD}" />
+	</td>
+</tr>
+<tr class="advanced">
+	<td colspan="3" style="padding-top: 10px;">
+		<a name="administration_tools"></a>
+		<h2>{HEADING_ADMINISTRATION_TOOLS}</h2>
+	</td>
+</tr>
+<tr class="advanced">
+	<td colspan="3">
+		<ul style="margin: 0; padding: 0; margin-left: 20px; margin-bottom: 10px;">
+		<!-- BEGIN tool_list_block -->
+		<li style="padding-bottom: 5px;">
+		<a href="{ADMIN_URL}/settings/tool.php?tool={TOOL_DIR}">{TOOL_NAME}</a>
+		<br />{TOOL_DESCRIPTION}
+		</li>
+		<!-- END tool_list_block -->
+		</ul>
+		{TOOL_LIST}
+	</td>
+	<td>
+		&nbsp;
+	</td>
+	<td>&nbsp;</td>
+</tr>
+<tr>
+	<td>&nbsp;</td>
+	<td>
+		<input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
+		<input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
+	</td>
+	<td style="text-align: right;">
+		<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
+	</td>
+</tr>
+</table>
+
+</form>
+
+<hr />
+
+<button onclick="window.location = '{ADVANCED_LINK}'; return false;" class="{DISPLAY_ADVANCED_BUTTON}">{ADVANCED_BUTTON}</button>
+
+<font class="{DISPLAY_ADVANCED_BUTTON}">
+&nbsp; {MODE_SWITCH_WARNING}
+</font>
+
 <!-- END main_block -->
\ No newline at end of file
Index: trunk/wb/framework/class.wb.php
===================================================================
--- trunk/wb/framework/class.wb.php	(revision 416)
+++ trunk/wb/framework/class.wb.php	(revision 417)
@@ -1,315 +1,279 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-/*
-
-wb class
-
-This class is the basis for admin and frontend classes.
-
-*/
-
-// Include PHPLIB template class
-require_once(WB_PATH."/include/phplib/template.inc");
-
-require_once(WB_PATH.'/framework/class.database.php');
-
-// Include new wbmailer class (subclass of PHPmailer)
-require_once(WB_PATH."/framework/class.wbmailer.php");
-
-class wb
-{
-	// General initialization function 
-	// performed when frontend or backend is loaded.
-	function wb() {
-	}
-
-	// Check whether we should show a page or not (for front-end)
-	function show_page($page) {
-		// First check if the page is set to private
-		if($page['visibility'] == 'private' OR $page['visibility'] == 'registered') {
-			// Check if the user is logged in
-			if($this->is_authenticated() == true) {
-				// Now check if the user has perms to view it
-				$viewing_groups = explode(',', $page['viewing_groups']);
-				$viewing_users = explode(',', $page['viewing_users']);
-				if(is_numeric(array_search($this->get_group_id(), $viewing_groups)) OR is_numeric(array_search($this->get_user_id(), $viewing_users))) {
-					return true;
-				} else {
-					return false;
-				}
-			} else {
-				return false;
-			}
-		} elseif($page['visibility'] == 'public') {
-			return true;
-		} else {
-			return false;
-		}
-	}
-
-	// Check if the user is already authenticated or not
-	function is_authenticated() {
-		if(isset($_SESSION['USER_ID']) AND $_SESSION['USER_ID'] != "" AND is_numeric($_SESSION['USER_ID'])) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-	// Modified addslashes function which takes into account magic_quotes
-	function add_slashes($input) {
-		if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
-			return $input;
-		}
-		$output = addslashes($input);
-		return $output;
-	}
-
-	// Ditto for stripslashes
-	function strip_slashes($input) {
-		if ( !get_magic_quotes_gpc() || ( !is_string($input) ) ) {
-			return $input;
-		}
-		$output = stripslashes($input);
-		return $output;
-	}
-
-	// Escape backslashes for use with mySQL LIKE strings
-	function escape_backslashes($input) {
-		return str_replace("\\","\\\\",$input);
-	}
-
-	function page_link($link){
-		// Check for :// in the link (used in URL's) as well as mailto:
-		if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') {
-			return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
-		} else {
-			return $link;
-		}
-	}
-	
-	// Get POST data
-	function get_post($field) {
-		if(isset($_POST[$field])) {
-			return $_POST[$field];
-		} else {
-			return null;
-		}
-	}
-
-	// Get POST data and escape it
-	function get_post_escaped($field) {
-		$result = $this->get_post($field);
-		return (is_null($result)) ? null : $this->add_slashes($result);
-	}
-	
-	// Get GET data
-	function get_get($field) {
-		if(isset($_GET[$field])) {
-			return $_GET[$field];
-		} else {
-			return null;
-		}
-	}
-
-	// Get SESSION data
-	function get_session($field) {
-		if(isset($_SESSION[$field])) {
-			return $_SESSION[$field];
-		} else {
-			return null;
-		}
-	}
-
-	// Get SERVER data
-	function get_server($field) {
-		if(isset($_SERVER[$field])) {
-			return $_SERVER[$field];
-		} else {
-			return null;
-		}
-	}
-
-	// Get the current users id
-	function get_user_id() {
-		return $_SESSION['USER_ID'];
-	}
-
-	// Get the current users group id
-	function get_group_id() {
-		return $_SESSION['GROUP_ID'];
-	}
-
-	// Get the current users group name
-	function get_group_name() {
-		return $_SESSION['GROUP_NAME'];
-	}
-
-	// Get the current users username
-	function get_username() {
-		return $_SESSION['USERNAME'];
-	}
-
-	// Get the current users display name
-	function get_display_name() {
-		return ($_SESSION['DISPLAY_NAME']);
-	}
-
-	// Get the current users email address
-	function get_email() {
-		return $_SESSION['EMAIL'];
-	}
-
-	// Get the current users home folder
-	function get_home_folder() {
-		return $_SESSION['HOME_FOLDER'];
-	}
-
-	// Get the current users timezone
-	function get_timezone() {
-		if(!isset($_SESSION['USE_DEFAULT_TIMEZONE'])) {
-			return $_SESSION['TIMEZONE'];
-		} else {
-			return '-72000';
-		}
-	}
-
-	// Validate supplied email address
-	function validate_email($email) {
-		if(eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $email)) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-
-	// Print a success message which then automatically redirects the user to another page
-	function print_success($message, $redirect = 'index.php') {
-		global $TEXT;
-		$success_template = new Template(ADMIN_PATH.'/interface');
-		$success_template->set_file('page', 'success.html');
-		$success_template->set_block('page', 'main_block', 'main');
-		$success_template->set_var('MESSAGE', $message);
-		$success_template->set_var('REDIRECT', $redirect);
-		$success_template->set_var('NEXT', $TEXT['NEXT']);
-		$success_template->parse('main', 'main_block', false);
-		$success_template->pparse('output', 'page');
-	}
-	
-	// Print an error message
-	function print_error($message, $link = 'index.php', $auto_footer = true) {
-		global $TEXT;
-		$success_template = new Template(ADMIN_PATH.'/interface');
-		$success_template->set_file('page', 'error.html');
-		$success_template->set_block('page', 'main_block', 'main');
-		$success_template->set_var('MESSAGE', $message);
-		$success_template->set_var('LINK', $link);
-		$success_template->set_var('BACK', $TEXT['BACK']);
-		$success_template->parse('main', 'main_block', false);
-		$success_template->pparse('output', 'page');
-		if($auto_footer == true) {
-			$this->print_footer();
-		}
-		exit();
-	}
-
-	// Validate send email
-	function mail($fromaddress, $toaddress, $subject, $message) {
-		$fromaddress = preg_replace('/[\r\n]/', '', $fromaddress);
-		$toaddress = preg_replace('/[\r\n]/', '', $toaddress);
-		$subject = preg_replace('/[\r\n]/', '', $subject);
-		$message = preg_replace('/[\r\n]/', '<br \>', $message);
-		
-		/* 
-		SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION
-		NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE
-		
-		NOTE:
-		To use SMTP for sending out mails, you have to specify the SMTP host of your domain
-		via the variable "WBMAILER_SMTP_HOST" in the "config.php" file
-		If variable is not defined, the WBMAILER class uses the PHP mail() function per default
-		
-		the mail header is automatically created by PHPMailer and therefore commented out
-		UPDATE INTRODUCED BY DOC (C. SOMMER, 22. October 2006)
-		*/ 
-		
-		/* 
-		if ($fromaddress=='') {
-			$fromaddress = SERVER_EMAIL;
-		}
-		
-		if(defined('DEFAULT_CHARSET')) { 
-			$charset = DEFAULT_CHARSET; 
-		} else {
-			$charset='utf-8';
-		}
-		
-		$headers  = "MIME-Version: 1.0\n";
-		$headers .= "Content-type: text/plain; charset=".$charset."\n";
-		$headers .= "X-Priority: 3\n";
-		$headers .= "X-MSMail-Priority: Normal\n";
-		$headers .= "X-Mailer: Website Baker\n";
-		$headers .= "From: ".$fromaddress."\n";
-		$headers .= "Return-Path: ".$fromaddress."\n";
-		$headers .= "Reply-To: ".$fromaddress."\n";
-		$headers .= "\n"; // extra empty line needed??
-		
-		if (OPERATING_SYSTEM=='windows') {
-			//str_replace("\n","\r\n",$headers);
-			str_replace("\n","\r\n",$message);
-		}	
-		
-		if(mail($toaddress, $subject, $message, $headers)) {
-			return true;
-		} else {
-			return false;
-		}
-		*/
-		
-		// create PHPMailer object and define default settings
-		$myMail = new wbmailer();
-      
-		// set user defined from address
-		if ($fromaddress!='') {
-			$myMail->From = $fromaddress;                           // FROM:
-			$myMail->AddReplyTo($fromaddress);                      // REPLY TO:
-		}
-		
-		// define recepient and information to send out
-		$myMail->AddAddress($toaddress);                            // TO:
-		$myMail->Subject = $subject;                                // SUBJECT
-		$myMail->Body = $message;                                   // CONTENT (HTML)
-		$myMail->AltBody = strip_tags($message);                    // CONTENT (TEXT)
-		
-		// check if there are any send mail errors, otherwise say successful
-		if (!$myMail->Send()) {
-			return false;
-		} else {
-			return true;
-		}
-	}
-
-}
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*
+
+wb class
+
+This class is the basis for admin and frontend classes.
+
+*/
+
+// Include PHPLIB template class
+require_once(WB_PATH."/include/phplib/template.inc");
+
+require_once(WB_PATH.'/framework/class.database.php');
+
+// Include new wbmailer class (subclass of PHPmailer)
+require_once(WB_PATH."/framework/class.wbmailer.php");
+
+class wb
+{
+	// General initialization function 
+	// performed when frontend or backend is loaded.
+	function wb() {
+	}
+
+	// Check whether we should show a page or not (for front-end)
+	function show_page($page) {
+		// First check if the page is set to private
+		if($page['visibility'] == 'private' OR $page['visibility'] == 'registered') {
+			// Check if the user is logged in
+			if($this->is_authenticated() == true) {
+				// Now check if the user has perms to view it
+				$viewing_groups = explode(',', $page['viewing_groups']);
+				$viewing_users = explode(',', $page['viewing_users']);
+				if(is_numeric(array_search($this->get_group_id(), $viewing_groups)) OR is_numeric(array_search($this->get_user_id(), $viewing_users))) {
+					return true;
+				} else {
+					return false;
+				}
+			} else {
+				return false;
+			}
+		} elseif($page['visibility'] == 'public') {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	// Check if the user is already authenticated or not
+	function is_authenticated() {
+		if(isset($_SESSION['USER_ID']) AND $_SESSION['USER_ID'] != "" AND is_numeric($_SESSION['USER_ID'])) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+	// Modified addslashes function which takes into account magic_quotes
+	function add_slashes($input) {
+		if ( get_magic_quotes_gpc() || ( !is_string($input) ) ) {
+			return $input;
+		}
+		$output = addslashes($input);
+		return $output;
+	}
+
+	// Ditto for stripslashes
+	function strip_slashes($input) {
+		if ( !get_magic_quotes_gpc() || ( !is_string($input) ) ) {
+			return $input;
+		}
+		$output = stripslashes($input);
+		return $output;
+	}
+
+	// Escape backslashes for use with mySQL LIKE strings
+	function escape_backslashes($input) {
+		return str_replace("\\","\\\\",$input);
+	}
+
+	function page_link($link){
+		// Check for :// in the link (used in URL's) as well as mailto:
+		if(strstr($link, '://') == '' AND substr($link, 0, 7) != 'mailto:') {
+			return WB_URL.PAGES_DIRECTORY.$link.PAGE_EXTENSION;
+		} else {
+			return $link;
+		}
+	}
+	
+	// Get POST data
+	function get_post($field) {
+		if(isset($_POST[$field])) {
+			return $_POST[$field];
+		} else {
+			return null;
+		}
+	}
+
+	// Get POST data and escape it
+	function get_post_escaped($field) {
+		$result = $this->get_post($field);
+		return (is_null($result)) ? null : $this->add_slashes($result);
+	}
+	
+	// Get GET data
+	function get_get($field) {
+		if(isset($_GET[$field])) {
+			return $_GET[$field];
+		} else {
+			return null;
+		}
+	}
+
+	// Get SESSION data
+	function get_session($field) {
+		if(isset($_SESSION[$field])) {
+			return $_SESSION[$field];
+		} else {
+			return null;
+		}
+	}
+
+	// Get SERVER data
+	function get_server($field) {
+		if(isset($_SERVER[$field])) {
+			return $_SERVER[$field];
+		} else {
+			return null;
+		}
+	}
+
+	// Get the current users id
+	function get_user_id() {
+		return $_SESSION['USER_ID'];
+	}
+
+	// Get the current users group id
+	function get_group_id() {
+		return $_SESSION['GROUP_ID'];
+	}
+
+	// Get the current users group name
+	function get_group_name() {
+		return $_SESSION['GROUP_NAME'];
+	}
+
+	// Get the current users username
+	function get_username() {
+		return $_SESSION['USERNAME'];
+	}
+
+	// Get the current users display name
+	function get_display_name() {
+		return ($_SESSION['DISPLAY_NAME']);
+	}
+
+	// Get the current users email address
+	function get_email() {
+		return $_SESSION['EMAIL'];
+	}
+
+	// Get the current users home folder
+	function get_home_folder() {
+		return $_SESSION['HOME_FOLDER'];
+	}
+
+	// Get the current users timezone
+	function get_timezone() {
+		if(!isset($_SESSION['USE_DEFAULT_TIMEZONE'])) {
+			return $_SESSION['TIMEZONE'];
+		} else {
+			return '-72000';
+		}
+	}
+
+	// Validate supplied email address
+	function validate_email($email) {
+		if(eregi("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$", $email)) {
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+	// Print a success message which then automatically redirects the user to another page
+	function print_success($message, $redirect = 'index.php') {
+		global $TEXT;
+		$success_template = new Template(ADMIN_PATH.'/interface');
+		$success_template->set_file('page', 'success.html');
+		$success_template->set_block('page', 'main_block', 'main');
+		$success_template->set_var('MESSAGE', $message);
+		$success_template->set_var('REDIRECT', $redirect);
+		$success_template->set_var('NEXT', $TEXT['NEXT']);
+		$success_template->parse('main', 'main_block', false);
+		$success_template->pparse('output', 'page');
+	}
+	
+	// Print an error message
+	function print_error($message, $link = 'index.php', $auto_footer = true) {
+		global $TEXT;
+		$success_template = new Template(ADMIN_PATH.'/interface');
+		$success_template->set_file('page', 'error.html');
+		$success_template->set_block('page', 'main_block', 'main');
+		$success_template->set_var('MESSAGE', $message);
+		$success_template->set_var('LINK', $link);
+		$success_template->set_var('BACK', $TEXT['BACK']);
+		$success_template->parse('main', 'main_block', false);
+		$success_template->pparse('output', 'page');
+		if($auto_footer == true) {
+			$this->print_footer();
+		}
+		exit();
+	}
+
+	// Validate send email
+	function mail($fromaddress, $toaddress, $subject, $message) {
+		/* 
+			INTEGRATED OPEN SOURCE PHPMAILER CLASS FOR SMTP SUPPORT AND MORE
+			SOME SERVICE PROVIDERS DO NOT SUPPORT SENDING MAIL VIA PHP AS IT DOES NOT PROVIDE SMTP AUTHENTICATION
+			NEW WBMAILER CLASS IS ABLE TO SEND OUT MESSAGES USING SMTP WHICH RESOLVE THESE ISSUE (C. Sommer)
+
+			NOTE:
+			To use SMTP for sending out mails, you have to specify the SMTP host of your domain
+			via the Settings panel in the backend of Website Baker
+		*/ 
+
+		$fromaddress = preg_replace('/[\r\n]/', '', $fromaddress);
+		$toaddress = preg_replace('/[\r\n]/', '', $toaddress);
+		$subject = preg_replace('/[\r\n]/', '', $subject);
+		$message = preg_replace('/[\r\n]/', '<br \>', $message);
+		
+		// create PHPMailer object and define default settings
+		$myMail = new wbmailer();
+      
+		// set user defined from address
+		if ($fromaddress!='') {
+			$myMail->From = $fromaddress;                            // FROM:
+			$myMail->AddReplyTo($fromaddress);                       // REPLY TO:
+		}
+		
+		// define recepient and information to send out
+		$myMail->AddAddress($toaddress);                            // TO:
+		$myMail->Subject = $subject;                                // SUBJECT
+		$myMail->Body = $message;                                   // CONTENT (HTML)
+		$myMail->AltBody = strip_tags($message);                    // CONTENT (TEXT)
+		
+		// check if there are any send mail errors, otherwise say successful
+		if (!$myMail->Send()) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+}
 ?>
\ No newline at end of file
Index: trunk/wb/framework/class.wbmailer.php
===================================================================
--- trunk/wb/framework/class.wbmailer.php	(revision 416)
+++ trunk/wb/framework/class.wbmailer.php	(revision 417)
@@ -1,86 +1,113 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2007, Ryan Djurovich
-
- Website Baker 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.
-
- Website Baker 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 Website Baker; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-/*
-
-wbmailer class
-
-This class is a subclass of the PHPMailer class and replaces the mail() function of PHP
-
-*/
-
-// Include PHPMailer class
-require_once(WB_PATH."/include/phpmailer/class.phpmailer.php");
-
-class wbmailer extends PHPMailer 
-{
-	// new websitebaker mailer class (subset of PHPMailer class)
-	// setting default values 
-
-	function wbmailer() {
-		// set method to send out emails
-		if(defined('WBMAILER_SMTP_HOST')) {
-			// sets Mailer to send messages using SMTP
-			$this->IsSMTP();                                            
-			$this->Host = WBMAILER_SMTP_HOST;                        // use STMP host defined in config.php
-		} else {
-			// set Mailer to send message using PHP mail() function
-			$this->IsMail();
-		}
-
-		// set language file for PHPMailer error messages
-		if(defined("LANGUAGE")) {
-			$this->SetLanguage(strtolower(LANGUAGE),"language");     // english default (also used if file is missing)
-		}
-
-		// set default charset
-		if(defined('DEFAULT_CHARSET')) { 
-			$this->CharSet = DEFAULT_CHARSET; 
-		} else {
-			$this->CharSet='utf-8';
-		}
-
-		// set default sender name
-		if (isset($_SESSION['DISPLAY_NAME'])) {
-			$this->FromName = $_SESSION['DISPLAY_NAME'];             // FROM NAME: display name of user logged in
-		} else {
-			$this->FromName = "WB Mailer";                           // FROM NAME: set default name
-		}
-
-		// set default sender mail address
-		if (isset($_SESSION['EMAIL'])) {
-			$this->From = $_SESSION['EMAIL'];                        // FROM MAIL: (of user logged in)
-		} else {
-			$this->From = SERVER_EMAIL;                              // FROM MAIL: (server mail)
-		}
-
-		// set default mail formats
-		$this->IsHTML(true);                                        
-		$this->WordWrap = 80;                                       
-		$this->Timeout = 30;
-	}
-}
-
+<?php
+
+// $Id$
+
+/*
+
+ Website Baker Project <http://www.websitebaker.org/>
+ Copyright (C) 2004-2007, Ryan Djurovich
+
+ Website Baker 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.
+
+ Website Baker 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 Website Baker; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+*/
+
+/*
+
+wbmailer class
+
+This class is a subclass of the PHPMailer class and replaces the mail() function of PHP
+
+*/
+
+// Include PHPMailer class
+require_once(WB_PATH."/include/phpmailer/class.phpmailer.php");
+
+class wbmailer extends PHPMailer 
+{
+	// new websitebaker mailer class (subset of PHPMailer class)
+	// setting default values 
+
+	function wbmailer() {
+		// set mailer defaults (PHP mail function)
+		$db_wbmailer_routine = "phpmail";
+		$db_wbmailer_smtp_host = "";
+
+		// get mailer settings from database
+		$database = new database();
+		$query = "SELECT * FROM " .TABLE_PREFIX. "settings";
+		$results = $database->query($query);
+		while($setting = $results->fetchRow()) {
+			if ($setting['name'] == "wbmailer_routine") { $db_wbmailer_routine = $setting['value']; }
+			if ($setting['name'] == "wbmailer_smtp_host") { $db_wbmailer_smtp_host = $setting['value']; }
+			if ($setting['name'] == "wbmailer_smtp_auth") { $db_wbmailer_smtp_auth = (bool)$setting['value']; }
+			if ($setting['name'] == "wbmailer_smtp_username") { $db_wbmailer_smtp_username = $setting['value']; }
+			if ($setting['name'] == "wbmailer_smtp_password") { $db_wbmailer_smtp_password = $setting['value']; }
+		}
+
+		// set method to send out emails
+		if($db_wbmailer_routine == "smtp" AND strlen($db_wbmailer_smtp_host) > 5) {
+			// use SMTP for all outgoing mails send by Website Baker
+			$this->IsSMTP();                                            
+			$this->Host = $db_wbmailer_smtp_host;
+			// check if SMTP authentification is required
+			if ($db_wbmailer_smtp_auth && strlen($db_wbmailer_smtp_username) > 1 && strlen($db_wbmailer_smtp_password) > 1) {
+				// use SMTP authentification
+				$this->SMTPAuth = true;     	  								// enable SMTP authentification
+				$this->Username = $db_wbmailer_smtp_username;  	// set SMTP username
+				$this->Password = $db_wbmailer_smtp_password;	  // set SMTP password
+			}
+		} else {
+			// use PHP mail() function for outgoing mails send by Website Baker
+			$this->IsMail();
+		}
+
+		// set language file for PHPMailer error messages
+		if(defined("LANGUAGE")) {
+			$this->SetLanguage(strtolower(LANGUAGE),"language");     // english default (also used if file is missing)
+		}
+
+		// set default charset
+		if(defined('DEFAULT_CHARSET')) { 
+			$this->CharSet = DEFAULT_CHARSET; 
+		} else {
+			$this->CharSet='utf-8';
+		}
+
+		// set default sender name
+		if (isset($_SESSION['DISPLAY_NAME'])) {
+			$this->FromName = $_SESSION['DISPLAY_NAME'];             // FROM NAME: display name of user logged in
+		} else {
+			$this->FromName = "WB Mailer";                           // FROM NAME: set default name
+		}
+
+/*  some mail provider (lets say mail.com) reject mails send out by foreign mail relays
+    but using the providers domain in the from mail address (e.g. myname@mail.com)
+		// set default sender mail address
+		if (isset($_SESSION['EMAIL'])) {
+			$this->From = $_SESSION['EMAIL'];                        // FROM MAIL: (of user logged in)
+		} else {
+			$this->From = SERVER_EMAIL;                              // FROM MAIL: (server mail)
+		}
+*/
+		$this->From = SERVER_EMAIL;                                // FROM MAIL: (server mail)
+
+		// set default mail formats
+		$this->IsHTML(true);                                        
+		$this->WordWrap = 80;                                       
+		$this->Timeout = 30;
+	}
+}
+
 ?>
\ No newline at end of file
