[pLog-svn] r6934 - in plog/trunk: . bin-devel class/action class/action/admin class/action/admin/chooser class/config class/controller class/dao class/dao/userdata class/data class/data/filter class/data/forms class/data/validator class/data/validator/rules class/database class/gallery/dao class/net class/net/http class/net/http/session class/net/xmlrpc class/summary/action class/summary/view class/template class/template/templatesets class/test/PHPUnit class/test/helpers class/test/tests/dao class/test/tests/data class/test/tests/data/validator class/test/tests/locale class/test/tests/mail/phpmailer class/test/tests/net/xmlrpc class/test/tests/summary/dao class/test/tests/ui class/view class/view/admin gallery js/tinymce js/tinymce/plugins/insertaudio js/tinymce/plugins/insertaudio/images js/tinymce/plugins/insertaudio/langs js/tinymce/plugins/insertresource js/tinymce/plugins/insertvideo js/ui locale locale/admin locale/unported plugins/badbehavior plugins/badbehavior/bad-beh avior styles templates templates/admin templates/default templates/rss templates/summary templates/summary/rss templates/wizard

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Thu Dec 24 12:43:57 EST 2009


Author: jondaley
Date: 2009-12-24 12:43:57 -0500 (Thu, 24 Dec 2009)
New Revision: 6934

Added:
   plog/trunk/bin-devel/build-core-all-svn.sh
   plog/trunk/bin-devel/build-core-diff.sh
   plog/trunk/bin-devel/build-core-nightly.sh
   plog/trunk/bin-devel/build-plugin-local.sh
   plog/trunk/bin-devel/build-plugins-all-svn.sh
   plog/trunk/bin-devel/build-plugins-nightly.sh
   plog/trunk/bin-devel/build-template-local.sh
   plog/trunk/bin-devel/build-templates-all-svn.sh
   plog/trunk/bin-devel/build-templates-nightly.sh
   plog/trunk/bin-devel/genpluginfeeds.php
   plog/trunk/bin-devel/testlocale.php
   plog/trunk/class/dao/userdata/ldapuserdataprovider.class.php
   plog/trunk/class/data/filter/javascriptfilter.class.php
   plog/trunk/class/data/inputfilter.class.php
   plog/trunk/class/data/validator/datetimevalidator.class.php
   plog/trunk/class/data/validator/rules/datetimerule.class.php
   plog/trunk/class/data/validator/rules/nohtmlrule.class.php
   plog/trunk/class/test/tests/data/validator/datetimevalidator_test.class.php
   plog/trunk/locale/admin/locale_pl_PL.php
   plog/trunk/locale/admin/locale_ua_UA.php
   plog/trunk/locale/locale_pl_PL.php
   plog/trunk/locale/locale_ua_UA.php
   plog/trunk/plugins/badbehavior/bad-behavior/COPYING
   plog/trunk/plugins/badbehavior/bad-behavior/README.txt
Removed:
   plog/trunk/bin-devel/build-diff.sh
   plog/trunk/bin-devel/build-nightly.sh
   plog/trunk/bin-devel/build-plugins-nightly.sh
   plog/trunk/bin-devel/build-plugins.sh
   plog/trunk/bin-devel/build-svn.sh
   plog/trunk/bin-devel/build-svn2.sh
   plog/trunk/bin-devel/build-templates-nightly.sh
   plog/trunk/bin-devel/build-templates.sh
   plog/trunk/class/net/http/phpsniff/
   plog/trunk/js/tinymce/plugins/insertaudio/css/
   plog/trunk/js/tinymce/plugins/insertaudio/functions.js
   plog/trunk/js/tinymce/plugins/insertaudio/images/player.png
   plog/trunk/js/tinymce/plugins/insertresource/popup.htm
   plog/trunk/js/tinymce/plugins/insertresource/readme.txt
   plog/trunk/locale/unported/locale_it_IT.php
   plog/trunk/plugins/badbehavior/bad-behavior/admin.inc.php
   plog/trunk/templates/LifeType/
Modified:
   plog/trunk/
   plog/trunk/.htaccess
   plog/trunk/bin-devel/genmd5.php
   plog/trunk/class/action/action.class.php
   plog/trunk/class/action/addcommentaction.class.php
   plog/trunk/class/action/addtrackbackaction.class.php
   plog/trunk/class/action/admin/adminaction.class.php
   plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminaddblogaction.class.php
   plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminaddbloguseraction.class.php
   plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
   plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminaddlinkaction.class.php
   plog/trunk/class/action/admin/adminaddpermissionaction.class.php
   plog/trunk/class/action/admin/adminaddpostaction.class.php
   plog/trunk/class/action/admin/adminaddresourceaction.class.php
   plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php
   plog/trunk/class/action/admin/adminaddtemplateaction.class.php
   plog/trunk/class/action/admin/adminadduseraction.class.php
   plog/trunk/class/action/admin/adminadminblogselectaction.class.php
   plog/trunk/class/action/admin/adminblogcategoriesaction.class.php
   plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php
   plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php
   plog/trunk/class/action/admin/admincleanupaction.class.php
   plog/trunk/class/action/admin/admindeleteblogaction.class.php
   plog/trunk/class/action/admin/admindeletepermissionsaction.class.php
   plog/trunk/class/action/admin/admindeleteusersaction.class.php
   plog/trunk/class/action/admin/admindoregisterblogaction.class.php
   plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php
   plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
   plog/trunk/class/action/admin/admineditcommentsaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php
   plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/admineditlinkaction.class.php
   plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php
   plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
   plog/trunk/class/action/admin/admineditlinksaction.class.php
   plog/trunk/class/action/admin/admineditpostaction.class.php
   plog/trunk/class/action/admin/admineditpostsaction.class.php
   plog/trunk/class/action/admin/adminglobalsettingsaction.class.php
   plog/trunk/class/action/admin/adminloginaction.class.php
   plog/trunk/class/action/admin/adminmainaction.class.php
   plog/trunk/class/action/admin/adminnewpostaction.class.php
   plog/trunk/class/action/admin/adminplugincenteraction.class.php
   plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
   plog/trunk/class/action/admin/adminpoststatsaction.class.php
   plog/trunk/class/action/admin/adminpreviewpostaction.class.php
   plog/trunk/class/action/admin/adminresourcealbumsaction.class.php
   plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
   plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
   plog/trunk/class/action/admin/adminsiteblogsaction.class.php
   plog/trunk/class/action/admin/adminstatisticsaction.class.php
   plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
   plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
   plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php
   plog/trunk/class/action/admin/adminupdateeditblogaction.class.php
   plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
   plog/trunk/class/action/admin/adminupdateglobalsettingsaction.class.php
   plog/trunk/class/action/admin/adminupdatelinkaction.class.php
   plog/trunk/class/action/admin/adminupdatepermissionaction.class.php
   plog/trunk/class/action/admin/adminupdatepluginsettingsaction.class.php
   plog/trunk/class/action/admin/adminupdateresourceaction.class.php
   plog/trunk/class/action/admin/adminupdateresourcealbumaction.class.php
   plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php
   plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php
   plog/trunk/class/action/admin/chooser/adminresourcelistaction.class.php
   plog/trunk/class/action/blogaction.class.php
   plog/trunk/class/action/defaultaction.class.php
   plog/trunk/class/action/resourceserveraction.class.php
   plog/trunk/class/action/rssaction.class.php
   plog/trunk/class/action/searchaction.class.php
   plog/trunk/class/action/templateaction.class.php
   plog/trunk/class/action/viewalbumaction.class.php
   plog/trunk/class/action/viewarticleaction.class.php
   plog/trunk/class/action/viewarticletrackbacksaction.class.php
   plog/trunk/class/action/viewresourceaction.class.php
   plog/trunk/class/config/configabstractstorage.class.php
   plog/trunk/class/config/configdbstorage.class.php
   plog/trunk/class/controller/controller.class.php
   plog/trunk/class/dao/article.class.php
   plog/trunk/class/dao/articlecategories.class.php
   plog/trunk/class/dao/articlecategory.class.php
   plog/trunk/class/dao/articles.class.php
   plog/trunk/class/dao/blogs.class.php
   plog/trunk/class/dao/commentscommon.class.php
   plog/trunk/class/dao/permissions.class.php
   plog/trunk/class/dao/searchengine.class.php
   plog/trunk/class/dao/trackbackclient.class.php
   plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php
   plog/trunk/class/dao/userdata/vbb3userdataprovider.class.php
   plog/trunk/class/data/forms/formvalidator.class.php
   plog/trunk/class/data/plogcalendar.class.php
   plog/trunk/class/data/textfilter.class.php
   plog/trunk/class/data/timestamp.class.php
   plog/trunk/class/data/validator/blognamevalidator.class.php
   plog/trunk/class/data/validator/domainvalidator.class.php
   plog/trunk/class/data/validator/rules/urlformatrule.class.php
   plog/trunk/class/data/validator/stringvalidator.class.php
   plog/trunk/class/database/ltdb.class.php
   plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
   plog/trunk/class/net/baserequestgenerator.class.php
   plog/trunk/class/net/customrequestgenerator.class.php
   plog/trunk/class/net/http/session/sessionmanager.class.php
   plog/trunk/class/net/modrewriterequestgenerator.class.php
   plog/trunk/class/net/prettyrequestgenerator.class.php
   plog/trunk/class/net/rawrequestgenerator.class.php
   plog/trunk/class/net/url.class.php
   plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php
   plog/trunk/class/summary/action/chooseblogtemplateaction.class.php
   plog/trunk/class/summary/action/doblogregistration.class.php
   plog/trunk/class/summary/action/dofinishregister.class.php
   plog/trunk/class/summary/action/dousercreation.class.php
   plog/trunk/class/summary/action/summaryrssaction.class.php
   plog/trunk/class/summary/action/summarysearchaction.class.php
   plog/trunk/class/summary/view/summarycachedview.class.php
   plog/trunk/class/summary/view/summaryrssview.class.php
   plog/trunk/class/summary/view/summaryview.class.php
   plog/trunk/class/template/templateservice.class.php
   plog/trunk/class/template/templatesets/templatesets.class.php
   plog/trunk/class/test/PHPUnit/Assert.php
   plog/trunk/class/test/helpers/lifetypetestcase.class.php
   plog/trunk/class/test/helpers/testtools.class.php
   plog/trunk/class/test/tests/dao/article_test.class.php
   plog/trunk/class/test/tests/dao/articlecategories_test.class.php
   plog/trunk/class/test/tests/dao/commentscommon_test.class.php
   plog/trunk/class/test/tests/dao/permissions_test.class.php
   plog/trunk/class/test/tests/dao/searchengine_test.class.php
   plog/trunk/class/test/tests/data/textfilter_test.class.php
   plog/trunk/class/test/tests/data/validator/httpurlvalidator_test.class.php
   plog/trunk/class/test/tests/locale/locale_test.class.php
   plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php
   plog/trunk/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
   plog/trunk/class/test/tests/summary/dao/summarystats_test.class.php
   plog/trunk/class/test/tests/ui/articlecategoriesui_test.class.php
   plog/trunk/class/test/tests/ui/login_test.class.php
   plog/trunk/class/test/tests/ui/permissionsui_test.class.php
   plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php
   plog/trunk/class/view/admin/adminsiteblogslistview.class.php
   plog/trunk/class/view/admin/adminsiteuserslistview.class.php
   plog/trunk/class/view/view.class.php
   plog/trunk/gallery/
   plog/trunk/js/tinymce/plugins/insertaudio/audioinput.html
   plog/trunk/js/tinymce/plugins/insertaudio/editor_plugin.js
   plog/trunk/js/tinymce/plugins/insertaudio/langs/en.js
   plog/trunk/js/tinymce/plugins/insertaudio/langs/fr.js
   plog/trunk/js/tinymce/plugins/insertresource/editor_plugin.js
   plog/trunk/js/tinymce/plugins/insertvideo/editor_plugin.js
   plog/trunk/js/tinymce/plugins/insertvideo/functions.js
   plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js
   plog/trunk/js/tinymce/tiny_mce.js
   plog/trunk/js/tinymce/tiny_mce_popup.js
   plog/trunk/js/tinymce/tiny_mce_src.js
   plog/trunk/js/ui/autosave.js
   plog/trunk/locale/admin/locale_de_DE.php
   plog/trunk/locale/admin/locale_en_UK.php
   plog/trunk/locale/locale_en_UK.php
   plog/trunk/plugins/badbehavior/bad-behavior/banned.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/blackhole.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/blacklist.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/common_tests.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/core.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/functions.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/google.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/mozilla.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/msie.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/post.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/responses.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/version.inc.php
   plog/trunk/plugins/badbehavior/bad-behavior/whitelist.inc.php
   plog/trunk/plugins/badbehavior/index.inc.php
   plog/trunk/plugins/badbehavior/pluginbadbehavior.class.php
   plog/trunk/styles/admin-ie.css
   plog/trunk/styles/summary.css
   plog/trunk/templates/
   plog/trunk/templates/admin/addbloguser_form.template
   plog/trunk/templates/admin/editcomments.template
   plog/trunk/templates/admin/editcomments_table.template
   plog/trunk/templates/admin/editcustomfield.template
   plog/trunk/templates/admin/editcustomfield_form.template
   plog/trunk/templates/admin/newblogcategory.template
   plog/trunk/templates/admin/newblogcategory_form.template
   plog/trunk/templates/admin/newcustomfield.template
   plog/trunk/templates/admin/newcustomfield_form.template
   plog/trunk/templates/admin/newglobalarticlecategory.template
   plog/trunk/templates/admin/newglobalarticlecategory_form.template
   plog/trunk/templates/admin/newpost.template
   plog/trunk/templates/admin/newpostcategory.template
   plog/trunk/templates/admin/newpostcategory_form.template
   plog/trunk/templates/admin/sendtrackbacks.template
   plog/trunk/templates/default/commentform.template
   plog/trunk/templates/rss/atom.template
   plog/trunk/templates/rss/rss090.template
   plog/trunk/templates/rss/rss10.template
   plog/trunk/templates/rss/rss20.template
   plog/trunk/templates/summary/index.template
   plog/trunk/templates/summary/rss/atom.template
   plog/trunk/templates/summary/rss/blogs_atom.template
   plog/trunk/templates/summary/rss/blogs_rss10.template
   plog/trunk/templates/summary/rss/blogs_rss20.template
   plog/trunk/templates/summary/rss/rss10.template
   plog/trunk/templates/summary/rss/rss20.template
   plog/trunk/templates/wizard/update4.template
   plog/trunk/wizard
Log:
merged lifetype 1.2 branch: revisions: 6448:6933


Property changes on: plog/trunk
___________________________________________________________________
Added: svn:mergeinfo
   + /plog/branches/lifetype-1.2:6449-6933

Modified: plog/trunk/.htaccess
===================================================================
--- plog/trunk/.htaccess	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/.htaccess	2009-12-24 17:43:57 UTC (rev 6934)
@@ -24,22 +24,22 @@
 # Permalink to the blog entry (i.e. /1_userfoo/archive/3_title-foo-bar.html)
 RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]+)_[^.]+\.html$ index.php?op=ViewArticle&blogId=$1&articleId=$2 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]+)_[^.]+\.html\.page\.([1-9]+)$ index.php?op=ViewArticle&blogId=$1&articleId=$2&page=$3 [L,NC]
+RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]+)_[^.]+\.html\.page\.([0-9]+)$ index.php?op=ViewArticle&blogId=$1&articleId=$2&page=$3 [L,NC]
 
 # Monthly archive (i.e. /1_userfoo/archive/200401.html)
 RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{6})\.html$ index.php?blogId=$1&Date=$2 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{6})\.html\.page\.([1-9]+)$ index.php?blogId=$1&Date=$2&page=$3 [L,NC]
+RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{6})\.html\.page\.([0-9]+)$ index.php?blogId=$1&Date=$2&page=$3 [L,NC]
 
 # Daily archive (i.e. /1_blogfoo/archive/20040101.html)
 RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{8})\.html$ index.php?blogId=$1&Date=$2 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{8})\.html\.page\.([1-9]+)$ index.php?blogId=$1&Date=$2&page=$3 [L,NC]
+RewriteRule ^([0-9]+)_[^/]+/archive/([0-9]{8})\.html\.page\.([0-9]+)$ index.php?blogId=$1&Date=$2&page=$3 [L,NC]
 
 # Album (i.e. /88_userfoo/albums/34_title-foo-bar.html)
 RewriteRule ^([0-9]+)_[^/]+/albums/([0-9]+)_[^.]+\.html$ index.php?op=ViewAlbum&blogId=$1&albumId=$2 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^/]+/albums/([0-9]+)_[^.]+\.html\.page\.([1-9]+)$ index.php?op=ViewAlbum&blogId=$1&albumId=$2&page=$3 [L,NC]
+RewriteRule ^([0-9]+)_[^/]+/albums/([0-9]+)_[^.]+\.html\.page\.([0-9]+)$ index.php?op=ViewAlbum&blogId=$1&albumId=$2&page=$3 [L,NC]
 
 # Albums (i.e. /88_userfoo/albums/)
 RewriteRule ^([0-9]+)_[^/]+/albums/$ index.php?op=ViewAlbum&blogId=$1&albumId=0 [L,NC]
@@ -47,7 +47,7 @@
 # Category view (i.e. /88_userfoo/categories/4_cat-foobar.html)
 RewriteRule ^([0-9]+)_[^/]+/categories/([0-9]+)_[^.]+\.html$ index.php?blogId=$1&postCategoryId=$2 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^/]+/categories/([0-9]+)_[^.]+\.html\.page\.([1-9]+)$ index.php?blogId=$1&postCategoryId=$2&page=$3 [L,NC]
+RewriteRule ^([0-9]+)_[^/]+/categories/([0-9]+)_[^.]+\.html\.page\.([0-9]+)$ index.php?blogId=$1&postCategoryId=$2&page=$3 [L,NC]
 
 # Category-Feeds (i.e. /3_userfoo/feeds/categories/2_category/atom)
 RewriteRule ^([0-9]+)_[^/]+/feeds/categories/([0-9]+)_[^.]+/(.*)$ rss.php?blogId=$1&categoryId=$2&profile=$3 [L,NC]
@@ -67,14 +67,14 @@
 # Download a resource (i.e. /88_userfoo/get/this-is-a-resource-name.pdf)
 RewriteRule ^([0-9]+)_[^/]+/get/(.+)$ resserver.php?blogId=$1&resource=$2 [L,NC]
 
+# Static Pages (i.e /3_userfoo/demosites)
+RewriteRule ^([0-9]+)_[^/]+/(.+)$ index.php?op=Template&blogId=$1&show=$2 [L,NC]
+
 # A non-default blog (i.e. /88_userfoo)
 RewriteRule ^([0-9]+)_[^.]+$ index.php?blogId=$1 [L,NC]
 # -- same as above but with paging included
-RewriteRule ^([0-9]+)_[^.]+\.page\.([1-9]+)$ index.php?blogId=$1&page=$2 [L,NC]
+RewriteRule ^([0-9]+)_[^.]+\.page\.([0-9]+)$ index.php?blogId=$1&page=$2 [L,NC]
 
-# Static Pages (i.e /3_userfoo/demosites)
-RewriteRule ^([0-9]+)_[^/]+/(.+)$ index.php?op=Template&blogId=$1&show=$2 [NC]
-
 # If you would like to use custom urls but ForceType or SetType directives do
 # not work on your server (e.g. PHP is running as CGI/FastCGI) you may uncomment
 # the rewrite rule below to rewrite all requests to ./blog to ./blog.php.
@@ -140,6 +140,10 @@
  ForceType application/x-httpd-php
 </Files>
 
+<Files content>
+ ForceType application/x-httpd-php
+</Files>
+
 <Files page>
  ForceType application/x-httpd-php
 </Files>

Copied: plog/trunk/bin-devel/build-core-all-svn.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-core-all-svn.sh)
===================================================================
--- plog/trunk/bin-devel/build-core-all-svn.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-core-all-svn.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,187 @@
+
+#!/bin/bash
+
+# Script to generate distribution builds of LifeType
+#
+# (c) 27-08-2004, the LifeType Team
+#
+#
+# Requires two parameters: the name of the output package and the
+# CVS tag label that will be used to fetch the contents of the build. Therefore,
+# contents must be tagged _before_ running this script. 
+# The same CVS label must be used for both the plog_devel and plog_docs module.
+#
+
+#
+# server and repository path
+#
+SVNSERVER=http://devel.lifetype.net
+SVNREPO=/svn/plog/plog
+
+#
+# array with the files that we are going to remove before
+# making the package... Wildcards, complete paths, whatever
+# can be used here
+# NOTE: When changing this list, update the list in build-diff.sh as well
+
+TOREMOVE="include_files release/ locale/unported/ templates/LifeType/ templates/standard-with-plugins/ templates/grey-sf/ templates/plogworld docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module.mis
 c.exe.php class/gallery/getid3/module.misc.iso.php class/gallery/getid3/extension.cache.dbm.php class/gallery/getid3/extension.cache.mysql.php class/gallery/getid3/write.apetag.php class/gallery/getid3/write.id3v1.php class/gallery/getid3/write.id3v2.php class/gallery/getid3/write.lyrics3.php class/gallery/getid3/write.metaflac.php class/gallery/getid3/write.php class/gallery/getid3/write.real.php class/gallery/getid3/write.vorbiscomment.php dbperf.php *.xcode tools/ runtests.php class/test/"
+
+#
+# helper functions to print things in different colors
+#
+NOCOLOR='\e[0m'
+message()
+{
+ echo -e "\033[01;32m$*$NOCOLOR"
+}
+
+warning()
+{
+ echo -e "\033[01;33m$*$NOCOLOR"
+}
+
+error()
+{
+ echo -e "\033[01;31m$*$NOCOLOR"
+}
+
+find_phpcli()
+{
+    if [ -x /usr/bin/php5 ]; then
+        PHP=/usr/bin/php5
+    else
+        PHP=/usr/bin/php
+    fi
+}
+
+# check parameters
+if [ $# -lt 1 ]; then
+    echo "Makes a build off the latest SVN source code and packages it"
+    echo ""
+	echo "Usage: $0 label package-name"
+	echo ""
+	echo "If package-name is omitted, the name will be lifetype-devel-<current_date>"
+	echo ""
+	echo "Use HEAD or TRUNK to indicate the main development branch"
+    echo ""
+    echo "Example:"
+    echo ""
+    echo "    $0 tags/lifetype-1.2.6 lifetype-1.2.6"
+	exit -1
+fi
+
+SVNTAG=$1
+
+# if there was no package name parameter, then build one using the current date
+if [ $# -eq 1 ]; then
+    PACKAGENAME=lifetype-devel-`date +%Y%m%d`
+else
+    PACKAGENAME=$2
+fi
+
+message "Using $PACKAGENAME as the package name"
+WORKDIR=`basename $PACKAGENAME`
+BUILDLABEL=`basename $PACKAGENAME`
+
+# determine whether code should be fetched from 
+# plog/trunk or plog/tags/xxxx
+if [ $SVNTAG == "HEAD" -o $SVNTAG == "TRUNK" -o $SVNTAG == "head" -o $SVNTAG == "trunk" ]; then
+   SVNREPO=${SVNREPO}/trunk
+else
+   SVNREPO=${SVNREPO}/${SVNTAG}
+fi
+
+# call the svn command with the correct parameters
+message "Fetching the source code using $SVNTAG label..."
+REV=`svn export $SVNSERVER$SVNREPO $WORKDIR | tail -n 1 | awk '{print $NF}' | tr -d . `
+if [ $? -eq 1 ]; then
+    echo "There was an error fetching the source code. Please try again."
+    exit 1
+fi
+
+# create the temp folder and give proper permissions to it
+message "Creating the temporary folders and setting permissions to 777..."
+if [ \! -d $WORKDIR/tmp ]; then
+	mkdir $WORKDIR/tmp
+fi
+chmod 777 $WORKDIR/tmp
+
+# create the gallery/ folder and make sure that it has the right permissions
+message "Creating the gallery/ folder and setting permissions to 777..."
+if [ \! -d $WORKDIR/gallery ]; then
+	mkdir $WORKDIR/gallery
+fi
+chmod 777 $WORKDIR/gallery
+
+# copy the generic config file and remove the dist/ folder since it is not needed
+message "Copying the generic config.properties.file..."
+cp -f $WORKDIR/release/config.properties.php.dist $WORKDIR/config/config.properties.php
+cp -f $WORKDIR/release/logging.properties.php.dist $WORKDIR/config/logging.properties.php
+cp -f $WORKDIR/release/cache.properties.php.dist $WORKDIR/config/cache.properties.php
+cp -f $WORKDIR/release/userdata.properties.php.dist $WORKDIR/config/userdata.properties.php
+rm -rf $WORKDIR/release
+
+# regular users want to use the wizard
+mv $WORKDIR/wizard $WORKDIR/wizard.php
+
+# update the version.php file
+message "Updating the version.php file..."
+VERNAME=`basename ${SVNTAG}`
+echo "<?php" > $WORKDIR/version.php
+echo "\$version = \"${VERNAME}_r${REV}\";" >> $WORKDIR/version.php
+echo "?>" >> $WORKDIR/version.php
+
+# and remove all unnecessary files
+message "Removing unnecessary files...";
+for i in $TOREMOVE
+do
+  echo "  -- removing $i"
+  rm -rf $WORKDIR/$i
+done
+
+# generate install/file.properties.php with the MD5 hashes of most core files
+find_phpcli
+message "Generating MD5 hashes (using $PHP)..."
+$PHP $WORKDIR/bin-devel/genmd5.php
+# remove the bin-devel/ folder, we don't need it anymore
+rm -rf $WORKDIR/bin-devel
+
+# and create the .zip, tar.gz and .tar.bz2 packages
+message "Creating .zip package..."
+zip $BUILDLABEL.zip -r $WORKDIR  > /dev/null
+message "Creating .tar.gz package..."
+tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null
+message "Creating .tar.bz2 package..."
+tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null
+
+
+# calculate branch and version
+LTBRANCH=`echo $VERNAME | sed 's_lifetype-\(.*\..*\)\.\(.*\)_\1_'`
+LTVERSION=`echo $VERNAME | sed 's_lifetype-\(.*\)_\1_'`
+
+# create the lifetype core version feed xml file
+echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>
+<rss version=\"2.0\" xmlns:lt=\"http://www.lifetype.net\">
+<channel>
+<title>Lifetype version feed</title>
+<link>http://www.lifetype.net</link>
+<description>This feed contains the latest Lifetype version available</description>
+<item>
+<title>lifetype-${LTVERSION}_r${REV}</title>
+<link>http://downloads.sourceforge.net/lifetype/lifetype-${LTVERSION}.zip</link>
+<author>The Lifetype project</author>
+<description>Lifetype ${LTVERSION}</description>
+<lt:version>${LTVERSION}_r${REV}</lt:version>
+<lt:development>0</lt:development>
+<lt:branch>${LTBRANCH}</lt:branch>
+<lt:relnotes>http://wiki.lifetype.net/index.php/Release_notes_Lifetype_${LTVERSION}</lt:relnotes>
+</item>
+</channel>
+</rss>" > lifetype.xml
+
+# clean up the temporary folders
+message "Cleaning up..."
+rm -rf $WORKDIR
+
+# done!
+message "Done!"

Copied: plog/trunk/bin-devel/build-core-diff.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-core-diff.sh)
===================================================================
--- plog/trunk/bin-devel/build-core-diff.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-core-diff.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,114 @@
+#!/bin/sh
+
+# This script is for building upgrade tar files, e.g. contain all the files
+# needed to upgrade a 1.2.5 installation to a 1.2.6 installation.  The
+# wizard is not included, since this script is only for minor upgrades
+
+# where to find the svn repository
+SVNSERVER="http://devel.lifetype.net"
+SVNREPO="/svn/plog/plog"
+
+# check paramters
+if [ $# -ne 2 ]; then
+	echo "Creates a folder with the folders that were added or updated when comparing"
+	echo "two subversion folders or branches"
+	echo " "
+	echo "Usage: $0 branch1 branch2"
+        echo " "
+	echo "Where branch1 and branch2 are two different branches/tags from the repository"
+	echo " "
+	echo "Example:"
+	echo " "
+	echo "    $0 tags/lifetype-1.2.5 tags/lifetype-1.2.6"
+	exit -1
+fi
+
+#
+# array with the files that we are going to remove before
+# making the package... Wildcards, complete paths, whatever
+# can be used here
+#
+# NOTE: the exact same list is also maintained in build-svn.sh, please make sure that
+# changes made here also propagated to the other script
+#
+TOREMOVE="include_files release/ locale/unported/ templates/LifeType/ templates/standard-with-plugins/ templates/grey-sf/ templates/plogworld docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module.mis
 c.exe.php class/gallery/getid3/module.misc.iso.php class/gallery/getid3/extension.cache.dbm.php class/gallery/getid3/extension.cache.mysql.php class/gallery/getid3/write.apetag.php class/gallery/getid3/write.id3v1.php class/gallery/getid3/write.id3v2.php class/gallery/getid3/write.lyrics3.php class/gallery/getid3/write.metaflac.php class/gallery/getid3/write.php class/gallery/getid3/write.real.php class/gallery/getid3/write.vorbiscomment.php dbperf.php *.xcode tools/ runtests.php class/test/"
+
+# parameters with the branches
+BRANCH1=$1
+BRANCH2=$2
+
+# create our temporary folder
+WORKFOLDER=`date +%Y%m%d%H%M`
+DESTFOLDER="destination"
+rm -rf $WORKFOLDER
+mkdir $WORKFOLDER
+rm -rf $DESTFOLDER
+mkdir $DESTFOLDER
+
+# checkout the first branch
+echo "Checking out $BRANCH1..."
+svn checkout $SVNSERVER$SVNREPO/$BRANCH1 $WORKFOLDER > /dev/null
+# switch to the second one
+pushd $WORKFOLDER > /dev/null
+echo "Switching to $BRANCH2..."
+REV=`svn switch $SVNSERVER$SVNREPO/$BRANCH2 | tee files | tail -n 1 | cut -d ' ' -f 4 | tr -d . `
+popd > /dev/null
+
+# and remove all unnecessary files
+echo "Removing unnecessary files...";
+for i in $TOREMOVE
+do
+#  echo "  -- removing $i"
+  rm -rf $WORKFOLDER/$i
+done
+
+# remove files that shouldn't be included in upgrades
+rm -f $WORKFOLDER/wizard*
+rm -rf $WORKFOLDER/config/
+
+echo "Generating MD5 hash of files..."
+php $WORKFOLDER/bin-devel/genmd5.php
+
+echo "Copying new or updated files..."
+# need to change this.  We should parse deleted files, and parse
+# this list in order because the same file could have been added
+# and deleted within the time range we are interested in, and
+# the current method will cause errors.
+for i in `grep "^[UA]" $WORKFOLDER/files | grep -v revision | awk '{print $2}'`
+do
+    if [ -f $WORKFOLDER/$i -o -d $WORKFOLDER/$i ]; then
+      echo Keeping: $i
+	  FOLDER=`dirname $i`
+	  mkdir -p $DESTFOLDER/$FOLDER
+	  cp $WORKFOLDER/$i $DESTFOLDER/$FOLDER
+#    else
+#      echo Ignoring: $i
+    fi
+done
+
+# finally, update the version.php file
+echo "Updating the version.php file..."
+VERNAME=`basename ${BRANCH2}`
+echo "<?php" > $DESTFOLDER/version.php
+echo "\$version = \"${VERNAME}_r${REV}\";" >> $DESTFOLDER/version.php
+echo "?>" >> $DESTFOLDER/version.php
+
+# make sure that install/files.properties.php is included
+echo "Moving the updated files.properties.php to the destination package..."
+mkdir -p $DESTFOLDER/install
+cp $WORKFOLDER/install/files.properties.php $DESTFOLDER/install/files.properties.php
+
+# remove temporary folders
+rm -rf $WORKFOLDER
+
+# remove files that shouldn't be included in any release
+rm -rf $DESTFOLDER/bin-devel/
+rm -rf $DESTFOLDER/docs-devel/
+rm -rf $DESTFOLDER/plog.xcode/
+rm -rf $DESTFOLDER/release/
+rm -rf $DESTFOLDER/templates/LifeType
+rm -rf $DESTFOLDER/templates/grey-sf
+rm -rf $DESTFOLDER/templates/plogworld
+
+
+echo "Done! Output available under the $DESTFOLDER/ folder"

Copied: plog/trunk/bin-devel/build-core-nightly.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-core-nightly.sh)
===================================================================
--- plog/trunk/bin-devel/build-core-nightly.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-core-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1 @@
+link build-plugins-nightly.sh
\ No newline at end of file

Deleted: plog/trunk/bin-devel/build-diff.sh
===================================================================
--- plog/trunk/bin-devel/build-diff.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-diff.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,114 +0,0 @@
-#!/bin/sh
-
-# This script is for building upgrade tar files, e.g. contain all the files
-# needed to upgrade a 1.2.5 installation to a 1.2.6 installation.  The
-# wizard is not included, since this script is only for minor upgrades
-
-# where to find the svn repository
-SVNSERVER="http://devel.lifetype.net"
-SVNREPO="/svn/plog/plog"
-
-# check paramters
-if [ $# -ne 2 ]; then
-	echo "Creates a folder with the folders that were added or updated when comparing"
-	echo "two subversion folders or branches"
-	echo " "
-	echo "Usage: $0 branch1 branch2"
-        echo " "
-	echo "Where branch1 and branch2 are two different branches/tags from the repository"
-	echo " "
-	echo "Example:"
-	echo " "
-	echo "    $0 tags/lifetype-1.2.5 tags/lifetype-1.2.6"
-	exit -1
-fi
-
-#
-# array with the files that we are going to remove before
-# making the package... Wildcards, complete paths, whatever
-# can be used here
-#
-# NOTE: the exact same list is also maintained in build-svn.sh, please make sure that
-# changes made here also propagated to the other script
-#
-TOREMOVE="include_files release/ locale/unported/ templates/LifeType/ templates/standard-with-plugins/ templates/grey-sf/ templates/plogworld docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module.mis
 c.exe.php class/gallery/getid3/module.misc.iso.php class/gallery/getid3/extension.cache.dbm.php class/gallery/getid3/extension.cache.mysql.php class/gallery/getid3/write.apetag.php class/gallery/getid3/write.id3v1.php class/gallery/getid3/write.id3v2.php class/gallery/getid3/write.lyrics3.php class/gallery/getid3/write.metaflac.php class/gallery/getid3/write.php class/gallery/getid3/write.real.php class/gallery/getid3/write.vorbiscomment.php dbperf.php *.xcode tools/ runtests.php class/test/"
-
-# parameters with the branches
-BRANCH1=$1
-BRANCH2=$2
-
-# create our temporary folder
-WORKFOLDER=`date +%Y%m%d%H%M`
-DESTFOLDER="destination"
-rm -rf $WORKFOLDER
-mkdir $WORKFOLDER
-rm -rf $DESTFOLDER
-mkdir $DESTFOLDER
-
-# checkout the first branch
-echo "Checking out $BRANCH1..."
-svn checkout $SVNSERVER$SVNREPO/$BRANCH1 $WORKFOLDER > /dev/null
-# switch to the second one
-pushd $WORKFOLDER > /dev/null
-echo "Switching to $BRANCH2..."
-REV=`svn switch $SVNSERVER$SVNREPO/$BRANCH2 | tee files | tail -n 1 | cut -d ' ' -f 4 | tr -d . `
-popd > /dev/null
-
-# and remove all unnecessary files
-echo "Removing unnecessary files...";
-for i in $TOREMOVE
-do
-#  echo "  -- removing $i"
-  rm -rf $WORKFOLDER/$i
-done
-
-# remove files that shouldn't be included in upgrades
-rm -f $WORKFOLDER/wizard*
-rm -rf $WORKFOLDER/config/
-
-echo "Generating MD5 hash of files..."
-php $WORKFOLDER/bin-devel/genmd5.php
-
-echo "Copying new or updated files..."
-# need to change this.  We should parse deleted files, and parse
-# this list in order because the same file could have been added
-# and deleted within the time range we are interested in, and
-# the current method will cause errors.
-for i in `grep "^[UA]" $WORKFOLDER/files | grep -v revision | awk '{print $2}'`
-do
-    if [ -f $WORKFOLDER/$i -o -d $WORKFOLDER/$i ]; then
-      echo Keeping: $i
-	  FOLDER=`dirname $i`
-	  mkdir -p $DESTFOLDER/$FOLDER
-	  cp $WORKFOLDER/$i $DESTFOLDER/$FOLDER
-#    else
-#      echo Ignoring: $i
-    fi
-done
-
-# finally, update the version.php file
-echo "Updating the version.php file..."
-VERNAME=`basename ${BRANCH2}`
-echo "<?php" > $DESTFOLDER/version.php
-echo "\$version = \"${VERNAME}_r${REV}\";" >> $DESTFOLDER/version.php
-echo "?>" >> $DESTFOLDER/version.php
-
-# make sure that install/files.properties.php is included
-echo "Moving the updated files.properties.php to the destination package..."
-mkdir -p $DESTFOLDER/install
-cp $WORKFOLDER/install/files.properties.php $DESTFOLDER/install/files.properties.php
-
-# remove temporary folders
-rm -rf $WORKFOLDER
-
-# remove files that shouldn't be included in any release
-rm -rf $DESTFOLDER/bin-devel/
-rm -rf $DESTFOLDER/docs-devel/
-rm -rf $DESTFOLDER/plog.xcode/
-rm -rf $DESTFOLDER/release/
-rm -rf $DESTFOLDER/templates/LifeType
-rm -rf $DESTFOLDER/templates/grey-sf
-rm -rf $DESTFOLDER/templates/plogworld
-
-
-echo "Done! Output available under the $DESTFOLDER/ folder"

Deleted: plog/trunk/bin-devel/build-nightly.sh
===================================================================
--- plog/trunk/bin-devel/build-nightly.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,42 +0,0 @@
-#!/bin/sh 
-
-# check parameters
-if [ $# -lt 2 ]; then
-    echo "Generates a build and moves it to the specified folder"
-    echo ""
-    echo "Usage: build-nightly.sh label destination-folder"
-    echo ""
-    exit -1
-fi
-
-echo "*** Build: starting process ***"
-date
-echo "***"
-
-SVNTAG=$1
-DESTFOLDER=$2
-BINPATH=/home/oscar/plog-devel/bin-devel
-
-pwd
-echo $DESTFOLDER
-echo $SVNTAG
-
-# make the package
-cd $BINPATH
-$BINPATH/build-svn.sh $SVNTAG
-
-# move the file to the destination folder
-PACKAGENAME=lifetype-devel-`date +%Y%m%d`
-mv -f $BINPATH/$PACKAGENAME.zip $DESTFOLDER
-
-# remove everything else
-rm -f $BINPATH/$PACKAGENAME.zip
-rm -f $BINPATH/$PACKAGENAME.tar.gz
-rm -f $BINPATH/$PACKAGENAME.tar.bz2
-
-# make the softlink
-rm $DESTFOLDER/lifetype-devel-latest.zip
-ln -s $DESTFOLDER/$PACKAGENAME.zip $DESTFOLDER/lifetype-devel-latest.zip 
-
-echo "*** Build: Nightly build complete!"
-echo "*** Build: build result available in $DESTFOLDER/$PACKAGENAME.zip"

Copied: plog/trunk/bin-devel/build-plugin-local.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-plugin-local.sh)
===================================================================
--- plog/trunk/bin-devel/build-plugin-local.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-plugin-local.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+set -e
+set -u
+
+TYPE=`basename $0 | cut -f2 -d-`
+
+#
+# Script to generate distribution builds of LifeType
+#
+# (c) 27-08-2004, the LifeType Team
+
+#
+# array with the files that we are going to remove before
+# making the package... Wildcards, complete paths, whatever
+# can be used here
+#
+TOREMOVE="unported/ bin/"
+WORKFOLDER="/tmp/"
+
+#sourceforge wants all unique filenames.  So
+# we code them with a version number.  ugh.
+VERSION="1.2"
+
+#
+# helper functions to print things in different colors
+#
+NOCOLOR='\e[0m'
+message()
+{
+ echo -e "\033[01;32m$*$NOCOLOR"
+}
+
+warning()
+{
+ echo -e "\033[01;33m$*$NOCOLOR"
+}
+
+error()
+{
+ echo -e "\033[01;31m$*$NOCOLOR"
+}
+
+# check parameters
+if [ $# -lt 1 ]; then
+    echo "Makes a zip package of a given $TYPE"
+    echo ""
+	echo "Usage: $0 [noupload] <$TYPE name>"
+	echo ""
+	echo "Use 'all' in order to generate a package of all the ${TYPE}s"
+	exit -1
+fi
+
+# get the name of the object that we're trying to build
+if [ "${1:-}" == "noupload" ]; then
+  message "Building, not uploading";
+  UPLOAD=""
+  NAME=$2
+else
+  message "Building and uploading, please type your sourceforge username"
+  read UPLOAD
+  if [ "${UPLOAD:-}" == "" ]; then
+    error "A sourceforge username is required to upload, or else use 'noupload'."
+    exit
+  fi
+  NAME=$1
+fi
+
+# a temporary working folder like any other...
+TMPFOLDER=${WORKFOLDER}`date | md5`
+CURFOLDER=`pwd`
+
+# export the current folder
+message "Exporting folder..."
+svn export . $TMPFOLDER
+
+# remove whatever we don't need
+message "Removing unnecessary files...";
+for i in ${TOREMOVE}
+do
+  message "  -- removing $i"
+  rm -rf ${TMPFOLDER}/$i
+done
+
+# build the correct template package, or all of them if that's what we were requested to do...
+cd $TMPFOLDER
+message "Creating ZIP package..."
+if [ $NAME == "all" ]; then
+    NAME=all_${TYPE}s
+    zip -qr ${CURFOLDER}/${VERSION}_${NAME}.zip .
+else
+	zip -r ${CURFOLDER}/${VERSION}_${NAME}.zip $NAME
+fi
+
+if [ "$UPLOAD" != "" ]; then
+  # upload the package.
+  scp ${CURFOLDER}/${VERSION}_${NAME}.zip ${UPLOAD},lifetype at frs.sourceforge.net:/home/frs/project/l/li/lifetype/lifetype-${TYPE}s/lifetype-${VERSION}/${VERSION}_${NAME}.zip
+fi
+
+message "Done!"
+
+# cleanup
+rm -rf $TMPFOLDER

Copied: plog/trunk/bin-devel/build-plugins-all-svn.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-plugins-all-svn.sh)
===================================================================
--- plog/trunk/bin-devel/build-plugins-all-svn.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-plugins-all-svn.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,112 @@
+
+#!/bin/bash
+
+# Script to generate distribution builds of LifeType
+#
+# (c) 27-08-2004, the LifeType Team
+#
+#
+# Requires two parameters: the name of the output package and the
+# CVS tag label that will be used to fetch the contents of the build. Therefore,
+# contents must be tagged _before_ running this script. 
+# The same CVS label must be used for both the plog_devel and plog_docs module.
+#
+
+TYPE=`basename $0 | cut -f2 -d-`
+
+#
+# server and repository path
+#
+SVNSERVER=http://devel.lifetype.net
+SVNREPO=/svn/plog/$TYPE
+
+#
+# array with the files that we are going to remove before
+# making the package... Wildcards, complete paths, whatever
+# can be used here
+# NOTE: When changing this list, update the list in build-diff.sh as well
+
+TOREMOVE="unported/ bin/"
+
+#
+# helper functions to print things in different colors
+#
+NOCOLOR='\e[0m'
+message()
+{
+ echo -e "\033[01;32m$*$NOCOLOR"
+}
+
+warning()
+{
+ echo -e "\033[01;33m$*$NOCOLOR"
+}
+
+error()
+{
+ echo -e "\033[01;31m$*$NOCOLOR"
+}
+
+# check parameters
+if [ $# -lt 1 ]; then
+    echo "Makes a build off the latest SVN source code and packages it"
+    echo ""
+	echo "Usage: $0 label package-name"
+	echo ""
+	echo "If package-name is omitted, the name will be lifetype-$TYPE-<current_date>"
+	echo ""
+	echo "Use HEAD or TRUNK to indicate the main development branch"
+    echo ""
+    echo "Example:"
+    echo ""
+    echo "    $0 branches/lifetype-1.2 lifetype-1.2"
+	exit -1
+fi
+
+SVNTAG=$1
+
+# if there was no package name parameter, then build one using the current date
+if [ $# -eq 1 ]; then
+    PACKAGENAME=lifetype-$TYPE-`date +%Y%m%d`
+else
+    PACKAGENAME=$2
+fi
+
+message "Using $PACKAGENAME as the package name"
+WORKDIR=`basename $PACKAGENAME`
+BUILDLABEL=`basename $PACKAGENAME`
+
+# determine whether code should be fetched from 
+# plog/trunk or plog/tags/xxxx
+if [ $SVNTAG == "HEAD" -o $SVNTAG == "TRUNK" -o $SVNTAG == "head" -o $SVNTAG == "trunk" ]; then
+   SVNREPO=${SVNREPO}/trunk
+else
+   SVNREPO=${SVNREPO}/${SVNTAG}
+fi
+
+# call the svn command with the correct parameters
+message "Fetching the source code using $SVNTAG label..."
+REV=`svn export $SVNSERVER$SVNREPO $WORKDIR | tail -n 1 | awk '{print $NF}' | tr -d . `
+if [ $? -eq 1 ]; then
+    echo "There was an error fetching the source code. Please try again."
+    exit 1
+fi
+
+# and remove all unnecessary files
+message "Removing unnecessary files...";
+for i in $TOREMOVE
+do
+  echo "  -- removing $i"
+  rm -rf $WORKDIR/$i
+done
+
+# and create the .zip, tar.gz and .tar.bz2 packages
+message "Creating .zip package..."
+zip $BUILDLABEL.zip -r $WORKDIR  > /dev/null
+
+# clean up the temporary folders
+message "Cleaning up..."
+rm -rf $WORKDIR
+
+# done!
+message "Done!"

Deleted: plog/trunk/bin-devel/build-plugins-nightly.sh
===================================================================
--- plog/trunk/bin-devel/build-plugins-nightly.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-plugins-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,42 +0,0 @@
-#!/bin/sh 
-
-# check parameters
-if [ $# -lt 2 ]; then
-    echo "Generates a build of all plugins and moves it to the specified folder"
-    echo ""
-    echo "Usage: build-plugins-nightly.sh label destination-folder"
-    echo ""
-    exit -1
-fi
-
-echo "*** Build plugins: starting process ***"
-date
-echo "***"
-
-SVNTAG=$1
-DESTFOLDER=$2
-BINPATH=/home/oscar/plog-devel/bin-devel
-
-pwd
-echo $DESTFOLDER
-echo $SVNTAG
-
-# make the package
-cd $BINPATH
-$BINPATH/build-plugins.sh $SVNTAG
-
-# move the file to the destination folder
-PACKAGENAME=lifetype-plugins-`date +%Y%m%d`
-mv -f $BINPATH/$PACKAGENAME.zip $DESTFOLDER
-
-# remove everything else
-rm -f $BINPATH/$PACKAGENAME.zip
-rm -f $BINPATH/$PACKAGENAME.tar.gz
-rm -f $BINPATH/$PACKAGENAME.tar.bz2
-
-# make the softlink
-rm $DESTFOLDER/lifetype-plugins-latest.zip
-ln -s $DESTFOLDER/$PACKAGENAME.zip $DESTFOLDER/lifetype-plugins-latest.zip 
-
-echo "*** Build: Nightly build complete!"
-echo "*** Build: build result available in $DESTFOLDER/$PACKAGENAME.zip"

Copied: plog/trunk/bin-devel/build-plugins-nightly.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-plugins-nightly.sh)
===================================================================
--- plog/trunk/bin-devel/build-plugins-nightly.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-plugins-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,51 @@
+#!/bin/sh 
+
+set -e
+set -u
+
+TYPE=`basename $0 | cut -f2 -d-`
+
+# check parameters
+if [ $# -lt 2 ]; then
+    echo "Generates a $TYPE build and moves it to the specified folder"
+    echo ""
+    echo "Usage: $0 label destination-folder"
+    echo ""
+    echo "Example:"
+    echo ""
+    echo "    $0 branches/lifetype-1.2 lifetype-1.2"
+    echo "    $0 trunk lifetype-trunk"
+    exit -1
+fi
+
+SVNTAG=$1
+DESTFOLDER=$2
+BINPATH=`dirname $0`
+if [ ${BINPATH:0:1} != "/" ]; then
+  BINPATH=`pwd`/$BINPATH
+fi
+CLEANSVNTAG=`echo -n $SVNTAG | tr -c "[:alnum:]." "-"`
+PACKAGENAME=$TYPE-$CLEANSVNTAG-`date +%Y%m%d`
+
+echo "*** Build: starting process for $SVNTAG ***"
+echo "Destination: $DESTFOLDER/$PACKAGENAME"
+date
+echo "***"
+
+# make the package
+mkdir -p $DESTFOLDER
+pushd $DESTFOLDER > /dev/null
+$BINPATH/build-$TYPE-all-svn.sh $SVNTAG $PACKAGENAME
+
+# remove everything else (only needed for the build-core-all-svn.sh script)
+rm -f $PACKAGENAME.tar.gz
+rm -f $PACKAGENAME.tar.bz2
+rm -f lifetype.xml
+
+# make the softlink
+rm -f $TYPE-$CLEANSVNTAG-latest.zip
+ln -s $PACKAGENAME.zip $TYPE-$CLEANSVNTAG-latest.zip 
+popd > /dev/null
+
+echo "*** Build: Nightly build complete!"
+echo "*** Build: build result available in $DESTFOLDER/$PACKAGENAME.zip"

Deleted: plog/trunk/bin-devel/build-plugins.sh
===================================================================
--- plog/trunk/bin-devel/build-plugins.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-plugins.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-# server and repository path
-#
-SVNSERVER=http://devel.lifetype.net
-SVNREPO=/svn/plog/plugins/
-
-#
-# folders that should not be included. Please add here any plugin that should be removed from
-# the final package!
-#
-DONOTINCLUDE="bin/ unported/"
-
-#
-# helper functions to print things in different colors
-#
-NOCOLOR='\e[0m'
-message()
-{
- echo -e "\033[01;32m$*$NOCOLOR"
-}
-
-warning()
-{
- echo -e "\033[01;33m$*$NOCOLOR"
-}
-
-error()
-{
- echo -e "\033[01;31m$*$NOCOLOR"
-}
-
-cleanup_exit()
-{
-	rm -rf $WORKDIR
-	rm -rf $WORKDIR-docs
-	exit $1
-}
-
-# check parameters
-if [ $# -lt 1 ]; then
-    echo "Makes a build off the latest SVN source code and packages it"
-    echo ""
-	echo "Usage: build-plugins.sh label package-name"
-	echo ""
-	echo "If package-name is omitted, the name will plog-plugins-current_date"
-	exit -1
-fi
-
-SVNTAG=$1
-
-# if there was no package name parameter, then build one using the current date
-if [ $# -eq 1 ]; then
-    PACKAGENAME=lifetype-plugins-`date +%Y%m%d`
-else
-    PACKAGENAME=$2
-fi
-
-message "Using $PACKAGENAME as the package name"
-WORKDIR=$PACKAGENAME
-BUILDLABEL=$PACKAGENAME
-
-# call the cvs command with the correct parameters
-message "Fetching the templates using $SVNTAG label..."
-svn checkout $SVNSERVER$SVNREPO/$SVNTAG $WORKDIR
-
-if [ $? -eq 1 ]; then
-    echo "There was an error fetching the plugins source code. Please try again."
-    exit 1
-fi
-
-# remove all the annoying SVN/ folders
-message "Removing unneeded SVN folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-
-# and remove all unnecessary files
-message "Removing unnecessary files...";
-for i in $DONOTINCLUDE
-do
-  message "  -- removing $i"
-  rm -rf $WORKDIR/$i
-done
-
-# and create the tar.gz and .tar.bz2 packages
-message "Creating .zip package..."
-zip -r $BUILDLABEL.zip $WORKDIR > /dev/null
-message "Creating .tar.gz package..."
-tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null
-message "Creating .tar.bz2 package..."
-tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null
-
-# remove all the annoying CVS/ folders
-message "Removing unneeded folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-find $WORKDIR/ -name ".DS_Store" -exec rm -rf '{}' \; >& /dev/null
-
-message "Done!"
-
-cleanup_exit -1

Deleted: plog/trunk/bin-devel/build-svn.sh
===================================================================
--- plog/trunk/bin-devel/build-svn.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-svn.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,200 +0,0 @@
-
-#!/bin/bash
-
-# Script to generate distribution builds of LifeType
-#
-# (c) 27-08-2004, the LifeType Team
-#
-#
-# Requires two parameters: the name of the output package and the
-# CVS tag label that will be used to fetch the contents of the build. Therefore,
-# contents must be tagged _before_ running this script. 
-# The same CVS label must be used for both the plog_devel and plog_docs module.
-#
-
-#
-# server and repository path
-#
-SVNSERVER=http://devel.lifetype.net
-SVNREPO=/svn/plog/plog
-
-#
-# array with the files that we are going to remove before
-# making the package... Wildcards, complete paths, whatever
-# can be used here
-# NOTE: When changing this list, update the list in build-diff.sh as well
-
-TOREMOVE="include_files release/ locale/unported/ templates/LifeType/ templates/standard-with-plugins/ templates/grey-sf/ templates/plogworld docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module.mis
 c.exe.php class/gallery/getid3/module.misc.iso.php class/gallery/getid3/extension.cache.dbm.php class/gallery/getid3/extension.cache.mysql.php class/gallery/getid3/write.apetag.php class/gallery/getid3/write.id3v1.php class/gallery/getid3/write.id3v2.php class/gallery/getid3/write.lyrics3.php class/gallery/getid3/write.metaflac.php class/gallery/getid3/write.php class/gallery/getid3/write.real.php class/gallery/getid3/write.vorbiscomment.php dbperf.php *.xcode tools/ runtests.php class/test/"
-
-#
-# helper functions to print things in different colors
-#
-NOCOLOR='\e[0m'
-message()
-{
- echo -e "\033[01;32m$*$NOCOLOR"
-}
-
-warning()
-{
- echo -e "\033[01;33m$*$NOCOLOR"
-}
-
-error()
-{
- echo -e "\033[01;31m$*$NOCOLOR"
-}
-
-cleanup_exit()
-{
-	rm -rf $WORKDIR
-	rm -rf $WORKDIR-docs
-	exit $1
-}
-
-find_phpcli()
-{
-    if [ -x /usr/bin/php5 ]; then
-        PHP=/usr/bin/php5
-    else
-        PHP=/usr/bin/php
-    fi
-}
-
-# check parameters
-if [ $# -lt 1 ]; then
-    echo "Makes a build off the latest SVN source code and packages it"
-    echo ""
-	echo "Usage: build-svn.sh label package-name"
-	echo ""
-	echo "If package-name is omitted, the name will lifetype-devel-current_date"
-	echo ""
-	echo "Use HEAD or TRUNK to indicate the main development branch"
-    echo ""
-    echo "Example:"
-    echo ""
-    echo "    $0 tags/lifetype-1.2.6 lifetype-1.2.6"
-	exit -1
-fi
-
-SVNTAG=$1
-
-# if there was no package name parameter, then build one using the current date
-if [ $# -eq 1 ]; then
-    PACKAGENAME=lifetype-devel-`date +%Y%m%d`
-else
-    PACKAGENAME=$2
-fi
-
-message "Using $PACKAGENAME as the package name"
-WORKDIR=`basename $PACKAGENAME`
-BUILDLABEL=`basename $PACKAGENAME`
-
-# determine whether code should be fetched from 
-# plog/trunk or plog/tags/xxxx
-if [ $SVNTAG == "HEAD" -o $SVNTAG == "TRUNK" -o $SVNTAG == "head" -o $SVNTAG == "trunk" ]; then
-   SVNREPO=${SVNREPO}/trunk
-else
-   SVNREPO=${SVNREPO}/${SVNTAG}
-fi
-
-# call the cvs command with the correct parameters
-message "Fetching the source code using $SVNTAG label..."
-REV=`svn checkout $SVNSERVER$SVNREPO $WORKDIR | tail -n 1 | cut -d ' ' -f 4 | tr -d . `
-
-if [ $? -eq 1 ]; then
-    echo "There was an error fetching the source code. Please try again."
-    exit 1
-fi
-
-# create the temp folder and give proper permissions to it
-message "Creating the temporary folders and setting permissions to 777..."
-if [ \! -d $WORKDIR/tmp ]; then
-	mkdir $WORKDIR/tmp
-fi
-chmod 777 $WORKDIR/tmp
-
-# create the gallery/ folder and make sure that it has the right permissions
-message "Creating the gallery/ folder and setting permissions to 777..."
-if [ \! -d $WORKDIR/gallery ]; then
-	mkdir $WORKDIR/gallery
-fi
-chmod 777 $WORKDIR/gallery
-
-# copy the generic config file and remove the dist/ folder since it is not needed
-message "Copying the generic config.properties.file..."
-cp -f $WORKDIR/release/config.properties.php.dist $WORKDIR/config/config.properties.php
-cp -f $WORKDIR/release/logging.properties.php.dist $WORKDIR/config/logging.properties.php
-cp -f $WORKDIR/release/cache.properties.php.dist $WORKDIR/config/cache.properties.php
-cp -f $WORKDIR/release/userdata.properties.php.dist $WORKDIR/config/userdata.properties.php
-rm -rf $WORKDIR/release
-
-# regular users want to use the wizard
-mv $WORKDIR/wizard $WORKDIR/wizard.php
-
-# update the version.php file
-message "Updating the version.php file..."
-VERNAME=`basename ${SVNTAG}`
-echo "<?php" > $WORKDIR/version.php
-echo "\$version = \"${VERNAME}_r${REV}\";" >> $WORKDIR/version.php
-echo "?>" >> $WORKDIR/version.php
-
-# remove all the annoying CVS/ folders
-message "Removing unneeded SVN folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-
-# and remove all unnecessary files
-message "Removing unnecessary files...";
-for i in $TOREMOVE
-do
-  message "  -- removing $i"
-  rm -rf $WORKDIR/$i
-done
-
-# generate install/file.properties.php with the MD5 hashes of most core files
-find_phpcli
-message "Generating MD5 hashes (using $PHP)..."
-$PHP $WORKDIR/bin-devel/genmd5.php
-# remove the bin-devel/ folder, we don't need it anymore
-rm -rf $WORKDIR/bin-devel
-
-# and create the .zip, tar.gz and .tar.bz2 packages
-message "Creating .zip package..."
-zip $BUILDLABEL.zip -r $WORKDIR  > /dev/null
-message "Creating .tar.gz package..."
-tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null
-message "Creating .tar.bz2 package..."
-tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null
-
-
-# calculate branche and version
-LTBRANCHE=`echo $VERNAME | sed 's_lifetype-\(.*\..*\)\.\(.*\)_\1_'`
-LTVERSION=`echo $VERNAME | sed 's_lifetype-\(.*\)_\1_'`
-
-# create the lifetype core version feed xml file
-echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>
-<rss version=\"2.0\" xmlns:lt=\"http://www.lifetype.net\">
-<channel>
-<title>Lifetype version feed</title>
-<link>http://www.lifetype.net</link>
-<description>This feed contains the latest Lifetype version available</description>
-<item>
-<title>lifetype-${LTVERSION}_r${REV}</title>
-<link>http://downloads.sourceforge.net/lifetype/lifetype-${LTVERSION}.zip</link>
-<author>The Lifetype project</author>
-<description>Lifetype ${LTVERSION}</description>
-<lt:version>${LTVERSION}_r${REV}</lt:version>
-<lt:development>0</lt:development>
-<lt:branch>${LTBRANCHE}</lt:branch>
-<lt:relnotes>http://wiki.lifetype.net/index.php/Release_notes_Lifetype_${LTVERSION}</lt:relnotes>
-</item>
-</channel>
-</rss>" > lifetype.xml
-
-
-# clean up the temporary folders
-message "Cleaning up..."
-cleanup_exit -1
-
-# done!
-message "Done!"

Deleted: plog/trunk/bin-devel/build-svn2.sh
===================================================================
--- plog/trunk/bin-devel/build-svn2.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-svn2.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,131 +0,0 @@
-#!/bin/sh
-
-#
-# Oscar's script to generate distribution builds of pLog - everyone else should use build-svn.sh
-#
-# (c) 27-08-2004, the pLog Team
-#
-#
-# Requires two parameters: the name of the output package and the
-# CVS tag label that will be used to fetch the contents of the build. Therefore,
-# contents must be tagged _before_ running this script. 
-# The same CVS label must be used for both the plog_devel and plog_docs module.
-#
-
-#
-# array with the files that we are going to remove before
-# making the package... Wildcards, complete paths, whatever
-# can be used here
-#
-TOREMOVE="include_files release/ locale/old/ templates/standard-with-plugins/ templates/grey-sf/ templates/default templates/plogworld bin-devel/ docs-devel/ class/gallery/getid3/module.archive.rar.php class/gallery/getid3/module.archive.szip.php class/gallery/getid3/module.audio-video.bink.php class/gallery/getid3/module.audio-video.matroska.php class/gallery/getid3/module.audio-video.nsv.php class/gallery/getid3/module.audio.avr.php class/gallery/getid3/module.audio.bonk.php class/gallery/getid3/module.audio.la.php class/gallery/getid3/module.audio.lpac.php class/gallery/getid3/module.audio.monkey.php class/gallery/getid3/module.audio.optimfrog.php class/gallery/getid3/module.audio.rkau.php class/gallery/getid3/module.audio.shorten.php class/gallery/getid3/module.audio.tta.php class/gallery/getid3/module.audio.voc.php class/gallery/getid3/module.audio.vqf.php class/gallery/getid3/module.graphic.bmp.php class/gallery/getid3/module.graphpc.pcd.php class/gallery/getid3/module
 .misc.exe.php class/gallery/getid3/module.misc.iso.php dbperf.php locale/locale_en_US.php *.xcode tools/ locale/locale_it_IT.php"
-
-#
-# helper functions to print things in different colors
-#
-NOCOLOR='\e[0m'
-message()
-{
- echo -e "\033[01;32m$*$NOCOLOR"
-}
-
-warning()
-{
- echo -e "\033[01;33m$*$NOCOLOR"
-}
-
-error()
-{
- echo -e "\033[01;31m$*$NOCOLOR"
-}
-
-cleanup_exit()
-{
-	rm -rf $WORKDIR
-	rm -rf $WORKDIR-docs
-	exit $1
-}
-
-# check parameters
-if [ $# -lt 1 ]; then
-    echo "Makes a build off the latest SVN source code and packages it"
-    echo ""
-	echo "Usage: build-svn2.sh label package-name"
-	echo ""
-	echo "If package-name is omitted, the name will plog-devel-current_date"
-	exit -1
-fi
-
-SVNTAG=$1
-
-# if there was no package name parameter, then build one using the current date
-if [ $# -eq 1 ]; then
-    PACKAGENAME=plog-devel-`date +%Y%m%d`
-else
-    PACKAGENAME=$2
-fi
-
-message "Using $PACKAGENAME as the package name"
-WORKDIR=$PACKAGENAME
-BUILDLABEL=$PACKAGENAME
-
-# call the cvs command with the correct parameters
-message "Exporting the source code..."
-svn export /Users/oscar/Sites/plog/plog $WORKDIR
-
-if [ $? -eq 1 ]; then
-    echo "There was an error fetching the source code. Please try again."
-    exit 1
-fi
-
-# create the temp folder and give proper permissions to it
-message "Creating the temporary folders and setting permissions to 777..."
-if [ \! -d $WORKDIR/tmp ]; then
-	mkdir $WORKDIR/tmp
-fi
-chmod 777 $WORKDIR/tmp
-
-# create the gallery/ folder and make sure that it has the right permissions
-message "Creating the gallery/ folder and setting permissions to 777..."
-if [ \! -d $WORKDIR/gallery ]; then
-	mkdir $WORKDIR/gallery
-fi
-chmod 777 $WORKDIR/gallery
-
-# copy the generic config file and remove the dist/ folder since it is not needed
-message "Copying the generic config.properties.file..."
-cp -f $WORKDIR/release/config.properties.php.dist $WORKDIR/config/config.properties.php
-rm -rf $WORKDIR/dist
-
-# regular users want to use the wizard
-mv $WORKDIR/wizard $WORKDIR/wizard.php
-
-# finally, update the version.php file
-message "Updating the version.php file..."
-echo "<?php" > $WORKDIR/version.php
-echo "\$version = \"$CVSTAG\";" >> $WORKDIR/version.php
-echo "?>" >> $WORKDIR/version.php
-
-# remove all the annoying CVS/ folders
-message "Removing unneeded SVN folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-
-# and remove all unnecessary files
-message "Removing unnecessary files...";
-for i in $TOREMOVE
-do
-  message "  -- removing $i"
-  rm -rf $WORKDIR/$i
-done
-
-# and create the tar.gz and .tar.bz2 packages
-message "Creating .tar.gz package..."
-tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null
-message "Creating .tar.bz2 package..."
-tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null
-
-# clean up the temporary folders
-message "Cleaning up..."
-cleanup_exit -1
-
-# done!
-message "Done!"

Copied: plog/trunk/bin-devel/build-template-local.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-template-local.sh)
===================================================================
--- plog/trunk/bin-devel/build-template-local.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-template-local.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1 @@
+link build-plugin-local.sh
\ No newline at end of file

Copied: plog/trunk/bin-devel/build-templates-all-svn.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-templates-all-svn.sh)
===================================================================
--- plog/trunk/bin-devel/build-templates-all-svn.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-templates-all-svn.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1 @@
+link build-plugins-all-svn.sh
\ No newline at end of file

Deleted: plog/trunk/bin-devel/build-templates-nightly.sh
===================================================================
--- plog/trunk/bin-devel/build-templates-nightly.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-templates-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,42 +0,0 @@
-#!/bin/sh 
-
-# check parameters
-if [ $# -lt 2 ]; then
-    echo "Generates a build of all templates and moves it to the specified folder"
-    echo ""
-    echo "Usage: build-templates-nightly.sh label destination-folder"
-    echo ""
-    exit -1
-fi
-
-echo "*** Build templates: starting process ***"
-date
-echo "***"
-
-SVNTAG=$1
-DESTFOLDER=$2
-BINPATH=/home/oscar/plog-devel/bin-devel
-
-pwd
-echo $DESTFOLDER
-echo $SVNTAG
-
-# make the package
-cd $BINPATH
-$BINPATH/build-templates.sh $SVNTAG
-
-# move the file to the destination folder
-PACKAGENAME=lifetype-templates-`date +%Y%m%d`
-mv -f $BINPATH/$PACKAGENAME.zip $DESTFOLDER
-
-# remove everything else
-rm -f $BINPATH/$PACKAGENAME.zip
-rm -f $BINPATH/$PACKAGENAME.tar.gz
-rm -f $BINPATH/$PACKAGENAME.tar.bz2
-
-# make the softlink
-rm $DESTFOLDER/lifetype-templates-latest.zip
-ln -s $DESTFOLDER/$PACKAGENAME.zip $DESTFOLDER/lifetype-templates-latest.zip 
-
-echo "*** Build: Nightly build complete!"
-echo "*** Build: build result available in $DESTFOLDER/$PACKAGENAME.zip"

Copied: plog/trunk/bin-devel/build-templates-nightly.sh (from rev 6933, plog/branches/lifetype-1.2/bin-devel/build-templates-nightly.sh)
===================================================================
--- plog/trunk/bin-devel/build-templates-nightly.sh	                        (rev 0)
+++ plog/trunk/bin-devel/build-templates-nightly.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1 @@
+link build-plugins-nightly.sh
\ No newline at end of file

Deleted: plog/trunk/bin-devel/build-templates.sh
===================================================================
--- plog/trunk/bin-devel/build-templates.sh	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/bin-devel/build-templates.sh	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,100 +0,0 @@
-#!/bin/sh
-
-#
-# server and repository path
-#
-SVNSERVER=http://devel.lifetype.net
-SVNREPO=/svn/plog/templates/
-
-#
-# folders that should not be included. Please add here any plugin that should be removed from
-# the final package!
-#
-DONOTINCLUDE="bin/ unported/ base/"
-
-#
-# helper functions to print things in different colors
-#
-NOCOLOR='\e[0m'
-message()
-{
- echo -e "\033[01;32m$*$NOCOLOR"
-}
-
-warning()
-{
- echo -e "\033[01;33m$*$NOCOLOR"
-}
-
-error()
-{
- echo -e "\033[01;31m$*$NOCOLOR"
-}
-
-cleanup_exit()
-{
-	rm -rf $WORKDIR
-	rm -rf $WORKDIR-docs
-	exit $1
-}
-
-# check parameters
-if [ $# -lt 1 ]; then
-    echo "Makes a build off the latest SVN source code and packages it"
-    echo ""
-	echo "Usage: build-templates.sh label package-name"
-	echo ""
-	echo "If package-name is omitted, the name will plog-plugins-current_date"
-	exit -1
-fi
-
-SVNTAG=$1
-
-# if there was no package name parameter, then build one using the current date
-if [ $# -eq 1 ]; then
-    PACKAGENAME=lifetype-templates-`date +%Y%m%d`
-else
-    PACKAGENAME=$2
-fi
-
-message "Using $PACKAGENAME as the package name"
-WORKDIR=$PACKAGENAME
-BUILDLABEL=$PACKAGENAME
-
-# call the cvs command with the correct parameters
-message "Fetching the templates using $SVNTAG label..."
-svn checkout $SVNSERVER$SVNREPO/$SVNTAG $WORKDIR
-
-if [ $? -eq 1 ]; then
-    echo "There was an error fetching the templates from the repository. Please try again."
-    exit 1
-fi
-
-# remove all the annoying SVN/ folders
-message "Removing unneeded SVN folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-
-# and remove all unnecessary files
-message "Removing unnecessary files...";
-for i in $DONOTINCLUDE
-do
-  message "  -- removing $i"
-  rm -rf $WORKDIR/$i
-done
-
-# and create the tar.gz and .tar.bz2 packages
-message "Creating .zip package..."
-zip -r $BUILDLABEL.zip $WORKDIR > /dev/null
-message "Creating .tar.gz package..."
-tar czvf $BUILDLABEL.tar.gz $WORKDIR > /dev/null
-message "Creating .tar.bz2 package..."
-tar cjvf $BUILDLABEL.tar.bz2 $WORKDIR > /dev/null
-
-# remove all the annoying CVS/ folders
-message "Removing unneeded folders..."
-find $WORKDIR/ -name ".svn" -exec rm -rf '{}' \; >& /dev/null
-find $WORKDIR/ -name ".DS_Store" -exec rm -rf '{}' \; >& /dev/null
-
-message "Done!"
-
-cleanup_exit -1


Property changes on: plog/trunk/bin-devel/genmd5.php
___________________________________________________________________
Deleted: svn:executable
   - *

Copied: plog/trunk/bin-devel/genpluginfeeds.php (from rev 6933, plog/branches/lifetype-1.2/bin-devel/genpluginfeeds.php)
===================================================================
--- plog/trunk/bin-devel/genpluginfeeds.php	                        (rev 0)
+++ plog/trunk/bin-devel/genpluginfeeds.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,194 @@
+<?php
+
+/**
+ * Please change this before running this file
+ */
+define( "PLOG_CLASS_PATH", "/home/lifetype/www/" );
+
+/**
+ * current LT version
+ */
+define( "LIFETYPE_VERSION", "1.2" );
+
+include_once( PLOG_CLASS_PATH."class/bootstrap.php" );
+lt_include( PLOG_CLASS_PATH."class/misc/glob.class.php" );
+lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
+
+class SvnRepository
+{
+	var $_url;
+	
+	function SvnRepository( $url )
+	{
+		$this->_url = $url;
+	}
+	
+	function getUrl()
+	{
+		return( $this->_url );
+	}
+}
+
+class SvnClient 
+{
+	var $_r;
+	
+	function SvnClient( $repository )
+	{
+		$this->_r = $repository;
+		
+		$this->_svn = $this->_findSvnClient();
+	}
+	
+	/**
+	 * @private
+	 */
+	function _findSvnClient()
+	{
+		$folders = Array(
+			"/usr/bin/svn",
+			"/usr/local/bin/svn"
+		);
+		
+		foreach( $folders as $path ) {
+			if( File::isReadable( $path )) 
+				return( $path );
+		}
+		
+		return( "svn" );
+	}
+	
+	function checkOut( $path, $dest = "" )
+	{
+		$cmd = $this->_svn." co ".$this->_r->getUrl().$path." ".$dest;
+		
+		$result = exec( $cmd, $output, $code );
+		
+		return( $code == 0 );
+	}
+	
+	function export( $path, $dest = "" )
+	{
+		$cmd = $this->_svn." export ".$this->_r->getUrl().$path." ".$dest;
+		
+		$result = exec( $cmd, $output, $code );
+		
+		return( $code == 0 );		
+	}
+}
+
+class PluginFeedWriter
+{
+	var $_dest;
+	
+	function PluginFeedWriter( $dest )
+	{
+		$this->_dest = $dest;
+		
+		// open the file
+		$this->_out = new File( $this->_dest );
+		$this->_out->open( "w+" );
+	}
+	
+	function open()
+	{
+		// header
+		$this->_out->write( "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>\n");
+		$this->_out->write( "<rss version=\"2.0\" xmlns:lt=\"http://www.lifetype.net\">\n" );
+		$this->_out->write( "<channel>\n");
+		$this->_out->write( "<title>Lifetype plugin feed</title>\n" );
+		$this->_out->write( "<link>http://www.lifetype.net</link>\n" );
+		$this->_out->write( "<description>This feed lists all the plugins available, their version and download link</description>\n" );		
+	}
+	
+	function writePluginInfo( $plugin, $data )
+	{
+		$this->_out->write( "<item>\n" );
+		$this->_out->write( "<title>".$plugin."</title>\n" );
+		$this->_out->write( "<link>".$data["url"]."</link>\n" );
+		$this->_out->write( "<author>".htmlentities($data["author"])."</author>\n" );
+		$this->_out->write( "<description>".$data["description"]."</description>\n" );
+		$this->_out->write( "<lt:version>".$data["version"]."</lt:version>\n" );
+		$this->_out->write( "</item>\n" );		
+	}
+	
+	function close()
+	{
+		$this->_out->write( "</channel>\n" );
+		$this->_out->write( "</rss>\n" );
+		$this->_out->close();		
+	}
+}
+
+// check that the amount of parameters is correct
+if( count( $argv ) < 3 ) {
+	die( "Usage: genpluginfeeds.php svnfolder destfile\n" );
+}
+
+// get the data from the command line
+$svnFolder = $argv[1];
+$feedFile = $argv[2];
+$workFolder = "/home/lifetype/tmp/feeds/";
+File::deleteDir($workFolder, true);
+
+// use svn to check files out
+$repo = new SvnRepository( "http://devel.lifetype.net/svn/plog" );
+$svn = new SvnClient( $repo );
+if( !$svn->checkOut( $svnFolder, $workFolder )) {
+    File::deleteDir($workFolder, true);
+	die("There was a problem while checking out data from the Subversion repository" );
+}
+
+// intialize the feed writer
+$w = new PluginFeedWriter( $feedFile );
+$w->open();
+
+$glob = new Glob();
+$files = $glob->Glob($workFolder);
+foreach( $files as $file ) {
+	// get the plugin name
+	$pluginName = basename( $file );
+	
+	// ignore those that are not folders, the 'unported' folder and some more
+	if( !is_dir( $file ) || $pluginName == "unported" || $pluginName == "bin" )
+		continue;
+	
+	// load the plugin file and try to extract some information from it...
+	$f = new File( $file."/plugin{$pluginName}.class.php" );
+	$f->open( "r" );
+
+	$contents = $f->readFile();
+	
+	// try to find the 'version' lines
+	$found = false;
+	$i = 0;
+	$version = "";
+	while( !$found && $i < count( $contents )) {
+		if( $res = preg_match( '/\$this->version *= *["\'](.*)["\'];/i', $contents[$i], $matches )) {
+			$found = true;
+			$version = $matches[1];
+		}
+		
+		if( $res = preg_match( '/\$this->author *= *["\'](.*)["\'];/i', $contents[$i], $matches )) {
+			$author = $matches[1];
+		}		
+		
+		$i++;
+	}
+	
+	if( !$found ) {
+		$version = "not found";
+	}
+
+	$data["version"] = $version;
+	$data["url"] = "http://downloads.sourceforge.net/lifetype/".LIFETYPE_VERSION."_{$pluginName}.zip";
+	$data["author"] = $author;
+	$data["description"] = "Plugin $pluginName - version $version";
+	
+	$w->writePluginInfo( $pluginName, $data );	
+}
+
+// close the feed writer
+$w->close();
+
+File::deleteDir($workFolder, true);

Copied: plog/trunk/bin-devel/testlocale.php (from rev 6933, plog/branches/lifetype-1.2/bin-devel/testlocale.php)
===================================================================
--- plog/trunk/bin-devel/testlocale.php	                        (rev 0)
+++ plog/trunk/bin-devel/testlocale.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,31 @@
+<?
+
+if(!$argv[1]){
+    print "Please put a locale name on the command line, e.g. ".$argv[0]." en_UK\n";
+    die;
+}
+
+$locale = preg_replace("/[^a-z_]/i", "", $argv[1]);
+
+
+// PUBLIC
+$file = "locale_$locale.php";
+if(!file_exists($file))
+    die("Can't find $file\n");
+include($file);
+print "Locale description: " . $messages["locale_description"]."\n";
+print "Encoding: " . $messages["encoding"]."\n";
+print "An error string as a sanity check: " . $messages["error_incorrect_search_terms"]."\n";
+unset($messages);
+
+
+// ADMIN
+$file = "admin/locale_$locale.php";
+if(!file_exists($file))
+    die("Can't find $file\n");
+include($file);
+print "Welcome: " . $messages["welcome_message"]."\n";
+print "Random Help String: " . $messages["help_notify_new_blogs"]."\n";
+
+
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/action.class.php
===================================================================
--- plog/trunk/class/action/action.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/action.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -59,7 +59,8 @@
 		var $_validationErrorView;
 		var $_previousAction;
 		var $_isSuccess;
-
+        var $_form;
+        
         /**
          * Constructor.
          *

Modified: plog/trunk/class/action/addcommentaction.class.php
===================================================================
--- plog/trunk/class/action/addcommentaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/addcommentaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -10,7 +10,6 @@
 
     	var $_articleId;
         var $_blogId;
-        var $_opId;
         var $_userName;
         var $_userEmail;
         var $_userUrl;
@@ -38,7 +37,8 @@
 			$this->_request->registerFilter( "userUrl", $f );
 
 			$f = new AllowedHtmlFilter();
-			$f->addFilter( new XhtmlizeFilter());			
+			$f->addFilter( new JavascriptFilter());
+			$f->addFilter( new XhtmlizeFilter());
 			$this->_request->registerFilter( "commentText", $f );			
 
 			// change the validation mode of the form
@@ -52,7 +52,7 @@
 			$this->_form->setFieldErrorMessage( "userEmail", $this->_locale->tr("error_incorrect_email_address" ));
 			$this->registerFieldValidator( "userName", new StringValidator());
 			$this->_form->setFieldErrorMessage( "userName", $this->_locale->tr("error_comment_without_name" ));
-			$this->registerFieldValidator( "commentText", new StringValidator());
+			$this->registerFieldValidator( "commentText", new StringValidator( true ));
 			$this->_form->setFieldErrorMessage( "commentText", $this->_locale->tr("error_comment_without_text"));
 			$this->registerFieldValidator( "userUrl", new HttpUrlValidator(), true );
 			$this->_form->setFieldErrorMessage( "userUrl", $this->_locale->tr("invalid_url" ));
@@ -71,7 +71,6 @@
 
             $this->_articleId = $this->_request->getValue( "articleId" );
             $this->_blogId    = $this->_request->getValue( "blogId" );
-            $this->_opId      = $this->_request->getValue( "op" );
             $this->_parentId  = $this->_request->getValue( "parentId" );
             if( $this->_parentId == null || $this->_parentId == "" )
                 $this->_parentId = 0;
@@ -232,7 +231,7 @@
 			// before it's too late! We also need to add a new request commentUserName to replace
 			// original userName, in case developer need it in filter or event plugin.
 			$request = HttpVars::getRequest();
-			$request["commentUserName"] = $request["userName"];
+			$request["commentUserName"] = $this->_userName;
 			$request["userName"] = "";
 			HttpVars::setRequest( $request ); 					
 			

Modified: plog/trunk/class/action/addtrackbackaction.class.php
===================================================================
--- plog/trunk/class/action/addtrackbackaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/addtrackbackaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,7 +1,6 @@
 <?php
-
 	lt_include( PLOG_CLASS_PATH."class/dao/blogstatus.class.php" );
-		
+
 	/**
 	 * Class that takes care of adding trackbacks
 	 *
@@ -16,10 +15,9 @@
 			$this->Action( $actionInfo, $request );
 			
 			// we need certain data
-			$this->registerFieldValidator( "id", new IntegerValidator());
-			$this->registerFieldValidator( "url", new StringValidator());
-			$this->setValidationErrorView( new TrackbackView( "Error incorrect parameters",
-															  true ));
+			$this->registerFieldValidator( "id", new IntegerValidator() );
+			$this->registerFieldValidator( "url", new HttpUrlValidator() );
+			$this->setValidationErrorView( new TrackbackView( "Error incorrect parameters", true ) );
 		}
 				
 		/**
@@ -28,8 +26,6 @@
 		 */
 		function tblog( $message )
 		{
-		    
-
 			$logger =& LoggerManager::getLogger( "trackback" );
 			$logger->debug( $message );
 		}

Modified: plog/trunk/class/action/admin/adminaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -98,6 +98,36 @@
 			        $this->_userBlogs[] = $this->_blogInfo;
 			    }
             }
+
+            //
+            // security stuff
+            //
+            if(!empty($this->_blogInfo)){
+                $pipeline = new Pipeline($request, $this->_blogInfo);
+                $result = $pipeline->process();
+                    //
+                    // if the pipeline blocked the request, then we have
+                    // to let the user know
+                if(!$result->isValid()){
+                    if(!$result->hasView()){
+                            // use the default view
+                        lt_include(PLOG_CLASS_PATH."class/view/admin/adminerrorview.class.php");
+                        $message = $this->_locale->tr('error_you_have_been_blocked').'<br/><br/>';
+                        $message .= $result->getErrorMessage();
+                        $this->_view = new AdminErrorView($this->_blogInfo);
+                        $this->_view->setMessage($message);
+                    }
+                    else{
+                            // if the filter that forced the processing to stop provided
+                            // its own view, then use it				
+                        $this->_view = $result->getView();
+                    }
+                    $this->setCommonData();
+                    $this->_view->render();
+                    
+                    die();
+                }
+            }
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddarticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-    
-    
-    
-		
-	
-
     /**
      * \ingroup Action
      * @private
@@ -17,9 +10,8 @@
 	{
 
     	var $_categoryName;
-        var $_categoryUrl;
-		var $_properties;
-		var $_categoryDescription;
+		var $_categoryDescription;
+		var $_categoryInMainPage;
 		var $_message;
 
     	/**
@@ -32,8 +24,9 @@
 			
 			// register two validators
 			$this->registerFieldValidator( "categoryName", new StringValidator(), false, $this->_locale->tr( "error_empty_name" ));
-			$this->registerField( "categoryDescription" );
-			$this->registerField( "categoryInMainPage" );
+			$this->registerFieldValidator( "categoryDescription", new StringValidator(), true );
+			$this->registerFieldValidator( "categoryInMainPage", new IntegerValidator(), true );
+
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newpostcategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_article_category" ));			
@@ -51,12 +44,11 @@
 		function addArticleCategory()
 		{
 			// fetch the data, we already know it's valid and that we can trust it!
-			$f = new HtmlFilter();
         	$this->_categoryName     = $this->_request->getValue( "categoryName" );
             $this->_categoryInMainPage = Textfilter::checkboxToBoolean($this->_request->getValue( "categoryInMainPage" ));
 			$this->_categoryDescription = $this->_request->getValue( "categoryDescription" );
-			
-			// create the object...
+
+                // create the object...
             $categories = new ArticleCategories();
             $category   = new ArticleCategory( $this->_categoryName,
                                                "",

Modified: plog/trunk/class/action/admin/adminaddblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddblogaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,18 +1,5 @@
 <?php
 
-	
-    
-    
-    
-    
-    
-    
-    
-    
-	
-	
-		
-
     /**
      * \ingroup Action
      * @private
@@ -24,7 +11,6 @@
 
     	var $_blogName;
         var $_ownerId;
-		var $_blogProperties;
 		var $_mainDomain;
 		var $_subDomain;
 
@@ -91,13 +77,11 @@
 		{
 	        // fetch the validated data
         	$this->_blogName = $this->_request->getFilteredValue( "blogName", new HtmlFilter());
-			$this->_blogProperties = $this->_request->getValue( "properties" );	        
 			
         	// now that we have validated the data, we can proceed to create the user, making
             // sure that it doesn't already exists
             $blogs = new Blogs();
 			$blog = new BlogInfo( $this->_blogName, $this->_ownerId, "", "" );
-			$blog->setProperties( $this->_blogProperties );
 			
             // check to see whether we are going to save subdomain information			
             if( Subdomains::getSubdomainsEnabled()) {

Modified: plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddblogcategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,11 +1,6 @@
 <?php
 
-	
-    
-    	
-	
-
-    /**
+   /**
      * \ingroup Action
      * @private
      *

Modified: plog/trunk/class/action/admin/adminaddbloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddbloguseraction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -17,10 +17,15 @@
         	$this->AdminAction( $actionInfo, $request );
 
 			// data validation
-			$this->registerFieldValidator( "userName", new UserNameValidator(), false, $this->_locale->tr("error_invalid_user"));
-			$this->_sendNotification = ($this->_request->getValue( "sendNotification" ) != "" );
-			$this->registerField( "sendNotification" );
-			$this->registerField( "perm" );
+			$this->registerFieldValidator( "newBlogUserName", new UsernameValidator(), false, $this->_locale->tr("error_invalid_user"));
+			$this->registerFieldValidator( "sendNotification", new IntegerValidator(), true);
+			$this->registerFieldValidator( "perm", new ArrayValidator( new IntegerValidator() ), true );
+			$this->registerFieldValidator( "newBlogUserText", new StringValidator(), true );
+
+            $this->_sendNotification = ($this->_request->getValue( "sendNotification" ) != "" );
+			if( $this->_sendNotification )
+				$this->registerFieldValidator( "newBlogUserText", new StringValidator());	
+
 			$view = new AdminNewBlogUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_user"));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddcustomfieldaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,5 @@
 <?php
 
-	
-	
-	
-	
-	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -32,10 +23,12 @@
 			$this->registerFieldValidator( "fieldName", new StringValidator(), false, $this->_locale->tr("error_empty_name"));
 			$this->registerFieldValidator( "fieldDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description"));
 			$this->registerFieldValidator( "fieldType", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
-			$this->_form->registerField( "fieldSearchable" );
-			$this->_form->registerField( "fieldHidden" );
-			$this->_form->registerField( "fieldId" );
-			$this->_form->registerField( "fieldValues" );
+			$this->registerFieldValidator( "fieldSearchable", new IntegerValidator(), true );
+			$this->registerFieldValidator( "fieldHidden", new IntegerValidator(), true );
+            if( $this->_request->getValue( "fieldType" ) == CUSTOM_FIELD_LIST )
+            {
+                $this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ));
+            }
 			$view = new AdminTemplatedView( $this->_blogInfo, "newcustomfield" );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_custom_field"));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddglobalarticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -33,7 +33,8 @@
 			
 			// register two validators
 			$this->registerFieldValidator( "categoryName", new StringValidator(), false, $this->_locale->tr("error_empty_name") );
-			$this->registerFieldValidator( "categoryDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description") );
+			$this->registerFieldValidator( "categoryDescription", new StringValidator(), true,
+                                           $this->_locale->tr("error_empty_description") );
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newglobalarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_global_article_category" ));			

Modified: plog/trunk/class/action/admin/adminaddlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddlinkaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddlinkaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,16 +1,5 @@
 <?php
 
-    
-    
-    
-	
-	
-	
-		
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -41,7 +30,7 @@
 			// linkRssFeed will only be validated if it is available in the form
 			$this->registerFieldValidator( "linkRssFeed", new HttpUrlValidator(), true, $this->_locale->tr( "error_invalid_url" ));
 			$this->registerFieldValidator( "linkCategoryId", new IntegerValidator());
-			$this->registerFieldValidator( "linkDescription", new EmptyValidator());
+			$this->registerFieldValidator( "linkDescription", new StringValidator(), true );
 			$view = new AdminNewLinkView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_link" ));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/adminaddpermissionaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpermissionaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddpermissionaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,11 +1,5 @@
 <?php
 
-	
-	
-		
-		
-		
-
     /**
      * \ingroup Action
      * @private
@@ -21,8 +15,8 @@
 			// register two validators
 			$this->registerFieldValidator( "permissionName", new StringValidator(), false, $this->_locale->tr("error_empty_name" ) );
 			$this->registerFieldValidator( "permissionDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description" ) );
-			$this->registerField( "corePermission" );
-			$this->registerField( "adminOnlyPermission" );			
+			$this->registerFieldValidator( "corePermission", new IntegerValidator(), true );
+			$this->registerFieldValidator( "adminOnlyPermission", new IntegerValidator(), true );			
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "newpermission" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_adding_permission" ));			

Modified: plog/trunk/class/action/admin/adminaddpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddpostaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddpostaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -18,30 +18,10 @@
         function AdminAddPostAction( $actionInfo, $request )
         {
         	$this->AdminPostManagementCommonAction( $actionInfo, $request );
-
-        	// for data validation purposes, posts must have at least a topic, an intro text, and a category
-        	$this->registerFieldValidator( "postText", new StringValidator(), false, $this->_locale->tr("error_missing_post_text" ));
-        	$this->registerFieldValidator( "postTopic", new StringValidator(), false, $this->_locale->tr("error_missing_post_topic" ));
-        	$this->registerFieldValidator( "postCategories", new ArrayValidator(), false, $this->_locale->tr("error_no_category_selected"));
-        	$this->registerFieldValidator( "globalArticleCategoryId", new IntegerValidator(), true,  $this->_locale->tr("error_no_global_article_category_selected"));
-			$this->registerFieldValidator( "postUser", new IntegerValidator(), false, $this->_locale->tr("error_invalid_user" ));
-			$this->registerFieldValidator( "postStatus", new IntegerValidator(), false, $this->_locale->tr( "error_incorrect_value" ));
-			$this->registerFieldValidator( "locationId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_value" ));
-
         	$view = new AdminNewPostView( $this->_blogInfo );
         	$view->setErrorMessage( $this->_locale->tr("error_adding_post"));
         	$this->setValidationErrorView( $view );
 
-        	// these fields do not need to be validated but should be there when we show the view once again
-        	$this->registerField( "postSlug" );
-        	$this->registerField( "sendNotification" );
-        	$this->registerField( "sendTrackbacks" );
-        	$this->registerField( "sendPings" );
-        	$this->registerField( "postId" );
-        	$this->registerField( "commentsEnabled" );
-        	$this->registerField( "customField" );
-        	$this->registerField( "postDateTime" );
-
 			// security checks
 			$this->requirePermission( "add_post" );
         }
@@ -56,7 +36,6 @@
 			$validateOk = parent::validate();
 			if( !$validateOk )
 				$this->clearAutoSaveCookie();
-
 			return $validateOk;
 		}
 
@@ -80,7 +59,9 @@
 			$article->setLocationId( $this->getLocationFromRequest());
 
 			// in case the post is already in the db
-			if( !empty( $this->_postId) ) {
+            // TODO: I am guessing this is for updating drafts?
+            // this allows people with only add permissions to update any article
+			if( $this->_postId != "" ) {
 				$article->setId( $this->_postId );
 				$artId = $this->_postId;
 				$postSavedOk = $articles->updateArticle( $article );
@@ -102,10 +83,6 @@
 			$this->_fetchCommonData();
 
 			$this->_postId         = $this->_request->getValue( "postId" );
-            $this->_previewPost    = $this->_request->getValue( "previewPost" );
-            $this->_addPost        = $this->_request->getValue( "addPost" );
-			$this->_saveDraft      = $this->_request->getValue( "isDraft" );
-
             // we know for sure that the information is correct so we can now add
             // the post to the database
 			$postText = Textfilter::xhtmlize($this->_postText);
@@ -122,6 +99,8 @@
 
 			// set also the date before it's too late
 			$article->setDateObject( $this->_postTimestamp );
+            $blogSettings = $this->_blogInfo->getSettings();
+            $article->setTimeOffset($blogSettings->getValue("time_offset"));
 			$article->setCommentsEnabled( $this->_commentsEnabled );
 			$article->setGlobalCategoryId( $this->_globalArticleCategoryId );
 
@@ -162,6 +141,9 @@
         	$cookieBaseName = "LT" . preg_replace("/[^a-zA-Z0-9]/", "", $plogBaseUrl).$this->_blogInfo->getId();
 
         	// set the auto save cookie as false
+                // cookies always have a 'cookieNum' suffix, if we ever go to using multiple cookies
+                // we'll need to be smarter here - TODO: just delete 0-5 or something?  How else do
+                // we get the maxBackupCookiesPerBlog value from autosave.js?
 	    	setcookie( $cookieBaseName.'postNotSaved', '0', -1, '/' );
 	    	setcookie( $cookieBaseName.'postTopic', '', -1, '/' );
 	    	setcookie( $cookieBaseName.'postText', '', -1, '/' );
@@ -197,7 +179,6 @@
             // otherwise there is no need to...
             if( $article->getStatus() == POST_STATUS_PUBLISHED) {
                 // get the output from the xmlrpc pings but only if the user decided to do so!
-
 				if( $this->_sendPings) {
                     $t = new Timestamp();
                     $today = $t->getTimestamp();
@@ -209,11 +190,11 @@
 
                 // and now check what to do with the trackbacks
                 if( $this->_sendTrackbacks ) {
-                	// get the links from the text of the post
-        		    $postLinks = StringUtils::getLinks( $article->getText());
-
-        			// if no links, there is nothing to do
-        			if( count($postLinks) == 0 ) {
+                        // get the links from the text of the post
+                    $postLinks = StringUtils::getLinks( $article->getText());
+                        
+                        // if no links, there is nothing to do
+                    if( count($postLinks) == 0) {
 			            $this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
         			}
         			else {

Modified: plog/trunk/class/action/admin/adminaddresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourceaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddresourceaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -22,19 +22,21 @@
         function AdminAddResourceAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-			
-			$this->registerFieldValidator( "resourceFile_1", new ArrayValidator(), true);
+
 			$this->registerFieldValidator( "albumId", new IntegerValidator());			
-			$this->_destView    = $this->_request->getValue( "destView" );
-			$this->_form->registerField( "resourceDescription" );
-			$this->_form->registerField( "destination" );
+			$this->registerFieldValidator( "resourceDescription", new StringValidator(), true );
 			
-			if( $this->_destView == "resourceList" )
+			$this->_destView = $this->_request->getFilteredValue( "destView", new HtmlFilter() );
+			if( $this->_destView == "resourceList" ) {
+				lt_include( PLOG_CLASS_PATH."class/view/admin/chooser/adminsimpleresourceslistview.class.php" );
 				$view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => 0 ));
-			elseif ($this->_destView == "pictureSelect" )
+            }
+			elseif ($this->_destView == "pictureSelect" ){
 				$view = new AdminPictureSelectView( $this->_blogInfo, Array( "albumId" => 0 ));
-			else
+            }
+			else{
 				$view = new AdminNewResourceView( $this->_blogInfo );
+            }
 				
 			$view->setErrorMessage( $this->_locale->tr( "error_no_resource_uploaded" ));
 			$this->setValidationErrorView( $view );
@@ -61,8 +63,6 @@
         	// fetch the information coming from the resource
         	$this->_description = Textfilter::filterAllHTML($this->_request->getValue( "resourceDescription" ));
             $this->_albumId     = $this->_request->getValue( "albumId" );
-            $this->_resource    = $this->_request->getValue( "resourceFile" );
-            $this->_destination = $this->_request->getValue( "destination" );
 
             // check if there is any file uploaded
             $files = HttpVars::getFiles();
@@ -77,19 +77,22 @@
         	// let the gallery library do its work...
         	$resources = new GalleryResources();
 			
-			if( $this->_destView == "resourceList" ) {
-				$this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
+			if( $this->_destView == "resourceList" ){
+				$this->_view = new AdminSimpleResourcesListView( $this->_blogInfo,
+                                                                 Array( "albumId" => $this->_albumId,
+                                                                        "gotoLastPage" => true ));
 				$this->_view->setValue( "destination", $this->_destination );
 			}
 			elseif ($this->_destView == "pictureSelect" ) {
 				$this->_view = new AdminPictureSelectView( $this->_blogInfo, Array( "albumId" => 0 ));
-				$this->_view->setValue( "destination", $this->_destination );
-			}
+            }
 			else {
 				if( $this->_request->getOutput() == "flash" )
 					$this->_view = new AdminPlainView( $this->_blogInfo );
 				else
-					$this->_view = new AdminResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId, "gotoLastPage" => true ));
+					$this->_view = new AdminResourcesListView( $this->_blogInfo,
+                                                               Array( "albumId" => $this->_albumId,
+                                                                      "gotoLastPage" => true ));
 			}
 			
 			$successMessage = "";

Modified: plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddresourcealbumaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -23,7 +23,7 @@
 			// validation stuff
 			$this->registerFieldValidator( "albumName", new StringValidator(), false, $this->_locale->tr("error_empty_name"));
 			$this->registerFieldValidator( "parentId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value"));
-			$this->_form->registerField( "albumDescription" );
+			$this->registerFieldValidator( "albumDescription", new StringValidator(), true);
 			$view = new AdminNewAlbumView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_album" ));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/adminaddtemplateaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminaddtemplateaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,16 +1,5 @@
 <?php
 
-    
-    
-    
-    
-    
-    
-    
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private

Modified: plog/trunk/class/action/admin/adminadduseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminadduseraction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminadduseraction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,20 +1,5 @@
 <?php
 
-	
-    
-    
-    
-	
-		
-    
-	
-	
-	
-	
-	
-		
-			
-
     /**
      * \ingroup Action
      * @private
@@ -42,11 +27,11 @@
         	$this->registerFieldValidator( "newUserPassword", new PasswordValidator(), false, $this->_locale->tr("error_invalid_password"));
         	$this->registerFieldValidator( "userEmail", new EmailValidator(), false, $this->_locale->tr("error_incorrect_email_address"));
 			$this->registerFieldValidator( "userStatus", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
-        	$this->registerField( "userFullName" );
+        	$this->registerFieldValidator( "userFullName", new StringValidator(), true );
         	$this->registerFieldValidator( "blogId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_blog_id"));
-			$this->registerField( "blogName" );
-			$this->registerField( "userPermissions" );
-        	$view = new AdminAddUserView( $this->_blogInfo );
+			$this->registerFieldValidator( "userPermissions", new ArrayValidator( new IntegerValidator() ), true );
+
+			$view = new AdminAddUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_adding_user" ));
         	$this->setValidationErrorView( $view );
 

Modified: plog/trunk/class/action/admin/adminadminblogselectaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminadminblogselectaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminadminblogselectaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
 
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -59,13 +55,9 @@
             $session["SessionInfo"]->setValue( "blogId", $blogInfo->getId() );
             HttpVars::setSession( $session );
 			
-			/*print_r($session);
-			die();*/
-			
-			// check if there was any redirection
-			$this->_nextAction = $this->_request->getValue( "action" );
+	        $this->_nextAction = $this->_request->getFilteredValue( "action", new HtmlFilter() );
 
-			if ( $this->_nextAction ) {
+			if ( $this->_nextAction && AdminController::checkActionExist( $this->_nextAction ) ) {
 				AdminController::setForwardAction( $this->_nextAction );
 		    } else {
 				AdminController::setForwardAction( "newPost" );

Modified: plog/trunk/class/action/admin/adminblogcategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminblogcategoriesaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,14 @@
 <?php
 	
-	
-	
-	
 	class AdminBlogCategoriesAction extends AdminAction
 	{
 			
 		function AdminBlogCategoriesAction( $actionInfo, $request )
 		{
-			$this->AdminAction( $actionInfo, $request );
+			$this->AdminAction( $actionInfo, $request );
+
+			$this->registerFieldValidator( "searchTerms", new StringValidator(), true);
+			$this->setValidationErrorView( new AdminBlogCategoriesListView( $this->_blogInfo ) );
 			
 			$this->requireAdminPermission( "view_blog_categories" );
 		}

Modified: plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminchangeblogstatusaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-    
-    
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -16,8 +9,8 @@
     class AdminChangeBlogStatusAction extends AdminAction 
 	{
 
-        var $_postIds;
-        var $_postStatus;
+        var $_blogIds;
+        var $_blogStatus;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent

Modified: plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminchangeuserstatusaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -16,8 +16,8 @@
     class AdminChangeUserStatusAction extends AdminAction 
 	{
 
-        var $_postIds;
-        var $_postStatus;
+        var $_userIds;
+        var $_userStatus;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent

Modified: plog/trunk/class/action/admin/admincleanupaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admincleanupaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admincleanupaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -101,10 +101,8 @@
 		 */		
 		function cleanupBlogs()
 		{
-			
-			
 			$purge = new PurgeData();
-			$result = $purge->purgeBlogs();
+			$result = $purge->purgeBlogs(1);
 
             if($result === false){
 				$this->_continue = false;

Modified: plog/trunk/class/action/admin/admindeleteblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteblogaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admindeleteblogaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -20,7 +20,7 @@
 			// set up the data validation stuff
         	$this->_op = $actionInfo->getActionParamValue();
         	if( $this->_op == "deleteBlogs" )
-        		$this->registerFieldvalidator( "blogIds", new ArrayValidator( new IntegerValidator()));
+        		$this->registerFieldValidator( "blogIds", new ArrayValidator( new IntegerValidator()));
         	else
         		$this->registerFieldValidator( "blogId", new IntegerValidator());
         	$view = new AdminSiteBlogsListView( $this->_blogInfo );

Modified: plog/trunk/class/action/admin/admindeletepermissionsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeletepermissionsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admindeletepermissionsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-    
-	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private

Modified: plog/trunk/class/action/admin/admindeleteusersaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindeleteusersaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admindeleteusersaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -21,7 +21,7 @@
 			// set up the data validation stuff
         	$this->_op = $actionInfo->getActionParamValue();
         	if( $this->_op == "deleteUsers" )
-        		$this->registerFieldvalidator( "userIds", new ArrayValidator( new IntegerValidator()));
+        		$this->registerFieldValidator( "userIds", new ArrayValidator( new IntegerValidator()));
         	else
         		$this->registerFieldValidator( "userId", new IntegerValidator());
         	$view = new AdminSiteUsersListView( $this->_blogInfo );

Modified: plog/trunk/class/action/admin/admindoregisterblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admindoregisterblogaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admindoregisterblogaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -10,11 +10,18 @@
 			$this->AdminAction( $actionInfo, $request );
 			
 			$this->registerFieldValidator( "blogName", new BlogNameValidator());
-            $this->registerFieldValidator( "blogSubDomain", new DomainValidator(), true );
-            $this->registerFieldValidator( "blogMainDomain", new DomainValidator(), true );
             $this->registerFieldValidator( "blogLocale", new StringValidator());
 			$this->registerFieldValidator( "templateId", new StringValidator());
 			$this->registerFieldValidator( "blogCategory", new IntegerValidator());
+
+			if( Subdomains::getSubdomainsEnabled()) {
+                $this->registerFieldValidator( "blogSubDomain", new DomainValidator());
+                $this->registerFieldValidator( "blogMainDomain", new DomainValidator());
+            } else {
+            	$this->registerFieldValidator( "blogSubDomain", new DomainValidator(), true );
+            	$this->registerFieldValidator( "blogMainDomain", new DomainValidator(), true );
+            }
+            
 			$this->setValidationErrorView( new AdminRegisterBlogView( $this->_userInfo ));
 		}
 

Modified: plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditarticlecategoriesaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,8 +1,5 @@
 <?php
 
-	
-    
-
     /**
      * \ingroup Action
      * @private
@@ -19,8 +16,10 @@
         function AdminEditArticleCategoriesAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-
-			$this->requirePermission( "view_categories" );
+
+        	$this->registerFieldValidator( "searchTerms", new StringValidator(), true);
+			$this->setValidationErrorView( new AdminArticleCategoriesListView( $this->_blogInfo ) );
+        	$this->requirePermission( "view_categories" );
         }
 
         /**
@@ -28,8 +27,9 @@
          */
         function perform()
         {
+        	$searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
         	// create the view, which will take care of fetching the right data
-        	$this->_view = new AdminArticleCategoriesListView( $this->_blogInfo );
+        	$this->_view = new AdminArticleCategoriesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms ) );
             $this->setCommonData();
 
             // better to return true if everything fine

Modified: plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditarticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,5 @@
 <?php
 
-	
-    
-	
-		
-    
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -30,8 +21,7 @@
 			
 			// stuff for the data validation
 			$this->registerFieldValidator( "categoryId", new IntegerValidator());
-			$this->_form->registerField( "categoryName" );
-			$this->_form->registerField( "categoryDescription" );
+
 			$errorView = new AdminArticleCategoriesListView( $this->_blogInfo, $this->_locale->tr("error_incorrect_category_id"));
 			$this->setValidationErrorView( $errorView );
 			

Modified: plog/trunk/class/action/admin/admineditblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditblogcategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,13 +1,5 @@
 <?php
 
-	
-	
-	
-	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private

Modified: plog/trunk/class/action/admin/admineditcommentsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditcommentsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditcommentsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -16,10 +16,16 @@
         function AdminEditCommentsAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-			
+
+			// we do this so that AdminEditTrackbacksAction can basically extend this class and provide
+			// a different view... it will allow us to save some extra code!
+        	$this->_viewClass = "AdminArticleCommentsListView";
+
 			// data validation
 			$this->registerFieldValidator( "articleId", new IntegerValidator(), true);
 			$this->registerFieldValidator( "showStatus", new IntegerValidator( true ), true);
+			$this->registerFieldValidator( "searchTerms", new StringValidator(), true);
+
 			$this->registerFieldValidator( "showType", new IntegerValidator( true ), true);			
 			$view = new AdminPostsListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_fetching_comments"));
@@ -40,7 +46,7 @@
 			return( $results );
 		}
 
-        /**
+		/**
          * Carries out the specified action
          */
         function perform()
@@ -67,6 +73,35 @@
 
             // better to return true if everything fine
             return true;
+        }
+
+		/**
+         * Get the correct view of this action
+         */
+        function _getView( $articleId, $showStatus, $searchTerms )
+        {
+        	if( $articleId && $articleId > 0 ) {
+				$articles = new Articles();
+				$article = $articles->getBlogArticle( $articleId, $this->_blogInfo->getId());
+				if( !$article ) {
+					// if article does not exist we better return the comments list with default parameters
+					// instead of post list in original design.
+					$view = new $this->_viewClass( $this->_blogInfo );
+					$view->setErrorMessage( $this->_locale->tr("error_fetching_article" ));				
+				}			
+				else
+					$view = new $this->_viewClass( $this->_blogInfo, Array( "article" => $article,
+																			"showStatus" => $showStatus,
+																			"searchTerms" => $searchTerms ));
+			}
+			else {
+				// if there is no article id, then we will show all comments from all posts...
+				$view = new $this->_viewClass( $this->_blogInfo, Array( "article" => null,
+																		"showStatus" => $showStatus,
+																		"searchTerms" => $searchTerms ));					
+			}
+
+			return $view;
         }
 
 		/**

Modified: plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoriesaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -4,8 +4,6 @@
        * version 1.0 
        * Changed from original article category.
        */
-	  
-      
 
     /**
      * \ingroup Action
@@ -24,7 +22,8 @@
         {
         	$this->AdminAction( $actionInfo, $request );
 			
-			$this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
+			$this->registerFieldValidator( "searchTerms", new StringValidator(), true);
+			$this->setValidationErrorView( new AdminGlobalArticleCategoriesListView( $this->_blogInfo ) );
 			
 			$this->requireAdminPermission( "view_global_categories" );
         }
@@ -34,8 +33,9 @@
          */
         function perform()
         {
+        	$searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter() );
         	// create the view, which will take care of fetching the right data
-        	$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo, Array( "searchTerms" => $this->_searchTerms ));
+        	$this->_view = new AdminGlobalArticleCategoriesListView( $this->_blogInfo, Array( "searchTerms" => $searchTerms ));
             $this->setCommonData();
 
             // better to return true if everything fine
@@ -47,4 +47,4 @@
         	return( $this->perform() );
         }
     }
-?>
+?>
\ No newline at end of file

Modified: plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditglobalarticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -5,14 +5,6 @@
        * Changed from original article category.
        */
 
-		
-        
-        
-        
-		
-		
-		
-
     /**
      * \ingroup Action
      * @private
@@ -34,8 +26,7 @@
 			
 			// stuff for the data validation
 			$this->registerFieldValidator( "categoryId", new IntegerValidator());
-			$this->_form->registerField( "categoryName" );
-			$this->_form->registerField( "categoryDescription" );
+
 			$errorView = new AdminGlobalArticleCategoriesListView( $this->_blogInfo );
 			$errorView->setErrorMessage( $this->_locale->tr("error_incorrect_category_id"));
 			$this->setValidationErrorView( $errorView );

Modified: plog/trunk/class/action/admin/admineditlinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditlinkaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -28,11 +28,7 @@
 			
 			// data validation stuff
 			$this->registerFieldValidator( "linkId", new IntegerValidator());
-			// we need to register the other fields or else the form validation will complain
-			$this->_form->registerField( "linkDescription" );
-			$this->_form->registerField( "linkName" );
-			$this->_form->registerField( "linkRssFeed" );
-			$this->_form->registerField( "linkUrl" );
+
 			$view = new AdminLinksListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_fetching_link" ));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditlinkcategoriesaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,8 +1,5 @@
 <?php
 
-	
-    
-
     /**
      * \ingroup Action
      * @private
@@ -18,7 +15,10 @@
          */
         function AdminEditLinkCategoriesAction( $actionInfo, $request )
         {
-        	$this->AdminAction( $actionInfo, $request );
+        	$this->AdminAction( $actionInfo, $request );
+        	$this->registerFieldValidator( "searchTerms", new StringValidator(), true );
+			$this->setValidationErrorView( new AdminLinkCategoriesListView( $this->_blogInfo ) );
+        	
         	$this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
         }
 

Modified: plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditlinkcategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -26,8 +26,8 @@
         	$this->AdminAction( $actionInfo, $request );
 
 			// data validation
-			$this->registerFieldValidator( "categoryId", new IntegerValidator());
-			$this->_form->registerField( "categoryName" );
+			$this->registerFieldValidator( "categoryId", new IntegerValidator() );
+
 			$view = new AdminLinkCategoriesListView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_fetching_link_category" ));
 			$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/admineditlinksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditlinksaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditlinksaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
 
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -25,13 +21,11 @@
 			
 			// data validation. In this case if the element is not correct we won't
 			// bother doing anything... we'll just show the whole list of categories
-			$this->registerFieldValidator( "showCategory", new IntegerValidator(), true);
+			$this->registerFieldValidator( "showCategory", new IntegerValidator(), true);
+			$this->registerFieldValidator( "searchTerms", new StringValidator(), true);
 			$blogSettings = $this->_blogInfo->getSettings();
 			$this->_linkCategoriesOrder = $blogSettings->getValue( "link_categories_order", MyLinksCategories::MYLINKS_CATEGORIES_NO_ORDER );
-			$this->setValidationErrorView( new AdminLinksListView( $this->_blogInfo, 
-			                                                       Array( "showCategory" => 0,
-			                                                              "searchTerms" => "",
-																          "showOrder" => $this->_linkCategoriesOrder )));
+			$this->setValidationErrorView( new AdminLinksListView( $this->_blogInfo ) );
 																
 																
 			$this->requirePermission( "view_links" );

Modified: plog/trunk/class/action/admin/admineditpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditpostaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditpostaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -20,11 +20,7 @@
 
         	// data validation
         	$this->registerFieldValidator( "postId", new IntegerValidator());
-        	// if we don't register the fields below, the view will complain that they are
-        	// not valid!
-        	$this->registerField( "postTopic" );
-        	$this->registerField( "postText" );
-        	$this->registerField( "postCategories" );
+
         	$view = new AdminPostsListView( $this->_blogInfo );
         	$view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id"));
         	$this->setValidationErrorView( $view );

Modified: plog/trunk/class/action/admin/admineditpostsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/admineditpostsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/admineditpostsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
 
-	
-    
-	
-
     /**
      * \ingroup Action
      * @private
@@ -19,13 +15,16 @@
         function AdminEditPostsAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-
-			// field validation
-			$this->registerFieldValidator( "showCategory", new IntegerValidator( true ));
-			$this->registerFieldValidator( "showStatus", new IntegerValidator( true ));
-			$this->registerFieldValidator( "showUser", new IntegerValidator());
-			$this->registerFieldValidator( "showMonth", new IntegerValidator( true ));
-
+                // TODO: if we are going to override the validator (we probably want a filter instead?)
+                // we shouldn't pretend we are validating by calling registerFieldValidator when it won't be used...
+                // field validation
+        	$this->registerFieldValidator( "showCategory", new IntegerValidator( true ), true );
+            $this->registerFieldValidator( "showStatus", new IntegerValidator( true ), true );
+			$this->registerFieldValidator( "showUser", new IntegerValidator(), true );
+			$this->registerFieldValidator( "showMonth", new IntegerValidator( true ), true );
+			$this->registerFieldValidator( "searchTerms", new StringValidator(), true );
+        	$this->setValidationErrorView( new AdminPostsListView( $this->_blogInfo ) );
+        	
 			$this->requirePermission( "view_posts" );
         }
 

Modified: plog/trunk/class/action/admin/adminglobalsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminglobalsettingsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminglobalsettingsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -2,6 +2,7 @@
 
 	
     
+    lt_include( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
 
     /**
      * \ingroup Action
@@ -11,7 +12,8 @@
      */
     class AdminGlobalSettingsAction extends AdminAction 
 	{
-
+        var $_show;
+        
     	function AdminGlobalSettingsAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
@@ -19,11 +21,22 @@
 			$this->requireAdminPermission( "view_global_settings" );
         }
 
+        function validate()
+        {
+            $this->_show = $this->_request->getValue( "show" );
+	        $strVal = new StringValidator();
+            if(!$strVal->validate( $this->_show ) ){
+                    // view can take care of setting a valid value
+                $this->_show = "";
+            }
+
+            return (parent::validate());
+        }
+        
         function perform()
         {
             // if no problem, continue
-            $show = $this->_request->getValue( "show" );
-            $this->_view = new AdminGlobalSettingsListView( $this->_blogInfo, $show );
+            $this->_view = new AdminGlobalSettingsListView( $this->_blogInfo, $this->_show );
             $this->setCommonData();
 
             return true;

Modified: plog/trunk/class/action/admin/adminloginaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminloginaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminloginaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -15,7 +15,6 @@
 
     	var $_userName;
         var $_userPassword;
-        var $_op;
         var $_locale;
 		var $_pm;
 		var $_config;

Modified: plog/trunk/class/action/admin/adminmainaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminmainaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminmainaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,6 +1,7 @@
 <?php
 
 	lt_include( PLOG_CLASS_PATH."class/dao/blogstatus.class.php" );	
+	lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
 
     /**
      * \ingroup Action
@@ -26,7 +27,9 @@
 		{
 	        // first of all, check if we have a valid blog id
 	        $this->_blogId = $this->_request->getValue( "blogId" );
-            if( $this->_blogId == "" || $this->_blogId < 0 ) {
+	        $intVal = new IntegerValidator();
+            if( $this->_blogId == "" || !$intVal->validate( $this->_blogId ) ) {
+                $this->_blogId = ""; // clear invalid data
 	            
 				
 				// check if the user really belongs to one or more blogs and if not, quit
@@ -105,12 +108,10 @@
 			// we don't have to worry about much more here, we can let the
 			// $this->_nextAction action take care of everytyhing now...
 			// If $this->_nextAction is null, we use "newPost" as default nextAction
-			if( $this->_view )
-				return true;
-				        
-	        $this->_nextAction = $this->_request->getValue( "action" );
+			lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
+	        $this->_nextAction = $this->_request->getFilteredValue( "action", new HtmlFilter() );
 
-			if ( $this->_nextAction ) {
+			if ( $this->_nextAction && AdminController::checkActionExist( $this->_nextAction ) ) {
 				AdminController::setForwardAction( $this->_nextAction );
 		    } 
 			else {

Modified: plog/trunk/class/action/admin/adminnewpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminnewpostaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminnewpostaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,10 +1,5 @@
 <?php
 
-	
-    
-    
-        
-
     /**
      * \ingroup Action
      * @private
@@ -22,6 +17,7 @@
         function AdminNewPostAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+        	$this->registerFieldValidator( "postText", new StringValidator( true ), true );
 
 			// security checks
 			$this->requirePermission( "add_post" );
@@ -51,6 +47,17 @@
 			$config =& Config::getConfig();
 			$this->_view->setValue( "globalArticleCategoryId", $config->getValue( "default_global_article_category_id", 0 ));
 
+            $postText = $this->_request->getValue( "postText" );
+			
+			// check if javascript code is allowed in posts
+			$config =& Config::getConfig();
+                // Don't ever allow javascript when directing from the 'bookmarklet'
+                // or perhaps other hackers trying to exploit the poor lifetype user
+//			if( !$config->getValue( "allow_javascript_blocks_in_posts", false ))
+            $postText = Textfilter::filterJavaScript( $postText );
+        	$postText = trim(Textfilter::xhtmlize( $postText ));
+			$this->_view->setValue( "postText", $postText );
+
             $this->setCommonData();
 
 

Modified: plog/trunk/class/action/admin/adminplugincenteraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminplugincenteraction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminplugincenteraction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -42,7 +42,8 @@
         	// initialize the plugin manager and load the plugins
         	$pluginManager =& PluginManager::getPluginManager();
 
-			$doVersionCheck = $this->_request->getValue( "doVersionCheck", false );
+            lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php");
+			$doVersionCheck = TextFilter::checkboxToBoolean( $this->_request->getValue( "doVersionCheck" ) );
 
             // check if the plugin manager is enabled or not, since if it's not
             // there is no point in this feature...

Modified: plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminpostmanagementcommonaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,13 +1,5 @@
 <?php
 
-
-
-
-
-
-
-
-
     /**
      * \ingroup Action
      * @private
@@ -25,8 +17,6 @@
         var $_postStatus;
         var $_sendNotification;
 		var $_sendPings;
-        var $_previewPost;
-        var $_addPost;
         var $_commentsEnabled;
         var $_globalCategoryId;
 		var $_posterId;
@@ -46,11 +36,61 @@
 		function AdminPostManagementCommonAction( $actionInfo, $request )
 		{
 			$this->AdminAction( $actionInfo, $request );
+
+        	// for data validation purposes, posts must have at least a topic, an intro text, and a category
+        	$this->registerFieldValidator( "postText", new StringValidator(), false, $this->_locale->tr("error_missing_post_text" ));
+        	$this->registerFieldValidator( "postTopic", new StringValidator(), false, $this->_locale->tr("error_missing_post_topic" ));
+        	$this->registerFieldValidator( "postCategories", new ArrayValidator( new IntegerValidator() ), false,
+                                           $this->_locale->tr("error_no_category_selected"));
+        	$this->registerFieldValidator( "globalArticleCategoryId", new IntegerValidator(), true,
+                                           $this->_locale->tr("error_no_global_article_category_selected"));
+			$this->registerFieldValidator( "postUser", new IntegerValidator(), false, $this->_locale->tr("error_invalid_user" ));
+			$this->registerFieldValidator( "postStatus", new IntegerValidator(), false, $this->_locale->tr( "error_incorrect_value" ));
+			$this->registerFieldValidator( "locationId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_value" ));
+
+        	$this->registerFieldValidator( "postId", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "postDateTime", new DateTimeValidator( '%j/%m/%Y %G:%i' ) );
+        	$this->registerFieldValidator( "postSlug", new StringValidator(), true );
+        	$this->registerFieldValidator( "sendNotification", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "sendTrackbacks", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "sendPings", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "commentsEnabled", new IntegerValidator(), true );
+        	$this->registerFieldValidator( "customField", new ArrayValidator(), true );
+        	$this->registerFieldValidator( "trackbackUrls", new StringValidator(), true);
 		}
 
+        function validate()
+        {
+            if(!parent::validate())
+                return false;
+
+                // TODO: validate customFields based on fieldType
+
+                // check trackback URLs
+            $trackbackUrls = $this->_request->getValue( "trackbackUrls" );
+            if($trackbackUrls != ""){
+                lt_include( PLOG_CLASS_PATH."class/data/filter/urlconverter.class.php" );
+                $f = new UrlConverter();
+                $trackbackLinks = Array();
+                foreach(explode( "\r\n", $trackbackUrls ) as $host ) {
+                    trim($host);
+                    if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" ){
+                        $host = $f->filter($host);
+                        array_push( $trackbackLinks, $host );
+                    }
+                }
+                $val = new ArrayValidator( new HttpUrlValidator() );
+                if(!$val->validate($trackbackLinks)){
+                    $this->validationErrorProcessing();
+                    return false;
+                }
+            }
+            
+            return true;
+        }
+        
 		function _fetchPostDateInformation()
 		{
-
             // fetch the timestamp that the post will have
           	$postDateTime = $this->_request->getValue( "postDateTime", "" );
             $this->_postTimestamp = new Timestamp();
@@ -133,17 +173,16 @@
 			}
         	$this->_postText = trim(Textfilter::xhtmlize( $this->_postText ));
             $this->_postTopic    = trim(Textfilter::xhtmlize(Textfilter::filterAllHTML($this->_request->getValue( "postTopic" ))));
-			$this->_posterId = $this->_request->getValue( "posterId" );
             $this->_postCategories = $this->_request->getValue( "postCategories" );
 			$this->_postSlug = Textfilter::filterAllHTML($this->_request->getValue( "postSlug" ));
             $this->_postStatus   = $this->_request->getValue( "postStatus" );
-            $this->_sendNotification = $this->_request->getValue( "sendNotification" );
-            $this->_sendTrackbacks = $this->_request->getValue( "sendTrackbacks" );
-			$this->_sendPings = $this->_request->getValue( "sendPings" );
+            $this->_sendNotification = $this->_request->getValue( "sendNotification" ) ? 1 : 0;
+            $this->_sendTrackbacks = $this->_request->getValue( "sendTrackbacks" ) ? 1 : 0;
+			$this->_sendPings = $this->_request->getValue( "sendPings" ) ? 1 : 0;			
             $this->_postId       = $this->_request->getValue( "postId" );
-            $this->_commentsEnabled = $this->_request->getValue( "commentsEnabled" );
+            $this->_commentsEnabled = $this->_request->getValue( "commentsEnabled" ) ? 1 : 0;
             $this->_globalArticleCategoryId = $this->_request->getValue( "globalArticleCategoryId" );
-
+            
 			// fetch the custom fields
 			$this->_customFields = $this->_request->getValue( "customField" );
 
@@ -151,11 +190,23 @@
 			$this->_fetchPostDateInformation();
 
 			// information about the poster but only if the user is supposed to be able to change it
-			if( $this->_userInfo->hasPermissionByName( "update_all_user_articles", $this->_blogInfo->getId()) ||
-			    $this->_userInfo->isSiteAdmin() ||
-			    $this->_blogInfo->getOwnerId() == $this->_userInfo->getId()) {
-				$this->_posterId = $this->_request->getValue( "postUser" );
-			}
+			if( $this->_userInfo->hasPermissionByName( "update_all_user_articles", $this->_blogInfo->getId()) || 
+			    $this->_userInfo->isSiteAdmin() || 
+			    $this->_blogInfo->getOwnerId() == $this->_userInfo->getId())
+            {			
+			    $this->_posterId = null;
+			    $posterId = $this->_request->getValue( "postUser" );
+			    
+			    $validUsers = $this->_blogInfo->getUsersInfo();
+			    foreach($validUsers as $validUser){
+                    if($validUser->getId() == $posterId){
+                        $this->_posterId = $posterId;
+                        break;
+                    }
+			    }
+			    if($this->_posterId == null)
+                    $this->_posterId = $this->_blogInfo->getOwnerId();
+            }
 			else {
 				$this->_posterId = $this->_userInfo->getId();
 			}
@@ -170,7 +221,8 @@
 			$fields = Array();
 			if( is_array($this->_customFields)) {
 				foreach( $this->_customFields as $fieldId => $fieldValue ) {
-					// 3 of those parameters are not really need when creating a new object... it's enough that
+					// 3 of those parameters are not really need when creating
+                    // a new object... it's enough that
 					// we know the field definition id.
 					$row = Array( "field_id" => $fieldId,
 					              "field_value" => $fieldValue,

Modified: plog/trunk/class/action/admin/adminpoststatsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpoststatsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminpoststatsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -32,27 +32,12 @@
         }
 
         /**
-         * Check that the parameter is correct.
-         */
-        function validate()
-        {
-			// let's make sure that the "page" parameter has a sane value
-			// and that it is not below 0
-			$val = new IntegerValidator();
-			$this->_page = $this->_request->getValue( "page" );			
-			if( !$val->validate( $this->_page ) || $this->_page < 0 )
-				$this->_page = 1;
-
-			// run the real validation stuff...
-            return parent::validate();
-        }
-
-        /**
          * Carries out the specified action
          */
         function perform()
         {
-        	$this->_postId = $this->_request->getValue( "postId" );		
+        	$this->_postId = $this->_request->getValue( "postId" );	
+        	$this->_page = View::getCurrentPageFromRequest();
 		
             // fetch the post itself
             $posts = new Articles();

Modified: plog/trunk/class/action/admin/adminpreviewpostaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminpreviewpostaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminpreviewpostaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -22,7 +22,12 @@
          */
         function AdminPreviewPostAction( $actionInfo, $request )
         {
-        	$this->AdminAction( $actionInfo, $request );
+        	$this->AdminPostManagementCommonAction( $actionInfo, $request );
+
+                // TODO: not the best error message, but at least it displays something
+			$view = new AdminErrorView( $this->_blogInfo, Array( 'random' => md5(time())));
+        	$view->setMessage( $this->_locale->tr("error_adding_post"));
+        	$this->setValidationErrorView( $view );
         }
         
         /**
@@ -68,6 +73,8 @@
 			// and a few more properties that we need to know about
 			$this->_fetchPostDateInformation();
 			$article->setDateObject( $this->_postTimestamp );
+            $blogSettings = $this->_blogInfo->getSettings();
+            $article->setTimeOffset($blogSettings->getValue("time_offset"));
 			// we will not allow comments because it wouldn't work!
 			$article->setCommentsEnabled( false );
 			$article->setFields( $this->_getArticleCustomFields());

Modified: plog/trunk/class/action/admin/adminresourcealbumsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminresourcealbumsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminresourcealbumsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -2,6 +2,7 @@
 
 	
     
+    lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
 
     /**
      * \ingroup Action
@@ -20,6 +21,7 @@
         function AdminResourceAlbumsAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
+			$this->registerFieldValidator( "albumId", new IntegerValidator());
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminsavedraftarticleajaxaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -15,6 +15,8 @@
 		function AdminSaveDraftArticleAjaxAction( $actionInfo, $request )
 		{
 			$this->AdminAjaxAction( $actionInfo, $request );
+                // TODO: since this was moved to exten AdminAjaxAction i
+                // nstead of AdminPostManagement, we need to redo all of the validation
 		}
 
 		function validate()

Modified: plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminsendtrackbacksaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -23,17 +23,47 @@
         {
         	$this->AdminAction( $actionInfo, $request );
 
-			$this->registerFieldValidator( "postLinks", new ArrayValidator( new StringValidator()), true, $this->_locale->tr("error_no_post_links_select") );
+			$this->registerFieldValidator( "postLinks", new ArrayValidator( new HttpUrlValidator()), true, $this->_locale->tr("error_no_post_links_select") );
+                // TODO: httpurlvalidator?
 			$this->registerFieldValidator( "trackbackUrls", new StringValidator(), true, $this->_locale->tr("error_no_trackback_urls") );
+                // TODO: why optional?
 			$this->registerFieldValidator( "postId", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_article_id") );
 
             $view = new AdminPostsListView( $this->_blogInfo );
             $view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
             $this->setValidationErrorView( $view );
 
+			$view = new AdminPostsListView( $this->_blogInfo );
+			$view->setErrorMessage( $this->_locale->tr("error_incorrect_article_id" ));
+			$this->setValidationErrorView( $view );
+
 			$this->requirePermission( "add_post" );
         }
 
+            // TODO: needs to be fixed since the merge from 1.2 was too different
+		function validate()
+		{
+			if( !parent::validate())
+				return( false );
+
+                // fetch the validated data
+			$this->_postId = $this->_request->getValue( "postId" );
+			$this->_postLinks = $this->_request->getValue( "postLink" );
+			$this->_trackbackLinks = $this->_request->getValue( "trackbackLink" );
+
+                // Need to do validation here because we need one of the validations to pass
+			$val = new ArrayValidator( new HttpUrlValidator() );
+			if( !$val->validate( $this->_postLinks ) && !$val->validate( $this->_trackbackLinks ) ) {
+                $this->_view = new AdminPostsListView( $this->_blogInfo );
+                $this->_view->setErrorMessage( $this->_locale->tr("error_no_trackback_links_sent"));
+                $this->setCommonData();
+
+                return false;
+            }   
+
+			return true;
+		}        
+
         function sendTrackbacks()
         {
             // fetch the parameters that we need

Modified: plog/trunk/class/action/admin/adminsiteblogsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminsiteblogsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminsiteblogsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
 
-	
-    
-    
-
     /**
      * \ingroup Action
      * @private

Modified: plog/trunk/class/action/admin/adminstatisticsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminstatisticsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminstatisticsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,10 +1,11 @@
 <?php
-    /**
-     * \ingroup Action
-     * @private
-     *
-     * Action that shows statistics
-     */
+
+  /**
+   * \ingroup Action
+   * @private
+   *
+   * Action that shows statistics
+   */
     class AdminStatisticsAction extends AdminAction
 	{
 

Modified: plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatearticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,5 @@
 <?php
 
-	
-    
-	
-	
-	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -23,7 +14,6 @@
         var $_categoryId;
 		var $_categoryDescription;
         var $_categoryInMainPage;
-		var $_properties;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
@@ -36,8 +26,9 @@
 			// data validation settings
 			$this->registerFieldValidator( "categoryName", new StringValidator(), false, $this->_locale->tr("error_empty_name"));
 			$this->registerFieldValidator( "categoryId", new IntegerValidator());
-			$this->registerField( "categoryDescription" );
-			$this->registerField( "categoryInMainPage" );
+			$this->registerFieldValidator( "categoryDescription", new StringValidator(), true );
+			$this->registerFieldValidator( "categoryInMainPage", new IntegerValidator(), true );
+
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editarticlecategory" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_article_category" ));
 			$this->setValidationErrorView( $errorView );
@@ -57,8 +48,7 @@
         	$this->_categoryName = $this->_request->getValue( "categoryName" );
             $this->_categoryId   = $this->_request->getValue( "categoryId" );
 			$this->_categoryDescription = $this->_request->getValue( "categoryDescription" );
-            $this->_categoryInMainPage = $this->_request->getValue( "categoryInMainPage" );
-			$this->_properties = Array();		
+            $this->_categoryInMainPage = ( $this->_request->getValue( "categoryInMainPage" ) != "" );
 		
         	// fetch the category we're trying to update
             $categories = new ArticleCategories();
@@ -76,9 +66,9 @@
 
             // update the fields
             $category->setName( $this->_categoryName );
+            $category->setMangledName( $this->_categoryName, true );
             $category->setUrl( "" );
             $category->setInMainPage( $this->_categoryInMainPage );
-			$category->setProperties( $this->_properties );
 			$category->setDescription( $this->_categoryDescription );
 			
 			$result = false;

Modified: plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateblogcategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,5 @@
 <?php
 
-	
-    
-	
-	
-	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -22,8 +13,8 @@
         var $_categoryUrl;
         var $_categoryId;
 		var $_categoryDescription;     
-		var $_properties;
-
+        var $_category;
+        
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
          * class, BlogAction with the same parameters
@@ -52,7 +43,6 @@
         	$this->_categoryName = $this->_request->getValue( "categoryName" );
             $this->_categoryId   = $this->_request->getValue( "categoryId" );
 			$this->_categoryDescription = $this->_request->getValue( "categoryDescription" );
-        	$this->_properties = Array();		
 		
         	// fetch the category we're trying to update
             $categories = new BlogCategories();

Modified: plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateblogsettingsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,17 +1,5 @@
 <?php
 
-	
-    
-    
-    
-    
-	
-	
-    	
-	
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -32,32 +20,35 @@
 			$val = new IntegerValidator();
 			$val->addRule( new IntRangeRule( 1, 99999999 ));
 			$this->registerFieldValidator( "blogMaxMainPageItems", $val, false, $this->_locale->tr("error_invalid_number"));	
+			$this->registerFieldValidator( "blogNumCommentsPerPage", $val );
 			// the rest of validators, as normal...
 			$this->registerFieldValidator( "blogMaxRecentItems", new IntegerValidator(), false, $this->_locale->tr("error_invalid_number"));
 			$this->registerFieldValidator( "blogName",  new BlogNameValidator(), false, $this->_locale->tr("error_invalid_blog_name"));
 			$this->registerFieldValidator( "blogLocale", new StringValidator(), false, $this->_locale->tr("error_incorrect_value"));
 			$this->registerFieldValidator( "blogTemplate", new StringValidator(), false, $this->_locale->tr("error_incorrect_template"));
 			$this->registerFieldValidator( "blogCategory", new IntegerValidator(), false, $this->_locale->tr("error_invalid_blog_category"));
-			$this->registerFieldValidator( "blogNumCommentsPerPage", $val, false, $this->_locale->tr("error_invalid_number"));
 			$this->registerFieldValidator( "blogArticlesOrder", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value"));
-			$this->registerField( "blogAbout" );
-			$this->registerField( "blogShowMoreEnabled" );
-			$this->registerField( "blogEnableHtmlarea" );
-			$this->registerField( "blogEnablePullDownMenu" );
-			$this->registerField( "blogCommentsEnabled" );
-			$this->registerField( "blogCommentsOrder" );
-			$this->registerField( "blogShowFuturePosts" );
-			$this->registerField( "blogFirstDayOfWeek" );
-			$this->registerField( "blogTimeOffset" );
-			$this->registerField( "properties" );
-			$this->registerField( "blogCategoriesOrder" );
-			$this->registerField( "blogLinkCategoriesOrder" );
-			$this->registerField( "blogEnableAutosaveDrafts" );
-			$this->registerField( "blogShowInSummary" );
-			$this->registerField( "blogSendNotification" );
-			$this->registerField( "blogCommentOnlyRegisteredUsers" );
-			$this->registerField( "blogSubDomain" );
-			$this->registerField( "blogMainDomain" );
+			$this->registerFieldValidator( "blogNumCommentsPerPage", $val, false, $this->_locale->tr("error_invalid_number"));
+			$this->registerFieldValidator( "blogAbout", new StringValidator(), true );
+			$this->registerFieldValidator( "blogShowMoreEnabled", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogEnableHtmlarea", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogEnablePullDownMenu", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogCommentsEnabled", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogCommentsOrder", new IntegerValidator() );
+			$this->registerFieldValidator( "blogArticlesOrder", new IntegerValidator() );
+			$this->registerFieldValidator( "blogShowFuturePosts", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogFirstDayOfWeek", new IntegerValidator() );
+			$this->registerFieldValidator( "blogTimeOffset", new IntegerValidator( true ) );
+			$this->registerFieldValidator( "blogCategoriesOrder", new IntegerValidator() );
+			$this->registerFieldValidator( "blogLinkCategoriesOrder", new IntegerValidator() );
+			$this->registerFieldValidator( "blogEnableAutosaveDrafts", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogShowInSummary", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogSendNotification", new IntegerValidator(), true );
+			$this->registerFieldValidator( "blogCommentOnlyRegisteredUsers", new IntegerValidator(), true );
+            if( Subdomains::getSubdomainsEnabled()) {
+                $this->registerFieldValidator( "blogSubDomain", new DomainValidator());
+                $this->registerFieldValidator( "blogMainDomain", new DomainValidator());
+            }       
 			// set the view that we're going to use
 			$view = new AdminBlogSettingsView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_settings"));
@@ -135,7 +126,6 @@
             $this->_blogInfo->setBlog( $this->_request->getFilteredValue( "blogName", new HtmlFilter()));
             $this->_blogInfo->setSettings( $blogSettings );
             $this->_blogInfo->setTemplate( $this->_request->getValue( "blogTemplate" ));
-			$this->_blogInfo->setProperties( $this->_request->getValue( "properties" ));
 			$this->_blogInfo->setBlogCategoryId( $this->_request->getValue( "blogCategory" ));
 			$this->_blogInfo->setMangledBlogName( $this->_blogInfo->getBlog(), true );
 			$this->_blogInfo->setShowInSummary( Textfilter::checkboxToBoolean( $this->_request->getValue( "blogShowInSummary" )));

Modified: plog/trunk/class/action/admin/adminupdatebloguseraction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatebloguseraction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatebloguseraction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,11 +1,5 @@
 <?php
 
-		
-		
-		
-	
-    	
-
     /**
      * \ingroup Action
      * @private
@@ -25,6 +19,8 @@
 			
 			// register one validator
 			$this->registerFieldValidator( "userId", new IntegerValidator(), false, $this->_locale->tr("error_invalid_user"));
+			$this->registerFieldValidator( "perm", new ArrayValidator( new IntegerValidator() ), true );
+
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminBlogUsersListView( $this->_blogInfo );
 			$errorView->setErrorMessage( $this->_locale->tr("error_invalid_user_id" ));

Modified: plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatecustomfieldaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-    
-	
-	
-		
-		
-
     /**
      * \ingroup Action
      * @private
@@ -33,9 +26,11 @@
 			$this->registerFieldValidator( "fieldDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description"));
 			$this->registerFieldValidator( "fieldType", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
 			$this->registerFieldValidator( "fieldId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
-			$this->registerField( "fieldSearchable" );
-			$this->registerField( "fieldHidden" );
-			$this->registerField( "fieldValues" );
+            $this->registerFieldValidator( "fieldSearchable", new IntegerValidator(), true );
+			$this->registerFieldValidator( "fieldHidden", new IntegerValidator(), true );
+            if( $this->_request->getValue( "fieldType" ) == CUSTOM_FIELD_LIST )
+                $this->registerFieldValidator( "fieldValues", new ArrayValidator( new StringValidator() ));
+
 			$view = new AdminTemplatedView( $this->_blogInfo, "editcustomfield" );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_custom_field" ));
 			$this->setValidationErrorView( $view );			
@@ -49,16 +44,19 @@
 			$this->_fieldId = $this->_request->getValue( "fieldId" );
 			$this->_fieldName = $this->_request->getValue( "fieldName", new HtmlFilter());
 			$this->_fieldDescription = $this->_request->getValue( "fieldDescription", new HtmlFilter());
+			$this->_fieldSearchable = ( $this->_request->getValue( "fieldSearchable" ) != "" );
+			$this->_fieldHidden = ( $this->_request->getValue( "fieldHidden" ) != "" );
 			$this->_fieldType = $this->_request->getValue( "fieldType" );
-			$this->_fieldSearchable = $this->_request->getValue( "fieldSearchable" );
-			$this->_fieldHidden = $this->_request->getValue( "fieldHidden" );
 			
 			// get and pre-process the field values
 			if( $this->_fieldType == CUSTOM_FIELD_LIST ) {
 				$values = $this->_request->getValue( "fieldValues" );
 				$this->_fieldValues = Array();				
-				foreach( $values as $value ) {
-					$this->_fieldValues[] = Textfilter::filterAllHTML( $value );
+				if( $values )
+				{
+					foreach( $values as $value ) {
+						$this->_fieldValues[] = Textfilter::filterAllHTML( $value );
+					}
 				}
 			}			
 					

Modified: plog/trunk/class/action/admin/adminupdateeditblogaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateeditblogaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateeditblogaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,18 +1,5 @@
 <?php
 
-	
-    
-    
-    
-    
-    
-    
-    
-    
-    
-	
-    	
-
     /**
      * \ingroup Action
      * @private
@@ -27,7 +14,6 @@
         var $_blogOwner;
         var $_blogTemplate;
 		var $_blogTimeOffset;
-		var $_blogProperties;
 		var $_blogUsers;
 		var $_blogQuota;
 		var $_blogName;
@@ -49,7 +35,7 @@
 			$this->registerFieldValidator( "blogResourcesQuota", new IntegerValidator(), true, $this->_locale->tr("error_incorrect_value"));
         	$this->registerFieldValidator( "userId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_user"));
 			$this->registerFieldValidator( "userName", new UsernameValidator());
-			$this->registerField( "blogTimeOffset" );
+			$this->registerFieldValidator( "blogTimeOffset", new IntegerValidator( true ) );
 			if( Subdomains::getSubdomainsEnabled()) {
 				$this->registerFieldValidator( "blogSubDomain", new DomainValidator(), false, $this->_locale->tr("error_invalid_subdomain"));
 				$this->registerFieldValidator( "blogMainDomain", new DomainValidator(), false, $this->_locale->tr("error_invalid_domain"));
@@ -66,10 +52,10 @@
 			if( !parent::validate())
 				return( false );
 
-            $this->_blogOwner = $this->_request->getValue( "userId" );
+            $blogOwner = $this->_request->getValue( "userId" );
             // check that the user really exists
             $users = new Users();
-            $userInfo = $users->getUserInfoFromId( $this->_blogOwner );
+            $userInfo = $users->getUserInfoFromId( $blogOwner );
             if( !$userInfo ) {
 				$this->_form->setFieldValidationStatus( "userId", false );
 				$this->validationErrorProcessing();
@@ -114,7 +100,6 @@
 		{
             // fetch the values from the form which have already been validated
         	$this->_blogName = $this->_request->getFilteredValue( "blogName", new HtmlFilter());
-            $this->_blogProperties = $this->_request->getValue( "properties" );
             $this->_blogQuota = $this->_request->getValue( "blogResourcesQuota" );
             $this->_blogStatus = $this->_request->getValue( "blogStatus" );
 			$this->_blogOwner = $this->_request->getValue( "userId" );
@@ -124,7 +109,6 @@
             $this->_blog->setSettings( $blogSettings );
 			$this->_blog->setResourcesQuota( $this->_blogQuota );
 			$this->_blog->setBlog( $this->_blogName );
-			$this->_blog->setProperties( $this->_blogProperties );
             $this->_blog->setOwner( $this->_blogOwner );
 			$this->_blog->setStatus( $this->_blogStatus );
             $this->_blog->setMangledBlogName( $this->_blog->getBlog(), true );
@@ -152,7 +136,6 @@
             // do it again, baby :)))
             if( $this->_blogInfo->getId() == $this->_blog->getId()) {
             	$this->_blogInfo->setSettings( $blogSettings );
-				$this->_blog->setProperties( $this->_blogProperties );
             	$this->_session->setValue( "blogInfo", $this->_blogInfo );
             	$this->saveSession();
             }

Modified: plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateglobalarticlecategoryaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -4,14 +4,6 @@
        * version 1.0 
        * Changed from original article category.
        */
-	
-    
-	
-	
-	
-	
-	
-	
 
     /**
      * \ingroup Action
@@ -26,7 +18,6 @@
         var $_categoryUrl;
         var $_categoryId;
 		var $_categoryDescription;     
-		var $_properties;
 
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
@@ -53,7 +44,6 @@
         	$this->_categoryName = $this->_request->getValue( "categoryName" );
             $this->_categoryId   = $this->_request->getValue( "categoryId" );
 			$this->_categoryDescription = $this->_request->getValue( "categoryDescription" );
-        	$this->_properties = Array();		
 		
         	// fetch the category we're trying to update
             $categories = new GlobalArticleCategories();
@@ -68,8 +58,6 @@
 
             // update the fields
             $category->setName( $this->_categoryName );
-         
-			$category->setProperties( $this->_properties );
 			$category->setDescription( $this->_categoryDescription );
 			
             if( !$categories->updateGlobalArticleCategory( $category )) {

Modified: plog/trunk/class/action/admin/adminupdateglobalsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateglobalsettingsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateglobalsettingsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,8 +1,5 @@
 <?php
 
-	
-    
-
     /**
      * \ingroup Action
      * @private
@@ -19,11 +16,41 @@
         	$this->AdminAction( $actionInfo, $request );
 
 			$this->requireAdminPermission( "update_global_settings" );
+
+			$this->registerFieldValidator( "blogId", new IntegerValidator(), true);
+			$this->registerFieldValidator( "show", new StringValidator(), true);
+                // TODO: how do we validate the data inside the array?
+			$this->registerFieldValidator( "config", new ArrayValidator() );
+
+            $view = new AdminGlobalSettingsListView( $this->_blogInfo,  "");
+            $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+            $this->setValidationErrorView( $view );
         }
 
         function validate()
         {
-	    	// all the seettings come from a very nice array from the html form
+            $valid = parent::validate();
+
+            if($this->_form->isFieldValid("show")){
+                    // 'show' has now been validated,
+                    // so we can set our error view to a better page
+                $view = new AdminGlobalSettingsListView( $this->_blogInfo,
+                                                         $this->_request->getValue("show"));
+                $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+                $this->setValidationErrorView( $view );
+            }
+
+            if(!$valid){
+                    // since we switched the view, we need to run the error setting again
+                $this->validationErrorProcessing();
+                return false;
+            }
+
+            $view = new AdminGlobalSettingsListView( $this->_blogInfo, "" );
+            $view->setErrorMessage( $this->_locale->tr("error_saving_site_config"));
+        	$this->setValidationErrorView( $view );
+
+	    	// all the settings come from a very nice array from the html form
             $this->_newConfigOpts = Array();
             $this->_newConfigOpts = $this->_request->getValue( "config" );
 
@@ -33,7 +60,7 @@
                 $array = Array();
                 foreach(explode( "\r\n", $this->_newConfigOpts["xmlrpc_ping_hosts"] ) as $host ) {
                 	trim($host);
-                	if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" )
+                	if($host != "")
                     	array_push( $array, $host );
                 }
                 $this->_newConfigOpts["xmlrpc_ping_hosts"] = $array;
@@ -60,12 +87,6 @@
                 }
             }
 
-            // the 'locales' and 'arrays' settings are not coming from the request
-            $configOpts = $this->_config->getAsArray();
-            $locales = new Locales();
-            $this->_newConfigOpts["locales"] = $locales->getAvailableLocales();
-            $this->_newConfigOpts["templates"] = $configOpts["templates"];
-			
 			// the default_blog_id setting is coming from a chooser, so it won't be automatically picked up
             $blogId = $this->_request->getValue( "blogId" );
             if($blogId)
@@ -76,12 +97,17 @@
 
         function perform()
         {
-        	// get the global setting section
-        	$show = $this->_request->getValue( "show" );
-        	
+                // get the global setting section
+            $show = $this->_request->getValue( "show" );
+            
         	// we can proceed to update the config
             foreach( $this->_newConfigOpts as $key => $value ) {
-            	$this->_config->setValue( $key, $value );
+                    // TODO: we shouldn't blindly save all configuration values from the user, right?
+                    // An admin could fill up the config table with all sorts of garbage.
+                if(is_array($value) || is_object($value))
+                    $this->_config->setValue($key, $value);
+                else
+                    $this->_config->setValue($key, trim($value));
             }
             // and finally save everything
             $res = $this->_config->save();

Modified: plog/trunk/class/action/admin/adminupdatelinkaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatelinkaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatelinkaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,15 +1,5 @@
 <?php
 
-	
-	
-	
-    
-	
-	
-	
-	
-		
-
     /**
      * \ingroup Action
      * @private
@@ -39,7 +29,7 @@
 			// linkRssFeed will only be validated if it is available in the form
 			$this->registerFieldValidator( "linkRssFeed", new HttpUrlValidator(), true, $this->_locale->tr( "error_invalid_url" ));
 			$this->registerFieldValidator( "linkCategoryId", new IntegerValidator());
-			$this->registerFieldValidator( "linkDescription", new EmptyValidator());
+			$this->registerFieldValidator( "linkDescription", new StringValidator(), true );
 			$this->registerFieldValidator( "linkId", new IntegerValidator());
 			$view = new AdminEditLinkView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_link" ));

Modified: plog/trunk/class/action/admin/adminupdatepermissionaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatepermissionaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatepermissionaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-	
-		
-		
-			
-		
-
     /**
      * \ingroup Action
      * @private
@@ -23,8 +16,8 @@
 			$this->registerFieldValidator( "permissionName", new StringValidator(), false, $this->_locale->tr("error_empty_name" ));
 			$this->registerFieldValidator( "permissionDescription", new StringValidator(), false, $this->_locale->tr("error_empty_description" ));
 			$this->registerFieldValidator( "permissionId", new IntegerValidator());
-			$this->registerField( "corePermission" );
-			$this->registerField( "adminOnlyPermission" );			
+			$this->registerFieldValidator( "corePermission", new IntegerValidator(), true );
+			$this->registerFieldValidator( "adminOnlyPermission", new IntegerValidator(), true );			
 			// and the view we should show in case there is a validation error
 			$errorView = new AdminTemplatedView( $this->_blogInfo, "editpermission" );
 			$errorView->setErrorMessage( $this->_locale->tr("error_updating_permission" ));			
@@ -38,10 +31,17 @@
 			// load the permission			
 			$perms = new Permissions();
 			$this->_perm = $perms->getPermission( $this->_request->getValue( "permissionId" ));
+            $this->_view = new AdminPermissionsListView( $this->_blogInfo );
 			
 			if( !$this->_perm ) {
 				$this->_message = $this->_locale->tr("error_fetching_permission" );
 				return false;
+                    // TODO: 1.2 branch said:
+                    /*
+				$this->_view->setErrorMessage( $this->_locale->tr("error_fetching_permission" ));			
+				$this->setCommonData();
+				return( false );
+                    */
 			}
 			
 			$this->_perm->setName( $this->_request->getValue( "permissionName" ));			
@@ -57,7 +57,14 @@
 			} else {
 				$this->_message = $this->_locale->tr("error_updating_permission" );
 				return false;
+            }
+                // TODO: 1.2 said:
+                    /*
+			if( $perms->updatePermission( $perm )) {
+				$this->_view->setSuccessMessage( $this->_locale->tr("permission_updated_ok" ));
+				$this->setCommonData();
 			}
+                    */
         }
 
         /**

Modified: plog/trunk/class/action/admin/adminupdatepluginsettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdatepluginsettingsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdatepluginsettingsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,11 +1,5 @@
 <?php
 
-	
-    
-    
-	
-	
-
     /**
      * \ingroup Action
      * @private
@@ -56,7 +50,7 @@
 			}
 			
 			// "can override" fields
-			$this->registerField( "canOverride" );
+			$this->registerFieldValidator( "canOverride", new ArrayValidator( new IntegerValidator() ), true );
 		}
 
         /**
@@ -76,7 +70,7 @@
 			GlobalPluginConfig::setValues( $settings );
 			
 			// load the override settings and save them
-			GlobalPluginConfig::setOverrideSettings( $this->_request->getValue( "canOverride" ));
+			GlobalPluginConfig::setOverrideSettings( $this->_request->getValue( "canOverride" ) );
 			
 			$this->_view = new AdminPluginSettingsView( $this->_blogInfo, $this->_userInfo );
 			$this->_view->setData( true );

Modified: plog/trunk/class/action/admin/adminupdateresourceaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateresourceaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateresourceaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -23,11 +23,33 @@
 			// data validation
 			$this->registerFieldValidator( "albumId", new IntegerValidator(), false, $this->_locale->tr("error_empty_album_id" ));
 			$this->registerFieldValidator( "resourceId", new IntegerValidator(), false, $this->_locale->tr("error_empty_resource_id" ));
-			$this->registerField( "resourceDescription" );
+			$this->registerFieldValidator( "resourceDescription", new StringValidator(), true);
+			$this->registerFieldValidator( "regenerate", new StringValidator(), true);
+
 			$view = new AdminEditResourceView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
 			$this->setValidationErrorView( $view );
         }
+		
+		function validate()
+		{
+            if(parent::validate())
+                return true;
+            
+                // If it didn't validate, customize the view returned based on inputs
+            if($this->_form->isFieldValid("resourceId")){
+                $resources = new GalleryResources();
+                $resource = $resources->getResource( $this->_request->getValue("resourceId"), $this->_blogInfo->getId());
+                if( !$resource ) {	
+                    $this->_view = new AdminResourcesListView( $this->_blogInfo );
+                    $this->_view->setErrorMessage( $this->_locale->tr("error_updating_resource" ));
+                    $this->setCommonData();
+                    return false;
+                }
+            }
+            $this->_view->setValue( "resource", $resource );
+            return false;
+		}
 
         function updateResource()
         {
@@ -56,10 +78,16 @@
             	$this->_message = $this->_locale->tr("error_updating_resource");
                 return false;
             }
+            else {
+                    // check which submit button was pressed
+                if($this->_request->getValue("regenerate" ) != ""){
+                    return Controller::setForwardAction( "regeneratePreview" );
+                }
+            }
 
             $this->_message = $this->_locale->pr( "resource_updated_ok", $resource->getFileName() );
             $this->notifyEvent( EVENT_POST_RESOURCE_UPDATE, Array( "resource" => &$resource ));
-
+                
             // clear the cache
             CacheControl::resetBlogCache( $this->_blogInfo->getId(), false );
 

Modified: plog/trunk/class/action/admin/adminupdateresourcealbumaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateresourcealbumaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateresourcealbumaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -26,8 +26,8 @@
 			$this->registerFieldValidator( "albumId", new IntegerValidator() );
 			$this->registerFieldValidator( "albumName", new StringValidator(), false, $this->_locale->tr("error_empty_name") );
 			$this->registerFieldValidator( "parentId", new IntegerValidator() );
-			$this->registerField( "albumDescription" );
-			$this->registerField( "showAlbum" );
+			$this->registerFieldValidator( "albumDescription", new StringValidator(), true );
+			$this->registerFieldValidator( "showAlbum", new IntegerValidator(), true );
 			$view = new AdminEditResourceAlbumView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_album" ));
 			$this->setValidationErrorView( $view );
@@ -41,9 +41,7 @@
         	$this->_parentId = $this->_request->getValue( "parentId" );
             $this->_albumName = Textfilter::filterAllHTML($this->_request->getValue( "albumName" ));
             $this->_albumDescription = Textfilter::filterAllHTML($this->_request->getValue( "albumDescription" ));
-            $this->_showAlbum = $this->_request->getValue( "showAlbum" );
-            if( $this->_showAlbum == "" )
-            	$this->_showAlbum = 0;
+            $this->_showAlbum = ( $this->_request->getValue( "showAlbum" ) != "" );
 
             // fetch the albums for this blog
             $albums = new GalleryAlbums();

Modified: plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateuserprofileaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,16 +1,5 @@
 <?php
 
-	
-    
-    	
-    
-    
-    
-    	
-    	
-    
-    
-
     /**
      * \ingroup Action
      * @private
@@ -34,14 +23,21 @@
 			
 			// data validation
         	$this->registerFieldValidator( "userEmail", new EmailValidator(), false, $this->_locale->tr("error_incorrect_email_address"));
-			$this->registerFieldValidator( "userPictureId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
-			$this->registerField( "userAbout" );
 			$this->registerField( "properties" );
-			$this->registerField( "userIsSiteAdmin" );
+			$this->registerFieldValidator( "userFullName", new StringValidator(),true );
+			$this->registerFieldValidator( "userId", new IntegerValidator() );
+			$this->registerFieldValidator( "userAbout", new StringValidator(), true );
+			$this->registerFieldValidator( "userIsSiteAdmin", new IntegerValidator(), true );
+			$this->registerFieldValidator( "userPermissions", new ArrayValidator( new IntegerValidator() ), true );
+        	$this->registerFieldValidator( "userProfilePassword", new PasswordValidator(), true,
+                                           $this->_locale->tr("error_invalid_password"));
+			$this->registerFieldValidator( "userStatus", new IntegerValidator(), false,
+                                           $this->_locale->tr("error_incorrect_value" ));
+
+                // TODO: these aren't used in this class, but they are in the form
+			$this->registerFieldValidator( "userPictureId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));
 			$this->registerFieldValidator( "userName", new UsernameValidator());
-			$this->registerField( "userPermissions" );
-        	$this->registerFieldValidator( "userProfilePassword", new PasswordValidator(), true, $this->_locale->tr("error_invalid_password"));			
-			$this->registerFieldValidator( "userStatus", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value" ));			
+
 			$view = new AdminEditSiteUserView( $this->_blogInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_user"));
 			$this->setValidationErrorView( $view );
@@ -57,8 +53,7 @@
             $this->_userEmail = $this->_request->getValue( "userEmail", new HtmlFilter());
             $this->_userAbout = $this->_request->getValue( "userAbout", new HtmlFilter());
             $this->_userFullName = $this->_request->getValue( "userFullName", new HtmlFilter());
-            $this->_adminPrivs = $this->_request->getValue( "userIsSiteAdmin" );
-			$this->_userProperties = $this->_request->getValue( "properties" );
+            $this->_adminPrivs = ( $this->_request->getValue( "userIsSiteAdmin" ) != "" );
 			$this->_userStatus = $this->_request->getValue( "userStatus" );
 			$this->_perms = $this->_request->getValue( "userPermissions" );
 
@@ -79,7 +74,6 @@
             $user->setAboutMyself( $this->_userAbout );
             $user->setSiteAdmin( $this->_adminPrivs );
             $user->setFullName( $this->_userFullName );
-			$user->setProperties( $this->_userProperties );
 			$user->setStatus( $this->_userStatus );
             if( $this->_userPassword != "" )
             	$user->setPassword( $this->_userPassword );

Modified: plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php
===================================================================
--- plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/adminupdateusersettingsaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,14 +1,5 @@
 <?php
 
-	
-    
-	
-		
-    
-	
-		
-    
-
     /**
      * \ingroup Action
      * @private
@@ -18,9 +9,6 @@
     class AdminUpdateUserSettingsAction extends AdminAction 
 	{
 
-        var $_userPassword;
-        var $_userConfirmPassword;
-
     	/**
          * Constructor. If nothing else, it also has to call the constructor of the parent
          * class, BlogAction with the same parameters
@@ -29,13 +17,14 @@
         {
         	$this->AdminAction( $actionInfo, $request );
 			
-            $this->registerField( "confirmPassword" );
-			$this->registerField( "userFullName" );
+			$this->registerFieldValidator( "userFullName", new StringValidator(), true );
 			$this->registerFieldValidator( "userEmail", new EmailValidator(), false, $this->_locale->tr("error_incorrect_email_address" ));
 			$this->registerFieldValidator( "userPictureId", new IntegerValidator(), false, $this->_locale->tr("error_incorrect_value"  ));
-			$this->registerField( "userAbout" );
 			$this->registerField( "properties" );
-			$this->registerField( "userSettingsPassword", new PasswordValidator(), true, $this->_locale->tr("error_invalid_password" ));
+			$this->registerFieldValidator( "userAbout", new StringValidator(), true );
+			$this->registerFieldValidator( "userSettingsPassword", new PasswordValidator(), true );
+            $this->registerFieldValidator( "confirmPassword", new PasswordValidator(), true );
+
 			$view = new AdminUserProfileView( $this->_blogInfo, $this->_userInfo );
 			$view->setErrorMessage( $this->_locale->tr("error_updating_user_settings"));
 			$this->setValidationErrorView( $view );
@@ -47,13 +36,17 @@
          */
         function validate()
         {
+                // TODO: 2.0 had this removed?
+            if(!parent::validate())
+                return false;
+
 			// use the FormValidator object to validate the data
 			$validationOk =  $this->_form->validate( $this->_request );	
 	
 			// validate that the password is confirmed
             $this->_userPassword = $this->_request->getFilteredValue( "userSettingsPassword", new TrimFilter());
             $this->_userConfirmPassword = $this->_request->getFilteredValue( "confirmPassword", new TrimFilter());
-			
+
             // check that the password is correct and confirm it
             if( $this->_userPassword != "" ) {
             	if( $this->_userPassword != $this->_userConfirmPassword ) {
@@ -68,7 +61,6 @@
 				$this->validationErrorProcessing();
 			}
 
-			
 			return $validationOk;
         }
 
@@ -77,12 +69,12 @@
         	// update the user information
 			$f = new HtmlFilter();
             $this->_userInfo->setEmail( $this->_request->getFilteredValue( "userEmail", $f ));
-            if( $this->_userPassword != "" )
-            	$this->_userInfo->setPassword( $this->_userPassword );
+            $userPassword = trim($this->_request->getValue( "userSettingsPassword" ));
+            if( $userPassword != "" )
+            	$this->_userInfo->setPassword( $userPassword );
             $this->_userInfo->setAboutMyself( $this->_request->getFilteredValue( "userAbout", $f ));
             $this->_userInfo->setFullName( $this->_request->getValue( "userFullName", $f ));
 			$this->_userInfo->setPictureId( $this->_request->getValue( "userPictureId" ));
-			$this->_userInfo->setProperties( $this->_request->getValue( "properties" ));
 			$this->notifyEvent( EVENT_PRE_USER_UPDATE, Array( "user" => &$this->_userInfo ));			
             $this->_session->setValue( "userInfo", $this->_userInfo );
             $this->saveSession();

Modified: plog/trunk/class/action/admin/chooser/adminresourcelistaction.class.php
===================================================================
--- plog/trunk/class/action/admin/chooser/adminresourcelistaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/admin/chooser/adminresourcelistaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -2,6 +2,7 @@
 
 	
     
+    lt_include( PLOG_CLASS_PATH."class/data/validator/integervalidator.class.php" );
 
     /**
      * \ingroup Action
@@ -20,11 +21,12 @@
         function AdminResourceListAction( $actionInfo, $request )
         {
         	$this->AdminAction( $actionInfo, $request );
-			
-            $this->_albumId = $this->_request->getValue( "albumId" );
-            if( $this->_albumId == "" )
-            	$this->_albumId = 0;	
-            	
+			$this->registerFieldValidator( "albumId", new IntegerValidator(), true );
+
+        	// and the view we should show in case there is a validation error
+			$view = new AdminSimpleResourcesListView( $this->_blogInfo );
+			$this->setValidationErrorView( $view );
+
             $this->requirePermission( "view_resources" );		
         }
 
@@ -33,6 +35,11 @@
          */
         function perform()
         {
+            // fetch the albumId
+            $this->_albumId = $this->_request->getValue( "albumId" );
+            if( $this->_albumId == "" )
+            	$this->_albumId = 0;
+
 			$this->_view = new AdminSimpleResourcesListView( $this->_blogInfo, Array( "albumId" => $this->_albumId));
             $this->setCommonData();
 

Modified: plog/trunk/class/action/blogaction.class.php
===================================================================
--- plog/trunk/class/action/blogaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/blogaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -176,12 +176,32 @@
                 }
             }
 
+            $val = new IntegerValidator();
     		$blogId = $this->_request->getValue( 'blogId' );
+            if( !$val->validate( $blogId ))
+                $blogId = "";	
+
+            $val = new IntegerValidator();
+    		$userId = $this->_request->getValue( 'userId' );
+            if( !$val->validate( $userId ))
+                $userId = "";	
+
+            $val = new BlogNameValidator();
     		$blogName = $this->_request->getValue( 'blogName' );
-    		$userId = $this->_request->getValue( 'userId' );
+            if( !$val->validate( $blogName ))
+                $blogName = "";	
+
+            $val = new UsernameValidator();
     		$userName = $this->_request->getValue( 'blogUserName' );
+            if( !$val->validate( $userName ))
+                $userName = "";	
+
+            $val = new DomainValidator();
             $blogDomain = $this->_request->getValue( 'blogDomain' );
+            if( !$val->validate( $blogDomain ))
+                $blogDomain = "";	
 
+
             // if there is a "blogId" parameter, it takes precedence over the
             // "user" parameter.
             if( !$blogId && !$blogName && !$blogDomain) {
@@ -328,29 +348,24 @@
             if( strlen($inDate) == 4 ) 
         	{
         		$year = $inDate;
-        		$outDate = Timestamp::getDateWithOffset( $year."0101000000", -$serverTimeOffset );
-        		$maxDate = Timestamp::getDateWithOffset( $year."1231235959", -$serverTimeOffset );
+        		$outDate = Timestamp::getDateWithOffset( $year."0101000000", -abs($serverTimeOffset) );
+        		$maxDate = Timestamp::getDateWithOffset( $year."1231235959", abs($serverTimeOffset) );
         	} 
         	elseif ( strlen($inDate) == 6 )
         	{
                 $year = substr( $inDate, 0, 4 );
                 $month = substr( $inDate, 4, 2 );
                 $dayOfMonth = Date_Calc::daysInMonth( $month, $year );
-        		$outDate = Timestamp::getDateWithOffset( $year.$month."01000000", -$serverTimeOffset );
-        		$maxDate = Timestamp::getDateWithOffset( $year.$month.$dayOfMonth."235959", -$serverTimeOffset );
+        		$outDate = Timestamp::getDateWithOffset( $year.$month."01000000", -abs($serverTimeOffset) );
+        		$maxDate = Timestamp::getDateWithOffset( $year.$month.$dayOfMonth."235959", abs($serverTimeOffset) );
         	}
         	elseif ( strlen($inDate) == 8 )
         	{
         		$year = substr( $inDate, 0, 4 );
                 $month = substr( $inDate, 4, 2 );
                 $day = substr( $inDate, 6, 2 );
-        		$outDate  = Timestamp::getDateWithOffset( $year.$month.$day."000000", -$serverTimeOffset );
-                //$maxDate = Timestamp::getDateWithOffset( $year.$month.$day."235959", -$serverTimeOffset );                                                             
-                //                                                                                               
-                // Fix for issue http://bugs.lifetype.net/view.php?id=1018
-                // Although I am not sure if this fix will have other consequences...
-				//
-                $maxDate = Timestamp::getDateWithOffset( $year.$month.$day."235959", 0 );
+        		$outDate  = Timestamp::getDateWithOffset( $year.$month.$day."000000", -abs($serverTimeOffset) );
+                $maxDate = Timestamp::getDateWithOffset( $year.$month.$day."235959", abs($serverTimeOffset) );
         	}
         	else
         	{
@@ -370,7 +385,6 @@
 	     */
 	    function _getPage()
 	    {
-	                	
 				// get the value from the request
 				$page = HttpVars::getRequestValue( "page" );
 				// but first of all, validate it

Modified: plog/trunk/class/action/defaultaction.class.php
===================================================================
--- plog/trunk/class/action/defaultaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/defaultaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,7 +1,7 @@
 <?php
 
 	lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
-	
+
     /**
      * \ingroup Action
      * @private
@@ -18,13 +18,15 @@
 		var $_userId;
 		var $_userName;
 		var $_postAmount;
+        var $_searchTerms;
 
 		function DefaultAction( $actionInfo, $request )
         {
 			$this->BlogAction( $actionInfo, $request );
 			
+			$this->registerFieldValidator( "searchTerms", new StringValidator( true ), true );
 			$this->registerFieldValidator( "postCategoryId", new IntegerValidator(), true );
-			$this->registerFieldValidator( "postCategoryName", new StringValidator(), true );
+			$this->registerFieldValidator( "postCategoryName", new StringValidator( ), true );
 			$this->registerFieldValidator( "userId", new IntegerValidator(), true );
 			$this->registerFieldValidator( "userName", new UsernameValidator(), true );
 			
@@ -51,7 +53,7 @@
 					
 			$this->_userId = $this->_request->getValue( 'userId', -1 );
 			$this->_userName = $this->_request->getValue( 'userName', '' );
-			$this->_searchTerms = $this->_request->getValue( 'searchTerms', '' );
+            $this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
 
             return true;
         }

Modified: plog/trunk/class/action/resourceserveraction.class.php
===================================================================
--- plog/trunk/class/action/resourceserveraction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/resourceserveraction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -23,7 +23,7 @@
 		function ResourceServerAction( $actionInfo, $request )
 		{
 			$this->Action( $actionInfo, $request );
-			
+
 			// keep the session for later use
             $session = HttpVars::getSession();
         	$this->_session = $session['SessionInfo'];			
@@ -35,9 +35,10 @@
 			$this->registerFieldValidator( "albumId", new IntegerValidator(), true );
 			$this->registerFieldValidator( "albumName", new StringValidator(), true );
 			$this->registerFieldValidator( "blogId", new IntegerValidator(), true );
-			$this->registerFieldValidator( "blogName", new StringValidator(), true );
+			$this->registerFieldValidator( "blogDomain", new DomainValidator(), true );
+			$this->registerFieldValidator( "blogName", new BlogNameValidator(), true );
 			$this->registerFieldValidator( "userId", new IntegerValidator(), true );
-			$this->registerFieldValidator( "blogUserName", new StringValidator(), true );			
+			$this->registerFieldValidator( "blogUserName", new UsernameValidator(), true );
 			
 			// since this class does not return HTML code but files, we cannot
 			// return HTML so let's return 404 status code with a custom error message
@@ -189,7 +190,7 @@
 				$this->_view = new View();
 				$this->_view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
 				$this->_view->addHeaderResponse( "Status: 404 Not Found" );
-				$this->_view->addHeaderResponse( "X-LifeType-Error: Resource $this->_resId not found" );		
+				$this->_view->addHeaderResponse( "X-LifeType-Error: Resource ".$this->_resId." not found" );
 				
 				return false;
 			}
@@ -208,7 +209,7 @@
 			}
 			
 			// generate the correct view with the resource data...			
-			$this->_view = new RedirectView( $redirectUrl, $this->_mode );
+			$this->_view = new RedirectView( $redirectUrl );
 			
 			return true;
 		}

Modified: plog/trunk/class/action/rssaction.class.php
===================================================================
--- plog/trunk/class/action/rssaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/rssaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,7 +1,7 @@
 <?php
 
 	lt_include( PLOG_CLASS_PATH."class/dao/articlestatus.class.php" );
-	
+
     /**
      * \ingroup Action
      * @private
@@ -21,12 +21,7 @@
 			
 			$this->registerFieldValidator( "categoryId", new IntegerValidator(), true );
 			$this->registerFieldValidator( "userId", new IntegerValidator(), true );			
-			
-			// create a StringValidator and add an extra rule to make sure that the input string contains only
-			// alphanumeric characters
-			$profileValidator = new StringValidator();
-			$profileValidator->addRule( new RegexpRule( "^([a-zA-Z0-9]*)$" ));
-			$this->registerFieldValidator( "profile", $profileValidator, true );
+			$this->registerFieldValidator( "profile", new TemplateNameValidator(), true);
 
 			// generate a dummy view with nothing in it to signal an error
 			$view = new RssView( $this->_blogInfo, RSS_VIEW_DEFAULT_PROFILE );

Modified: plog/trunk/class/action/searchaction.class.php
===================================================================
--- plog/trunk/class/action/searchaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/searchaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -16,8 +16,8 @@
         {
             $this->BlogAction( $actionInfo, $request );
 			
-			// data validatdion
-			$this->registerFieldValidator( "searchTerms", new StringValidator());
+			// data validation
+			$this->registerFieldValidator( "searchTerms", new StringValidator( true ));
 			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_incorrect_search_terms" ));
         }
 		
@@ -25,7 +25,13 @@
         {
 			// get the search terms that have already been validated...
             $this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
-		
+
+            if(trim($this->_searchTerms) == ""){
+                $this->_view = new ErrorView( $this->_blogInfo, "error_incorrect_search_terms" );
+                $this->setCommonData();
+                return false;
+            }
+            
 			// check if the search feature is disabled in this site...
 			$config =& Config::getConfig();
 			if( !$config->getValue( "search_engine_enabled" )) {
@@ -68,12 +74,11 @@
                 
                 return true;
             }
-            
+
             // if only one search result, we can see it straight away 
             if( count($searchResults) == 1 && $numSearchResults == 1 ) {
 				// only one search result, we can redirect the view via the URL,
 				// so that the right permalink appears in the address bar
-                $request = HttpVars::getRequest();
                 $searchResult = array_pop( $searchResults );
                 $article = $searchResult->getResult();
 				$url = $this->_blogInfo->getBlogRequestGenerator();

Modified: plog/trunk/class/action/templateaction.class.php
===================================================================
--- plog/trunk/class/action/templateaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/templateaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -72,8 +72,10 @@
                 return false;
             }	        
         	// get the name of the template file and create the view
-        	$this->_view = new TemplateView( $this->_blogInfo, 
-			                                 $this->_request->getValue( "show" ));
+        	$this->_view = new TemplateView( $this->_blogInfo, $templateFile);
+                // NOTE: this passes unvalidated data to the view,
+                // need to validate it in the template if you are
+                // going to use it.
             $this->_view->setValue( "request", $this->_request );
             // add all the common information to the view
             $this->setCommonData();

Modified: plog/trunk/class/action/viewalbumaction.class.php
===================================================================
--- plog/trunk/class/action/viewalbumaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/viewalbumaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -30,7 +30,6 @@
 			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_fetching_album" ));
         }
 
-        // checks that the articleId is valid
         function validate()
         {
 			if( !parent::validate())

Modified: plog/trunk/class/action/viewarticleaction.class.php
===================================================================
--- plog/trunk/class/action/viewarticleaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/viewarticleaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -32,7 +32,8 @@
 			$this->registerFieldValidator( "postCategoryName", new StringValidator(), true );
 			$this->registerFieldValidator( "userId", new IntegerValidator(), true );
 			$this->registerFieldValidator( "userName", new UsernameValidator(), true );
-
+            $this->registerFieldValidator( "Date", new IntegerValidator(), true );
+            
 			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_fetching_article" ));
         }
         
@@ -45,7 +46,7 @@
         	$this->_articleId = $this->_request->getValue( "articleId" );
 			$this->_articleName = $this->_request->getValue( "articleName" );
 			// find some other additional parameters and use some 'null' values
-			// in casuse they're empty
+			// in case they're empty
 			$this->_categoryId = $this->_request->getValue( "postCategoryId", -1 );
 			$this->_categoryName = $this->_request->getValue( "postCategoryName" );
 			$this->_userId = $this->_request->getValue( "userId", -1 );
@@ -148,11 +149,15 @@
 					$articles = new Articles();
 					if( $this->_articleId ){
 						$articles->updateArticleNumReads( $this->_articleId );
-                        $this->_updateArticleReferrersById( $this->_articleId );
+                        if( $this->_config->getValue( "referer_tracker_enabled" )) {
+                            $this->_updateArticleReferrersById( $this->_articleId );
+                        }
                     }
  					else if($this->_articleName){
 						$articles->updateArticleNumReadsByName( $this->_articleName );
-                        $this->_updateArticleReferrersByTitle($this->_articleName );
+                        if( $this->_config->getValue( "referer_tracker_enabled" )) {
+                            $this->_updateArticleReferrersByTitle($this->_articleName );
+                        }
                     }
                     else{
                             // print "Can't update referrers without an id or a name...";
@@ -241,7 +246,9 @@
             }
 			
 			// update the referrers, if needed
-			$this->_updateArticleReferrers( $article );
+            if( $this->_config->getValue( "referer_tracker_enabled" )) {
+                $this->_updateArticleReferrers( $article );
+            }
 						
             // if everything's fine, we set up the article object for the view
             $this->_view->setArticle( $article );

Modified: plog/trunk/class/action/viewarticletrackbacksaction.class.php
===================================================================
--- plog/trunk/class/action/viewarticletrackbacksaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/viewarticletrackbacksaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -14,7 +14,7 @@
 	{
 	
         var $_articleId;
-	var $_articleName;
+		var $_articleName;
 		var $_categoryId;
 		var $_categoryName;
 		var $_userId;
@@ -46,7 +46,10 @@
 			$this->_categoryName = $this->_request->getValue( "postCategoryName" );
 			$this->_userId       = $this->_request->getValue( "userId", -1 );
 			$this->_userName     = $this->_request->getValue( "userName" );
-			$this->_date         = $this->_request->getValue( "Date", -1 );
+			$this->_date         = $this->_request->getValue( "Date" );
+        	$val = new IntegerValidator();
+        	if( !$val->validate( $this->_date ) )
+            	$this->_date = -1;
 			
 			// Caculate the correct article date period
 			$adjustedDates = $this->_getCorrectedDatePeriod( $this->_date );

Modified: plog/trunk/class/action/viewresourceaction.class.php
===================================================================
--- plog/trunk/class/action/viewresourceaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/action/viewresourceaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -19,46 +19,29 @@
 		function ViewResourceAction( $actionInfo, $request )
         {
 			$this->BlogAction( $actionInfo, $request );
-			
 			$this->registerFieldValidator( "resId", new IntegerValidator(), true );
 			$this->registerFieldValidator( "resource", new StringValidator(), true );
 			$this->registerFieldValidator( "albumId", new IntegerValidator(), true );
-			$this->registerFieldValidator( "albumName", new StringValidator(), true );
+			$this->registerFieldValidator( "albumName", new StringValidator(), true );
+
+			if( $this->_request->getValue( "resource" ) == "" )
+				$this->registerFieldValidator( "resId", new IntegerValidator() );
 			
-			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_fetching_resource" ));			
+			$this->setValidationErrorView( new ErrorView( $this->_blogInfo, "error_fetching_resource" ));
         }
 
-        // checks that the articleId is valid
-        function validate()
-        {
-			if( !parent::validate())
-				return false;
-	
-        	$this->_resourceId = $this->_request->getValue( "resId" );
-            $this->_resourceName = $this->_request->getValue( "resource" );
-			$this->_albumId = $this->_request->getValue( "albumId" );
-			$this->_albumName = $this->_request->getValue( "albumName" );
-            
-            if( $this->_resourceName == "" ) {
-            	$validator = new IntegerValidator();
-                // if the information is not correct, we better show a message and quit
-                if( !$validator->validate( $this->_resourceId )) {
-                	$this->_view = new ErrorView( $this->_blogInfo, "error_incorrect_resource_id" );
-                    $this->setCommonData();
-
-                    return false;
-                }
-            }
-			
-			// if no album id parameter in the url, forget about the whole thing
-			if( $this->_albumId == "" && $this->_albumName == "")
-				$this->_albumId = -1;
-
-            return true;
-        }
-
         function perform()
         {
+    		lt_include( PLOG_CLASS_PATH."class/data/filter/htmlfilter.class.php" );
+        	$this->_resourceId = $this->_request->getValue( "resId" );
+            $this->_resourceName = $this->_request->getFilteredValue( "resource", new HtmlFilter() );
+			$this->_albumId = $this->_request->getValue( "albumId" );
+			$this->_albumName = $this->_request->getFilteredValue( "albumName", new HtmlFilter() );
+
+			// if no album id parameter in the url, forget about the whole thing
+			if( $this->_albumId == "" && $this->_albumName == "")
+				$this->_albumId = -1;
+
         	$galleryResources = new GalleryResources();
 			
 			// initialize the view

Modified: plog/trunk/class/config/configabstractstorage.class.php
===================================================================
--- plog/trunk/class/config/configabstractstorage.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/config/configabstractstorage.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -28,14 +28,7 @@
 
         /**
          * Returns a constant determining the type of the value passed as parameter. The constants
-         * are:
-         * - TYPE_INTEGER = 1
-         * - TYPE_BOOLEAN = 2
-         * - TYPE_STRING = 3
-         * - TYPE_OBJECT = 4
-         * - TYPE_ARRAY = 5
-         * - TYPE_FLOAT = 6
-         * 
+         * are defined above.
          *
          * @param value The value from which we'd like to know its type
          * @return Returns one of the above.

Modified: plog/trunk/class/config/configdbstorage.class.php
===================================================================
--- plog/trunk/class/config/configdbstorage.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/config/configdbstorage.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -6,21 +6,21 @@
 	 *
      * Storage backend that stores/retrieves the data from the plog_config
      * table.
-     * The structore of the table is as follows:
+     * The structure of the table is as follows:
 	 *
      * - id: setting identifier
      * - config_key: Name of the setting. Can't be empty
      * - config_value: Value assigned to the key
      * - value_type: This field can take several values and gives the class
-     * a hint regardign the type of the value:
-     * -- 1: integer. The config_value field represents is value.
-     * -- 2: boolean. It is saved as 1 == true and 0 == false.
-     * -- 3: string. It is saved as is.
-     * -- 4: object. The object is saved in a seralized way.
-     * -- 5: array. The arrays are also saved serialized. This is transparently
+     *               a hint regarding the type of the value:
+     * -- TYPE_INTEGER: It is saved as is.
+     * -- TYPE_BOOLEAN: It is saved as 1 == true and 0 == false.
+     * -- TYPE_STRING: It is saved as is.
+     * -- TYPE_OBJECT: The object is saved in a seralized way.
+     * -- TYPE_ARRAY: The arrays are also saved serialized. This is transparently
      * done inside the save() and saveValue() methods, and therefore the user
      * does not have to worry about doing it.
-     * -- 6: float. It is saved as is.
+     * -- TYPE_FLOAT: It is saved as is.
      * 
      * Type detection is provided via the built-in mechanisms that PHP offers.
      * </ul>
@@ -146,6 +146,7 @@
 		 */
         function setValue( $key, $value )
         {
+
         	$this->_data[$key] = $value;
 
             return true;
@@ -235,6 +236,13 @@
 				 case TYPE_INTEGER:
                  case TYPE_BOOLEAN:
                  case TYPE_FLOAT:
+                       // TODO: Note, this is a little broken.  We ask PHP for the type of
+                       // the variable, so it always returns a string, so this code isn't used.
+                       // Probably the _getType function should be rewritten to use the values
+                       // from the database instead, rather than rewriting the types that are
+                       // stored in the database.  We should fix this in the 2.0 wizard, since
+                       // all int/bool/floats have been stored in the database as a string.
+                       // All that is required is to change the value_type column, the data is fine.
                  	$query = "UPDATE ".$this->_dbPrefix."config SET config_value =
                              '$value', value_type = $type WHERE config_key = '$key'";
                     break;
@@ -252,7 +260,7 @@
                  	throw( new Exception( "_updateValue: _getType produced an unexpected value of $type when checking value \"$value\""));
                     die();
              }
-			 
+
              $result = $this->_db->Execute( $query );
 
              if( $result )

Modified: plog/trunk/class/controller/controller.class.php
===================================================================
--- plog/trunk/class/controller/controller.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/controller/controller.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -206,6 +206,19 @@
         }
 
         /**
+         * check action exist in controller map or not
+         *
+         * @param actionName Name of the action
+         * @return true if action exist
+         * @static
+         */
+        function checkActionExist( $actionName )
+        {
+            global $_plogController_actionMap;
+            return (array_key_exists( $actionName, $_plogController_actionMap ) );
+        }
+
+        /**
          * Add function info here
          *
          * @private

Modified: plog/trunk/class/dao/article.class.php
===================================================================
--- plog/trunk/class/dao/article.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/article.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -235,6 +235,7 @@
         	if( $this->_categories == null ) {
 				$this->_categories = array();
                 $categories = new ArticleCategories();
+                $this->_categories = Array();
         		foreach( $this->getCategoryIds() as $categoryId ) {
         			if(( $category = $categories->getCategory( $categoryId )))
 	        			array_push( $this->_categories, $category);

Modified: plog/trunk/class/dao/articlecategories.class.php
===================================================================
--- plog/trunk/class/dao/articlecategories.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/articlecategories.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -267,6 +267,21 @@
          */
         function addArticleCategory( &$articleCategory )
         {
+            $mangledName = $articleCategory->getMangledName();
+            $i = 1;
+                // check if there already is a category with the same mangled name
+            while($this->getCategoryByName($mangledName,
+                                           $articleCategory->getBlogId()))
+            {
+                $i++;
+                    // and if so, assign a new one
+                    // if we already tried with blogname+"i" we have
+                    // to strip "i" before adding it again!
+                $mangledName = substr($mangledName, 0,
+                               ($i > 2) ? strlen($mangledName)-strlen($i-1) : strlen($mangledName)).$i;
+            }
+            $articleCategory->setMangledName($mangledName);
+
         	if(( $result = $this->add( $articleCategory, Array(  DaoCacheConstants::CACHE_ARTICLE_CATEGORIES => "getId" )))) {
         		$this->_cache->removeData( $articleCategory->getBlogId(),  DaoCacheConstants::CACHE_ARTICLE_CATEGORIES_BLOG );
 				$this->_cache->removeData( $articleCategory->getMangledName(),  DaoCacheConstants::CACHE_ARTICLE_CATEGORIES_BYNAME );
@@ -344,7 +359,27 @@
 					"acl.category_id = '".LtDb::qstr($category->getId())."' and acl.article_id = a.id and a.status = ".POST_STATUS_PUBLISHED,
 					"acl.category_id"
 			));
-        	if( $result = $this->update( $category )) {
+
+            $mangledName = $category->getMangledName();
+            $i = 1;
+                // check if there already is a category with the same mangled name
+            while($existingCategory = $this->getCategoryByName($mangledName,
+                                                               $category->getBlogId()))
+            {
+                    // if we found ourselves, it is okay to keep using this name
+                if($existingCategory->getId() == $category->getId())
+                    break;
+
+                $i++;
+                    // and if so, assign a new one
+                    // if we already tried with blogname+"i" we have
+                    // to strip "i" before adding it again!
+                $mangledName = substr($mangledName, 0,
+                               ($i > 2) ? strlen($mangledName)-strlen($i-1) : strlen($mangledName)).$i;
+            }
+            $category->setMangledName($mangledName);
+
+            if( $result = $this->update( $category )) {
 				$this->_cache->removeData( $category->getBlogId(), DaoCacheConstants::CACHE_ARTICLE_CATEGORIES_BLOG );
         		$this->_cache->setData( $category->getId(),  DaoCacheConstants::CACHE_ARTICLE_CATEGORIES, $category );
         	}

Modified: plog/trunk/class/dao/articlecategory.class.php
===================================================================
--- plog/trunk/class/dao/articlecategory.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/articlecategory.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -360,11 +360,15 @@
 		 * links when custom URLs are enabled.
 		 *
 		 * @param mangledName A string containing a 'url-ified' version of the category name
-		 */		
-		function setMangledName( $mangledName )
-		{
-			$this->_mangledName = $mangledName;
-		}
+		 */
+        function setMangledName( $mangledName, $modify = false )
+        {
+            if( $modify ) {
+                lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+                $mangledName = Textfilter::urlize( $mangledName );
+            }
+            $this->_mangledName = $mangledName;
+        }
 		
 		/**
 		 * Returns the BlogInfo object to which this category belongs

Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/articles.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -880,6 +880,8 @@
          */
         function addArticle( &$newArticle )
         {
+            $blogInfo = $newArticle->getBlogInfo();
+
                 // Check if we need to force the article slug to be unique
             
 			$config =& Config::getConfig();
@@ -900,10 +902,17 @@
                 }
                 $newArticle->setPostSlug($slug);
             }
-
             
+	    lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+    
+	    // check whether the categories are valid for this blog
+            $newCategoryIds = $newArticle->getCategoryIds();
+            $blogCategories = new ArticleCategories();
+            foreach($newCategoryIds as $catId){
+                if(!$blogCategories->getCategory($catId, $blogInfo->getId()))
+                    return false;
+            }
             
-            
             $result = $this->add( $newArticle );
 			
             if( !$result )
@@ -932,8 +941,8 @@
             // update the blog counters
             if( $newArticle->getStatus() == POST_STATUS_PUBLISHED ) {
 					
+                lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
 	            $blogs = new Blogs();
-    	        $blogInfo = $newArticle->getBlogInfo();
         	    $blogInfo->setTotalPosts( $blogInfo->getTotalPosts() + 1 );
 				$blogInfo->setUpdateDate( Timestamp::getNowTimestamp());
             	$blogs->updateBlog( $blogInfo );
@@ -1023,21 +1032,32 @@
          */
         function updateArticle( $article )
         {
+            $blogInfo = $article->getBlogInfo();
+
                 // Check if we need to force the article slug to be unique
             
 			$config =& Config::getConfig();
             if($config->getValue("force_posturl_unique"))
             {
                 $slug = $article->getPostSlug();
+
+                    // remove the cached data now, before the slug changes
+                $this->_cache->removeData( $slug, CACHE_ARTICLES_BYNAME );
+
                 $i = 1;
                     // check if there already is an article with the same mangled name
                 while($existingArticle = $this->getBlogArticleByTitle($slug,
                                                                       $article->getBlog()))
                 {
                         // if we found ourselves, it is okay to keep using this name
+                        // NOTE: if someone changed the unique setting after two posts
+                        // were published with the same slug, they will have to update
+                        // BOTH articles in order to make sure that all slugs are unique
+                        // (or at least update the later article, since the first article
+                        // will continue to use the same slug)
                     if($existingArticle->getId() == $article->getId())
                         break;
-                
+
                         // found a match, so assign a new one
                         // if we already tried with slug+"i" we have
                         // to strip "i" before adding it again!
@@ -1050,7 +1070,19 @@
             
 			// keep the old version, since we're going to need it to udpate the category counters
 			$oldArticle = $this->getArticle( $article->getId());
-		
+
+                // check whether the categories are valid for this blog
+            if($article->getStatus() != POST_STATUS_DELETED){
+        	lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+
+                $newCategoryIds = $article->getCategoryIds();
+                $blogCategories = new ArticleCategories();
+                foreach($newCategoryIds as $catId){
+                    if(!$blogCategories->getCategory($catId, $blogInfo->getId()))
+                        return false;
+                }
+            }
+            
 			// and now update the new version
         	$result = $this->update( $article );
 
@@ -1081,14 +1113,12 @@
 			if( $oldArticle->getStatus() == POST_STATUS_PUBLISHED && $article->getStatus() != POST_STATUS_PUBLISHED ) {
 								
 		    	$blogs = new Blogs();
-	    	    $blogInfo = $article->getBlogInfo();
 	        	$blogInfo->setTotalPosts( $blogInfo->getTotalPosts() - 1 );
 				$blogInfo->setUpdateDate( Timestamp::getNowTimestamp());
 	            $blogs->updateBlog( $blogInfo );
 	        } elseif ( $oldArticle->getStatus() != POST_STATUS_PUBLISHED && $article->getStatus() == POST_STATUS_PUBLISHED ) {
 						
 		    	$blogs = new Blogs();
-	    	    $blogInfo = $article->getBlogInfo();
 	        	$blogInfo->setTotalPosts( $blogInfo->getTotalPosts() + 1 );
 				$blogInfo->setUpdateDate( Timestamp::getNowTimestamp());	
 	            $blogs->updateBlog( $blogInfo );
@@ -1287,11 +1317,6 @@
 		 */
         function mapRow( $query_result )
         {
-        	
-            
-            
-            
-
 			$id = $query_result['id'];
 			
             // this is a little dirty trick or otherwise the old

Modified: plog/trunk/class/dao/blogs.class.php
===================================================================
--- plog/trunk/class/dao/blogs.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/blogs.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -207,20 +207,17 @@
                                $page = -1, 
                                $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
         {
-			$statusCond = "";
+			$where = "";
             if( $status != BLOG_STATUS_ALL )
-                $statusCond = "status = '".LtDb::qstr($status)."'";
-			$where = $statusCond;
+                $where = "status = '".Db::qstr($status)."'";
 			
 			if( $blogCategoryId != ALL_BLOG_CATEGORIES )
 				$where .= " AND blog_category_id = '".LtDb::qstr($blogCategoryId)."'";
 
-			$searchCond = "";
 			if( $searchTerms != "" ){
-				$searchCond = $this->getSearchConditions( $searchTerms );
                 if( $where != "" )
                     $where .= " AND ";
-				$where .= $searchCond;
+				$where .= $this->getSearchConditions( $searchTerms );
             }
 				
 			if( $where != "" )

Modified: plog/trunk/class/dao/commentscommon.class.php
===================================================================
--- plog/trunk/class/dao/commentscommon.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/commentscommon.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -78,9 +78,9 @@
 					$blog->setTotalTrackbacks($this->getNumItems( $this->getPrefix().'articles_comments', 
 																  'blog_id = '.$blog->getId().' AND type = '.$comment->getType()));					
 				}
-									
+
 				$articles = new Articles();
-				$articles->updateArticle( $article );
+				$result = $articles->updateArticle( $article );
 				
 				$blogs = new Blogs();
 				$blogs->updateBlog( $blog );

Modified: plog/trunk/class/dao/permissions.class.php
===================================================================
--- plog/trunk/class/dao/permissions.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/permissions.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -83,6 +83,7 @@
 		 *
 		 * @param id The id of the permission
 		 * @return True if successful or false otherwise
+         * (note, only false on a SQL error, not if the value didn't exist)
 		 */		 
 		function deletePermission( $id )
 		{

Modified: plog/trunk/class/dao/searchengine.class.php
===================================================================
--- plog/trunk/class/dao/searchengine.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/searchengine.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -179,9 +179,8 @@
 				}
 			}
 			else {
-				// alternative, slower path
-				$query = $this->getArticleSearchConditions( $searchTerms );
-								
+                    // alternative, slower path
+				$query = $this->getArticleSearchConditions( $searchTerms ) . " {$conds} ";
 				$total = $this->getNumItems( "{$prefix}articles a", $query." ".$conds, "a.id" );				
 			}
 			

Modified: plog/trunk/class/dao/trackbackclient.class.php
===================================================================
--- plog/trunk/class/dao/trackbackclient.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/trackbackclient.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -43,13 +43,11 @@
          * found in the page, or an empty array if there was none found.
          */
          function getTrackbackLinks( $page, $pageUrl = "" ) {
-         	//$regexp = "/trackback:ping\ *=\ *\"(.+)\"/";
-            $regexp ="/<rdf:RDF.*?<\/rdf:RDF>/s";
-    		$links = preg_match_all( $regexp, $page, $out, PREG_SET_ORDER );
-
+            $regexp ="#<rdf:RDF.*?</rdf:RDF>#s";
+    		preg_match_all( $regexp, $page, $out, PREG_SET_ORDER );
             $links = Array();
             foreach( $out as $result ) {
-            	// we have to get now from within the rdf code the following identifiers:
+                    // we have to get now from within the rdf code the following identifiers:
                 // dc:identifier, trackback:ping and dc:about
 
                 // get the dc identifier
@@ -62,8 +60,28 @@
 
 	                // if we provided the url of the page, we have a mechanism to make sure
 	                // that we are fetching the right trackback ping
-	                if( $pageUrl != "" ) {
-	                	if( $dcIdentifier == $pageUrl || $dcIdentifier == htmlentities($pageUrl) || urldecode($dcIdentifier) == $pageUrl ) {
+	                if( $dcIdentifier && $pageUrl ) {
+                        $matched = 0;
+                        
+                        $len1 = strlen($pageUrl);
+                        $len2 = strlen($dcIdentifier);
+                        $length = ($len1 > $len2) ? $len2 : $len1;
+                        if( strncasecmp($dcIdentifier,$pageUrl,$length) == 0)
+                            $matched = 1;
+
+                        $len1 = strlen(htmlentities($pageUrl));
+                        $len2 = strlen($dcIdentifier);
+                        $length = ($len1 > $len2) ? $len2 : $len1;
+	                	if( strncasecmp($dcIdentifier,htmlentities($pageUrl),$length) == 0)
+                            $matched = 1;
+
+                        $len1 = strlen($pageUrl);
+                        $len2 = strlen(urldecode($dcIdentifier));
+                        $length = ($len1 > $len2) ? $len2 : $len1;
+	                	if( strncasecmp(urldecode($dcIdentifier),$pageUrl,$length) == 0)
+                            $matched = 1;
+
+                        if($matched == 1){
 	                		//print("identifer matches page!!");
 	                		array_push( $links, $tbPing );
 	                	}
@@ -191,12 +209,12 @@
                     		if( !$result ) {
                         		// if it didn't work, mark it
                             	array_push( $results, $this->_buildResult( $link, TRACKBACK_FAILED ));
-                                //print("Error: trackback failed<br/>");
+                                    //print("Error: trackback failed<br/>");
                     		}
                         	else {
                         		// it actually worked, so we say so ;)
                         		array_push( $results, $this->_buildResult( $link, TRACKBACK_SUCCESS ));
-                                //print("It worked!<br/>");
+                                    //print("It worked!<br/>");
                         	}
                     	}
                 	}
@@ -204,7 +222,7 @@
             	else {
             		// page could not be fetched, so the trackback was not available
             		array_push( $results, $this->_buildResult( $link, TRACKBACK_UNAVAILABLE ));
-                    //print("Error: page was empty");
+                        //print("Error: page was empty");
             	}
         	}
 

Copied: plog/trunk/class/dao/userdata/ldapuserdataprovider.class.php (from rev 6933, plog/branches/lifetype-1.2/class/dao/userdata/ldapuserdataprovider.class.php)
===================================================================
--- plog/trunk/class/dao/userdata/ldapuserdataprovider.class.php	                        (rev 0)
+++ plog/trunk/class/dao/userdata/ldapuserdataprovider.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,211 @@
+<?php
+
+	//function _dump($x) { echo "<pre>"; var_dump($x); echo "</pre>"; }
+
+    lt_include( PLOG_CLASS_PATH."class/dao/userdata/lifetypeuserdataprovider.class.php" );
+
+/*
+
+Oles Hnatkevych <don_oles at able.com.ua>
+
+This provider just extends lifetype provider. When user logs in, its authenticated against LDAP, not
+against database. But record for user in database must exist. If the user logs in for the first time,
+and he is in LDAP, but no record in database, the use is automatically created in DB, and granted
+some basic permissions.
+
+Put in userdata.properties.php:
+
+$config = Array(
+  "provider" 		=> "LDAPUserDataProvider",
+  "ad_domain"		=> "DOMAIN", // can be empty, will be added to username when binding to LDAP, like DOMAIN\username
+  "ldap_host"		=> "dc.comain.com",
+  "ldap_port"		=> "389",
+  "ldap_binddn"		=> "cn=ldapreader,ou=systemaccounts,ou=allusers,dc=domain,dc=com",
+  "ldap_bindpass"	=> "sEcReT",
+  "ldap_base"		=> "ou=allusers,dc=domain,dc=com",
+  "ldap_attr_user"	=> "sAMAccountName",
+  "ldap_attr_email"	=> "mail",
+  "ldap_attr_fullname"	=> "cn",
+  "ldap_filter_user"=> "objectClass=person",
+  "createBlogIfNotExisting" => true,
+);
+
+*/
+
+
+    /**
+     * Model representing the users in our application. Provides the methods such as
+     * authentication and querying for users.
+	 *
+	 * \ingroup User_Data_Providers
+     */
+    class LDAPUserDataProvider extends LifeTypeUserDataProvider
+    {
+		var $ldap_conn;
+		var $ad_domain;
+		var $ldap_binddn;
+		var $ldap_bindpass;
+		var $ldap_base;
+		var $ldap_filter_user;
+		var $ldap_attr_user;
+		var $ldap_attr_email;
+		var $ldap_attr_fullname;
+
+        /**
+         * Initializes the model
+         */
+        function LDAPUserDataProvider( $providerConfig )
+        {
+            $this->LifeTypeUserDataProvider( $providerConfig );
+            $config = $this->getProviderConfiguration();
+
+            $this->ad_domain = $config->getValue("ad_domain");
+            $this->ldap_base = $config->getValue("ldap_base");
+            $this->ldap_filter_user = $config->getValue("ldap_filter_user");
+            $this->ldap_attr_user = $config->getValue("ldap_attr_user");
+            $this->ldap_attr_email = $config->getValue("ldap_attr_email");
+            $this->ldap_attr_fullname = $config->getValue("ldap_attr_fullname");
+
+            $ldap_host = $config->getValue("ldap_host");
+            $ldap_port = $config->getValue("ldap_port");
+            $this->ldap_conn = ldap_connect( $ldap_host, $ldap_port);
+            if (! $this->ldap_conn)
+            	die ("Can not connect to LDAP server $ldap_host:$ldap_port");
+        }
+
+
+		// found in another class ;)
+        function _phpBB2AddBlog( $username, $id)
+        {
+		    // create a new blog
+		    lt_include( PLOG_CLASS_PATH."class/dao/bloginfo.class.php" );
+		    lt_include( PLOG_CLASS_PATH."class/dao/blogs.class.php" );
+            lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php" );
+            lt_include( PLOG_CLASS_PATH."class/dao/articlecategories.class.php" );
+
+		    $blogs = new Blogs();
+		    $blog = new BlogInfo( $username,
+		       	                  $id,
+		           	              "",  // no about
+		            	          ""); // no properties either
+		    $newBlogId = $blogs->addBlog( $blog );
+
+            // add a default category and a default post
+            $articleCategories = new ArticleCategories();
+            $articleCategory = new ArticleCategory( "General", "", $newBlogId, true );
+            $catId = $articleCategories->addArticleCategory( $articleCategory );
+            $config =& Config::getConfig();
+            $locale =& Locales::getLocale( $config->getValue( "default_locale" ));
+            $articleTopic = $locale->tr( "register_default_article_topic" );
+            $articleText  = $locale->tr( "register_default_article_text" );
+            $article = new Article( $articleTopic,
+                                    $articleText,
+                                    Array( $catId ),
+                                    $id,
+                                    $newBlogId,
+                                    POST_STATUS_PUBLISHED,
+                                    0,
+                                    Array(),
+                                    "welcome" );
+            $t = new Timestamp();
+            $article->setDateObject( $t );
+            $article->setInSummary( false );
+            $articles = new Articles();
+            $articles->addArticle( $article );
+        }
+
+		// just checks if it is possible to login
+		function _authenticateUserLdap($user,$pass) {
+			if ($this->ad_domain != "")
+				$ldap_user = $this->ad_domain.'\\'.$user;
+			else
+				$ldap_user = $user;
+			return @ldap_bind($this->ldap_conn, $ldap_user, $pass);
+		}
+
+		// we look in LDAP/AD email and full name
+		function _getLDAPUserInfo($username) {
+			$filter = "(&(".$this->ldap_filter_user.")(".$this->ldap_attr_user."=$username))";
+			$sr = ldap_search($this->ldap_conn, $this->ldap_base, $filter, array($this->ldap_attr_email,$this->ldap_attr_fullname));
+			$user =  ldap_first_entry ($this->ldap_conn, $sr);
+			if (!$user)
+				return false;
+			$email_attr = ldap_get_values ($this->ldap_conn, $user, $this->ldap_attr_email);
+			$email = strtolower($email_attr[0]);
+			$fullname_attr = ldap_get_values ($this->ldap_conn, $user, $this->ldap_attr_fullname);
+			$full_name = $fullname_attr[0];
+			return array($email,$full_name);;
+		}
+
+
+		// automatically created users
+		function _grantMiscPermission( $userInfo )
+		{
+			lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+			lt_include( PLOG_CLASS_PATH."class/dao/userpermission.class.php" );
+			lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+			$perms = new Permissions();
+			foreach(preg_split("/,/","view_users,view_site_blogs,view_blog_categories") as $tmpperm) {
+				$thePerm = $perms->getPermissionByName( $tmpperm );
+				$perm = new UserPermission( $userInfo->getId(),    // user id
+											0,   // it's a global permission, no blog id needed
+											$thePerm->getId()  // id of the permission
+				);
+				$userPerms = new UserPermissions();
+				$userPerms->grantPermission( $perm, true );
+			}
+		}
+
+        /**
+         * Returns true if the user is in the database and the username
+         * and password match
+         *
+         * @param user Username of the user who we'd like to authenticate
+         * @param pass Password of the user
+         * @return true if user and password correct or false otherwise.
+         */
+        function authenticateUser( $user, $pass )
+        {
+			$binded = $this->_authenticateUserLdap( $user, $pass );
+			if ($binded) {
+				// it exists in LDAP
+        		$userInfo = parent::getUserInfoFromUsername( $user );
+        		list($email,$full_name) = $this->_getLDAPUserInfo($user);
+        		if ( ! $userInfo )  {
+					// create user in database
+					$userInfo = new UserInfo( $user, $pass, $email, "", $full_name);
+					$this->addUser( $userInfo );
+					$this->grantLoginPermission( $userInfo );
+					$this->_grantMiscPermission( $userInfo );
+				}
+
+				// create blog so he can do something.
+				$providerConfig = $this->getProviderConfiguration();
+				if( $providerConfig->getValue( "createBlogIfNotExisting" )) {
+					$userBlogs = $userInfo->getBlogs();
+					if( empty($userBlogs )) {
+						$this->grantLoginPermission( $userInfo );
+						$this->_phpBB2AddBlog( $user, $userInfo->getId());
+						$userInfo->setBlogs( $this->getUsersBlogs( $userInfo->getId()));
+					}
+				}
+				return true;
+			}
+			return parent::authenticateUser( $user, $pass );
+        }
+
+
+		// serves to patch default UserInfo with email and fullname from LDAP
+        function getUserInfo( $user, $pass )
+        {
+			$binded = $this->_authenticateUserLdap( $user, $pass );
+            $userInfo = parent::getUserInfo( $user, $pass );
+            if ($binded) {
+            	list ($email, $fullname) = $this->_getLDAPUserInfo( $user );
+            	$userInfo->setEmail($email);
+            	$userInfo->setFullName($fullname);
+			}
+			return $userInfo;
+        }
+    }
+?>
\ No newline at end of file

Modified: plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/userdata/lifetypeuserdataprovider.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -110,7 +110,7 @@
 	    	if( $searchTerms != "" ) {
 				if( $where != "" )
 					$where .= " AND ";
-	    	    $where = $this->getSearchConditions( $searchTerms );
+	    	    $where .= $this->getSearchConditions( $searchTerms );
 			}
 			if( $where != "" )
 				$where = "WHERE $where";

Modified: plog/trunk/class/dao/userdata/vbb3userdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/vbb3userdataprovider.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/dao/userdata/vbb3userdataprovider.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -675,12 +675,11 @@
 
             $result3 = $this->_dbc->Execute( $query3);            
 
-            
-
-            while ($info = $result3->FetchRow( $result3 ))
-                array_push( $users, $this->_mapUserInfoObject( $info ));
-            $result3->Close();
-
+            if($result3){
+                while ($info = $result3->FetchRow( $result3 ))
+                    array_push( $users, $this->_mapUserInfoObject( $info ));
+                $result3->Close();
+            }
             return $users;	
         }
     }

Copied: plog/trunk/class/data/filter/javascriptfilter.class.php (from rev 6933, plog/branches/lifetype-1.2/class/data/filter/javascriptfilter.class.php)
===================================================================
--- plog/trunk/class/data/filter/javascriptfilter.class.php	                        (rev 0)
+++ plog/trunk/class/data/filter/javascriptfilter.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,25 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/data/filter/filterbase.class.php" );
+
+	/**
+	 * \ingroup Filter
+	 *
+	 * This class extends the FilterBase interface to filter all Javascript
+	 * code in the given string
+	 */
+	class JavascriptFilter extends FilterBase
+	{
+		/**
+		 * Filters out all Javascript code
+		 *
+		 * @param data
+		 * @return The input string without Javascript code
+		 */
+		function filter( $data )
+		{
+			lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+			return( parent::filter( Textfilter::filterJavascript( $data )));
+		}	
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/class/data/forms/formvalidator.class.php
===================================================================
--- plog/trunk/class/data/forms/formvalidator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/forms/formvalidator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -110,7 +110,13 @@
 				}
 				
 				$this->_validationResults["$fieldName"] = $validationResult;
-				$this->_fieldValues["$fieldName"] = $fieldValue;
+				if($validationResult)
+					$this->_fieldValues["$fieldName"] = $fieldValue;
+				else {
+                        // Note: Display unvalidated data back to user, filtering out HTML
+					lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+					$this->_fieldValues["$fieldName"] = Textfilter::filterAllHTML( $fieldValue );
+				}
 				
 				// if one of the validations is false, then cancel the whole thing
 				$finalValidationResult = $finalValidationResult && $validationResult;				

Copied: plog/trunk/class/data/inputfilter.class.php (from rev 6933, plog/branches/lifetype-1.2/class/data/inputfilter.class.php)
===================================================================
--- plog/trunk/class/data/inputfilter.class.php	                        (rev 0)
+++ plog/trunk/class/data/inputfilter.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,274 @@
+<?php
+
+/** @class: InputFilter (PHP4 & PHP5, with comments)
+  * @project: PHP Input Filter
+  * @date: 10-05-2005
+  * @version: 1.2.2_php4/php5
+  * @author: Daniel Morris
+  * @contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie.
+  * @copyright: Daniel Morris
+  * @email: dan at rootcube.com
+  * @license: GNU General Public License (GPL)
+  */
+class InputFilter {
+	var $tagsArray;			// default = empty array
+	var $attrArray;			// default = empty array
+
+	var $tagsMethod;		// default = 0
+	var $attrMethod;		// default = 0
+
+	var $xssAuto;           // default = 1
+	var $tagBlacklist = array('applet', 'body', 'bgsound', 'base', 'basefont', 'frame', 'frameset', 'head', 'html', 'id', 'iframe', 'ilayer', 'layer', 'link', 'meta', 'name', 'script', 'style', 'title', 'xml');
+	var $attrBlacklist = array('action', 'background', 'codebase', 'dynsrc', 'lowsrc');  // also will strip ALL event handlers
+		
+	/** 
+	  * Constructor for inputFilter class. Only first parameter is required.
+	  * @access constructor
+	  * @param Array $tagsArray - list of user-defined tags
+	  * @param Array $attrArray - list of user-defined attributes
+	  * @param int $tagsMethod - 0= allow just user-defined, 1= allow all but user-defined
+	  * @param int $attrMethod - 0= allow just user-defined, 1= allow all but user-defined
+	  * @param int $xssAuto - 0= only auto clean essentials, 1= allow clean blacklisted tags/attr
+	  */
+	function inputFilter($tagsArray = array(), $attrArray = array(), $tagsMethod = 0, $attrMethod = 0, $xssAuto = 1) {		
+		// make sure user defined arrays are in lowercase
+		for ($i = 0; $i < count($tagsArray); $i++) $tagsArray[$i] = strtolower($tagsArray[$i]);
+		for ($i = 0; $i < count($attrArray); $i++) $attrArray[$i] = strtolower($attrArray[$i]);
+		// assign to member vars
+		$this->tagsArray = (array) $tagsArray;
+		$this->attrArray = (array) $attrArray;
+		$this->tagsMethod = $tagsMethod;
+		$this->attrMethod = $attrMethod;
+		$this->xssAuto = $xssAuto;
+	}
+	
+	/** 
+	  * Method to be called by another php script. Processes for XSS and specified bad code.
+	  * @access public
+	  * @param Mixed $source - input string/array-of-string to be 'cleaned'
+	  * @return String $source - 'cleaned' version of input parameter
+	  */
+	function process($source) {
+		// clean all elements in this array
+		if (is_array($source)) {
+			foreach($source as $key => $value)
+				// filter element for XSS and other 'bad' code etc.
+				if (is_string($value)) $source[$key] = $this->remove($this->decode($value));
+			return $source;
+		// clean this string
+		} else if (is_string($source)) {
+			// filter source for XSS and other 'bad' code etc.
+			return $this->remove($this->decode($source));
+		// return parameter as given
+		} else return $source;	
+	}
+
+	/** 
+	  * Internal method to iteratively remove all unwanted tags and attributes
+	  * @access protected
+	  * @param String $source - input string to be 'cleaned'
+	  * @return String $source - 'cleaned' version of input parameter
+	  */
+	function remove($source) {
+		$loopCounter=0;
+		// provides nested-tag protection
+		while($source != $this->filterTags($source)) {
+			$source = $this->filterTags($source);
+			$loopCounter++;
+		}
+		return $source;
+	}	
+	
+	/** 
+	  * Internal method to strip a string of certain tags
+	  * @access protected
+	  * @param String $source - input string to be 'cleaned'
+	  * @return String $source - 'cleaned' version of input parameter
+	  */
+	function filterTags($source) {
+		// filter pass setup
+		$preTag = NULL;
+		$postTag = $source;
+		// find initial tag's position
+		$tagOpen_start = strpos($source, '<');
+		// interate through string until no tags left
+		while($tagOpen_start !== FALSE) {
+			// process tag interatively
+			$preTag .= substr($postTag, 0, $tagOpen_start);
+			$postTag = substr($postTag, $tagOpen_start);
+			$fromTagOpen = substr($postTag, 1);
+			// end of tag
+			$tagOpen_end = strpos($fromTagOpen, '>');
+			if ($tagOpen_end === false) break;
+			// next start of tag (for nested tag assessment)
+			$tagOpen_nested = strpos($fromTagOpen, '<');
+			if (($tagOpen_nested !== false) && ($tagOpen_nested < $tagOpen_end)) {
+				$preTag .= substr($postTag, 0, ($tagOpen_nested+1));
+				$postTag = substr($postTag, ($tagOpen_nested+1));
+				$tagOpen_start = strpos($postTag, '<');
+				continue;
+			} 
+			$tagOpen_nested = (strpos($fromTagOpen, '<') + $tagOpen_start + 1);
+			$currentTag = substr($fromTagOpen, 0, $tagOpen_end);
+			$tagLength = strlen($currentTag);
+			if (!$tagOpen_end) {
+				$preTag .= $postTag;
+				$tagOpen_start = strpos($postTag, '<');			
+			}
+			// iterate through tag finding attribute pairs - setup
+			$tagLeft = $currentTag;
+			$attrSet = array();
+			$currentSpace = strpos($tagLeft, ' ');
+			// is end tag
+			if (substr($currentTag, 0, 1) == "/") {
+				$isCloseTag = TRUE;
+				list($tagName) = explode(' ', $currentTag);
+				$tagName = substr($tagName, 1);
+			// is start tag
+			} else {
+				$isCloseTag = FALSE;
+				list($tagName) = explode(' ', $currentTag);
+			}		
+			// excludes all "non-regular" tagnames OR no tagname OR remove if xssauto is on and tag is blacklisted
+			if ((!preg_match("/^[a-z][a-z0-9]*$/i",$tagName)) || (!$tagName) || ((in_array(strtolower($tagName), $this->tagBlacklist)) && ($this->xssAuto))) { 				
+				$postTag = substr($postTag, ($tagLength + 2));
+				$tagOpen_start = strpos($postTag, '<');
+				// don't append this tag
+				continue;
+			}
+			// this while is needed to support attribute values with spaces in!
+			while ($currentSpace !== FALSE) {
+				$fromSpace = substr($tagLeft, ($currentSpace+1));
+				$nextSpace = strpos($fromSpace, ' ');
+				$openQuotes = strpos($fromSpace, '"');
+				$closeQuotes = strpos(substr($fromSpace, ($openQuotes+1)), '"') + $openQuotes + 1;
+				// another equals exists
+				if (strpos($fromSpace, '=') !== FALSE) {
+					// opening and closing quotes exists
+					if (($openQuotes !== FALSE) && (strpos(substr($fromSpace, ($openQuotes+1)), '"') !== FALSE))
+						$attr = substr($fromSpace, 0, ($closeQuotes+1));
+					// one or neither exist
+					else $attr = substr($fromSpace, 0, $nextSpace);
+				// no more equals exist
+				} else $attr = substr($fromSpace, 0, $nextSpace);
+				// last attr pair
+				if (!$attr) $attr = $fromSpace;
+				// add to attribute pairs array
+				$attrSet[] = $attr;
+				// next inc
+				$tagLeft = substr($fromSpace, strlen($attr));
+				$currentSpace = strpos($tagLeft, ' ');
+			}
+			// appears in array specified by user
+			$tagFound = in_array(strtolower($tagName), $this->tagsArray);			
+			// remove this tag on condition
+			if ((!$tagFound && $this->tagsMethod) || ($tagFound && !$this->tagsMethod)) {
+				// reconstruct tag with allowed attributes
+				if (!$isCloseTag) {
+					$attrSet = $this->filterAttr($attrSet);
+					$preTag .= '<' . $tagName;
+					for ($i = 0; $i < count($attrSet); $i++)
+						$preTag .= ' ' . $attrSet[$i];
+					// reformat single tags to XHTML
+					if (strpos($fromTagOpen, "</" . $tagName)) $preTag .= '>';
+					else $preTag .= ' />';
+				// just the tagname
+			    } else $preTag .= '</' . $tagName . '>';
+			}
+			// find next tag's start
+			$postTag = substr($postTag, ($tagLength + 2));
+			$tagOpen_start = strpos($postTag, '<');			
+		}
+		// append any code after end of tags
+		$preTag .= $postTag;
+		return $preTag;
+	}
+
+	/** 
+	  * Internal method to strip a tag of certain attributes
+	  * @access protected
+	  * @param Array $attrSet
+	  * @return Array $newSet
+	  */
+	function filterAttr($attrSet) {	
+		$newSet = array();
+		// process attributes
+		for ($i = 0; $i <count($attrSet); $i++) {
+			// skip blank spaces in tag
+			if (!$attrSet[$i]) continue;
+                // split into attr name and value
+                // jondaley/lifetype, this added bit allows '=' to be inside the value,
+                // ex. name="FlashVars" value="file=blahblah&height=20"
+            $attr = trim($attrSet[$i]);
+            $equals = strpos($attr, "=");
+            if($equals !== false){
+                $attrSubSet = array(substr($attr, 0, $equals), substr($attr, $equals+1));
+            }
+            else{
+                $attrSubSet = array($attr);
+            }                
+			list($attrSubSet[0]) = explode(' ', $attrSubSet[0]);
+
+                // removes all "non-regular" attr names AND also attr blacklisted
+			if ((!eregi("^[a-z]*$",$attrSubSet[0])) || (($this->xssAuto) && ((in_array(strtolower($attrSubSet[0]), $this->attrBlacklist)) || (substr($attrSubSet[0], 0, 2) == 'on')))) 
+				continue;
+			// xss attr value filtering
+			if ($attrSubSet[1]) {
+				// strips unicode, hex, etc
+				$attrSubSet[1] = str_replace('&#', '', $attrSubSet[1]);
+				// strip normal newline within attr value
+                // jondaley/lifetype: this also stripped out all whitespace, not just newlines
+				$attrSubSet[1] = preg_replace('/\n\r/', '', $attrSubSet[1]);
+				// strip double quotes
+				$attrSubSet[1] = str_replace('"', '', $attrSubSet[1]);
+				// [requested feature] convert single quotes from either side to doubles (Single quotes shouldn't be used to pad attr value)
+				if ((substr($attrSubSet[1], 0, 1) == "'") && (substr($attrSubSet[1], (strlen($attrSubSet[1]) - 1), 1) == "'"))
+					$attrSubSet[1] = substr($attrSubSet[1], 1, (strlen($attrSubSet[1]) - 2));
+				// strip slashes
+				$attrSubSet[1] = stripslashes($attrSubSet[1]);
+			}
+			// auto strip attr's with "javascript:
+			if (	((strpos(strtolower($attrSubSet[1]), 'expression') !== false) &&	(strtolower($attrSubSet[0]) == 'style')) ||
+					(strpos(strtolower($attrSubSet[1]), 'javascript:') !== false) ||
+					(strpos(strtolower($attrSubSet[1]), 'behaviour:') !== false) ||
+					(strpos(strtolower($attrSubSet[1]), 'vbscript:') !== false) ||
+					(strpos(strtolower($attrSubSet[1]), 'mocha:') !== false) ||
+					(strpos(strtolower($attrSubSet[1]), 'livescript:') !== false) 
+			) continue;
+
+			// if matches user defined array
+			$attrFound = in_array(strtolower($attrSubSet[0]), $this->attrArray);
+			// keep this attr on condition
+			if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) {
+				// attr has value
+				if ($attrSubSet[1]) $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"';
+				// attr has decimal zero as value
+				else if ($attrSubSet[1] == "0") $newSet[] = $attrSubSet[0] . '="0"';
+				// reformat single attributes to XHTML
+				else $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"';
+			}	
+		}
+		return $newSet;
+	}
+	
+	/** 
+	  * Try to convert to plaintext
+	  * @access protected
+	  * @param String $source
+	  * @return String $source
+	  */
+	function decode($source) {
+		// url decode
+
+        // We can't run html_entity_decode here, as then people can't
+        // post HTML source in their posts, ie. &lt; etc.
+//		$source = html_entity_decode($source, ENT_QUOTES, "ISO-8859-1");
+		// convert decimal
+		$source = preg_replace('/&#(\d+);/me',"chr(\\1)", $source);				// decimal notation
+		// convert hex
+		$source = preg_replace('/&#x([a-f0-9]+);/mei',"chr(0x\\1)", $source);	// hex notation
+		return $source;
+	}
+}
+
+?>
\ No newline at end of file

Modified: plog/trunk/class/data/plogcalendar.class.php
===================================================================
--- plog/trunk/class/data/plogcalendar.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/plogcalendar.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -108,18 +108,7 @@
          */
         function getMonthView($month, $year)
         {
-        
             $t = Timestamp::getBlogDate( $this->_blogInfo );
-            
-            // getBlogDate sometimes returns the time without the time zone applied.  If it wasn't
-            // We need to make sure that it is applied now
-            $config =& Config::getConfig();
-            if( $config->getValue( "time_difference_calculation" ) == TIME_DIFFERENCE_CALCULATION_DYNAMIC ) {
-                $blogSettings = $this->_blogInfo->getSettings();
-                $timeDifference = $blogSettings->getValue( "time_offset" );
-                $t->setDate( Timestamp::getDateWithOffset( $t->getDate(), $timeDifference ), DATE_FORMAT_TIMESTAMP );
-            }
-            
             return $this->getMonthHTML($month, $year, 1/*showYear*/, 
                                        $t->getTimestamp(DATE_FORMAT_UNIXTIME) );
         }

Modified: plog/trunk/class/data/textfilter.class.php
===================================================================
--- plog/trunk/class/data/textfilter.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/textfilter.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -26,18 +26,12 @@
 	{
 
 		var $htmlAllowedTags;
-		var $removeJavaScript;
 
         /**
          * Constructor.
-         *
-         * @param removeJavaScript By default, JavaScript code will also be removed
-         * from texts
          */
-		function TextFilter( $removeJavaScript = true )
+		function TextFilter()
 		{
-			$this->removeJavaScript = $removeJavaScript;
-
             
 			$config =& Config::getConfig();
 			$this->htmlAllowedTags = $config->getValue( "html_allowed_tags_in_comments" );
@@ -53,22 +47,10 @@
 		 */
         function filterJavaScript( $text )
         {
-                // Strip all of the Javascript in script tags out...
-                $text = preg_replace('/<SCRIPT.*?<\/SCRIPT>/ims',"",$text);
-
-				/** copied from the original function **/
-                /* The following matches any on* events, followed by any amount of space, a
-                 *' or " some script and then the matching ' or " (the \\2 matches the
-                 *single or double quote).  Note that this regex is
-                 * in single quotes to alleviate the problem of double quoting special
-                 * chars, otherwise the backreferenced 2 would be \\\\2
-                 * -- which is just silly...
-				 */
-                $text = preg_replace('/on(Load|Click|DblClick|DragStart|KeyDown|KeyPress|KeyUp|MouseDown|MouseMove|MouseOut|MouseOver|SelectStart|Blur|Focus|Scroll|Select|Unload|Change|Submit)\s*=\s*(\'|").*?\\2/smi',"",$text);
-
-                $text = preg_replace('/(\'|")Javascript:.*?\\1/smi','',$text);
-
-                return $text;
+            lt_include( PLOG_CLASS_PATH."class/data/inputfilter.class.php" );		      
+            $if = new InputFilter(Array(), Array(), 1, 1);
+            $text = $if->process($text);
+            return $text;
         }
 
 		/**
@@ -503,17 +485,11 @@
             
             $config =& Config::getConfig();
             if( $config->getValue( "xhtml_converter_enabled" )) {
-               			      
                 $kses = new kses( true, $config->getValue( "xhtml_converter_aggresive_mode_enabled"));
-                $result = $kses->Parse( $string );
-                
-                    // if balanceTags wasn't broken, we could use it...
-                    //$result = Textfilter::balanceTags( $result );		          
+                $string = $kses->Parse( $string );
             }
-            else
-                $result = $string;
             
-            return $result;
+            return $string;
 		}
 
 

Modified: plog/trunk/class/data/timestamp.class.php
===================================================================
--- plog/trunk/class/data/timestamp.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/timestamp.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -5,15 +5,6 @@
 	 
      
 
-	 /**
-	  * constants used to determine whether we are using dynamic time
-	  * difference calculation or static time difference calculation (that is,
-	  * dates are stored 
-	  */
- 	 define( "TIME_DIFFERENCE_CALCULATION_DYNAMIC", 0 );	 
-	 define( "TIME_DIFFERENCE_CALCULATION_STATIC", 1 );
-
-
     /**
      * \ingroup Data
      *
@@ -40,10 +31,6 @@
      */
 	class Timestamp extends Date 
 	{
-
-		// internal variables
-		var $_timestamp;
-
 		/*
 		 * Creates a Timestamp object
 		 * If $timestamp is empty or not specified, creates a timestamp
@@ -305,13 +292,6 @@
          */
         function getBlogDate( $blog, $timestamp = null )
         {
-	       // check whether time differences are dynamically or statically
-	       // applied, because in case of the former, we don't have to do
-	       // anything here!
-	       $config =& Config::getConfig();
-	       if( $config->getValue( "time_difference_calculation" ) == TIME_DIFFERENCE_CALCULATION_DYNAMIC )
-	       		return( new Timestamp( $timestamp ));
-
 	       //
 	       // how's this for function overloading??
 	       // I know it's quite hackish, but it's a bit of a pain that

Modified: plog/trunk/class/data/validator/blognamevalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/blognamevalidator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/validator/blognamevalidator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,10 +1,5 @@
 <?php
 
-	
-	
-	
-	
-
     /**
      * \ingroup Validator
      *
@@ -24,6 +19,7 @@
         	
 			// it can't be empty
         	$this->addRule( new NonEmptyRule());
+            $this->addRule( new NoHtmlRule() );
 
 			// it can't be any of the forbidden ones
 			$config =& Config::getConfig();			
@@ -44,10 +40,14 @@
 			lt_include( PLOG_CLASS_PATH."class/net/http/subdomains.class.php" );
 			lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
 
-			if( Subdomains::getSubdomainsEnabled() )
-				return(( Textfilter::domainize( Textfilter::filterAllHTML( $value ))) != "" );
-			else
-				return(( Textfilter::filterAllHTML( $value )) != "" );
+			if( Subdomains::getSubdomainsEnabled() ) {
+				$config =& Config::getConfig();
+				if( strstr( $config->getValue( "subdomains_base_url" ), '{blogname}' ) ) {
+					return( ( Textfilter::domainize( $value ) ) != "" );
+				}
+			}
+
+			return true;
 		}
     }
 ?>

Copied: plog/trunk/class/data/validator/datetimevalidator.class.php (from rev 6933, plog/branches/lifetype-1.2/class/data/validator/datetimevalidator.class.php)
===================================================================
--- plog/trunk/class/data/validator/datetimevalidator.class.php	                        (rev 0)
+++ plog/trunk/class/data/validator/datetimevalidator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,27 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/data/validator/validator.class.php" );
+
+    /**
+     * \ingroup Validator
+     *
+     * Checks that it is really a valid date/time or not.
+     *
+     * @see DateTimeRule
+     */
+    class DateTimeValidator extends Validator 
+    {
+		/**
+		 * Constructor.
+		 *
+		 * @param format To specify data format.
+		 */
+    	function DateTimeValidator( $format = '' )
+        {
+        	$this->Validator();
+        	
+			lt_include( PLOG_CLASS_PATH."class/data/validator/rules/datetimerule.class.php" );			
+			$this->addRule( new DateTimeRule( $format ));
+        }
+    }
+?>
\ No newline at end of file

Modified: plog/trunk/class/data/validator/domainvalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/domainvalidator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/validator/domainvalidator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
-
 	
-	
-	
-	
     /**
      * \ingroup Validator
      *
@@ -23,6 +19,7 @@
         {
         	$this->Validator();
         	$this->addRule( new NonEmptyRule());
+            $this->addRule( new NoHtmlRule() );
 			$config =& Config::getConfig();
 			$forbiddenDomainNames = $config->getValue( "forbidden_usernames", "" );
 			$forbiddenDomainNamesArray = explode( " ", $forbiddenDomainNames );

Copied: plog/trunk/class/data/validator/rules/datetimerule.class.php (from rev 6933, plog/branches/lifetype-1.2/class/data/validator/rules/datetimerule.class.php)
===================================================================
--- plog/trunk/class/data/validator/rules/datetimerule.class.php	                        (rev 0)
+++ plog/trunk/class/data/validator/rules/datetimerule.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,190 @@
+<?php
+
+    lt_include(PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php");
+
+    define( "ERROR_RULE_DATE_FORMAT_WRONG", "error_rule_date_format_wrong");
+
+    /**
+     * \ingroup Validator_Rules
+     *
+     * Validates if a date is valid or not
+     */
+    class DateTimeRule extends Rule
+    {
+        var $_format;
+
+        /**
+         * Initializes the rule
+         */
+        function DateTimeRule( $format = '')
+        {
+            $this->Rule();
+
+			$this->_format = $format;
+        }
+
+        /**
+         * Returns true if the value is not empty or false otherwise. If empty,
+         * the error ERROR_RULE_VALUE_IS_EMPTY will be set.
+         *
+         * @param value the string that we'd like to validate
+         * @return true if successful or false otherwise
+         */
+        function validate( $value )
+        {
+            if( DateTimeRule::_datetime( $value, $this->_format ) ) {
+				return true;         
+            }
+            else {
+                $this->_setError( ERROR_RULE_DATE_FORMAT_WRONG );
+                return false;
+            }
+        }
+
+	    function _datetime( $date, $format = '' )
+	    {
+	        if (strtolower($format) == 'rfc822_compliant') {
+	            $preg = '&^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),) \s+
+	                    (?:(\d{2})?) \s+
+	                    (?:(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)?) \s+
+	                    (?:(\d{2}(\d{2})?)?) \s+
+	                    (?:(\d{2}?)):(?:(\d{2}?))(:(?:(\d{2}?)))? \s+
+	                    (?:[+-]\d{4}|UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|[A-IK-Za-ik-z])$&xi';
+	
+	            if (!preg_match($preg, $date, $matches)) {
+	                return false;
+	            }
+	
+	            $year   = (int)$matches[4];
+	            $months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
+	                            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
+	            $month  = array_keys($months, $matches[3]);
+	            $month  = (int)$month[0]+1;
+	            $day    = (int)$matches[2];
+	            $weekday= $matches[1];
+	            $hour   = (int)$matches[6];
+	            $minute = (int)$matches[7];
+	            isset($matches[9]) ? $second = (int)$matches[9] : $second = 0;
+	
+	            if ((strlen($year) != 4)        ||
+	                ($day    > 31   || $day < 1)||
+	                ($hour   > 23)  ||
+	                ($minute > 59)  ||
+	                ($second > 59)) {
+	                    return false;
+	            }
+	        } else {
+	            $date_len = strlen($format);
+	            for ($i = 0; $i < $date_len; $i++) {
+	                $c = $format{$i};
+	                if ($c == '%') {
+	                    $next = $format{$i + 1};
+	                    switch ($next) {
+	                        case 'j':
+	                        case 'd':
+	                            if ($next == 'j') {
+	                                $day = (int)DateTimeRule::_substr($date, 1, 2);
+	                            } else {
+	                                $day = (int)DateTimeRule::_substr($date, 0, 2);
+	                            }
+	                            if ($day < 1 || $day > 31) {
+	                                return false;
+	                            }
+	                            break;
+	                        case 'm':
+	                        case 'n':
+	                            if ($next == 'm') {
+	                                $month = (int)DateTimeRule::_substr($date, 0, 2);
+	                            } else {
+	                                $month = (int)DateTimeRule::_substr($date, 1, 2);
+	                            }
+	                            if ($month < 1 || $month > 12) {
+	                                return false;
+	                            }
+	                            break;
+	                        case 'Y':
+	                        case 'y':
+	                            if ($next == 'Y') {
+	                                $year = DateTimeRule::_substr($date, 4);
+	                                $year = (int)$year?$year:'';
+	                            } else {
+	                                $year = (int)(substr(date('Y'), 0, 2) .
+	                                              DateTimeRule::_substr($date, 2));
+	                            }
+	                            if (strlen($year) != 4 || $year < 0 || $year > 9999) {
+	                                return false;
+	                            }
+	                            break;
+	                        case 'g':
+	                        case 'h':
+	                            if ($next == 'g') {
+	                                $hour = DateTimeRule::_substr($date, 1, 2);
+	                            } else {
+	                                $hour = DateTimeRule::_substr($date, 2);
+	                            }
+	                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 12) {
+	                                return false;
+	                            }
+	                            break;
+	                        case 'G':
+	                        case 'H':
+	                            if ($next == 'G') {
+	                                $hour = DateTimeRule::_substr($date, 1, 2);
+	                            } else {
+	                                $hour = DateTimeRule::_substr($date, 2);
+	                            }
+	                            if (!preg_match('/^\d+$/', $hour) || $hour < 0 || $hour > 24) {
+	                                return false;
+	                            }
+	                            break;
+	                        case 's':
+	                        case 'i':
+	                            $t = DateTimeRule::_substr($date, 2);
+	                            if (!preg_match('/^\d+$/', $t) || $t < 0 || $t > 59) {
+	                                return false;
+	                            }
+	                            break;
+	                        default:
+	                            trigger_error("Not supported char `$next' after % in offset " . ($i+2), E_USER_WARNING);
+	                    }
+	                    $i++;
+	                } else {
+	                    //literal
+	                    if (DateTimeRule::_substr($date, 1) != $c) {
+	                        return false;
+	                    }
+	                }
+	            }
+	        }
+	        // there is remaing data, we don't want it
+	        if (strlen($date) && (strtolower($format) != 'rfc822_compliant')) {
+	            return false;
+	        }
+	
+	        if (isset($day) && isset($month) && isset($year)) {
+	            if (!checkdate($month, $day, $year)) {
+	                return false;
+	            }
+	
+	            if (strtolower($format) == 'rfc822_compliant') {
+	                if ($weekday != date("D", mktime(0, 0, 0, $month, $day, $year))) {
+	                    return false;
+	                }
+	            }
+	        }
+	
+	        return true;
+	    }
+	
+	    function _substr(&$date, $num, $opt = false)
+	    {
+	        if ($opt && strlen($date) >= $opt && preg_match('/^[0-9]{'.$opt.'}/', $date, $m)) {
+	            $ret = $m[0];
+	        } else {
+	            $ret = substr($date, 0, $num);
+	        }
+	        $date = substr($date, strlen($ret));
+	        return $ret;
+	    }
+    }
+?>
\ No newline at end of file

Copied: plog/trunk/class/data/validator/rules/nohtmlrule.class.php (from rev 6933, plog/branches/lifetype-1.2/class/data/validator/rules/nohtmlrule.class.php)
===================================================================
--- plog/trunk/class/data/validator/rules/nohtmlrule.class.php	                        (rev 0)
+++ plog/trunk/class/data/validator/rules/nohtmlrule.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,25 @@
+<?php
+
+    lt_include( PLOG_CLASS_PATH."class/data/validator/rules/rule.class.php");
+    lt_include( PLOG_CLASS_PATH."class/data/textfilter.class.php");
+
+    /**
+	 * \ingroup Validator_Rules
+	 *
+	 * Checks for HTML in the string
+	 */
+    class NoHtmlRule extends Rule
+    {
+        /**
+		 * Validates that the given string doesn't contain any HTML/javascript
+		 *
+		 * @param value The string to validate
+		 * @return True if there isn't any HTML in the string or false otherwise
+         */
+        function validate($value)
+        {
+            $filtered = Textfilter::filterAllHtml($value);
+            return ($filtered == trim($value));
+        }
+    }
+?>

Modified: plog/trunk/class/data/validator/rules/urlformatrule.class.php
===================================================================
--- plog/trunk/class/data/validator/rules/urlformatrule.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/validator/rules/urlformatrule.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -67,6 +67,11 @@
         if (!$value)
             return array('Result' => array(EW_ERR_URL_EMPTY_STRING), 'Value' => '');
 
+        if(!isset($options['Require']))
+            $options['Require'] = array();
+        if(!isset($options['Forbid']))
+            $options['Forbid'] = array();
+        
             /* Set up default options */
         $options = array_merge(array(/**/
                                        /* array('http', 'https', etc.) always lcase! */
@@ -80,7 +85,7 @@
                                    ), $options);
 
             /* Setup default values for $options['Require]*/
-        @ $options['Require'] = array_merge(array(/**/
+        $options['Require'] = array_merge(array(/**/
                                                 'Protocol' => true, /**/
                                                 'User' => false, /**/
                                                 'Password' => false, /**/
@@ -93,7 +98,7 @@
                                                 ), $options['Require']);
 
             /* Setup default values for $options['Forbid]*/
-        @ $options['Forbid'] = array_merge(array(/**/
+        $options['Forbid'] = array_merge(array(/**/
                                                'Protocol' => false, /**/
                                                'User' => false, /**/
                                                'Password' => false, /**/

Modified: plog/trunk/class/data/validator/stringvalidator.class.php
===================================================================
--- plog/trunk/class/data/validator/stringvalidator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/data/validator/stringvalidator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -2,6 +2,7 @@
 
 	
 	
+	lt_include( PLOG_CLASS_PATH."class/data/validator/rules/nohtmlrule.class.php" );
 
     /**
      * \ingroup Validator
@@ -12,11 +13,15 @@
      */
     class StringValidator extends Validator 
     {
-    	function StringValidator()
+    	function StringValidator( $allowHtml = false )
         {
         	$this->Validator();
         	
         	$this->addRule( new NonEmptyRule());
+
+            if(!$allowHtml){
+                $this->addRule( new NoHtmlRule() );
+            }
         }
     }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/database/ltdb.class.php
===================================================================
--- plog/trunk/class/database/ltdb.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/database/ltdb.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -160,7 +160,11 @@
 		 * @param  string $string
 		 * @return string
 		 * @access public
-		 */
+         *
+         * TODO: use mysql_real_escape_string instead.  Code should be refactored
+         *   to account for different database engines.  e.g. this function should
+         *   be completely removed, and each db engine should quote its own stuff
+         */                                              
 		function qstr($string) {
 			$string = str_replace("\\", "\\\\", $string);
  			$string = str_replace("'", "''", $string);

Modified: plog/trunk/class/gallery/dao/galleryresourcestorage.class.php
===================================================================
--- plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/gallery/dao/galleryresourcestorage.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -226,7 +226,11 @@
             // move the file to the temporaray folder first
             $config =& Config::getConfig();
             $tmpFolder = $config->getValue( "temp_folder" );
-            /*$files = HttpVars::getFiles();*/
+
+                // if relative path, like e.g. "./tmp/"...
+            if(strpos($tmpFolder, '.') === 0)
+                $tmpFolder = rtrim(PLOG_CLASS_PATH, '/') . ltrim($tmpFolder, '.');
+
 			// we don't need the parameter in the constructor though it is necessary 
 			// according to the signature of the method
             $uploads = new FileUploads( null );

Modified: plog/trunk/class/net/baserequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/baserequestgenerator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/baserequestgenerator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -452,7 +452,7 @@
         }
 
         /**
-         * Returns the trackback link for a given post. Must be implemented by child classes to generate a valid URL.
+         * Returns the trackback link for a given post.
          *
          * @param post The post with the necessary information.
          * @return A string representing the rdf trackback link.
@@ -462,7 +462,6 @@
         	$rdfHeader = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                                    xmlns:dc="http://purl.org/dc/elements/1.1/"
                                    xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">';
-
             $trackbackLink = $this->getTrackbackUrl()."?id=".$post->getId();
 			$postLink = $this->postLink($post);
 			$topic = str_replace('-', '\-', $post->getTopic());
@@ -775,10 +774,9 @@
 		 * @param category
 		 * @param userInfo
 		 * @param date
-		 * @param page
 		 * @return the current url with its page
 		 */
-		function getCurrentUrl( $category = null, $userInfo = null, $date = null, $page = null )
+		function getCurrentUrl( $category = null, $userInfo = null, $date = null )
 		{
 			throw( new Exception( "This function must be implemented by child classes." ));
 		}

Modified: plog/trunk/class/net/customrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/customrequestgenerator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/customrequestgenerator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -426,7 +426,7 @@
          */
         function getRequest()
         {
-        	throw( new Exception( "PrettyRequestGenerator::getRequest: function not implemented" ));
+        	throw( new Exception( "CustomRequestGenerator::getRequest: function not implemented" ));
             die();
         }
 
@@ -438,12 +438,11 @@
          */
         function _replaceTags( $format, $tags )
         {
-            $result = $format;
-            $result = str_replace( "$", "", $format );
-			$result = str_replace( "(", "", $result );
-			$result = str_replace( ")", "", $result );
-			$result = str_replace( "?", "", $result );
-			$result = str_replace( "\\", "", $result );
+                // allow such things as archive_link_format:
+                // /archives/(?:{year}/{month}/{day}/)?{postname}$
+                // /(?:post|archives)/(?:{year}/{month}/{day}/)?{postname}$
+            $result = preg_replace("/\(\?:([^\)\|]*)([^\)]*)\)/", "$1", $format);
+            $result = preg_replace("/[$()?]/", "", $result);
             foreach( $tags as $key => $value ) {
                 $result = str_replace( $key, $value, $result );
             }
@@ -458,7 +457,6 @@
 		 * @param category
 		 * @param userInfo
 		 * @param date
-		 * @param page
 		 * @return the current url with its page
 		 */		
 		function getCurrentUrl( $category = null, $userInfo = null, $date = -1 )

Modified: plog/trunk/class/net/http/session/sessionmanager.class.php
===================================================================
--- plog/trunk/class/net/http/session/sessionmanager.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/http/session/sessionmanager.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -41,7 +41,7 @@
 	            $sessionDomain = SessionManager::setSessionCookieDomain();
 			
 				session_cache_limiter( "" );
-				// Use base_url as part of session name to support multiplue lifetype installations in the one site
+				// Use base_url as part of session name to support multiple lifetype installations in the one site
 				$config =& Config::getConfig();
 				$baseURL = $config->getValue( "base_url" );
 	            $sessionName = "LT" . preg_replace("/[^a-zA-Z0-9]/", "", $baseURL);

Modified: plog/trunk/class/net/modrewriterequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/modrewriterequestgenerator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/modrewriterequestgenerator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -378,10 +378,9 @@
 		 * @param category
 		 * @param userInfo
 		 * @param date
-		 * @param page
 		 * @return the current url with its page
 		 */
-		function getCurrentUrl( $category = null, $userInfo = null, $date = null, $page = null )
+		function getCurrentUrl( $category = null, $userInfo = null, $date = null )
 		{
 			if( $category ) {
 				$url = $this->categoryLink( $category );

Modified: plog/trunk/class/net/prettyrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/prettyrequestgenerator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/prettyrequestgenerator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -329,10 +329,9 @@
 		 * @param category
 		 * @param userInfo
 		 * @param date
-		 * @param page
 		 * @return the current url with its page
 		 */
-		function getCurrentUrl( $category = null, $userInfo = null, $date = null, $page = null )
+		function getCurrentUrl( $category = null, $userInfo = null, $date = null )
 		{
 			if( $category ) {
 				$url = $this->categoryLink( $category );

Modified: plog/trunk/class/net/rawrequestgenerator.class.php
===================================================================
--- plog/trunk/class/net/rawrequestgenerator.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/rawrequestgenerator.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -417,7 +417,6 @@
 		 * @param category
 		 * @param userInfo
 		 * @param date
-		 * @param page
 		 * @return the current url with its page
 		 */
 		function getCurrentUrl( $category = null, $userInfo = null, $date = -1 )

Modified: plog/trunk/class/net/url.class.php
===================================================================
--- plog/trunk/class/net/url.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/url.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -44,7 +44,7 @@
 		 */
 		function Url( $url )
 		{
-			$this->_url = $url;
+			$this->_url = trim($url);
 
 			$this->_calculateFields();
 		}

Modified: plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php
===================================================================
--- plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/net/xmlrpc/xmlrpcserver.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -199,6 +199,14 @@
                 $status = POST_STATUS_DRAFT;
             }
 
+            if(!$blogid){
+                $blogs = $userInfo->getBlogs();
+                if(!$blogs){
+                    return new IXR_Error(-1, "This user doesn't have access to any blogs.");
+                }
+                $blogid = $blogs[0]->getId();
+            }
+
             $blogInfo = $blogsG->getBlogInfo( $blogid );
             if( !$this->userHasPermission( $userInfo, $blogInfo, "add_post" )) {
                 return new IXR_Error(-1, 'This user does not have enough permissions' );
@@ -388,13 +396,13 @@
                 $dummy                   = array();
                 $dummy["description"]    = $cat->getDescription();
                 
-	                // disable the generation of xhtml content or else the IXR_XMLRPC library will
-	                // escape things twice!
+	        // disable the generation of xhtml content or else the IXR_XMLRPC library will
+	        // escape things twice!
                 $url->setXHTML( false );
                 
                 $dummy["htmlUrl"]        = $url->categoryLink( $cat );
-                $dummy["rssUrl"]         = $url->categoryRssLink( $cat );
-                $ret[]                   = $dummy;
+                $dummy["rssUrl"]         = $url->categoryRssLink( $cat, "", $blogInfo );
+                $ret[$cat->getName()]    = $dummy;
             }
             
             $this->setResponseCharset( $blogInfo );
@@ -1280,4 +1288,4 @@
 		}	
 
 	}
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/class/summary/action/chooseblogtemplateaction.class.php
===================================================================
--- plog/trunk/class/summary/action/chooseblogtemplateaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/chooseblogtemplateaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,12 +1,5 @@
 <?php
 
-	
-
-    
-    
-    
-
-
 	/**
 	 * shows a form where users can choose a new blog template
 	 * for their blog, to start with
@@ -17,7 +10,7 @@
         {
         	$this->RegisterAction( $actionInfo, $request );
         	
-        	$this->registerFieldValidator( "templateId", new StringValidator());
+        	$this->registerFieldValidator( "templateId", new TemplateNameValidator());
         	$this->setValidationErrorView( new BlogTemplateChooserView());
         }
 

Modified: plog/trunk/class/summary/action/doblogregistration.class.php
===================================================================
--- plog/trunk/class/summary/action/doblogregistration.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/doblogregistration.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,18 +1,5 @@
 <?php
 
-	
-    
-    
-    
-    	 		
-	
-	
-	
-    
-	
-		
-        
-
 	/**
 	 * registers a blog
 	 */
@@ -31,9 +18,8 @@
 	    	$this->registerFieldValidator( "blogName", new BlogNameValidator());
 	    	$this->registerFieldValidator( "blogCategoryId", new IntegerValidator());
 	    	$this->registerFieldValidator( "blogLocale", new StringValidator());
-			$config =& Config::getConfig();
-			$this->registerField( "blogSubDomain" );
-			$this->registerField( "blogMainDomain" );
+			$this->registerFieldValidator( "blogSubDomain", new StringValidator(), true );
+			$this->registerFieldValidator( "blogMainDomain", new StringValidator(), true );
 	    	$view = new doBlogRegistrationView();
 	    	$view->setErrorMessage( $this->_locale->tr("register_error_creating_blog"));
 	    	$this->setValidationErrorView( $view );   

Modified: plog/trunk/class/summary/action/dofinishregister.class.php
===================================================================
--- plog/trunk/class/summary/action/dofinishregister.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/dofinishregister.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -27,7 +27,7 @@
         {
             $this->RegisterAction( $actionInfo, $request );
             
-        	$this->registerFieldValidator( "templateId", new StringValidator());
+        	$this->registerFieldValidator( "templateId", new TemplateNameValidator());
         	$this->setValidationErrorView( new BlogTemplateChooserView());        	            
         }   
 
@@ -206,7 +206,6 @@
                                     "welcome" );
             $article->setGlobalCategoryId( $globalArticleCategoryId );  // set the default ArticleGlobalCategory id to article
             $article->setDateObject( new Timestamp());  // set it to the current date
-            $article->setCommentsEnabled( true ); // enable comments
 			$article->setInSummary( false );	// no need to see these in the summary!
             $articles = new Articles();
             $articles->addArticle( $article );

Modified: plog/trunk/class/summary/action/dousercreation.class.php
===================================================================
--- plog/trunk/class/summary/action/dousercreation.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/dousercreation.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,23 +1,12 @@
 <?php
 
-	
-    
-    
-    
-        
-    
-    
-
-    
-    
-	    
-
     /**
      * starts the user and blog registration process
      */
     class doUserCreation extends RegisterAction 
 	{
-	
+        var $_config;
+        
 		function doUserCreation( $actionInfo, $request )
 		{
 			$this->RegisterAction( $actionInfo, $request );
@@ -30,17 +19,16 @@
 			$this->_request->registerFilter( "userEmail", $f );
 			$this->_request->registerFilter( "userPassword", $f );
 			$this->_request->registerFilter( "userPasswordCheck", $f );
-			
+            
 			// data validation and stuff like that :)
 			$this->registerFieldValidator( "userName", new UsernameValidator());
 			$this->registerFieldValidator( "userPassword", new PasswordValidator());
 			$this->registerFieldValidator( "userPasswordCheck", new PasswordValidator());
 			$this->registerFieldValidator( "userEmail", new EmailValidator());
+            $this->registerFieldValidator( "userAuth", new StringValidator(), true);
+			$this->registerFieldValidator( "userFullName", new StringValidator(), true );
             $this->_config =& Config::getConfig();
-            if( $this->_config->getValue( "use_captcha_auth" )) {
-				$this->registerFieldValidator( "userAuth", new StringValidator());
-			}
-			$this->registerField( "userFullName" );
+
 			$view = new SummaryUserCreationView();
 			$view->setErrorMessage( $this->_locale->tr("error_adding_user" ));
 			$this->setValidationErrorView( $view );
@@ -54,7 +42,6 @@
             $this->confirmPassword = $this->_request->getValue( "userPasswordCheck" );
             $this->userEmail = $this->_request->getValue( "userEmail" );
 			$this->userFullName = $this->_request->getValue( "userFullName" );
-			$this->captcha = $this->_request->getValue( "userAuth" );
 			
 			// check if there is already a user with the same username and quit if so
 			$users = new Users();
@@ -89,9 +76,9 @@
             
             // check if the captcha matches
             if( $this->_config->getValue( "use_captcha_auth")) {
-            	
+                $userAuth = $this->_request->getValue( "userAuth" );
             	$captcha = new Captcha();
-            	if( !$captcha->validate( $this->captcha )) {
+            	if( !$captcha->validate( $userAuth )) {
 		            $this->_view = new SummaryUserCreationView();
     	            $this->_view->setErrorMessage( $this->_locale->tr("error_invalid_auth_code"));
 					$this->_form->setFieldValidationStatus( "userAuth", false );                

Modified: plog/trunk/class/summary/action/summaryrssaction.class.php
===================================================================
--- plog/trunk/class/summary/action/summaryrssaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/summaryrssaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -18,7 +18,11 @@
       */
      class SummaryRssAction extends SummaryAction
      {
-
+         var $_mode;
+         var $_profile;
+         var $_globalArticleCategoryId;
+         var $_blogCategoryId;
+         
         function SummaryRssAction( $actionInfo, $request )
         {
             $this->SummaryAction( $actionInfo, $request );
@@ -39,8 +43,39 @@
 				// in case the parameter looks weird, let's use a default one...
 				$this->_mode = SUMMARY_RSS_TYPE_DEFAULT;
 			}
-			
+
 			$this->_profile = $this->_request->getValue( "profile" );
+            $profileValidator = new StringValidator();
+            $profileValidator->addRule( new RegexpRule( "^([a-zA-Z0-9]*)$" ));
+            if(!$profileValidator->validate($this->_profile)){
+                $this->_profile = "";
+            }
+
+            $val = new IntegerValidator();
+
+            $this->_globalArticleCategoryId = $this->_request->getValue("globalArticleCategoryId");
+            if(!$val->validate( $this->_globalArticleCategoryId)){
+                $this->_globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
+            }
+            else{
+                    // id is an integer, now lets see it is a valid category id
+                lt_include( PLOG_CLASS_PATH."class/dao/globalarticlecategories.class.php" );
+                $categories = new GlobalArticleCategories();
+                if(!$categories->getGlobalArticleCategory( $this->_globalArticleCategoryId ))
+                    $this->_globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
+            }
+            
+            
+            $this->_blogCategoryId = $this->_request->getValue("blogCategoryId");
+            if(!$val->validate($this->_blogCategoryId)){
+                $this->_blogCategoryId = ALL_BLOG_CATEGORIES;
+            }
+            else{
+                lt_include( PLOG_CLASS_PATH."class/dao/blogcategories.class.php" );
+                $categories = new BlogCategories();
+                if(!$categories->getBlogCategory( $this->_blogCategoryId ))
+                    $this->_blogCategoryId = ALL_BLOG_CATEGORIES;
+            }
 			
 			return true;
 		}
@@ -53,17 +88,12 @@
             if( $this->_mode == SUMMARY_RSS_TYPE_MOST_COMMENTED ||
                 $this->_mode == SUMMARY_RSS_TYPE_MOST_READ ||
                 $this->_mode == SUMMARY_RSS_TYPE_DEFAULT ||
-                $this->_mode == SUMMARY_RSS_TYPE_POSTS_LIST ) {	                
+                $this->_mode == SUMMARY_RSS_TYPE_POSTS_LIST )
+            {
 	                
-            	// get the globalArticleCategoryId from request
-				$globalArticleCategoryId = $this->_request->getValue( "globalArticleCategoryId" );
-				$val = new IntegerValidator();
-				if( !$val->validate( $globalArticleCategoryId ))
-					$globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
-				    			
 	            // RSS feeds for posts stuff
 	            $this->_view = new SummaryRssView( $this->_profile, Array( "summary" => "rss", 
-			                                       "globalArticleCategoryId" => $globalArticleCategoryId,
+			                                       "globalArticleCategoryId" => $this->_globalArticleCategoryId,
 			                                       "mode" => $this->_mode,
 												   "profile" => $this->_profile ));
 				if( $this->_view->isCached()) {
@@ -81,32 +111,16 @@
 					$postslist = $stats->getMostReadArticles();			
 				}
 				elseif( $this->_mode == SUMMARY_RSS_TYPE_POSTS_LIST ) {
-     				
-            		
-            		
             		// get the summary_items_per_page from config
             		$config =& Config::getConfig();
             		$summaryItemsPerPage = $config->getValue( "summary_items_per_page", SUMMARY_DEFAULT_ITEMS_PER_PAGE );
 					
-					$categories = new GlobalArticleCategories();
-					$currentGlobalArticleCategory = $categories->getGlobalArticleCategory( $globalArticleCategoryId );
-					
-					if( empty($currentGlobalArticleCategory) )
-						$globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
-						
-					$postslist = $stats->getPostsByGlobalCategory( $globalArticleCategoryId,
+					$postslist = $stats->getPostsByGlobalCategory( $this->_globalArticleCategoryId,
         										 					 $page = 1, 
         										 					 $summaryItemsPerPage );
 				}				
 				else {
-					
-					$categories = new GlobalArticleCategories();
-					$currentGlobalArticleCategory = $categories->getGlobalArticleCategory( $globalArticleCategoryId );
-					
-					if( empty($currentGlobalArticleCategory) )
-						$globalArticleCategoryId = ALL_GLOBAL_ARTICLE_CATEGORIES;
-					
-					$postslist = $stats->getRecentArticles( $globalArticleCategoryId );
+					$postslist = $stats->getRecentArticles( $this->_globalArticleCategoryId );
 				}
 	
 	            if( !$postslist ) {
@@ -119,15 +133,9 @@
 			        $this->_mode == SUMMARY_RSS_TYPE_NEWEST_BLOGS ||
 			        $this->_mode == SUMMARY_RSS_TYPE_BLOGS_LIST ) {
 				
-            	// get the globalArticleCategoryId from request
-				$blogCategoryId = $this->_request->getValue( "blogCategoryId" );
-				$val = new IntegerValidator();
-				if( !$val->validate( $blogCategoryId ))
-					$blogCategoryId = ALL_BLOG_CATEGORIES;
-
 				// RSS feeds for blogs, need different template sets...
 	            $this->_view = new SummaryRssView( "blogs_".$this->_profile, Array( "summary" => "rss",
-	            								   "blogCategoryId" => $blogCategoryId, 
+	            								   "blogCategoryId" => $this->_blogCategoryId, 
 			                                       "mode" => $this->_mode,
 												   "profile" => $this->_profile ));
 				if( $this->_view->isCached()) {
@@ -143,21 +151,13 @@
 					$blogslist = $stats->getMostActiveBlogs();	
 				}
 				elseif( $this->_mode == SUMMARY_RSS_TYPE_BLOGS_LIST ) {
-     				
             		
-            		
             		// get the summary_items_per_page from config
             		$config =& Config::getConfig();
             		$summaryItemsPerPage = $config->getValue( "summary_items_per_page", SUMMARY_DEFAULT_ITEMS_PER_PAGE );
-					
-					$categories = new BlogCategories();
-					$currentBlogCategory = $categories->getBlogCategory( $blogCategoryId );
-					
-					if( empty($currentBlogCategory) )
-						$blogCategoryId = ALL_BLOG_CATEGORIES;
-						
-					$blogslist = $blogs->getAllBlogs( BLOG_STATUS_ACTIVE, 
-													  $blogCategoryId, 
+
+                    $blogslist = $blogs->getAllBlogs( BLOG_STATUS_ACTIVE, 
+													  $this->_blogCategoryId, 
 													  "", 
 													  1, 
 													  $summaryItemsPerPage );

Modified: plog/trunk/class/summary/action/summarysearchaction.class.php
===================================================================
--- plog/trunk/class/summary/action/summarysearchaction.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/action/summarysearchaction.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,11 +1,5 @@
 <?php
 
-	
-	
-	
-	
-	
-
      class SummarySearchAction extends SummaryAction
      {
 		var $_searchTerms;
@@ -16,7 +10,7 @@
             $this->SummaryAction( $actionInfo, $request );			
 
 			// validation stuff
-			$this->registerFieldValidator( "searchTerms", new StringValidator());
+			$this->registerFieldValidator( "searchTerms", new StringValidator( true ));
 			$this->registerFieldValidator( "searchType", new IntegerValidator());
 			
 			$view = new SummaryView( "summaryerror" );
@@ -29,14 +23,24 @@
          */
         function perform()
         {
+            $this->_searchTerms = $this->_request->getFilteredValue( "searchTerms", new HtmlFilter());
+
+            if(trim($this->_searchTerms) == ""){
+                $this->_view = new ErrorView( $this->_blogInfo, "error_incorrect_search_terms" );
+                $this->setCommonData();
+                return false;
+            }
+			$this->_searchType  = $this->_request->getValue( "searchType" );	
+
+			// check if the search feature is disabled in this site...
+			$config =& Config::getConfig();
+			if( !$config->getValue( "search_engine_enabled" )) {
+				$this->_view = new ErrorView( $this->_blogInfo, "error_search_engine_disabled" );
+				$this->setCommonData();
 				
-			
-			
-	
-			$tf = new Textfilter();
-			$this->_searchTerms = $tf->filterAllHTML( $this->_request->getValue( "searchTerms" ));
-			$this->_searchType  = $this->_request->getValue( "searchType" );	
-	
+				return false;
+			}
+
             $search = new SearchEngine();
 
 			// number of items per page

Modified: plog/trunk/class/summary/view/summarycachedview.class.php
===================================================================
--- plog/trunk/class/summary/view/summarycachedview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/view/summarycachedview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -92,7 +92,7 @@
 			$baseurl = $config->getValue( "base_url" );
 
 			$this->_getLocale();
-			$this->_params->setValue( "version", new Version());
+			$this->_params->setValue( "version", Version::getVersion());
 			$this->_params->setValue( "locale", $this->_locale);
 			$this->_params->setValue( "rss", new RssParser());
 			$this->_params->setValue( "baseurl", $baseurl);

Modified: plog/trunk/class/summary/view/summaryrssview.class.php
===================================================================
--- plog/trunk/class/summary/view/summaryrssview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/view/summaryrssview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -53,7 +53,7 @@
 
             $config =& Config::getConfig();
             $this->_locale =& Locales::getLocale( $config->getValue("default_locale" ));
-            $this->_params->setValue( "version", new Version());
+            $this->_params->setValue( "version", Version::getVersion());
             $this->_params->setValue( "locale", $this->_locale );
 			$this->_params->setValue( "serviceName", $config->getValue( "summary_service_name" ));
             $this->_template->assign( $this->_params->getAsArray());

Modified: plog/trunk/class/summary/view/summaryview.class.php
===================================================================
--- plog/trunk/class/summary/view/summaryview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/summary/view/summaryview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -49,7 +49,6 @@
             $templateService = new TemplateService();
             $template = $templateService->customTemplate( $this->_templateName, $this->_templateFolder );
 
-            $this->_params->setValue( "version", new Version());
             $this->_params->setValue( "locale", $this->_locale );
 			$this->_params->setValue( "baseurl", $baseurl);
 			$this->_params->setValue( "serviceName", $config->getValue( "summary_service_name" ));			

Modified: plog/trunk/class/template/templateservice.class.php
===================================================================
--- plog/trunk/class/template/templateservice.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/template/templateservice.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -301,6 +301,8 @@
 			// change a few things...
             $config =& Config::getConfig();
 			$tmpFolder = $config->getValue( 'temp_folder' );
+            if (strpos($tmpFolder,'.') === 0)
+                $tmpFolder = rtrim(PLOG_CLASS_PATH,'/').ltrim($tmpFolder,'.');
 			if( $blogInfo == null )
 				$blogTmpFolder = $tmpFolder;
 			else {

Modified: plog/trunk/class/template/templatesets/templatesets.class.php
===================================================================
--- plog/trunk/class/template/templatesets/templatesets.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/template/templatesets/templatesets.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -151,7 +151,7 @@
 		{
 			if( $this->isTemplate( $templateName ))
 				$templateSet = new TemplateSet( $templateName, TEMPLATE_SET_GLOBAL, 0 );
-			elseif( $this->isBlogTemplate( $templateName, $blogId ))
+			elseif( $blogId && $this->isBlogTemplate( $templateName, $blogId ))
 				$templateSet = new TemplateSet( $templateName, TEMPLATE_SET_BLOG_SPECIFIC, $blogId );
 			else {
 				$templateSet = null;
@@ -190,6 +190,9 @@
         	        
         	$blogs = new Blogs();
         	$blog = $blogs->getBlogInfo( $blogId );
+            if(!$blog)
+                return false;
+            
             $blogSettings = $blog->getSettings( $blogId );
 
             // get the array with the template names stored in the settings
@@ -208,7 +211,11 @@
         function getDefaultTemplateSet()
         {
 	     	$config =& Config::getConfig();
-	     	return( $this->getTemplateSet( $config->getValue( "default_template" )));
+	     	$default_template_name = $config->getValue("default_template");
+            $default_template = $this->getTemplateSet($default_template_name);
+            if(!$default_template)
+                $default_template = $this->getTemplateSet("standard");
+            return $default_template;
         }
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/PHPUnit/Assert.php
===================================================================
--- plog/trunk/class/test/PHPUnit/Assert.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/PHPUnit/Assert.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -137,7 +137,7 @@
             $expected = serialize($expected);
 
             $message = sprintf(
-              '%sexpected %s, actual %s',
+              '%sexpected "%s", actual "%s"',
 
               !empty($message) ? $message . ' ' : '',
               $expected,
@@ -151,7 +151,7 @@
 
         elseif (is_numeric($actual) && is_numeric($expected)) {
             $message = sprintf(
-              '%sexpected %s%s, actual %s',
+              '%sexpected "%s%s", actual "%s"',
 
               !empty($message) ? $message . ' ' : '',
               $expected,
@@ -166,7 +166,7 @@
 
         else {
             $message = sprintf(
-              '%sexpected %s, actual %s',
+              '%sexpected "%s", actual "%s"',
 
               !empty($message) ? $message . ' ' : '',
               $expected,

Modified: plog/trunk/class/test/helpers/lifetypetestcase.class.php
===================================================================
--- plog/trunk/class/test/helpers/lifetypetestcase.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/helpers/lifetypetestcase.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -41,7 +41,7 @@
 			// get the code from the response and see if the expected one
 			// is even there			
 			if( !strpos( $c->response_code, $expected )) {
-				$message = $message." expected $expected, actual '".$c->response_code."'";
+				$message = $message." expected '$expected', actual '".$c->response_code."'";
 				$this->fail( $message );
 			}
 		}

Modified: plog/trunk/class/test/helpers/testtools.class.php
===================================================================
--- plog/trunk/class/test/helpers/testtools.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/helpers/testtools.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -25,14 +25,43 @@
 			);
 			
 			$blogs = new Blogs();
-			if( $blogs->addBlog( $blog ))
-				return $blog;
-			else
-				return false;
+			if(!$blogs->addBlog($blog))
+                return false;
+
+                // every blog needs an article category, otherwise,
+                // other things don't work (like posting, which is our check
+                // to see if we successfully logged in)
+
+            // add a default category
+            $articleCategories = new ArticleCategories();
+            $articleCategory = new ArticleCategory( "Default Category",
+                                                    "",
+                                                    $blog->getId(),
+                                                    true,
+                                                    "This is an uninteresting description");
+            $catId = $articleCategories->addArticleCategory( $articleCategory );
+
+            if(!$catId)
+                print "Couldn't create default category for blog";
+
+            return $blog;
 		}
-		
+
+        /**
+         * Delete a blog and the default category
+         * (Note: Why doesn't a blog erase relevant stuff when it is erased?
+         *  Maybe the blogs->deleteBlog should be a private function,
+         *  and outside folks always call purgeBlog instead??)
+         */
+         function deleteBlog( $blog ){
+            $articleCategories = new ArticleCategories();
+            $articleCategories->deleteBlogCategories( $blog->getId() );
+            
+            TestTools::deleteDaoTestData(Array($blog));
+        }
+        
 		/**
-		 * Creates a temporary user
+		 * Creates a temporary user with minimal (login only) permissions
 		 *
 		 * @return A UserInfo object if successful or false otherwise
 		 */
@@ -45,35 +74,69 @@
 				"About test user",
 				"Test User"				
 			);
-			
+
 			$users = new Users();
-			if( $users->addUser( $user ))
-				return( $user );
-			else
-				return( false );
+			if(!$users->addUser($user))
+                return false;
+            
+            $userPerms = new UserPermissions();
+            
+            $perms = new Permissions();
+            $loginAccess = $perms->getPermissionByName( "login_perm" );
+            if($loginAccess === false){
+                print "Error getting login permission id";
+                return false;
+            }
+            
+                // Give user login privileges
+            $userPerm = new UserPermission( $user->getId(), 0, $loginAccess->getId() );
+            if(!$userPerm){
+                print "Error creating UserPermission(login) for user";
+                return false;
+            }
+            if(!$userPerms->grantPermission( $userPerm )){
+                print "Error granting login permissions to user";
+                return false;
+            }
+            
+            return $user;
 		}
 		
 		/**
-		 * Creates a temporary admin user
+		 * Creates a temporary admin user, with default admin privileges
 		 *
 		 * @return A UserInfo object if successful or false otherwise
 		 */
 		function createAdminUser()
 		{
-			$user = new UserInfo(
-				TestTools::getRandomWord( 15, false, false ),
-				"password",
-				"test at user.com",
-				"About test user",
-				"Test User"				
-			);
+            $user = TestTools::createUser();
+            if(!$user)
+                return false;
+
 			$user->setSiteAdmin( true );
-			
+            $userPerms = new UserPermissions();
+            
+            $perms = new Permissions();
+            $allPerms = $perms->getAllPermissions();
+            foreach($allPerms as $perm){
+                if($perm->isAdminOnlyPermission()){
+                    $userPerm = new UserPermission( $user->getId(), 0, $perm->getId() );
+                    if(!$userPerm){
+                        print "Error creating UserPermission(".$perm->getId().") for user";
+                    }
+                    if(!$userPerms->grantPermission($userPerm)){
+                        print "Error granting UserPermission(".$perm->getId().") for user";
+                    }
+                }
+            }
+            
+                // save user
 			$users = new Users();
-			if( $users->addUser( $user ))
-				return( $user );
-			else
-				return( false );
+			if(!$users->updateUser($user)){
+                print "Couldn't update admin privileges for user";
+                return $user;  // return a user, since he has already been created
+            }
+            return $user;
 		}		
 		
 		/**
@@ -216,14 +279,13 @@
 					$users = new Users();
 					$users->deleteUser( $item->getId());
 				}
-				elseif( $className == "usercomment" ) {
+				elseif( $className == "usercomment" || $className == "trackback" ) {
 					$comments = new ArticleComments();
 					$comments->deleteComment( $item->getId());
 				}
 				else {
-					print("Unrecognized object of class $className" );
+					print("<br/><br/>Unrecognized object of class $className" );
 					print_r( $item );
-					die();
 				}
 			}
 		}

Modified: plog/trunk/class/test/tests/dao/article_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/article_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/dao/article_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -12,23 +12,19 @@
 	{
 		function setUp()
 		{
-                // 
-                // Note: if you are going to copy this code for another test, note that this code
-                // doesn't ever add this article to the database, since if it did, it could
-                // potentially overwrite your real blog data...
-                //
-                // build a dummy Article object			
-			$this->article = new Article(
-				"dummy topic",
-				"dummy text",
-				Array( 1 ),   // a dummy category
-				Array( 1 ),   // a dummy user
-				1,  // a dummy blog
-				POST_STATUS_PUBLISHED,  // published status
-				0   // not read yet
-			);	
+			// create the scenario
+			$this->user = TestTools::createUser();
+			$this->blog = TestTools::createBlog( $this->user->getId());
+			$this->cat  = TestTools::createArticleCategory( $this->blog->getId());
+			$this->article = TestTools::createArticle( $this->blog->getId(), $this->user->getId(),
+                                                       Array( $this->cat->getId()));
 		}
-		
+
+        function tearDown(){
+			TestTools::deleteDaoTestData(Array($this->article, $this->cat, $this->user));
+			TestTools::deleteBlog( $this->blog );
+        }
+        
 		/** 
 		 * regression test for mantis case 986 (http://bugs.lifetype.net/view.php?id=986)
 		 * and for method Article::hasExtendedText in general

Modified: plog/trunk/class/test/tests/dao/articlecategories_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/articlecategories_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/dao/articlecategories_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -9,43 +9,55 @@
 	 */
 	class ArticleCategories_Test extends LifeTypeTestCase
 	{
-		
+        function setUp(){
+			// create the test data
+			$this->data = TestTools::createBlogScenario(
+                Array( "num_articles" => 5, "num_categories" => 3 ));
+
+			$this->article = TestTools::createArticle( $this->data["blog"]->getId(),
+                                                       $this->data["user"]->getId(),
+                                                       Array( $this->data["categories"][0]->getId()),
+                                                       POST_STATUS_DRAFT );
+        }
+
+        function tearDown(){
+			// delete the test data
+			TestTools::deleteDaoTestData( $this->data["articles"] );
+			TestTools::deleteDaoTestData( $this->data["categories"] );
+            TestTools::deleteDaoTestData( Array( $this->article,
+                                                 $this->data["user"] ));
+            TestTools::deleteBlog($this->data["blog"]);
+        }
+        
 		/**
 		 * Regression test for Mantis case http://bugs.lifetype.net/view.php?id=1100 -- category
 		 * counters getting out of sync.
 		 */
 		function testArticleCategoriesCounters()
 		{
-			// create the test data
-			$data = TestTools::createBlogScenario( Array( "num_articles" => 5, "num_categories" => 3 ));
-			
 			// add an article to one of the categories
-			$article = TestTools::createArticle( $data["blog"]->getId(), $data["user"]->getId(), Array( $data["categories"][0]->getId()), POST_STATUS_DRAFT );
-			$this->assertTrue( $article, "Error creating test article!" );
+
+			$this->assertTrue( $this->article, "Error creating test article!" );
 			
 			// check that the counter has been updated
 			$articleCategories = new ArticleCategories();
-			$updatedCat = $articleCategories->getCategory( $data["categories"][0]->getId());
-			$this->assertTrue( $updatedCat->getNumArticles( POST_STATUS_ALL ) == ($data["categories"][0]->getNumArticles() + 1 ), "Article category counters are not valid!" );
+			$updatedCat = $articleCategories->getCategory( $this->data["categories"][0]->getId());
+			$this->assertTrue( $updatedCat->getNumArticles( POST_STATUS_ALL ) == ($this->data["categories"][0]->getNumArticles() + 1 ), "Article category counters are not valid!" );
 			
 			// now let's mess up the database a little
 			$db =& LtDb::getDb();
 			$db->Execute( "UPDATE ".LtDb::getPrefix().
 			              "articles_categories SET num_published_articles = 234234, num_articles = 2342 ".
-			              "WHERE id = ".$data["categories"][1]->getId());
+			              "WHERE id = ".$this->data["categories"][1]->getId());
 			// trigger a cache reset
-			$articleCategories->_cache->removeData( $data["categories"][1]->getId(), DaoCacheConstants::CACHE_ARTICLE_CATEGORIES );
-			// update the category, relaod it and check that the counters are correct again
-			$tmp = $data["categories"][1];
+			$articleCategories->_cache->removeData( $this->data["categories"][1]->getId(), CACHE_ARTICLE_CATEGORIES );
+			// update the category, reload it and check that the counters are correct again
+			$tmp = $this->data["categories"][1];
 			$articleCategories->updateCategory( $tmp );
-			$updatedCat2 = $articleCategories->getCategory( $data["categories"][1]->getId());
-			$this->assertTrue( $updatedCat2->getNumArticles( POST_STATUS_ALL ) == $data["categories"][1]->getNumArticles( POST_STATUS_ALL ), "Article category counters do not match!" );
-			$this->assertTrue( $updatedCat2->getNumPublishedArticles() == $data["categories"][1]->getNumPublishedArticles(), "Article category counters do not match!" );
+			$updatedCat2 = $articleCategories->getCategory( $this->data["categories"][1]->getId());
+			$this->assertTrue( $updatedCat2->getNumArticles( POST_STATUS_ALL ) == $this->data["categories"][1]->getNumArticles( POST_STATUS_ALL ), "Article category counters do not match!" );
+			$this->assertTrue( $updatedCat2->getNumPublishedArticles() == $this->data["categories"][1]->getNumPublishedArticles(), "Article category counters do not match!" );
 
-			// delete the test data
-			//TestTools::deleteDaoTestData( Array( $data["blog"], $data["user"] ));
-			//TestTools::deleteDaoTestData( $data["categories"] );
-			//TestTools::deleteDaoTestData( $data["articles"] );
 		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/dao/commentscommon_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/commentscommon_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/dao/commentscommon_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -10,55 +10,46 @@
 	 */
 	class CommentsCommon_Test extends LifeTypeTestCase
 	{
+        function setUp(){
+			// create the scenario
+			$this->user = TestTools::createUser();
+			$this->blog = TestTools::createBlog( $this->user->getId());
+			$this->cat  = TestTools::createArticleCategory( $this->blog->getId());
+			$this->article = TestTools::createArticle( $this->blog->getId(), $this->user->getId(),
+                                                       Array( $this->cat->getId()));
+        }
 
+        function tearDown(){
+			// destroy the test data
+			TestTools::deleteDaoTestData(Array($this->article, $this->cat, $this->user));
+			TestTools::deleteBlog($this->blog);
+        }
+
+        
         function testGetNumPostComments()
 		{
 
-            // create a user
-            $users = new Users();
-            $randomName = md5(time());
-            $user = new UserInfo($randomName, "blah", "test at not-a-real-address.net", "", "Full Name");
-            $this->assertTrue($users->addUser($user), "Couldn't add test user");
-            
-            // create a blog
-			$blogs = new Blogs();
-			$randomName = md5(time());
-			$blog = new BlogInfo( $randomName, $user->getId(), "About blog random blog", new BlogSettings());
-			$this->assertTrue($blogs->addBlog( $blog ), "Couldn't add test blog");
 
-            // add an article
-            $articles = new Articles();
-			$article = new Article(
-				"dummy topic",
-				"dummy text",
-				Array( 1 ),   // a dummy category (I don't need a category here)
-				$user->getId(), // our user we created above
-				$blog->getId(),  // our blog we created above
-				POST_STATUS_PUBLISHED,  // published status
-				0   // not read yet
-                );
-            $this->assertTrue($articles->addArticle($article), "Couldn't add test article");
-
             // Add comments
             $timestamp = new Timestamp();
-            $comment1 = new UserComment($article->getId(),
-                                        $article->getBlogId(),
+            $comment1 = new UserComment($this->article->getId(),
+                                        $this->article->getBlogId(),
                                         0, // dummy parent
                                         "dummy topic",
                                         "dummy text",
                                         $timestamp->getTimestamp());
             
             $timestamp = new Timestamp();
-            $comment2 = new UserComment($article->getId(),
-                                        $article->getBlogId(),
+            $comment2 = new UserComment($this->article->getId(),
+                                        $this->article->getBlogId(),
                                         0, // dummy parent
                                         "dummy topic 2",
                                         "dummy text 2",
                                         $timestamp->getTimestamp());
 
             $timestamp = new Timestamp();
-            $comment3 = new UserComment($article->getId(),
-                                        $article->getBlogId(),
+            $comment3 = new UserComment($this->article->getId(),
+                                        $this->article->getBlogId(),
                                         0, // dummy parent
                                         "dummy topic 2",
                                         "spam",
@@ -74,8 +65,8 @@
             $timestamp = new Timestamp();
             $trackback1 = new Trackback("fake url",
                                         "this is a title",
-                                        $article->getId(),
-                                        $article->getBlogId(),
+                                        $this->article->getId(),
+                                        $this->article->getBlogId(),
                                         "excerpt from my blog",
                                         "my blog name",
                                         $timestamp->getTimestamp(),
@@ -84,8 +75,8 @@
             $timestamp = new Timestamp();
             $trackback2 = new Trackback("fake url 2",
                                         "this is a title",
-                                        $article->getId(),
-                                        $article->getBlogId(),
+                                        $this->article->getId(),
+                                        $this->article->getBlogId(),
                                         "excerpt from my blog",
                                         "my blog name",
                                         $timestamp->getTimestamp(),
@@ -95,8 +86,8 @@
             $timestamp = new Timestamp();
             $trackback3 = new Trackback("fake url 3",
                                         "this is a title",
-                                        $article->getId(),
-                                        $article->getBlogId(),
+                                        $this->article->getId(),
+                                        $this->article->getBlogId(),
                                         "excerpt from my blog",
                                         "my blog name",
                                         $timestamp->getTimestamp(),
@@ -106,8 +97,8 @@
             $timestamp = new Timestamp();
             $trackback4 = new Trackback("fake url 4",
                                         "this is a title",
-                                        $article->getId(),
-                                        $article->getBlogId(),
+                                        $this->article->getId(),
+                                        $this->article->getBlogId(),
                                         "excerpt from my blog",
                                         "my blog name",
                                         $timestamp->getTimestamp(),
@@ -124,32 +115,29 @@
             $this->assertTrue($comments->addComment($trackback2), "Couldn't add test trackback 2");
             $this->assertTrue($comments->addComment($trackback3), "Couldn't add test trackback 3");
             $this->assertTrue($comments->addComment($trackback4), "Couldn't add test trackback 4");
-
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_ALL, CommentsCommon::COMMENT_TYPE_ANY);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_ALL, COMMENT_TYPE_ANY);
             $this->assertTrue($num == 7, "Wrong number of comments/trackbacks (all) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_NONSPAM, CommentsCommon::COMMENT_TYPE_ANY);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_NONSPAM, COMMENT_TYPE_ANY);
             $this->assertTrue($num == 3, "Wrong number of comments/trackbacks (nonspam) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_SPAM, CommentsCommon::COMMENT_TYPE_ANY);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_SPAM, COMMENT_TYPE_ANY);
             $this->assertTrue($num == 4, "Wrong number of comments/trackbacks (spam) ". $num);
-
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_ALL, CommentsCommon::COMMENT_TYPE_COMMENT);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_ALL, COMMENT_TYPE_COMMENT);
             $this->assertTrue($num == 3, "Wrong number of comments (all) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_NONSPAM, CommentsCommon::COMMENT_TYPE_COMMENT);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_NONSPAM, COMMENT_TYPE_COMMENT);
             $this->assertTrue($num == 2, "Wrong number of comments (nonspam) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_SPAM, CommentsCommon::COMMENT_TYPE_COMMENT);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_SPAM, COMMENT_TYPE_COMMENT);
             $this->assertTrue($num == 1, "Wrong number of comments (spam) ". $num);
-
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_ALL, CommentsCommon::COMMENT_TYPE_TRACKBACK);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_ALL, COMMENT_TYPE_TRACKBACK);
             $this->assertTrue($num == 4, "Wrong number of trackbacks (all) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_NONSPAM, CommentsCommon::COMMENT_TYPE_TRACKBACK);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_NONSPAM, COMMENT_TYPE_TRACKBACK);
             $this->assertTrue($num == 1, "Wrong number of trackbacks (nonspam) ". $num);
-            $num = $comments->getNumPostComments($article->getId(), COMMENT_STATUS_SPAM, CommentsCommon::COMMENT_TYPE_TRACKBACK);
+            $num = $comments->getNumPostComments($this->article->getId(), COMMENT_STATUS_SPAM, COMMENT_TYPE_TRACKBACK);
             $this->assertTrue($num == 3, "Wrong number of trackbacks (spam) ". $num);
 
             
-			// delete the temporary blogs
-			$blogs->deleteBlog($blog->getId());
-            $users->deleteUser($user->getId());
+                // delete the temporary data
+			TestTools::deleteDaoTestData(Array($comment1, $comment2, $comment3,
+                                               $trackback1, $trackback2, $trackback3, $trackback4));
 		}
 		
 		/**
@@ -159,19 +147,15 @@
 		 */
 		function testUpdateCommentWithTimeOffsets()
 		{
-			// create the scenario
-			$user = TestTools::createUser();
-			$blog = TestTools::createBlog( $user->getId());
-			$cat  = TestTools::createArticleCategory( $blog->getId());
-			$article = TestTools::createArticle( $blog->getId(), $user->getId(), Array( $cat->getId()));
-			
 			// update the time offset settings for the blog
-			$blog->setValue( "time_offset", "+3" );
+			$this->blog->setValue( "time_offset", "+3" );
 			$blogs = new Blogs();
-			$blogs->updateBlog( $blog );
+			$blogs->updateBlog($this->blog);
 			
 			// create the comment and save it to the database
-			$comment = new UserComment( $article->getId(), $blog->getId(), 0, "test comment", "test comment body" );
+			$comment = new UserComment( $this->article->getId(),
+                                        $this->blog->getId(),
+                                        0, "test comment", "test comment body" );
 			$comments = new ArticleComments();
 			$comments->addComment( $comment );
 			
@@ -187,7 +171,7 @@
 			$this->assertEquals( $origTime->getTimestamp(), $newTime->getTimestamp(), "Comment times are not the same!" );
 			
 			// destroy the test data
-			TestTools::deleteDaoTestData( Array( $comment, $comment2, $article, $cat, $blog, $user));
+			TestTools::deleteDaoTestData(Array($comment, $comment2));
 		}
 	}
 ?>

Modified: plog/trunk/class/test/tests/dao/permissions_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/permissions_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/dao/permissions_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -33,6 +33,9 @@
 			$this->assertEquals( $perm->getDescription(), $newPerm->getDescription(), "new permission is not the same as original" );
 			$this->assertEquals( $perm->isAdminOnlyPermission(), $newPerm->isAdminOnlyPermission(), "new permission is not the same as original" );
 			$this->assertEquals( $perm->isCorePermission(), $newPerm->isCorePermission(), "new permission is not the same as original" );
+
+			$this->assertTrue( $perms->deletePermission( $perm->getId()), "There was an error deleting the permission" );			
+
 		}
 		
 		function testGetPermission()

Modified: plog/trunk/class/test/tests/dao/searchengine_test.class.php
===================================================================
--- plog/trunk/class/test/tests/dao/searchengine_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/dao/searchengine_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -32,7 +32,10 @@
 			// and one with future date
 			$t = new Timestamp();
 			$t->addSeconds( 60 * 60 * 10 );
-			$this->art2 = TestTools::createArticle( $this->blog->getId(), $this->user->getId(), Array( $this->cat->getId()), POST_STATUS_PUBLISHED, $t );	
+			$this->art2 = TestTools::createArticle( $this->blog->getId(), $this->user->getId(), Array( $this->cat->getId()), POST_STATUS_PUBLISHED, $t );
+
+            sleep(1); // have to sleep, otherwise the search for "time < NOW()" will return false
+                // for all articles.  Alternatively, the searchengine could use "time <= NOW()"
 		}
 		
 		/**
@@ -42,8 +45,9 @@
 		function tearDown()
 		{
 			TestTools::deleteDaoTestData(
-                Array( $this->art1, $this->art2, $this->cat, $this->blog, $this->user)
+                Array( $this->art1, $this->art2, $this->cat, $this->user)
 			);
+			TestTools::deleteBlog( $this->blog );
 		}
 		
 		/**
@@ -51,9 +55,9 @@
 		 */
 		function testSearchIgnoreFuturePosts()
 		{
-			// check that when searching for this specific string, we only get one match (there should only be one test article)
+                // check that when searching for this specific string, we only get one match (there should only be one test article)
 			$searchEngine = new SearchEngine();
-			$results = $searchEngine->search( $this->blog->getId(), "test article", POST_STATUS_PUBLISHED, false );			
+			$results = $searchEngine->search( $this->blog->getId(), "test article", POST_STATUS_PUBLISHED, false );
 			$this->assertEquals( 1, count( $results ), "There should only be one article in the search results" );
 			
 			// check that the article with the future date is not part of the results
@@ -66,7 +70,7 @@
 			
 			// and finally check that the amount of search results returned is valid
 			$this->assertEquals( 1, $searchEngine->getNumSearchResults( $this->blog->getId(), "test article", POST_STATUS_PUBLISHED, false ),
-			                     "The future article was counted by SearchEngine::getNumSearchResults()!" );
+			                     "SearchEngine::getNumSearchResults() returned additional articles???" );
 		}
 		
 		/**
@@ -75,11 +79,12 @@
 		 */
 		function testSiteSearchIgnoreFuturePosts()
 		{
-			// check that when searching for this specific string, we only get one match (there should only be one test article)
+                // check that when searching for this specific string,
+                // we only get one match (there should only be one test article)
 			$searchEngine = new SearchEngine();
-			$results = $searchEngine->siteSearch( "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false );
+			$results = $searchEngine->siteSearch("test article", SEARCH_ARTICLE,
+                                                  POST_STATUS_PUBLISHED, false);
 			$this->assertEquals( 1, count( $results ), "There should only be one article in the search results" );
-			
 			// check that the article with the future date is not part of the results
 			foreach( $results as $result ) {
 				if( $result->getType() == SEARCH_RESULT_ARTICLE ) {
@@ -89,8 +94,10 @@
 			}
 			
 			// and finally check that the amount of search results returned is valid
-			$this->assertEquals( 1, $searchEngine->getNumSiteSearchResults( "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false ),
-			                     "The future article was counted by SearchEngine::getNumSiteSearchResults()!" );			
+            $numResults = $searchEngine->getNumSiteSearchResults(
+                "test article", SEARCH_ARTICLE, POST_STATUS_PUBLISHED, false );
+            $this->assertEquals(1, $numResults,
+                                "The future article was counted by getNumSiteSearchResults()!");
 		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/data/textfilter_test.class.php
===================================================================
--- plog/trunk/class/test/tests/data/textfilter_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/data/textfilter_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -107,6 +107,7 @@
 			// array with strings and the expected result, the key is the
 			// input and the value is the expected output, add more if needed
 			$tests = Array(
+				"&lt;" => "<",
 				"&amp;" => "&",
 				"test" => "test",
 				"&aacute;&eacute;" => "áé",
@@ -117,6 +118,7 @@
 				// check that the input is equal to the output after processing it with TextFilter::htmlDecode
 				$this->assertEquals( $output, TextFilter::htmlDecode( $input ), "Error htmlDecode()-ing string: $input" );
 				// and that htmlDecode and filterHTMLEntities are really the opposite of each other
+				$this->assertEquals( $input, Textfilter::htmlDecode( TextFilter::filterHTMLEntities( $input )));
 				$this->assertEquals( $output, Textfilter::htmlDecode( TextFilter::filterHTMLEntities( $output )));
 			}
 		}

Copied: plog/trunk/class/test/tests/data/validator/datetimevalidator_test.class.php (from rev 6933, plog/branches/lifetype-1.2/class/test/tests/data/validator/datetimevalidator_test.class.php)
===================================================================
--- plog/trunk/class/test/tests/data/validator/datetimevalidator_test.class.php	                        (rev 0)
+++ plog/trunk/class/test/tests/data/validator/datetimevalidator_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,29 @@
+<?php
+
+	lt_include( PLOG_CLASS_PATH."class/test/helpers/lifetypetestcase.class.php" );
+	lt_include( PLOG_CLASS_PATH."class/data/validator/datetimevalidator.class.php" );
+
+	/**
+	 * \ingroup Test
+	 *
+	 * Test case for the ArrayValidator class
+	 */
+	class DateTimeValidator_Test extends LifeTypeTestCase
+	{
+		function testDate()
+		{
+			// create a username validator
+			$v = new DateTimeValidator( '%Y%m%d' );
+			$this->assertTrue( $v->validate( '20070813' ) );
+			$this->assertFalse( $v->validate( '07813' ) );
+		}
+		
+		function testDateTime()
+		{
+			// create a username validator
+			$v = new DateTimeValidator( '%Y-%m-%d %G:%i' );
+			$this->assertTrue( $v->validate( '2007-08-13 23:37' ) );
+			$this->assertFalse( $v->validate( '2007-08-13 23' ) );
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/data/validator/httpurlvalidator_test.class.php
===================================================================
--- plog/trunk/class/test/tests/data/validator/httpurlvalidator_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/data/validator/httpurlvalidator_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -24,6 +24,7 @@
 				"http://www.lifetype.net/index.php?op=Default&blogId=3",
 				"http://www.lifetype.net/#anchortest",
 				"http://localhost/",
+				"http://localhost",
 				"http://127.22.45.44",
 				"http://user:password@www.server.com",
 				"http://user@23.44.22.12:8050/my/very/long/server/folder/.with.several.dots",
@@ -34,7 +35,7 @@
                 "http://surprisingly/%20valid.too",
 				"http://crazy.that.this.is.valid.too/index.php&param1=value&param2&param3",
 				"http://and.me.too/index.php?param1?param2?param3",
-				"http://user@password@server.com",
+				"http://user@badpassword@server.com",
 			);
 			
 			foreach( $urls as $url ) {
@@ -46,6 +47,7 @@
 		{
 			$urls = Array(
 				"http://",
+				"http:///",
 				"http://www.....com",
 				"htttp://www.server.com",
                     // we don't check for valid email addresses

Modified: plog/trunk/class/test/tests/locale/locale_test.class.php
===================================================================
--- plog/trunk/class/test/tests/locale/locale_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/locale/locale_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -95,13 +95,51 @@
 		
 		/**
 		 * Tests that the Locale::testFormatDateGMT() method also behaves
+		 * as expected during daylight savings time
+		 */
+		function testFormatDateGMT_DST()
+		{
+			$d = new Timestamp( "20070605180000" );
+			
+			$diff = $this->l->formatDate( $d, "%O" );
+            $diff = $diff / 100;
+
+			$this->assertEquals( "Tue", $this->l->formatDateGMT( $d, "%a" ));
+			$this->assertEquals( "Tuesday", $this->l->formatDateGMT( $d, "%A" ));
+			$this->assertEquals( "Jun", $this->l->formatDateGMT( $d, "%b" ));
+			$this->assertEquals( "June", $this->l->formatDateGMT( $d, "%B" ));
+			$this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
+			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
+			$this->assertEquals( 18-$diff, $this->l->formatDateGMT( $d, "%H" ));
+			$this->assertEquals( (18-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
+			$this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));			
+			$this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));						
+			$this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));			
+			$this->assertEquals( "06", $this->l->formatDateGMT( $d, "%m" ));
+			$this->assertEquals( "00", $this->l->formatDateGMT( $d, "%S" ));
+			$this->assertEquals( "07", $this->l->formatDateGMT( $d, "%y" ));			
+			$this->assertEquals( "2007", $this->l->formatDateGMT( $d, "%Y" ));
+			$this->assertEquals( "%", $this->l->formatDateGMT( $d, "%%" ));
+			$this->assertEquals( "5th of June", $this->l->formatDateGMT( $d, "%T" ));			
+			$this->assertEquals( "5th", $this->l->formatDateGMT( $d, "%D" ));	
+			
+			// a longer format test
+			$this->assertEquals( "Jun ", $this->l->formatDateGMT( $d, "%b " ));
+			$this->assertEquals( "Jun 5", $this->l->formatDateGMT( $d, "%b %j" ));
+			$this->assertEquals( "05/06/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
+			$this->assertEquals( "05 June, 2007 ".(18-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
+		}		
+
+		
+		/**
+		 * Tests that the Locale::testFormatDateGMT() method also behaves
 		 * as expected
 		 */
 		function testFormatDateGMT()
 		{
 			$d = new Timestamp( "20070205120000" );
 			
-			$diff = $this->l->formatDate( new Timestamp(), "%O" );
+			$diff = $this->l->formatDate( $d, "%O" );
             $diff = $diff / 100;
 
 			$this->assertEquals( "Mon", $this->l->formatDateGMT( $d, "%a" ));
@@ -111,7 +149,7 @@
 			$this->assertEquals( "05", $this->l->formatDateGMT( $d, "%d" ));
 			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%j" ));
 			$this->assertEquals( 12-$diff, $this->l->formatDateGMT( $d, "%H" ));
-			$this->assertEquals( "5", $this->l->formatDateGMT( $d, "%I" ));
+			$this->assertEquals( (12-$diff)%12, $this->l->formatDateGMT( $d, "%I" ));
 			$this->assertEquals( "pm", $this->l->formatDateGMT( $d, "%p" ));			
 			$this->assertEquals( "PM", $this->l->formatDateGMT( $d, "%P" ));						
 			$this->assertEquals( "00", $this->l->formatDateGMT( $d, "%M" ));			
@@ -129,5 +167,6 @@
 			$this->assertEquals( "05/02/2007", $this->l->formatDateGMT( $d, "%d/%m/%Y" ));
 			$this->assertEquals( "05 February, 2007 ".(12-$diff).":00", $this->l->formatDateGMT( $d, "%d %B, %Y %H:%M" ));								
 		}		
-	}
+
+    }
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php
===================================================================
--- plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/mail/phpmailer/phpmailer_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -475,10 +475,6 @@
 
         $this->BuildBody();
         $this->assertTrue($this->Mail->Send(), $this->Mail->ErrorInfo);
-
-        $fp = fopen(PHPMAILER_TEST_BASE_FOLDER."message.txt", "w");
-        fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());
-        fclose($fp);
     }    
 
     function test_MultipleSend() {

Modified: plog/trunk/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php
===================================================================
--- plog/trunk/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/net/xmlrpc/xmlrpcserver_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -7,67 +7,29 @@
 	 */
 	class XmlRpcServer_Test extends LifeTypeTestCase
 	{
-		/**
-		 * dummy blog we'll be using during the tests
-		 */
 		var $blog;
-		
-		/**
-		 * dummy blog owner
-		 */
-		var $owner;
-		
-		/**
-		 * dummy category
-		 */
+		var $user;
 		var $cat;
-		
-		/**
-		 * URL pointing to this server's xmlrpc.php
-		 */
-		
+        var $url;
+        
 		function setUp()
 		{
-			// create the blog owner
-			$this->owner = new UserInfo( md5(time()),   // name
-			                             "password",   // password
-			                             "whatever at whatever.com",  // email address
-			             				 "",    // about
-			                             "" );
-			$users = new Users();
-			if( !$users->addUser( $this->owner )) {
-				throw( new Exception( "Error adding test user" ));
-				die();
-			}
-			
+			$this->user = TestTools::createUser();
+			$this->blog = TestTools::createBlog( $this->user->getId());
+            $articlecategories = new ArticleCategories();
+			$arr = $articlecategories->getBlogCategories($this->blog->getId());
+            $this->cat = $arr[0];
+            
 			// load a UTF-8 locale
 			$zhLocale =& Locales::getLocale( "zh_CN" );
-		
-			// create the test blog
+
 			$blogs = new Blogs();
-			$this->blog = null;
-			$this->blog = new BlogInfo( "test blog",
-			                            $this->owner->getId(),
-			                            "",
-			                            new BlogSettings());
 			$this->blog->setLocale( $zhLocale );
-			if( !$blogs->addBlog( $this->blog )) {
-				throw( new Exception( "Error adding test blog!" ));
-				die();
+			if(!$blogs->updateBlog( $this->blog )) {
+				print "Error adding test blog!";
+				return;
 			}
 			
-			// add a default category
-			$this->cat = new ArticleCategory( "General", 
-			                            "Description for category General",
-										$this->blog->getId(),
-										true );
-										
-			$cats = new ArticleCategories();
-			if( !$cats->addArticleCategory( $this->cat )) {
-				throw(  new Exception( "Error adding test category!" ));
-				die();
-			}
-			
 			// get the URL pointing to xmlrpc.php
 			$config =& Config::getConfig();
 			$this->url = $config->getValue( "base_url" )."/xmlrpc.php";
@@ -75,15 +37,14 @@
 		
 		function tearDown()
 		{
-			$users = new Users();
-			$users->deleteUser( $this->owner->getId());
-			
-			$blogs = new Blogs();
-			$blogs->deleteBlog( $this->blog->getId());
-			
-			$cats = new ArticleCategories();
-			$cats->deleteCategory( $this->cat->getId(), $this->blog->getId());
-		}
+            $articles = new Articles();
+            $articles->deleteBlogPosts($this->blog->getId());
+            
+			TestTools::deleteDaoTestData(
+                Array($this->cat, $this->user)
+			);
+			TestTools::deleteBlog( $this->blog );
+        }
 
 		/**
 		 * test the blogger.newPost method call
@@ -94,7 +55,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "blah blah", 
 					   true );
@@ -114,7 +75,7 @@
 			$this->assertEquals( "blah blah", $article->getTopic());
 			
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -124,7 +85,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\nblah blah", 
 					   true );
@@ -144,7 +105,7 @@
 			$this->assertEquals( "topic", $article->getTopic());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -154,7 +115,7 @@
 			$res = $c->query( "blogger.newPost", 
 			           "appkey", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\n" . "Intro text" . Article::POST_EXTENDED_TEXT_MODIFIER . "Extended text", 
 					   true );
@@ -177,7 +138,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -193,7 +154,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "blogger.getUserInfo", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -202,10 +163,10 @@
 			// and check the data in the response
 			$userData = $c->getResponse();
 			
-			$this->assertEquals( $this->owner->getUsername(), $userData["nickname"], "The user nickname did not match!" );
-			$this->assertEquals( $this->owner->getUsername(), $userData["firstname"], "The user firstname did not match!" );
-			$this->assertEquals( $this->owner->getEmail(), $userData["email"], "The user email address did not match!" );
-			$this->assertEquals( $this->owner->getId(), $userData["userid"], "The user id did not match!" );			
+			$this->assertEquals( $this->user->getUsername(), $userData["nickname"], "The user nickname did not match!" );
+			$this->assertEquals( $this->user->getUsername(), $userData["firstname"], "The user firstname did not match!" );
+			$this->assertEquals( $this->user->getEmail(), $userData["email"], "The user email address did not match!" );
+			$this->assertEquals( $this->user->getId(), $userData["userid"], "The user id did not match!" );			
 
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
@@ -220,7 +181,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "blogger.getUsersBlogs", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -247,7 +208,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getUsersBlogs", 
 			           "appkey", 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -276,7 +237,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -289,7 +250,7 @@
 			$res = $c->query( "blogger.editPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "updated text", 
 					   true );
@@ -318,7 +279,7 @@
 			$res = $c->query( "blogger.editPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   "topic\nupdated text", 
 					   true );
@@ -341,7 +302,7 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );	
 			
 			// delete the post
-			$articles->deleteArticle( $updatedArticle->getId(), $this->owner->getId(), $this->blog->getId());	
+			$articles->deleteArticle( $updatedArticle->getId(), $this->user->getId(), $this->blog->getId());	
 		}
 		
 		/**
@@ -354,7 +315,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -367,7 +328,7 @@
 			$res = $c->query( "blogger.deletePost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   true );
 					
@@ -399,18 +360,18 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
 				);
 			$articles = new Articles();
-			$this->assertTrue( $articles->addArticle( $article ), "Unable to add the first tet article" );
+			$this->assertTrue( $articles->addArticle( $article ), "Unable to add the first test article" );
 			$article2 = new Article(
 				"topic 2",
 				"text 2",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -422,7 +383,7 @@
 			$res = $c->query( "blogger.getRecentPosts", 
 			           "appkey", 
 					   $this->blog->getId(),	
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   10 );
 					
@@ -440,8 +401,8 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );
 			
 			// delete the articles
-			$articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true );
-			$articles->deleteArticle( $article2->getId(), $this->owner->getId(), $this->blog->getId(), true );			
+			$articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $article2->getId(), $this->user->getId(), $this->blog->getId(), true );			
 		}
 		
 		/**
@@ -454,7 +415,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -467,7 +428,7 @@
 			$res = $c->query( "blogger.getPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -478,11 +439,11 @@
 			$this->assertTrue( $response, "blogger.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic\ntext", $response["content"] );
 			$this->assertEquals( $article->getId(), $response["postid"] );
 
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -495,7 +456,7 @@
 				"topic",
 				"Intro text" . Article::POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -507,7 +468,7 @@
 			$res = $c->query( "blogger.getPost", 
 			           "appkey", 
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -519,11 +480,11 @@
 			$this->assertTrue( $response, "blogger.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic\nIntro text[@more@]Extended text", $response["content"] );
 			$this->assertEquals( $article->getId(), $response["postid"] );
 
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -544,7 +505,6 @@
 			$cat3 = TestTools::createArticleCategory( $this->blog->getId());			
 			
 			$c = new IXR_Client( $this->url );
-			$c->debug=true;
             $content  = array();
             $content["title"] = "topic";
             $content["description"] = "body text";
@@ -552,7 +512,7 @@
 
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -565,8 +525,10 @@
 			$articles = new Articles();
 			$article = $articles->getArticle( $artId );
 			$this->assertTrue( $article, "Could not load article with id = ".$artId );
-			if( !$article )
+			if( !$article ){
+                TestTools::deleteDaoTestData( Array( $cat1, $cat2, $cat3 ));
 				return;
+            }
 			// check that the post has the expected values
 			$this->assertEquals( "body text", $article->getText(false));
 			$this->assertEquals( "topic", $article->getTopic());
@@ -577,7 +539,7 @@
 			$this->assertEquals( count( $cats ), count( $postCats ), "The post did not have as many categories as expected!" );
 			
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -590,7 +552,7 @@
 			$content["categories"] = Array( $cat1->getName(), $cat2->getName(), $cat3->getName());
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -613,7 +575,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -626,7 +588,7 @@
             $content["mt_text_more"] = "Extended text";
 			$res = $c->query( "metaWeblog.newPost", 
 					   $this->blog->getId(), 
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   $content, 
 					   true );
@@ -639,8 +601,10 @@
 			$articles = new Articles();
 			$article = $articles->getArticle( $artId );
 			$this->assertTrue( $article, "Could not load article with id = ".$artId );
-			if( !$article )
+			if( !$article ){
+                TestTools::deleteDaoTestData( Array( $cat1, $cat2, $cat3 ));
 				return;
+            }
 			// check that the post has the expected values
 			$this->assertEquals( "topic", $article->getTopic());
 			$this->assertEquals( "Intro textExtended text", $article->getText());
@@ -649,7 +613,7 @@
 			$this->assertEquals( "Extended text", $article->getExtendedText());
 
 			// delete the article
-			$articles->deleteArticle( $artId, $this->owner->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $artId, $this->user->getId(), $this->blog->getId(), true );
 
 			// get the response and see that it has the right encoding			
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog), 
@@ -671,7 +635,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -683,7 +647,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -694,7 +658,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( $article->getId(), $response["postid"] );
@@ -702,7 +666,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -715,7 +679,7 @@
 				"topic",
 				"Intro text" . Article::POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -728,7 +692,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -739,7 +703,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "Intro text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( $article->getId(), $response["postid"] );
@@ -747,7 +711,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -762,7 +726,7 @@
 				"topic",
 				"Intro text" . Article::POST_EXTENDED_TEXT_MODIFIER . "Extended text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -782,7 +746,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getPost",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -793,7 +757,7 @@
 			$this->assertTrue( $response, "metaWeblog.getPost did not return a valid response" );
 			
 			// and now compare that the returned values match with what we expected
-			$this->assertEquals( $this->owner->getId(), $response["userid"], "The user id of the article does not match" );
+			$this->assertEquals( $this->user->getId(), $response["userid"], "The user id of the article does not match" );
 			$this->assertEquals( "topic", $response["title"], "The topic of the post does not match" );
 			$this->assertEquals( "Intro text", $response["description"], "The text of the article does not match" );
 			$this->assertEquals( "Extended text", $response["mt_text_more"], "The text of the extended text does not match" );
@@ -802,7 +766,7 @@
 			$this->assertEquals( $url->postLink( $article ), $response["link"], "The post permalink does not match" );
 			$this->assertEquals( $url->postPermalink( $article ), $response["permaLink"], "The post permalink does not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -827,7 +791,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getCategories",
 					   $this->blog->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -838,14 +802,16 @@
 			$this->assertTrue( $response, "metaWeblog.getCategories did not return a valid response" );
 						
 			// there should only be one category
-			$this->assertTrue(( count( $response ) == 1 ), "There should only be one category returned by metaWeblog.getCategories" );
+			$this->assertEquals(1, count($response), "There should only be one category returned by metaWeblog.getCategories" );
 			
 			// check that the category settings are correct
 			$this->assertEquals( $this->cat->getName(), key($response), "The category name did not match" );
-			$this->assertEquals( $this->cat->getDescription(), $response["General"]["description"], "The category description did not match" );
+			$this->assertEquals( $this->cat->getDescription(), $response["Default Category"]["description"], 
+                                 "The category description did not match" );
 			$url = $this->blog->getBlogRequestGenerator();
 			$url->setXHTML( false );
-			$this->assertEquals( $url->categoryLink( $this->cat ), $response["General"]["htmlUrl"], "The category link did not match" );
+			$this->assertEquals( $url->categoryLink( $this->cat ), $response["Default Category"]["htmlUrl"],
+                                 "The category link did not match" );
 			
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
@@ -858,7 +824,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.getCategoryList",
 					   $this->blog->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -869,7 +835,7 @@
 			$this->assertTrue( $response, "mt.getCategoryList did not return a valid response" );
 						
 			// there should only be one category
-			$this->assertTrue(( count( $response ) == 1 ), "There should only be one category returned by mt.getCategoryList" );
+			$this->assertEquals(1, count($response), "There should only be one category returned by mt.getCategoryList" );
 			
 			// check that the category settings are correct
 			$this->assertEquals( $this->cat->getName(), $response[0]["categoryName"], "The category name did not match" );
@@ -887,7 +853,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -898,7 +864,7 @@
 				"topic 2",
 				"text 2",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -909,7 +875,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "metaWeblog.getRecentPosts", 
 					   $this->blog->getId(),	
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password", 
 					   10 );
 					
@@ -927,8 +893,8 @@
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );
 			
 			// delete the articles
-			$articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true );
-			$articles->deleteArticle( $article2->getId(), $this->owner->getId(), $this->blog->getId(), true );			
+			$articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true );
+			$articles->deleteArticle( $article2->getId(), $this->user->getId(), $this->blog->getId(), true );			
 			
 		}
 		
@@ -956,7 +922,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -968,7 +934,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.getPostCategories",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password" );
 					
 			// see that the call was successful
@@ -986,7 +952,7 @@
 			$this->assertEquals( $this->cat->getName(), $response[0]["categoryName"], "The category name did not match" );
 			$this->assertEquals( $this->cat->getId(), $response[0]["categoryId"], "The category description did not match" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId(), true ),
+			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->user->getId(), $this->blog->getId(), true ),
 			                   "Error deleting article" );
 			
 			// get the response and see that it has the right encoding
@@ -1002,7 +968,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -1017,8 +983,8 @@
 										  true );			
 			$cats = new ArticleCategories();
 			if( !$cats->addArticleCategory( $cat2 )) {
-				throw(  new Exception( "Error adding test category!" ));
-				die();
+				print "Error adding test category!";
+                return;
 			}		  
 			
 			// Construct the Category Struct
@@ -1032,7 +998,7 @@
 			$c = new IXR_Client( $this->url );
 			$res = $c->query( "mt.setPostCategories",
 					   $article->getId(),
-					   $this->owner->getUsername(), 
+					   $this->user->getUsername(), 
 					   "password",
 					   $categories
 					   );
@@ -1047,9 +1013,11 @@
 			// check that the post was successfully updated
 			$updatedArticle = $articles->getArticle( $article->getId());
 			$this->assertEquals( $cat2->getId(), $updatedArticle->_categoryIds[0]);
-			
-			$cats->deleteCategory( $cat2->getId(), $this->blog->getId());
 
+
+			$this->assertTrue( $cats->deleteCategory( $cat2->getId(), $this->blog->getId()),
+                               "Couldn't erase/cleanup category");
+
 			// get the response and see that it has the right encoding
 			$this->assertTrue( $this->checkResponseEncoding( $c->message->rawmessage, $this->blog ), 
 			                   "The blog encoding and the response of the XMLRPC request did not match!" );			

Modified: plog/trunk/class/test/tests/summary/dao/summarystats_test.class.php
===================================================================
--- plog/trunk/class/test/tests/summary/dao/summarystats_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/summary/dao/summarystats_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -7,73 +7,21 @@
 	 */
 	class SummaryStats_Test extends LifeTypeTestCase
 	{
-		/**
-		 * dummy blog we'll be using during the tests
-		 */
 		var $blog;
-		
-		/**
-		 * dummy blog owner
-		 */
-		var $owner;
-		
-		/**
-		 * dummy category
-		 */
+		var $user;
 		var $cat;
 		
-		/**
-		 * URL pointing to this server's xmlrpc.php
-		 */
-		
 		function setUp()
 		{
-			// create the blog owner
-			$this->owner = new UserInfo( md5(time()),   // name
-			                             "password",   // password
-			                             "whatever at whatever.com",  // email address
-			             				 "",    // about
-			                             "" );
-			$users = new Users();
-			if( !$users->addUser( $this->owner )) {
-				throw( new Exception( "Error adding test user" ));
-				die();
-			}
-			
-			// create the test blog
-			$blogs = new Blogs();
-			$this->blog = null;
-			$this->blog = new BlogInfo( "test blog",
-			                            $this->owner->getId(),
-			                            "",
-			                            new BlogSettings());
-			if( !$blogs->addBlog( $this->blog )) {
-				throw( new Exception( "Error adding test blog!" ));
-				die();
-			}
-			
-			// add a default category
-			$this->cat = new ArticleCategory( "General", 
-			                            "",
-										$this->blog->getId(),
-										true );
-			$cats = new ArticleCategories();
-			if( !$cats->addArticleCategory( $this->cat )) {
-				throw(  new Exception( "Error adding test category!" ));
-				die();
-			}
+			$this->user = TestTools::createUser();
+			$this->blog = TestTools::createBlog( $this->user->getId());
+			$this->cat  = TestTools::createArticleCategory( $this->blog->getId());
 		}
 		
 		function tearDown()
 		{
-			$cats = new ArticleCategories();
-			$cats->deleteCategory( $this->cat->getId(), $this->blog->getId());
-
-			$blogs = new Blogs();
-			$blogs->deleteBlog( $this->blog->getId());
-			
-			$users = new Users();
-			$users->deleteUser( $this->owner->getId());
+			TestTools::deleteDaoTestData(Array($this->cat, $this->user));
+			TestTools::deleteBlog( $this->blog );
         }
 		
 		/**
@@ -87,7 +35,7 @@
 				"topic",
 				"text",
 				Array( $this->cat->getId()),
-				$this->owner->getId(),
+				$this->user->getId(),
 				$this->blog->getId(),
 				POST_STATUS_PUBLISHED,
 				0
@@ -115,7 +63,12 @@
 			
 			$this->assertFalse( $found, "A post with date in the future was returned by getRecentPosts" );
 			
-			$this->assertTrue( $articles->deleteArticle( $article->getId(), $this->owner->getId(), $this->blog->getId()));
+			$this->assertTrue(
+                $articles->deleteArticle( $article->getId(),
+                                          $this->user->getId(),
+                                          $this->blog->getId(),
+                                          true),
+                              "Could not delete article!");
 		}
 	}
 ?>
\ No newline at end of file

Modified: plog/trunk/class/test/tests/ui/articlecategoriesui_test.class.php
===================================================================
--- plog/trunk/class/test/tests/ui/articlecategoriesui_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/ui/articlecategoriesui_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -19,7 +19,8 @@
 		
 		function tearDown()
 		{
-			TestTools::deleteDaoTestData( Array( $this->user, $this->blog ));
+			TestTools::deleteDaoTestData( Array( $this->user ));
+			TestTools::deleteBlog( $this->blog );
 		}
 		
 		/**
@@ -49,7 +50,7 @@
 							"op" => "blogSelect",
 							"blogId" => $this->blog->getId()
 						),
-						"expected" => "New Post",
+						"expected" => "<b><a href=\"?op=newPost\">New Post",
 						"message" => "The blog could not be selected after the dashboard"
 					),
 					"new_category" => Array(
@@ -57,7 +58,7 @@
 						"type" => "get",
 						"params" => Array( "op" => "newArticleCategory" ),
 						"expected" => "Name that will be used to display the category",
-						"message" => "The form to input a new category was not successfully displayed"						
+						"message" => "The form to input a new category was not successfully displayed"
 					),
 					"create_category" => Array(
 						"url" => $this->getAdminUrl(),

Modified: plog/trunk/class/test/tests/ui/login_test.class.php
===================================================================
--- plog/trunk/class/test/tests/ui/login_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/ui/login_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,5 +1,7 @@
 <?php
 
+    lt_include( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
+    lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
 	
 		
 	
@@ -12,12 +14,29 @@
 		{
 			$this->user = TestTools::createUser();
 			$this->user2 = TestTools::createUser();
-			$this->blog = TestTools::createBlog( $this->user2->getId());
+			$this->user3 = TestTools::createUser();
+
+			$userPerms = new UserPermissions();
+
+            $perms = new Permissions();
+            $loginAccess = $perms->getPermissionByName( "login_perm" );
+            if($loginAccess === false){
+				print "Error getting login permission id";
+                return;
+            }
+
+                // Revoke user login privileges
+            if(!$userPerms->revokePermission( $this->user->getId(), 0, $loginAccess->getId())){
+				print "Error revoking login permissions from user";
+            }
+
+            $this->blog = TestTools::createBlog( $this->user2->getId());
 		}
 		
 		function tearDown()
 		{
-			TestTools::deleteDaoTestData( Array( $this->user, $this->user2, $this->blog ));
+			TestTools::deleteDaoTestData( Array( $this->user, $this->user2, $this->user3 ));
+			TestTools::deleteBlog( $this->blog );
 		}
 		
 		/**
@@ -38,6 +57,28 @@
 		}
 		
 		/**
+		 * Test that a user without login privileges cannot login
+		 */
+		function testUserDoesntHaveLoginPrivileges()
+		{
+			$this->assertUIScript(
+				Array(
+					"login_page" => Array(
+						"url" => $this->getAdminUrl(),
+						"type" => "post",
+						"params" => Array(
+							"userName" => $this->user->getUserName(),
+							"userPassword" => "password",
+							"op" => "Login"
+						),
+						"expected" => "you are not allowed to log in",
+						"message" => "User was able to login without login privileges!!"
+					)
+				)
+			);			
+		}
+
+        		/**
 		 * Test that a user without a blog cannot login
 		 */
 		function testUserHasNoBlog()
@@ -48,7 +89,7 @@
 						"url" => $this->getAdminUrl(),
 						"type" => "post",
 						"params" => Array(
-							"userName" => $this->user->getUserName(),
+							"userName" => $this->user3->getUserName(),
 							"userPassword" => "password",
 							"op" => "Login"
 						),
@@ -58,7 +99,7 @@
 				)
 			);			
 		}
-		
+
 		/**
 		 * Test the whoe login and logout process
 		 */
@@ -84,7 +125,7 @@
 							"op" => "blogSelect",
 							"blogId" => $this->blog->getId()
 						),
-						"expected" => "New Post",
+                        "expected" => "<b><a href=\"?op=newPost\">New Post",
 						"message" => "The blog could not be selected after the dashboard"
 					),
 					"logout" => Array(

Modified: plog/trunk/class/test/tests/ui/permissionsui_test.class.php
===================================================================
--- plog/trunk/class/test/tests/ui/permissionsui_test.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/test/tests/ui/permissionsui_test.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -15,12 +15,14 @@
 		function setUp()
 		{
 			$this->user = TestTools::createAdminUser();
+
 			$this->blog = TestTools::createBlog( $this->user->getId());
 		}
 		
 		function tearDown()
 		{
-			TestTools::deleteDaoTestData( Array( $this->user, $this->blog ));
+			TestTools::deleteDaoTestData( Array( $this->user ));
+			TestTools::deleteBlog( $this->blog );
 		}
 		
 		/**
@@ -51,7 +53,7 @@
 							"op" => "blogSelect",
 							"blogId" => $this->blog->getId()
 						),
-						"expected" => "New Post",
+                        "expected" => "<b><a href=\"?op=newPost\">New Post",
 						"message" => "The blog could not be selected after the dashboard"
 					)
 				)
@@ -64,8 +66,8 @@
 						"url" => $this->getAdminUrl(),
 						"type" => "get",
 						"params" => Array( "op" => "newPermission" ),
-						"expected" => "Unique name for the new permission",
-						"message" => "The form to input a new permission was not successfully displayed"						
+						"expected" => "Unique name for the permission",
+						"message" => "The form to input a new permission was not successfully displayed"
 					),
 					"create_permission" => Array(
 						"url" => $this->getAdminUrl(),
@@ -77,12 +79,13 @@
 				)
 			);
 			
-			// find the category in the db...
+			// find the permission in the db...
 			$perms = new Permissions();
 			$perm = $perms->getPermissionByName( $permName );
 			
 			if( !$perm ) {
-				die("FATAL: The permission was not successfully added and the test cannot continue" );
+                print "FATAL: The permission was not successfully added and the test cannot continue";
+                return;
 			}
 			
 			// ...and delete it via the UI
@@ -99,7 +102,8 @@
 			);
 			
 			// delete the permission via the API
-			$perms->deletePermission( $perm->getId());
+			$res = $perms->deletePermission( $perm->getId() );
+            $this->assertTrue($res, "Couldn't delete core permission via API");
 		}
 		
 		/**
@@ -130,7 +134,7 @@
 							"op" => "blogSelect",
 							"blogId" => $this->blog->getId()
 						),
-						"expected" => "New Post",
+                        "expected" => "<b><a href=\"?op=newPost\">New Post",
 						"message" => "The blog could not be selected after the dashboard"
 					)
 				)
@@ -143,7 +147,7 @@
 						"url" => $this->getAdminUrl(),
 						"type" => "get",
 						"params" => Array( "op" => "newPermission" ),
-						"expected" => "Unique name for the new permission",
+						"expected" => "Unique name for the permission",
 						"message" => "The form to input a new permission was not successfully displayed"						
 					),
 					"create_permission" => Array(
@@ -156,12 +160,13 @@
 				)
 			);
 			
-			// find the category in the db...
+			// find the permission in the db...
 			$perms = new Permissions();
 			$perm = $perms->getPermissionByName( $permName );
 			
 			if( !$perm ) {
-				die("FATAL: The permission was not successfully added and the test cannot continue" );
+				print "FATAL: The permission was not successfully added and the test cannot continue";
+                return;
 			}
 			
 			// ...and delete it via the UI

Modified: plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/view/admin/adminarticlecategorieslistview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,9 +1,5 @@
 <?php
 
-	
-    
-	
-	
     /**
      * \ingroup View
      * @private
@@ -19,7 +15,7 @@
          * Constructor. If nothing else, it also has to call the constructor of the parent
          * class, BlogAction with the same parameters
          */
-        function AdminArticleCategoriesListView( $blogInfo, $page = 1 )
+        function AdminArticleCategoriesListView( $blogInfo, $params = Array() )
         {
 			if( Request::isXHR())
 				$template = "editarticlecategories_table";
@@ -56,9 +52,8 @@
 															  $this->_searchTerms,
 															  $pager->getCurrentPage(),
 															  DEFAULT_ITEMS_PER_PAGE );
-			if( !$blogCategories ) {
+			if( !$blogCategories )
 				$blogCategories = Array();
-			}
 			
 			// throw the even in case somebody's waiting for it!
 			$this->notifyEvent( EVENT_CATEGORIES_LOADED, Array( "categories" => &$blogCategories ));

Modified: plog/trunk/class/view/admin/adminsiteblogslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminsiteblogslistview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/view/admin/adminsiteblogslistview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -39,7 +39,7 @@
 		 */
 		function getStatusFromRequest()
 		{
-			$status = HttpVars::getRequestValue( "status" );
+			$status = $this->_request->getFilteredValue( "status", new HtmlFilter());
 			
 			// validate the value 
 			$val = new IntegerValidator();

Modified: plog/trunk/class/view/admin/adminsiteuserslistview.class.php
===================================================================
--- plog/trunk/class/view/admin/adminsiteuserslistview.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/view/admin/adminsiteuserslistview.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -44,7 +44,7 @@
 		 */
 		function getStatusFromRequest()
 		{
-			$status = HttpVars::getRequestValue( "status" );
+			$status = $this->_request->getFilteredValue( "status", new HtmlFilter() );
 			
 			// validate the value 
 			$val = new IntegerValidator();

Modified: plog/trunk/class/view/view.class.php
===================================================================
--- plog/trunk/class/view/view.class.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/class/view/view.class.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -297,16 +297,16 @@
 		 */
 		function getCurrentPageFromRequest()
 		{
-                	
 			// get the value from the request
 			$page = HttpVars::getRequestValue( VIEW_DEFAULT_PAGE_PARAMETER );
-			// but first of all, validate it
+
+                // but first of all, validate it
 			$val = new IntegerValidator();
 			if( !$val->validate( $page ))
-				$page = VIEW_DEFAULT_START_PAGE;			
+				$page = VIEW_DEFAULT_START_PAGE;
 							
 			return $page;
-		}		
+		}
 		
         /**
          * Renders the view. Here we would ideally call a template engine, using the


Property changes on: plog/trunk/gallery
___________________________________________________________________
Added: svn:ignore
   + *



Modified: plog/trunk/js/tinymce/plugins/insertaudio/audioinput.html
===================================================================
--- plog/trunk/js/tinymce/plugins/insertaudio/audioinput.html	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertaudio/audioinput.html	2009-12-24 17:43:57 UTC (rev 6934)
@@ -2,7 +2,7 @@
 <head>
 	<title>{$lang_insertaudio_desc}</title>
 	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="functions.js"></script>	
+	<script language="javascript" type="text/javascript" src="../../tiny_mce-plog-resourcelist.js"></script>	
 	<base target="_self" />
 </head>
 <body style="display: none">
@@ -25,7 +25,9 @@
 		</div>
 		<div class="mceActionPanel">
 		  <div style="float:left">		
-			<input type="button" name="insert" value="{$lang_insert}" onClick="insertAudioCode()" id="insert" />
+			<input type="button" name="insert" value="{$lang_insert}" 
+                   onClick="insertMediaPlayer(document.audio.url.value,
+                            true,'20','300')" id="insert" />
 		  </div>
 		  <div style="float:right">
 		    <input type="button" name="cancel" value="{$lang_close}" onclick="tinyMCEPopup.close();" id="cancel" />

Modified: plog/trunk/js/tinymce/plugins/insertaudio/editor_plugin.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertaudio/editor_plugin.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertaudio/editor_plugin.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -9,14 +9,10 @@
 			author : 'Gabriel ROUSSEAU',
 			authorurl : 'http://grvg.free.fr',
 			infourl : 'http://grvg.free.fr',
-			version : "0.3"
+			version : "0.4"
 		};
 	},
 
-	initInstance : function(inst) {
-		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/insertaudio/css/content.css");	
-	},
-
 	getControlHTML : function(cn) {
 		switch (cn) {
 			case "insertaudio":
@@ -51,202 +47,14 @@
 					insertaudio['width'] = 500;
 					insertaudio['height'] = 120;
 
-					tinyMCE.openWindow(insertaudio, {editor_id : editor_id, resizable : "no", scrollbars : "no", inline : "yes"});
-				}
+					tinyMCE.openWindow(insertaudio, {editor_id : editor_id, resizable : "no", scrollbars : "no", inline : "yes"});	
+			}
 				return true;
 		}
 
 	   // Pass to next handler in chain
 	   return false;
-	},
-
-	cleanup : function(type, content) {
-		switch (type) {
-			case "insert_to_editor_dom":
-				// Force relative/absolute
-				if (tinyMCE.getParam('convert_urls')) {
-					var imgs = content.getElementsByTagName("img");
-					for (var i=0; i<imgs.length; i++) {
-						//if (tinyMCE.getAttrib(imgs[i], "class")== "ltVideoYouTube") {
-						if (tinyMCE.getAttrib(imgs[i], "class").substr(0,6) == "ltFlashPlayer") {							
-							var src = tinyMCE.getAttrib(imgs[i], "alt");
-
-							if (tinyMCE.getParam('convert_urls'))
-								src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
-
-							imgs[i].setAttribute('alt', src);
-							imgs[i].setAttribute('title', src);
-						}
-					}
-				}
-				break;
-
-			case "get_from_editor_dom":
-				var imgs = content.getElementsByTagName("img");
-				for (var i=0; i<imgs.length; i++) {
-					if (tinyMCE.getAttrib(imgs[i], "class").substr(0,6) == "ltAudio") {
-						var src = tinyMCE.getAttrib(imgs[i], "alt");
-
-						if (tinyMCE.getParam('convert_urls'))
-							src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, null, true);");
-
-						imgs[i].setAttribute('alt', src);
-						imgs[i].setAttribute('title', src);
-					}
-				}
-				break;
-
-			case "insert_to_editor":
-				var startPos = 0;
-				var embedList = new Array();			
-
-				// Fix the embed and object elements
-				content = content.replace(new RegExp('<[ ]*object','gi'),'<object');
-				content = content.replace(new RegExp('<[ ]*/object[ ]*>','gi'),'</object>');			
-				
-				// Parse all object tags and replace them with images from the embed data
-				var index = 0;
-				while ((startPos = content.indexOf('<object', startPos)) != -1) {
-
-					// Find end of object
-					endPos = content.indexOf('</object>', startPos);
-					endPos += 9;
-					
-					objectTag = content.substring(startPos,endPos);
-					attribs = TinyMCE_insertaudioPlugin._parseAttributes( objectTag );
-					
-					var cssClass = "";					
-					if( attribs["data"] == undefined )
-					{
-						startPos++;
-						continue;
-					} else {
-						cssClass = "ltPlayer";
-					}
-					
-					// Insert image
-					var contentAfter = content.substring(endPos);
-					content = content.substring(0, startPos);
-					content += '<img width="' + attribs["width"] + '" height="' + attribs["height"] + '"';
-					content += ' src="' + (tinyMCE.getParam("theme_href") + '/images/spacer.gif') + '" title="' + attribs["data"] + '"';
-					content += ' alt="' + attribs["data"] + '" class="'+cssClass+'" />' + content.substring(endPos);
-					content += contentAfter;
-					index++;
-
-					startPos++;
-				}
-				
-				break;
-
-			case "get_from_editor":
-				// Parse all img tags and replace them with object+embed
-				var startPos = -1;
-
-				while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
-					var endPos = content.indexOf('/>', startPos);
-					var attribs = TinyMCE_insertaudioPlugin._parseAttributes(content.substring(startPos + 4, endPos));
-
-					// Is not flash, skip it
-					if (attribs['class'] != "ltFlashPlayer")
-						continue;
-
-					type = attribs['class'];
-
-					endPos += 2;
-
-					var embedHTML = '';
-					
-					embedHTML = getAudioFlashHTML( attribs["title"] );
-
-					// Insert embed/object chunk
-					chunkBefore = content.substring(0, startPos);
-					chunkAfter = content.substring(endPos);
-					content = chunkBefore + embedHTML + chunkAfter;
-				}
-				break;
-		}
-
-		// Pass through to next handler in chain
-		return content;
-	},
-
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
-		if (node == null)
-			return;
-
-		do {
-			if (node.nodeName == "IMG" && tinyMCE.getAttrib(node, 'class').indexOf('ltFlashPlayer') == 0) {
-				tinyMCE.switchClass(editor_id + '_flash', 'mceButtonSelected');
-				return true;
-			}
-		} while ((node = node.parentNode));
-
-		tinyMCE.switchClass(editor_id + '_flash', 'mceButtonNormal');
-
-		return true;
-	},
-
-	// Private plugin internal functions
-
-	_parseAttributes : function(attribute_string) {
-		var attributeName = "";
-		var attributeValue = "";
-		var withInName;
-		var withInValue;
-		var attributes = new Array();
-		var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
-
-		if (attribute_string == null || attribute_string.length < 2)
-			return null;
-
-		withInName = withInValue = false;
-
-		for (var i=0; i<attribute_string.length; i++) {
-			var chr = attribute_string.charAt(i);
-
-			if ((chr == '"' || chr == "'") && !withInValue)
-				withInValue = true;
-			else if ((chr == '"' || chr == "'") && withInValue) {
-				withInValue = false;
-
-				var pos = attributeName.lastIndexOf(' ');
-				if (pos != -1)
-					attributeName = attributeName.substring(pos+1);
-
-				attributes[attributeName.toLowerCase()] = attributeValue.substring(1);
-
-				attributeName = "";
-				attributeValue = "";
-			} else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
-				withInName = true;
-
-			if (chr == '=' && withInName)
-				withInName = false;
-
-			if (withInName)
-				attributeName += chr;
-
-			if (withInValue)
-				attributeValue += chr;
-		}
-
-		return attributes;
 	}
 };
 
-function getAudioFlashHTML( url )
-{		
-	var baseUrl = TinyMCE.baseURL.substring(0, TinyMCE.baseURL.indexOf("/js/tinymce",0));
-	var playerUrl = baseUrl + "/flash/mp3player/mp3player.swf";
-		
-	var html =	'<object data="'+playerUrl+'" type="application/x-shockwave-flash" width="320" height="20" class="ltPlayer">'+
-			'<param name="quality" value="best" />'+
-			'<param name="bgcolor" value="#FFFFFF" />'+
-            '<param name="movie" value="' + playerUrl + '" />' +
-			'<param name="FlashVars" value="&amp;file='+url+'&amp;height=20&amp;width=320" />'+
-			'</object>';
-	
-	return( html );
-}
-
-tinyMCE.addPlugin("insertaudio", TinyMCE_insertaudioPlugin );
\ No newline at end of file
+tinyMCE.addPlugin("insertaudio", TinyMCE_insertaudioPlugin );

Deleted: plog/trunk/js/tinymce/plugins/insertaudio/functions.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertaudio/functions.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertaudio/functions.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,41 +0,0 @@
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
-}
-
-function isValidUrl( url )
-{
-	var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-	return regexp.test(url);
-}
-
-function insertAudioCode()
-{
-	// get and check the URL
-	urlField = document.forms[0].url;
-	url = urlField.value;
-	if( url == "" || !isValidUrl( url )) {
-		window.alert( tinyMCE.getLang('lang_insertvideo_badurl', 0) );
-		return( false );
-	}
-
-	css="ltFlashPlayer";
-	width=320;
-	height=20;
-	
-	insertFlash( url, css, width, height );
-}
-
-function insertFlash( file, css, width, height ) {
-
-	var html      = '';
-
-	html += ''
-		+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
-		+ 'width="' + width + '" height="' + height + '" '
-		+ 'border="0" alt="' + file + '" title="' + file + '" class="'+css+'" />';
-
-	tinyMCEPopup.execCommand("mceInsertContent", true, html);
-	tinyMCE.selectedInstance.repaint();
-
-	tinyMCEPopup.close();
-}
\ No newline at end of file

Deleted: plog/trunk/js/tinymce/plugins/insertaudio/images/player.png
===================================================================
(Binary files differ)

Modified: plog/trunk/js/tinymce/plugins/insertaudio/langs/en.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertaudio/langs/en.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertaudio/langs/en.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -3,6 +3,5 @@
 lang_insertaudio_desc : 'Insert Audio',
 lang_insertaudio_panellegend : 'Please provide a link to an mp3 audio file.',
 lang_insertaudio_url : 'Audio URL:',
-lang_insertaudio_badurl : 'Invalid URL',
 lang_insertaudio_inputurlstyle : 'style="width:350px"'
-});
\ No newline at end of file
+});

Modified: plog/trunk/js/tinymce/plugins/insertaudio/langs/fr.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertaudio/langs/fr.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertaudio/langs/fr.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -3,6 +3,5 @@
 lang_insertaudio_desc : 'Ins&eacute;rer audio',
 lang_insertaudio_panellegend : 'Veuillez indiquer un lien vers un fichier audio mp3.',
 lang_insertaudio_url : 'URL du fichier audio :',
-lang_insertaudio_badurl : 'L\'URL indique n\'est pas valide',
 lang_insertaudio_inputurlstyle : 'style="width:300px"'
-});
\ No newline at end of file
+});

Modified: plog/trunk/js/tinymce/plugins/insertresource/editor_plugin.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertresource/editor_plugin.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertresource/editor_plugin.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -146,7 +146,7 @@
 					}
 					
 					// find the value in "file=XXX"
-					var regexp = /.*file=([a-zA-Z0-9\-\/:._]*)/i;
+					var regexp = /.*file=([a-zA-Z0-9\-\/:._%]*)/i;
 					result = regexp.exec( attribs["value"] );
 					var fileUrl = "";
 					if( result ) {
@@ -259,4 +259,4 @@
 	}
 };
 
-tinyMCE.addPlugin("insertresource", TinyMCE_insertresourcePlugin);
\ No newline at end of file
+tinyMCE.addPlugin("insertresource", TinyMCE_insertresourcePlugin);

Deleted: plog/trunk/js/tinymce/plugins/insertresource/popup.htm
===================================================================
--- plog/trunk/js/tinymce/plugins/insertresource/popup.htm	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertresource/popup.htm	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,31 +0,0 @@
-<html>
-<head>
-<title>{$lang_template_title}</title>
-<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-<script language="javascript" type="text/javascript">
-<!--
-	function init() {
-		alert("Got a window argument from plugin: " + tinyMCE.getWindowArg('some_custom_arg'));
-	}
-
-	function insertSomething() {
-		// Execute the mceTemplate command without UI this time
-		tinyMCE.execInstanceCommand(tinyMCE.getWindowArg('editor_id'), 'mceTemplate');
-
-		// Close the dialog
-		tinyMCE.closeDialog();
-	}
-//-->
-</script>
-</head>
-<body onload="init();"> 
-	<h3>{$lang_template_title}</h3>
-
-	<form onsubmit="insert();return false;">
-		<!-- Just a simple insert button -->
-		<input type="button" name="insert" value="{$lang_insert}" onclick="insertSomething();" id="insert" />
-	</form>
-
-	<br />
-</body> 
-</html> 

Deleted: plog/trunk/js/tinymce/plugins/insertresource/readme.txt
===================================================================
--- plog/trunk/js/tinymce/plugins/insertresource/readme.txt	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertresource/readme.txt	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1 +0,0 @@
-This is a template/tutorial plugin that where created to help you in the development of own plugins for TinyMCE.
\ No newline at end of file

Modified: plog/trunk/js/tinymce/plugins/insertvideo/editor_plugin.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertvideo/editor_plugin.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertvideo/editor_plugin.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -269,9 +269,9 @@
 	html = "<object type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\" data=\""+url+"\" id=\""+type+"\">"+
 		"<param name=\"movie\" value=\""+url+"\" />"+
 		"<param name=\"wmode\" value=\"transparent\" />"+
-		"<param name=\"allowScriptAcess\" value=\"sameDomain\" />"+
+		"<param name=\"allowScriptAccess\" value=\"sameDomain\" />"+
 		"<param name=\"quality\" value=\"best\" />"+
-		"<param name=\"bgcolor\" value=\"#FFFFFF\" />";
+		"<param name=\"bgcolor\" value=\"#ffffff\" />";
 //		"<param name=\"scale\" value=\"noScale\" />";
   if (type=='ltVideoGoear') {
 		html= html + "<param name=\"FlashVars\" value=\""+url.substring( 43, url.length ) + "\" />";

Modified: plog/trunk/js/tinymce/plugins/insertvideo/functions.js
===================================================================
--- plog/trunk/js/tinymce/plugins/insertvideo/functions.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/plugins/insertvideo/functions.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1,248 +1,248 @@
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
-}
-
-function isValidUrl( url )
-{
-	var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
-	return regexp.test(url);
-}
-
-function getYouTubeLink( url )
-{
-	// check if this is a URL pointing to a youtube link or to a youtube video
-	//if( url.substring( 0, 31 ) == "http://www.youtube.com/watch?v=" ) {
-	if( url.match( /http:\/\/.{2,3}\.youtube.com\//i )) {
-		// and if it's a link to a normal youtube page, build the right link to the video player
-		var regexp = /http:\/\/.{2,3}\.youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {			
-			videoId = result[1];
-		}
-		else {
-			// let's try to make a best guess...
-			videoId = url.substring( 31, url.length );
-		}
-
-		url = "http://www.youtube.com/v/" + videoId;
-	}
-	else if ( url.substring( 0, 27 ) == "http://youtube.com/watch?v=" ) {
-		// Checks if the URL is missing WWW.		
-		// and if it's a link to a normal youtube page, build the right link to the video player
-		var regexp = /http:\/\/youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {
-			// let's try to make a best guess...
-			videoId = url.substring( 27, url.length );
-		}
-
-		url = "http://www.youtube.com/v/" + videoId;
-	}
-	else {
-		var regexp = /.*?v=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-			url = "http://www.youtube.com/v/" + videoId;
-		}
-	}
-
-	return( url );
-}
-
-function getGoogleVideoLink( url )
-{
-	// check if it's a link to a video page or a link to the video player
-	if( url.substring( 0, 40 ) == "http://video.google.com/videoplay?docid=" ) {
-		// if it's a link to a video page, generate the right one
-		var regexp = /http:\/\/video.google.com\/.*?docid=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {		
-			videoId = url.substring( 40, url.length );
-		}				
-		
-		url = "http://video.google.com/googleplayer.swf?docId=" + videoId;
-	}
-	
-	return( url );
-}
-
-function getMetacafeVideoLink( url )
-{
-	// check if it's a link to a video page or a link to the video player
-	if( url.substring( 0, 30 ) == "http://www.metacafe.com/watch/" ) {
-		// if it's a link to a video page, generate the right one
-		var regexp = /http:\/\/www.metacafe.com\/watch\/.*?docid=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {		
-			videoId = url.substring( 30, url.length - 1 );
-		}				
-		
-		url = "http://www.metacafe.com/fplayer/" + videoId + ".swf";
-	}
-	
-	return( url );
-}
-
-function getiFilmVideoLink( url )
-{
-	// check if it's a link to a video page or a link to the video player
-	if( url.substring( 0, 27 ) == "http://www.ifilm.com/video/" ) {
-		// if it's a link to a video page, generate the right one
-		var regexp = /http:\/\/www.ifilm.com\/video\/.*?docid=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {		
-			videoId = url.substring( 27, url.length );
-		}				
-		
-		url = "http://www.ifilm.com/efp?flvbaseclip=" + videoId ;
-	}
-
-	return( url );
-}
-
-function getGoearVideoLink( url )
-{
-	// check if it's a link to a video page or a link to the video player
-	if( url.substring( 0, 34 ) == "http://www.goear.com/listen.php?v=" ) {
-		// if it's a link to a video page, generate the right one
-		var regexp = /http:\/\/www.goear.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {		
-			videoId = url.substring( 34, url.length );
-		}				
-		url = "http://www.goear.com/files/localplayer.swf?file=" + videoId ;
-	}
-
-	return( url );
-}
-
-function getGrouperVideoLink( url )
-{
-	// check if it's a link to a video page or a link to the video player
-	if( url.substring( 0, 46 ) == "http://grouper.com/video/MediaDetails.aspx?id=" ) {
-		// if it's a link to a video page, generate the right one
-		var regexp = /http:\/\/www.grouper.com\/video\/MediaDetails.aspx.*?id=([\-0-9a-zA-z_]*).*/i;
-		result = regexp.exec( url );
-		if( result ) {
-			videoId = result[1];
-		}
-		else {		
-			videoId = url.substring( 46, url.length );
-		}		
-		
-		url = "http://grouper.com/mtg/mtgPlayer.swf?gvars=vurl~http%3a%2f%2fgrouper.com%2frss%2fflv.ashx%3fid%3d" + videoId + "_rf%7e-9_vfver~8_ap~1_extid~-1";
-	}
-
-	return( url );
-}
-
-function getDailymotionLink( url ) 
-{	
-	// check if this is a URL pointing to a dailymotion embedded video link
-	var regexp = /object\swidth="([0-9]+)"\sheight="([0-9]+)".+value="(http:\/\/www\.dailymotion\.com\/swf\/\w*)"/;
-	result = regexp.exec( url );
-	return( result );
-}
-
-function insertVideoCode()
-{
-	// get and check the URL
-	urlField = document.forms[0].url;
-	url = urlField.value;
-	if( url == "" || !isValidUrl( url )) {
-		window.alert( tinyMCE.getLang('lang_insertvideo_badurl', 0) );
-		return( false );
-	}
-	
-	// check if a destination system was selected
-	youtube = document.getElementById("youtube");
-	gvideo = document.getElementById("gvideo");
-//	dalealplay = document.getElementById("dalealplay");
-	metacafe = document.getElementById("metacafe");
-	ifilm = document.getElementById("ifilm");
-	goear = document.getElementById("goear");
-	grouper = document.getElementById("grouper");
-	dailymot = document.getElementById("dailymot");
-//	bolt = document.getElementById("bolt");
-
-	if( youtube.checked==false && gvideo.checked==false && metacafe.checked==false && ifilm.checked==false && goear.checked==false && grouper.checked==false && dailymot.checked==false ) {
-		window.alert( tinyMCE.getLang('lang_insertvideo_selectiontype', 0) );
-		return( false );	
-	}
-	
-	if( youtube.checked == true ) {
-		link = getYouTubeLink( url );
-		css="ltVideoYouTube";
-		width=450;
-		height=350;
-	}
-	if( gvideo.checked == true ) {
-		link = getGoogleVideoLink( url );	
-		css="ltVideoGoogleVideo";
-		width=400;
-		height=326;		
-	}
-	if( metacafe.checked == true ) {
-		link = getMetacafeVideoLink( url );	
-		css="ltVideoMetacafe";
-		width=400;
-		height=345;		
-	}
-	if( ifilm.checked == true ) {
-		link = getiFilmVideoLink( url );
-		css="ltVideoIfilm";
-		width=448;
-		height=365;
-	}
-	if( goear.checked == true ) {
-		link = getGoearVideoLink( url );	
-		css="ltVideoGoear";
-		width=366;
-		height=75;		
-	}	
-	if( grouper.checked == true ) {
-		link = getGrouperVideoLink( url );	
-		css="ltVideoGrouper";
-		width=496;
-		height=398;		
-	}
-	if( dailymot.checked == true ) {
-		result = getDailymotionLink( url );
-		width = result[1];
-		height = result[2];
-		link = result[3];
-		css="ltVideoDailymot";		
-	}
-	insertFlash( link, css, width, height );
-}
-
-function insertFlash( file, css, width, height ) {
-
-	var html      = '';
-
-	html += ''
-		+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
-		+ 'width="' + width + '" height="' + height + '" '
-		+ 'border="0" alt="' + file + '" title="' + file + '" class="'+css+'" />';
-
-	tinyMCEPopup.execCommand("mceInsertContent", true, html);
-	tinyMCE.selectedInstance.repaint();
-
-	tinyMCEPopup.close();
-}
\ No newline at end of file
+function init() {
+	tinyMCEPopup.resizeToInnerSize();
+}
+
+function isValidUrl( url )
+{
+	var regexp = /(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
+	return regexp.test(url);
+}
+
+function getYouTubeLink( url )
+{
+	// check if this is a URL pointing to a youtube link or to a youtube video
+	//if( url.substring( 0, 31 ) == "http://www.youtube.com/watch?v=" ) {
+	if( url.match( /http:\/\/.{2,3}\.youtube.com\/.*?v=/i )) {
+		// and if it's a link to a normal youtube page, build the right link to the video player
+		var regexp = /http:\/\/.{2,3}\.youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {			
+			videoId = result[1];
+		}
+		else {
+			// let's try to make a best guess...
+			videoId = url.substring( 31, url.length );
+		}
+
+		url = "http://www.youtube.com/v/" + videoId;
+	}
+	else if ( url.substring( 0, 27 ) == "http://youtube.com/watch?v=" ) {
+		// Checks if the URL is missing WWW.		
+		// and if it's a link to a normal youtube page, build the right link to the video player
+		var regexp = /http:\/\/youtube.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {
+			// let's try to make a best guess...
+			videoId = url.substring( 27, url.length );
+		}
+
+		url = "http://www.youtube.com/v/" + videoId;
+	}
+	else {
+		var regexp = /.*?v=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+			url = "http://www.youtube.com/v/" + videoId;
+		}
+	}
+
+	return( url );
+}
+
+function getGoogleVideoLink( url )
+{
+	// check if it's a link to a video page or a link to the video player
+	if( url.substring( 0, 40 ) == "http://video.google.com/videoplay?docid=" ) {
+		// if it's a link to a video page, generate the right one
+		var regexp = /http:\/\/video.google.com\/.*?docid=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {		
+			videoId = url.substring( 40, url.length );
+		}				
+		
+		url = "http://video.google.com/googleplayer.swf?docId=" + videoId;
+	}
+	
+	return( url );
+}
+
+function getMetacafeVideoLink( url )
+{
+	// check if it's a link to a video page or a link to the video player
+	if( url.substring( 0, 30 ) == "http://www.metacafe.com/watch/" ) {
+		// if it's a link to a video page, generate the right one
+		var regexp = /http:\/\/www.metacafe.com\/watch\/.*?docid=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {		
+			videoId = url.substring( 30, url.length - 1 );
+		}				
+		
+		url = "http://www.metacafe.com/fplayer/" + videoId + ".swf";
+	}
+	
+	return( url );
+}
+
+function getiFilmVideoLink( url )
+{
+	// check if it's a link to a video page or a link to the video player
+	if( url.substring( 0, 27 ) == "http://www.ifilm.com/video/" ) {
+		// if it's a link to a video page, generate the right one
+		var regexp = /http:\/\/www.ifilm.com\/video\/.*?docid=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {		
+			videoId = url.substring( 27, url.length );
+		}				
+		
+		url = "http://www.ifilm.com/efp?flvbaseclip=" + videoId ;
+	}
+
+	return( url );
+}
+
+function getGoearVideoLink( url )
+{
+	// check if it's a link to a video page or a link to the video player
+	if( url.substring( 0, 34 ) == "http://www.goear.com/listen.php?v=" ) {
+		// if it's a link to a video page, generate the right one
+		var regexp = /http:\/\/www.goear.com\/.*?v=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {		
+			videoId = url.substring( 34, url.length );
+		}				
+		url = "http://www.goear.com/files/external.swf?file=" + videoId ;
+	}
+
+	return( url );
+}
+
+function getGrouperVideoLink( url )
+{
+	// check if it's a link to a video page or a link to the video player
+	if( url.substring( 0, 46 ) == "http://grouper.com/video/MediaDetails.aspx?id=" ) {
+		// if it's a link to a video page, generate the right one
+		var regexp = /http:\/\/www.grouper.com\/video\/MediaDetails.aspx.*?id=([\-0-9a-zA-z_]*).*/i;
+		result = regexp.exec( url );
+		if( result ) {
+			videoId = result[1];
+		}
+		else {		
+			videoId = url.substring( 46, url.length );
+		}		
+		
+		url = "http://grouper.com/mtg/mtgPlayer.swf?gvars=vurl~http%3a%2f%2fgrouper.com%2frss%2fflv.ashx%3fid%3d" + videoId + "_rf%7e-9_vfver~8_ap~1_extid~-1";
+	}
+
+	return( url );
+}
+
+function getDailymotionLink( url ) 
+{	
+	// check if this is a URL pointing to a dailymotion embedded video link
+	var regexp = /object\swidth="([0-9]+)"\sheight="([0-9]+)".+value="(http:\/\/www\.dailymotion\.com\/swf\/\w+).*"/;
+	result = regexp.exec( url );
+	return( result );
+}
+
+function insertVideoCode()
+{
+	// get and check the URL
+	urlField = document.forms[0].url;
+	url = urlField.value;
+	if( url == "" || !isValidUrl( url )) {
+		window.alert( tinyMCE.getLang('lang_insertvideo_badurl', 0) );
+		return( false );
+	}
+	
+	// check if a destination system was selected
+	youtube = document.getElementById("youtube");
+	gvideo = document.getElementById("gvideo");
+//	dalealplay = document.getElementById("dalealplay");
+	metacafe = document.getElementById("metacafe");
+	ifilm = document.getElementById("ifilm");
+	goear = document.getElementById("goear");
+	grouper = document.getElementById("grouper");
+	dailymot = document.getElementById("dailymot");
+//	bolt = document.getElementById("bolt");
+
+	if( youtube.checked==false && gvideo.checked==false && metacafe.checked==false && ifilm.checked==false && goear.checked==false && grouper.checked==false && dailymot.checked==false ) {
+		window.alert( tinyMCE.getLang('lang_insertvideo_selectiontype', 0) );
+		return( false );	
+	}
+	
+	if( youtube.checked == true ) {
+		link = getYouTubeLink( url );
+		css="ltVideoYouTube";
+		width=425;
+		height=355;
+	}
+	if( gvideo.checked == true ) {
+		link = getGoogleVideoLink( url );	
+		css="ltVideoGoogleVideo";
+		width=425;
+		height=355;	
+	}
+	if( metacafe.checked == true ) {
+		link = getMetacafeVideoLink( url );	
+		css="ltVideoMetacafe";
+		width=400;
+		height=345;		
+	}
+	if( ifilm.checked == true ) {
+		link = getiFilmVideoLink( url );
+		css="ltVideoIfilm";
+		width=448;
+		height=365;
+	}
+	if( goear.checked == true ) {
+		link = getGoearVideoLink( url );	
+		css="ltVideoGoear";
+		width=366;
+		height=75;		
+	}	
+	if( grouper.checked == true ) {
+		link = getGrouperVideoLink( url );	
+		css="ltVideoGrouper";
+		width=496;
+		height=398;		
+	}
+	if( dailymot.checked == true ) {
+		result = getDailymotionLink( url );
+		width = result[1];
+		height = result[2];
+		link = result[3];
+		css="ltVideoDailymot";		
+	}
+	insertFlash( link, css, width, height );
+}
+
+function insertFlash( file, css, width, height ) {
+
+	var html      = '';
+
+	html += ''
+		+ '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
+		+ 'width="' + width + '" height="' + height + '" '
+		+ 'border="0" alt="' + file + '" title="' + file + '" class="'+css+'" />';
+
+	tinyMCEPopup.execCommand("mceInsertContent", true, html);
+	tinyMCE.selectedInstance.repaint();
+
+	tinyMCEPopup.close();
+}

Modified: plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/tiny_mce-plog-resourcelist.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -112,6 +112,7 @@
  */
 function insertMediaPlayer( url, tinyMCEEnabled, height, width )
 {
+    url = url.replace(/ /g, '%20');
 	if( tinyMCEEnabled ) {
 		var htmlCode = '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" mce_src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ' + 'width="' + width + '" height="' + height + '" ' + 'border="0" alt="' + url + '" title="' + url + '" class="ltFlashPlayer" />';
 
@@ -124,4 +125,4 @@
 	else {
 		Lifetype.UI.Pages.ResourceChooser.addText( parent.opener.document.newPost.postText, Lifetype.Media.getFlashPlayerHTML( url, height, width ));
 	}
-}
\ No newline at end of file
+}

Modified: plog/trunk/js/tinymce/tiny_mce.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/tiny_mce.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -1 +1 @@
-function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.2";this.releaseDate="2007-08-21";this.instances=[];this.switchClassCache=[];this.windowArgs=[];this.loadedFiles=[];this.pendingFiles=[];this.loadingIndex=0;this.configs=[];this.currentConfig=0;this.eventHandlers=[];this.log=[];this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.settings=[];ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=window['opera']&&opera.buildNumber?true:false;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=[];this.themes=[];this.menus=[];this.loadedPlugins=[];this.buttonMap=[];thi
 s.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i,cssPath,entities,h,p,src,elements=[],head;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){head=document.getElementsByTagName('head')[0];if(head){for(i=0,nl=head.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i])}for(i=0,nl=document.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i]);nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){src=elements
 [i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!==''&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings.language);th
 is._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],t
 foot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");
 this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_
 to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,25
 0,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747
 ,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers
 ","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",
 '');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);this._def("forced_root_block",false);this._def("remove_trailing_nbsp",false);this._def("save_on_tinymce_forms",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings.browsers.indexOf('msie')==-1)return;if(this.isGecko&&this.settings.browsers.indexOf('gecko')==-1)return;if(this.isSafari&&this.settings.browsers.indexOf('safari')==-1)return;if(this.isOpera&&this.settings.browsers.indexOf('opera')==-1)return;baseHREF=tinyMCE.settings.document_base_url;h=document.location.href;p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings.document_base_url=baseHREF;tinyMCE.settings.document_base_prefix=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings.base_href=baseHREF.substring(0,baseHREF.last
 IndexOf('/'))+"/";theme=this.settings.theme;this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=[13,45,36,35,33,34,37,38,39,40];this.uniqueURL='javascript:void(091039730);';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=['onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance'];thi
 s.settings.theme_href=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings.force_br_newlines=false;if(tinyMCE.getParam("popups_css",false)){cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.popups_css=this.documentBasePath+"/"+cssPath;else this.settings.popups_css=cssPath}else this.settings.popups_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.editor_css=this.documentBasePath+"/"+cssPath;else this.settings.editor_css=cssPath}else{if(this.settings.editor_css!=='')this.settings.editor_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMC
 E.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings.theme+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings.language+'.js');this.loadCSS(this.settings.editor_css);p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings.cleanup_entities=[];entities=tinyMCE.getParam('entities','',true,',');for(i=0;i<entities.length;i+=2)settings.cleanup_entities['c'+entities[i]]=entities[i+1]}settings.index=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isI
 E&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}this.xmlEncodeRe=new RegExp('[<>&"]','g')},_addUnloadEvents:function(){var st=tinyMCE.settings.add_unload_trigger;if(tinyMCE.isIE){if(st){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(st)tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substri
 ng(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xht
 ml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0,skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',')
 ;var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings.convert_on_click||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang.lang_edit_confirm)))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement,n,inst,doc;formElement=document.getElementById(form_element_name);for(n in tinyMCE.instances){
 inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;tinyMCE.dispatchCallback(ti,'remove_instance_callback','removeInstance',ti);return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(
 editor_id),h,re,ot,tn,n;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;tinyMCE.selectedInstance=tinyMCE.instances[n];break}re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip
 _cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance,n,pe,te;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)i
 nst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value.element,value.document),value.element,value.document);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCE
 Control(value);return;case"mceToggleEditor":inst=tinyMCE.getInstanceById(value);if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')te.value=inst.getHTML();else te.innerHTML=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')inst.setHTML(te.value);else inst.setHTML(te.innerHTML);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(tinyMCE.isGecko){for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].g
 etDoc().designMode="off";tinyMCE.instances[n].getDoc().designMode="on";tinyMCE.instances[n].useCSS=false}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings.focus_alert)alert(tinyMCELang.lang_focus_alert)},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings.area_width;ah=""+tinyMCE.settings.area_height;if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMa
 rgin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings.auto_resize)iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings.default_document);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i,doc=inst.getDoc(),head=doc.getElementsByTagName('head').item(0);var content=inst.startContent,contentElement,body;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;
 /g,'"');content=content.replace(/&amp;/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head||!doc.body){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8',''
 ,'FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings.nowrap)doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings.directionality;doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings.base_href);if(tinyMCE.settings.convert_newlines_to_brs){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSS
 Classes(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings.force_br_newlines)doc.styleSheets[0].addRule("p","margin: 0;");body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){contentElement=inst.getDoc().createElement("body");doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings.cleanup_on_startup)tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings.cleanup_on_startup){tinyMCE._setHTML(inst.getDoc(),content);try{tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,inst.contentDocument,this.settings,inst.getBody()))}catch(e){}}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);tinyMCE.dispatchCallback(inst,'setupcontent_cal
 lback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.a
 dd({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_submit'))return;if
 (typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i<form_obj.elements.length;i++){elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true}},handleEvent:function(e){var inst=tinyMCE.selectedInstance,i,elm,keys;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.setBaseHREF(null);if(tinyMCE.isRealIE){var ife=tinyMCE.selectedInstance.iframeElement;if(ife.style.height.indexOf('%')!=-1){
 ife._oldHeight=ife.style.height;ife.style.height=ife.clientHeight}}window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();",1);return;case"submit":tinyMCE.formSubmit(tinyMCE.isMSIE?window.event.srcElement:e.target);return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.target;for(i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUn
 doLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings.force_br_newlines&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img"
 );tinyMCE.triggerNodeChange(false)}return false;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;inst._fixRootBlocks();if(inst.settings.remove_trailing_nbsp)inst._fixTrailingNbsp();if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.s
 electedInstance.getBody(),true,tinyMCE.settings.visual,tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}keys=tinyMCE.posKeyCodes;var posKey=false;for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings.custom_undo_redo){keys=[8,46];for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execComm
 and("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.se
 lectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang'
 )==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOp
 era)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButto
 n" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},formSubmit:function(f,p){var n,inst,found=false;if(f.form)f=f.form;if(tinyMCE.getParam(
 'save_on_tinymce_forms')){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formElement){if(f==inst.formElement.form){found=true;inst.isNotDirty=true}}}}else found=true;if(found){tinyMCE.removeTinyMCEFormElements(f);tinyMCE.triggerSave()}if(f.mceOldSubmit&&p)f.mceOldSubmit()},submitPatch:function(){tinyMCE.formSubmit(this,true)},onLoad:function(){var r,i,c,mode,trigger,elements,element,settings,elementId,elm;var selector,deselector,elementRefAr,form;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body&&window.location.href!=window.top.location.href){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(c=0;c<ti
 nyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];selector=tinyMCE.getParam("editor_selector");deselector=tinyMCE.getParam("editor_deselector");elementRefAr=[];if(document.forms&&tinyMCE.settings.add_form_submit_trigger&&!tinyMCE.submitTriggers){for(i=0;i<document.forms.length;i++){form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings.submit_patch){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}mode=tinyMCE.settings.mode;switch(mode){case"exact":elements=tinyMCE.getParam('elements','',true,',');for(i=0;i<elements.length;i++){element=tinyMCE._getElementById(elements[i]);trigger=element?element.getAttribute(tinyMCE.settings.textarea_trigger):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((ti
 nyMCE.settings.ask||tinyMCE.settings.convert_on_click)&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i])}break;case"specific_textareas":case"textareas":elements=document.getElementsByTagName("textarea");for(i=0;i<elements.length;i++){elm=elements.item(i);trigger=elm.getAttribute(tinyMCE.settings.textarea_trigger);if(selector!==''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!=='')trigger=selector!==''?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(i=0;i<elementRefAr.length;i++){element=elementRefAr[i];elementId=element.name?element.name:element.id;if(tinyMCE.settings.ask||tinyMCE.settings.convert_on_click){if(tinyMCE.isGecko){settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",f
 unction(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings.auto_focus){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var i,outArray,value=(typeo
 f(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);outArray=[];for(i=0;i<value.length;i++){if(value[i]&&value[i]!=='')outArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue},addToLang:function(prefix,ar){var k;for(k in ar){if(typeof(ar[k])=='function')continue;tinyMCELang[(k.indexOf('lang_')==-1?'lang_':'')+(prefix!==''?(prefix+"_"):'')+k]=ar[k]}this.loadNextScript()},triggerNodeChange:functio
 n(focus,setup_content){var elm,inst,editorId,undoIndex=-1,undoLevels=-1,doc,anySelection=false,st;if(tinyMCE.selectedInstance){inst=tinyMCE.selectedInstance;elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();editorId=inst.editorId;st=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)inst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(st&&st.length>0);if(tinyMCE.settings.custom_undo_redo){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,t
 ype,content){var pl,po,i,customCleanup;customCleanup=tinyMCE.settings.cleanup_callback;if(customCleanup!='')content=tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback,window)(type,content,inst);po=tinyMCE.themes[tinyMCE.settings.theme];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings.theme;tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings.language+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings.language+'.js')},applyTemplate:func
 tion(h,ag){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(ag&&ag[s])return ag[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,scrollbars,url,name,win,modal,features;args=!args?{}:args;args.mce_template_file=template.file;args.mce_width=template.width;args.mce_height=template.height;tinyMCE.windowArgs=args;html=template.html;if(!(width=parseInt(template.width)))width=320;if(!(height=parseInt(template.height)))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args.resizable)?args.resizable:"no";scrollbars=(args&&args.scrollbars)?args.scrollbars:"no";if(template.file.charAt(
 0)!='/'&&template.file.indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template.file;else url=template.file;for(name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings.popups_css);html=tinyMCE.applyTemplate(html,args);win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings.dialog_type=="modal"){height+=10;features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}els
 e{modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template.close_previous!="no")try{tinyMCE.lastWindow.close()}catch(ex){}win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}if(template.close_previous!="no")tinyMCE.lastWindow=win;try{win.resizeTo(width,height)}catch(e){}if(tinyMCE.isGecko){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var i,classNames,ar,className,aidClass=tinyMCE.settings.visual_table_class;if(typeof(state)=="undefined")state=tinyMCE.settings.visual;classNames=[];ar=class_name.split(' ');for(i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!=='')classNames[classN
 ames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;className="";for(i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){var i,x,y,tableElement,anchorName,oldW,oldH,bo,cn;if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);tableElement=null;switch(el.nodeName){case"TABLE":oldW=el.style.width;oldH=el.style.height;bo=tinyMCE.getAttrib(el,"border");bo=bo==''||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(y=0;y<el.rows.length;y++){for(x=0;x<el.rows[y].cells.length;x++){cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!==''&
 &state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!==''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");return h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!==''){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!==''){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.
 nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){var i,html,paras,node;html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMCE.settings.fix_content_duplication){paras=doc.getElementsByTagName("P");for(i=0;i<paras.length;i++){node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id],n;if(!inst){for
 (n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formTargetElementId==editor_id)return inst}}else return inst;return null},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var i,c,x,rule,styles,rules,csses,selectorText,inst=tinyMCE.getInstanceById(editor_id);var cssClass,addClass,p;if(!inst)inst=tinyMCE.selectedInstance;if(!inst)return[];if(!doc)doc=inst.getDoc();if(inst&&inst.cssClasses.length>0)return inst.cssClasses;if(!doc)return;styles=doc.styleSheets;if(styles&&styles.length>0){
 for(x=0;x<styles.length;x++){csses=null;try{csses=tinyMCE.isIE?doc.styleSheets(x).rules:styles[x].cssRules}catch(e){}if(!csses)return[];for(i=0;i<csses.length;i++){selectorText=csses[i].selectorText;if(selectorText){rules=selectorText.split(',');for(c=0;c<rules.length;c++){rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')!=-1)continue;if(rule.indexOf(tinyMCE.settings.visual_table_class)!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){cssClass=rule.substring(rule.indexOf('.')+1);addClass=true;for(p=0;p<inst.cssClasses.length&&addClass;p++){if(inst.cssClasses[p]==cssClass)addClass=false}if(addClass)inst.cssClasses[inst.cssClasses.length]=cssClass}}}}}}return inst.cssClasses},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);r
 eturn in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v,rtl=tinyMCE.getLang('lang_dir')=='rtl';l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'</span>';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings.theme];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+v+'</span>';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.exec
 uteCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!==''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},resolveDots:function(s,o){var i;if(typeof(s)=='string'){for(i=0,s=s.split('.');i<s.length;i++)o=o[s[i]]}else o=s;return o},xmlEncode:function(s){return s?(''+s).replace(this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},add:function(c,m){var n;for(n in m){if(m.hasOwnProperty(n))c.prototype[n]=m[n]}},extend:function(p,np){var o={},n;o.parent=p;for(n in p){if(p.hasOwnProperty(n))o[n]=p
 [n]}for(n in np){if(np.hasOwnProperty(n))o[n]=np[n]}return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,tos,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.enabled=true;this.settings=s;this.settings.theme=tinyMCE.getParam("theme","default");this.settings.width=tinyMCE.getParam("width",-1);this.settings.height=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=[];this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_
 valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings.theme;if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;tos={};for(i=0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))tos[fn[i]]=fu}tinyMCE.addTheme(t,tos)}this.plugins=[];p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;tos={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))tos[fn[x]]=fu}tinyMCE.addPlugin(pn,tos)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};re
 turn o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,null);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings.index){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings.index}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:
 this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('
 alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s,o;if(!e.altKey&&!e.ctrlKey)return false;s=this.shortcuts;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.ra
 ngeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!this.isNotDirty},_mergeElements:function(scmd,pa,ch,override){var st,stc,className,n;if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_fixRootBlocks:function(){var rb,b,ne,be,nx,bm;rb=tinyMCE.getParam('forced_root_block');if(!rb)return;b=this.getBody();ne=b.firstChild;while(ne){
 nx=ne.nextSibling;if((ne.nodeType==3&&ne.nodeValue.replace(/\s+/g,'')!='')||(ne.nodeType==1&&!tinyMCE.blockRegExp.test(ne.nodeName))){if(!bm)bm=this.selection.getBookmark();if(!be){be=this.getDoc().createElement(rb);be.appendChild(ne.cloneNode(true));b.replaceChild(be,ne)}else{be.appendChild(ne.cloneNode(true));b.removeChild(ne)}}else be=null;ne=nx}if(bm)this.selection.moveToBookmark(bm)},_fixTrailingNbsp:function(){var s=this.selection,e=s.getFocusElement(),bm,v;if(e&&tinyMCE.blockRegExp.test(e.nodeName)&&e.firstChild){v=e.firstChild.nodeValue;if(v&&v.length>1&&/(^\u00a0|\u00a0$)/.test(v)){e.firstChild.nodeValue=v.replace(/(^\u00a0|\u00a0$)/,'');s.selectNode(e.firstChild,true,false,false);}}},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("obje
 ct_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var i,x,z,align,img,div,doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){align=focusElm.getAttribute('align');img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','left');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&
 &div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.setAttribute('align','');img.removeAttribute('align');div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','right');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();ret
 urn}}if(tinyMCE.settings.force_br_newlines){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!==''){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyFull":case"JustifyRight":var el=tinyMCE.getParentNode(focusElm,function(n){return tinyMCE.getAttrib(n,'align')});if(el){el.setAttribute('align','');el.removeAttribute('align')}else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();return tr
 ue;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==''){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|cod
 e|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=pare
 ntNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value.command;var sname=value.name;var svalue=value.value==null?'':value.value;var wrapper=value.wrapper?value.wrapper:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!==''?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table|i
 mg','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,[],1);for(z=0;z<ch.length;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,
 svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,[],1);for(z=0;z<ch.length;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.
 length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i],isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,fal
 se)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko||tinyMCE.isOpera){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(fal
 se)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInt
 ernal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else 
 selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}this._addBogusBR();tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value.targets)=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value.targets;var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value.name,value.value);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getB
 ody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getS
 el();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{value=doc.createTextNode(tinyMCE.entityDecode(value))}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.
 createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex==-1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings.custom_undo_redo&&this.undoRedoLevel){if(this.undoRedo.add(
 ))tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"RemoveFormat":case"removeformat":var text=this.selection.getSelectedTex
 t();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_ad
 dBogusBR:function(){var b=this.getBody();if(tinyMCE.isGecko&&!b.hasChildNodes())b.innerHTML='<br _moz_editor_bogus_node="TRUE" />'},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,tos,editorTemplate,targetDoc,deltaWidth,deltaHeight,html,rng,fragment;var dynamicIFrame,tElm,doc,parentElm;th=this.settings.theme;tos=tinyMCE.themes[th];targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings.theme;this.settings.themeurl=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(tos.getEditorTemplate)editorTemplate=tos.getEditorTemplate(this.settings,this.editorId);deltaWidth=editorTemplate.delta_width?editorTemplate.delta_width:0;deltaHeight=editorTemplate.delta_height?editorTemplate.delta_height:0;html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate.html;html=tinyMCE.replaceVar(html,"editor_id",th
 is.editorId);if(!this.settings.default_document)this.settings.default_document=tinyMCE.baseURL+"/blank.htm";this.settings.old_width=this.settings.width;this.settings.old_height=this.settings.height;if(this.settings.width==-1)this.settings.width=replace_element.offsetWidth;if(this.settings.height==-1)this.settings.height=replace_element.offsetHeight;if(this.settings.width==0)this.settings.width=replace_element.style.width;if(this.settings.height==0)this.settings.height=replace_element.style.height;if(this.settings.width==0)this.settings.width=320;if(this.settings.height==0)this.settings.height=240;this.settings.area_width=parseInt(this.settings.width);this.settings.area_height=parseInt(this.settings.height);this.settings.area_width+=deltaWidth;this.settings.area_height+=deltaHeight;this.settings.width_style=""+this.settings.width;this.settings.height_style=""+this.settings.height;if((""+this.settings.width).indexOf('%')!=-1)this.settings.area_width="100%";else this.settings.w
 idth_style+='px';if((""+this.settings.height).indexOf('%')!=-1)this.settings.area_height="100%";else this.settings.height_style+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings.width=replace_element.style.width;this.settings.area_width="100%";this.settings.width_style="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings.height=replace_element.style.height;this.settings.area_height="100%";this.settings.height_style="100%"}html=tinyMCE.applyTemplate(html);this.settings.width=this.settings.old_width;this.settings.height=this.settings.old_height;this.visualAid=this.settings.visual;this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;hc='<input type="hidden" id="'+form_
 element_name+'" name="'+form_element_name+'" />';this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}dynamicIFrame=false;tElm=targetDoc.getElementById(this.editorId
 );if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}doc=this.contentDocument;if(dynamicIFrame){html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings.base_href+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="t
 ext/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);parentElm=this.targetDoc.getElementById(this.editorId+'_parent');this.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==''||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,thi
 s.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_callback){var e,nl=[],i,s,content,htm;if(!this.enabled)return;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings.preformatted=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tin
 yMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings.cleanup==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings.save_callback!=='')content=tinyMCE.resolveDots(tinyMCE.settings.save_callback,window)(this.formTargetElementId,htm,this.getBody());if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if
 (tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};tinyMCE.add(TinyMCE_Engine,{cleanupHTMLCode:function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','gi'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s},parseStyle:function(str){var ar=[],st,i,re,pa;if(str==null)return ar;st=str.split(';');tinyMCE.clearArray(ar);for(i=0;i<st.length;
 i++){if(st[i]=='')continue;re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar},compressStyle:function(ar,pr,sf,res){var box=[],i,a;box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(i=0;i<box.length;i++){if(box[i]==null)return;if(i&&box[i]!=box[i-1])return}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null},serializeStyle:function(ar){var str="",key,val,m;tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(key in ar){val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=n
 ull&&val!==''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);val=val.replace(/\"/g,'\'');if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str},convertRGBToHex:function(s,k){var re,rgb;if(s.toLowerCase().indexOf('rgb')!=-1){re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]
 }}return s},convertHexToRGB:function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s},convertSpansToFonts:function(doc){var s,i,size,fSize,x,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();fSize=0;for(x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!==''){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}fColor=s[i].style.color;if(fColor!=null&&fColor!==''){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}},convertFontsToSpans:function(doc){var fsClasses,s,i,fSize,fFace,fColor,sizes=tinyMCE.get
 Param('font_size_style_values').replace(/\s+/,'').split(',');fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!=='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!==''){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!==''){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!==''){s[i].style.color=fColor;s[i].removeAttribute('color')}}},cleanupAnchors:function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!==''&&tinyMCE.getAttrib(an[i],"href")==''){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}},getContent
 :function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null},_fixListElements:function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.prevNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}},_fixTables:function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}},_cleanupHTML:function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyM
 CE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();inst._fixRootBlocks();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=[];c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/
 <p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<br \/>\s*<\/li>/g,'</li>');h=h.replace(/&nbsp;\s*<\/(dd|dt)>/g,'</$1>');h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.repl
 ace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on_submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h}});function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray([]);this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,scri
 pt,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray([]);this.vElementsRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayTo
 Re(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];this.serializationId=0;if(s.invalid_elements!=='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this.inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]','g')},addRuleStr:function(s){var r=this.parseRuleStr(s),n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray([]);for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){if(!this.rulesDone)this._setupRules();if(!n)return true;n=n.replace(/[^a
 -z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(cl[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray([]);this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseR
 uleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray([]),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r.tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].c
 harAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray([]);r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray([]);dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==''?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray([]);r.validAttribValues[t.toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray([]);r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(
 this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDoc.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(tinyMCE.isRealIE&&this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode("
 "));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr,nn;if(!this.rulesDone)this._setupRules();if(tinyMCE.isRealIE&&this._isDuplicate(n))return'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;nn=n.nodeName;if(tinyMCE.isRealIE){if(n.nodeName.indexOf('/')!=-1)break;if(n.scopeName&&n.scopeName!='HTML')nn=n.scopeName.toUpperCase()+':'+nn.toUpperCase()}else if(tinyMCE.isOpera&&nn.indexOf(':')>0)nn=nn.toUpperCase();if(this.settings.convert_fonts_to_spans){if(this.settings.on_save&&nn=='FONT')nn='SPAN';if(!this.settings.on_save&&nn=='SPAN')nn='FONT'}if(this
 .vElementsRe.test(nn)&&(!this.iveRe||!this.iveRe.test(nn))&&!inn){va=true;r=this.rules[nn];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(nn)){r=at[no];break}}}en=r.isWild?nn.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serializeAttribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(nn))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(nn))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(
 st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s
 =this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this,re=this.xmlEncodeRe;if(!this.entitiesDone)this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(re,function(c){var b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c){return'&#'+c.charCodeAt(0)+';'})}return s},split:function(re,s){var i,l,o=[],c=s.spl
 it(re);for(i=0,l=c.length;i<l;i++){if(c[i]!=='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){var v,ex,nn;if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;try{v=e.getAttribute(n,0)}catch(ex){v=e.getAttribute(n,2)}if(n=="class"&&!v)v=e.className;if(this.isIE){if(n=="http-equiv")v=e.httpEquiv;nn=e.nodeName;if(nn=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(nn=="INPUT"&&n=="size"&&v=="20")v="";if(nn=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="width"||n=="height")v=e.getAttribute(n,2)}if(n=='style'&&v){if(!tinyMCE.isOpera)v=e.style.cssText;v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v))}if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!=='')v=tinyMCE.cleanupEventStr(v);return(v&&v!=='')?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMC
 E.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls')){if(!this.urlConverter)this.urlConverter=eval(tinyMCE.settings.urlconverter_callback);return this.urlConverter(v,n,true)}return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=this._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(s.entity_encoding=="named"){n=tinyMCE.clearArray([]);a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true},_setupRules:function(){var s=this.settings;this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elem
 ents);this.rulesDone=true},_isDuplicate:function(n){var i,l,sn;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{sn=this.serializedNodes;for(i=0,l=sn.length;i<l;i++){if(sn[i]==n)return true}sn.push(n)}return false}};tinyMCE.add(TinyMCE_Engine,{createTagHTML:function(tn,a,h){var o='',f=tinyMCE.xmlEncode,n;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o},createTag:function(d,tn,a,h){var o=d.createElement(tn),n;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o},getElementByAttributeValue:function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl
 .length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o},isBlockElement:function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)},getParentBlockElement:function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null},insertAfter:function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.appendChild(n)},setInnerHTML:function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<embed([^>]*)>/gi,'<tmpembed$1>');h=h.replace(/<em([^>]*)>/gi,'<i$1>');h=h.replace(/<tmpembed([^>]*)>/gi,'<embed$1>');h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>'
 );e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}},getOuterHTML:function(e){var d;if(tinyMCE.isIE)return e.outerHTML;d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML},setOuterHTML:function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}},_getElementById:function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}
 }return e},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:[])},getParentElement:function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!==''});return this.getParentNode(n,function(n){return((n.nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)},getParentNode:function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null},getAttrib:function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;try{v=elm.getAttribute(name,0)}catch(ex){v=elm.getAttribute(name,2)}if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko){if(name=="src"&&elm.src!=null&&elm.src!=='')v=elm.src;if(name=="href"&&elm.href!=null&&elm.href!=='')v=elm.href}else if(tinyMCE.isIE){switch(name){case"http-equiv":v=elm.httpEquiv;b
 reak;case"width":case"height":v=elm.getAttribute(name,2);break}}if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!=='')?v:dv},setAttrib:function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!==''&&va!=-1)el.setAttribute(name,va);else el.removeAttribute(name)},setStyleAttrib:function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}},switchClass:function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}},getAbsPosition:function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n
 .offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}},prevNode:function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},nextNode:function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a},addCSSClass:function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!==''?(' '+o):''):(o!==''?(o+' '):'')+c},removeCSSClass:function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''},hasCSSClass:function(n,c){return new
  RegExp('\\b'+c+'\\b','g').test(n.className)},renameElement:function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.replaceChild(ne,e)}},getViewPort:function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}},getStyle:function(n,na,d){if(!n)return false;if(tinyMCE.isGecko&&n.ownerDocument.defaultView){try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(na)}catch(n){return null}}na=na.replace(/-(\D)/g,function(a,b){re
 turn b.toUpperCase()});if(n.currentStyle)return n.currentStyle[na];return false}});tinyMCE.add(TinyMCE_Engine,{parseURL:function(url_str){var urlParts=[],i,pos,lastPos,chr;if(url_str){pos=url_str.indexOf('://');if(pos!=-1){urlParts.protocol=url_str.substring(0,pos);lastPos=pos+3}for(i=lastPos;i<url_str.length;i++){chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts.host=url_str.substring(lastPos,pos);urlParts.port="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts.port=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts.path=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts.query=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts.anchor=url_str.substring(lastPos+1,pos)}}retur
 n urlParts},serializeURL:function(up){var o="";if(up.protocol)o+=up.protocol+"://";if(up.host)o+=up.host;if(up.port)o+=":"+up.port;if(up.path)o+=up.path;if(up.query)o+="?"+up.query;if(up.anchor)o+="#"+up.anchor;return o},convertAbsoluteURLToRelativeURL:function(base_url,url_to_relative){var baseURL=this.parseURL(base_url),targetURL=this.parseURL(url_to_relative);var i,strTok1,strTok2,breakPoint=0,outPath="",forceSlash=false;var fileName,pos;if(targetURL.path=='')targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(i=0;i<(strTok1.length-(breakPoint-1));i++)out
 Path+="../";for(i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==''&&forceSlash?"/":outPath;fileName=baseURL.path;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!=='')targetURL.path="";if(targetURL.path==''&&!targetURL.anchor)targetURL.path=fileName!==''?fileName:"/";return this.serializeURL(targetURL)},convertRelativeToAbsoluteURL:function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts,newRelURLParts,numBack,relURL=this.parseURL(relative_url),i;var len,absPath,start,end,newBaseURLParts;if(relative_url==''||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL.path.split('/');relURLParts=relURL.path.split('/');newBaseURLParts=[];for(i=baseURLParts.length-1;
 i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();newRelURLParts=[];numBack=0;for(i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=newRelURLParts.reverse();len=baseURLParts.length-numBack;absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');start="";end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)},convertURL:function(url,node,on_save){var dl=document.location,start,portPart,urlParts,baseUrlParts,tmpUrlParts,curl;var prot=dl.protocol,host=dl.hostname,port=dl.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(u
 rl,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||/^[ \t\r\n\+]*[#\?]/.test(url))return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings.base_href+url;if(on_save&&tinyMCE.getParam('relative_urls')){curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(curl.charAt(0)=='/')curl=tinyMCE.settings.document_base_prefix+curl;urlParts=tinyMCE.parseURL(curl);tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings.document_base_url);if(urlParts.host==tmpUrlParts.host&&(urlParts.port==tmpUrlParts.port))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,curl)}if(!tinyMCE.getParam('relative_urls')){urlParts=tinyMCE.parseURL(url);baseUrlParts=tinyMCE.parseURL(tinyMCE.settings.base_href);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(urlParts.anchor&&urlParts.path==baseUrlParts.path)return"#"+urlParts.anchor}if(tinyMCE.getParam('
 remove_script_host')){start="";portPart="";if(port!=='')portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url},convertAllRelativeURLs:function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!=='')src=msrc;if(src!==''){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!=='')href=mhref;if(href&&href!==''){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,href);elms[i].setAttribute("href",href)}}}});tinyMCE.add(TinyMCE_Engine,{clearArray:function(a){var n;for(n in a)a[n]=null;return a},explode:function(d,s){var ar=s.split(d),oar=[],i;for(i=0;i<ar.l
 ength;i++){if(ar[i]!=='')oar[oar.length]=ar[i]}return oar}});tinyMCE.add(TinyMCE_Engine,{_setEventsEnabled:function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings.event_elements.split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!==''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}},_eventPatch:function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;Tiny
 MCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}},findEvent:function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null},unloadHandler:function(){tinyMCE.triggerSave(true,true)},addEventHandlers:function(inst){this.setEventHandlers(inst,1)},setEventHandlers:function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototy
 pe._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);try{doc.designMode="On"}catch(e){}}},onMouseMove:function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}},cancelEvent:function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false},addEvent:function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)},removeEvent:function(o,n,h){if(o.detachEvent)o.detachEvent(
 "on"+n,h);else o.removeEventListener(n,h,false)},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false},accessibleEventHandler:function(e){var elm,win=this._win;e=tinyMCE.isIE?win.event:e;elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true},_resetIframeHeight:function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}}});function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function
 (){var inst=this.instance,e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(r.cloneContents());else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);return h},getSelectedText:function(){var inst=this.instance,d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance,rng=this.getRng(),doc=inst.getDoc(),b=inst.getBody();var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();var sp,le,s,e,nl,i,si,ei,w;sx=vp.left;sy=vp.top;if(simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isRealIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.lengt
 h;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}else{s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:s
 y}}}return null},moveToBookmark:function(bookmark){var inst=this.instance,rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc(),win=inst.getWin(),sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari&&bookmark.rng){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return fal
 se;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);if(!tinyMCE.isOpera)win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null
 },selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,[],3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.s
 etEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;i
 f(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if
 (rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){inst.isNotDirty=false;tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings.custom_undo_redo_levels;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)
 this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(i
 nst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents,i;function isEmpty(para){var nodes;function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==''}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;nodes=tinyMCE.getNodeTree(para,[],3)
 ;for(i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="HTML"?doc.body:startNode;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&(startBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(startBlock.style.position)))startBlock=null;if(endBlock&&(endBlock.n
 odeName=='CAPTION'||/absolute|relative|static/gi.test(endBlock.style.position)))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(/(TD|TABLE|TH|CAPTION)/.test(blockName)||(blockName=="DIV"&&/left|right/gi.test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;d
 o{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.in
 nerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=c
 ontents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_ha
 ndleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re),e=this.getElement(),x,y;var w=parseInt(re.offsetWidth),h=parseInt(re.offsetHeight);var ew=parseInt(e.offsetWidth),eh=parseInt(e.offsetHeight);switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2)
 ;break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=th
 is.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.e
 lement=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=[];this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=[]},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separ
 ator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="'+tinyMCE.xmlEncode(m[i].js)+'" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.inn
 erHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});tinyMCE.add(TinyMCE_Engine,{debug:function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m}});
\ No newline at end of file
+function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.3";this.releaseDate="2007-11-27";this.instances=[];this.switchClassCache=[];this.windowArgs=[];this.loadedFiles=[];this.pendingFiles=[];this.loadingIndex=0;this.configs=[];this.currentConfig=0;this.eventHandlers=[];this.log=[];this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.settings=[];ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=window['opera']&&opera.buildNumber?true:false;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=[];this.themes=[];this.menus=[];this.loadedPlugins=[];this.buttonMap=[];thi
 s.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i,cssPath,entities,h,p,src,elements=[],head;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){head=document.getElementsByTagName('head')[0];if(head){for(i=0,nl=head.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i])}for(i=0,nl=document.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i]);nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){src=elements
 [i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!==''&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings.language);th
 is._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],t
 foot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");
 this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_
 to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,25
 0,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747
 ,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers
 ","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",
 '');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);this._def("forced_root_block",false);this._def("remove_trailing_nbsp",false);this._def("save_on_tinymce_forms",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings.browsers.indexOf('msie')==-1)return;if(this.isGecko&&this.settings.browsers.indexOf('gecko')==-1)return;if(this.isSafari&&this.settings.browsers.indexOf('safari')==-1)return;if(this.isOpera&&this.settings.browsers.indexOf('opera')==-1)return;baseHREF=tinyMCE.settings.document_base_url;h=document.location.href;p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings.document_base_url=baseHREF;tinyMCE.settings.document_base_prefix=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings.base_href=baseHREF.substring(0,baseHREF.last
 IndexOf('/'))+"/";theme=this.settings.theme;this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=[13,45,36,35,33,34,37,38,39,40];this.uniqueURL='javascript:void(091039730);';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=['onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance'];thi
 s.settings.theme_href=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings.force_br_newlines=false;if(tinyMCE.getParam("popups_css",false)){cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.popups_css=this.documentBasePath+"/"+cssPath;else this.settings.popups_css=cssPath}else this.settings.popups_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.editor_css=this.documentBasePath+"/"+cssPath;else this.settings.editor_css=cssPath}else{if(this.settings.editor_css!=='')this.settings.editor_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMC
 E.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings.theme+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings.language+'.js');this.loadCSS(this.settings.editor_css);p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings.cleanup_entities=[];entities=tinyMCE.getParam('entities','',true,',');for(i=0;i<entities.length;i+=2)settings.cleanup_entities['c'+entities[i]]=entities[i+1]}settings.index=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isI
 E&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}this.xmlEncodeRe=new RegExp('[<>&"]','g')},_addUnloadEvents:function(){var st=tinyMCE.settings.add_unload_trigger;if(tinyMCE.isIE){if(st){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(st)tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substri
 ng(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xht
 ml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0,skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',')
 ;var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings.convert_on_click||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang.lang_edit_confirm)))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement,n,inst,doc;formElement=document.getElementById(form_element_name);for(n in tinyMCE.instances){
 inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;tinyMCE.dispatchCallback(ti,'remove_instance_callback','removeInstance',ti);return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(
 editor_id),h,re,ot,tn,n;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;tinyMCE.selectedInstance=tinyMCE.instances[n];break}re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip
 _cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance,n,pe,te;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)i
 nst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value.element,value.document),value.element,value.document);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCE
 Control(value);return;case"mceToggleEditor":inst=tinyMCE.getInstanceById(value);if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')te.value=inst.getHTML();else te.innerHTML=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')inst.setHTML(te.value);else inst.setHTML(te.innerHTML);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(tinyMCE.isGecko){for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].g
 etDoc().designMode="off";tinyMCE.instances[n].getDoc().designMode="on";tinyMCE.instances[n].useCSS=false}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings.focus_alert)alert(tinyMCELang.lang_focus_alert)},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings.area_width;ah=""+tinyMCE.settings.area_height;if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMa
 rgin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings.auto_resize)iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings.default_document);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i,doc=inst.getDoc(),head=doc.getElementsByTagName('head').item(0);var content=inst.startContent,contentElement,body;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;
 /g,'"');content=content.replace(/&amp;/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head||!doc.body){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8',''
 ,'FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings.nowrap)doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings.directionality;doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings.base_href);if(tinyMCE.settings.convert_newlines_to_brs){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSS
 Classes(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings.force_br_newlines)doc.styleSheets[0].addRule("p","margin: 0;");body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){contentElement=inst.getDoc().createElement("body");doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings.cleanup_on_startup)tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings.cleanup_on_startup){tinyMCE._setHTML(inst.getDoc(),content);try{tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,inst.contentDocument,this.settings,inst.getBody()))}catch(e){}}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);tinyMCE.dispatchCallback(inst,'setupcontent_cal
 lback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.a
 dd({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*[\"\']([^ >\"]*)[\"\']','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*[\"\']([^ >\"]*)[\"\']','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_su
 bmit'))return;if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i<form_obj.elements.length;i++){elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true}},handleEvent:function(e){var inst=tinyMCE.selectedInstance,i,elm,keys;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":return;case"submit":tinyMCE.formSubmit(tinyMCE.isMSIE?window.event.srcElement:e.target);return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.tar
 get;for(i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings.for
 ce_br_newlines&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false)}return false;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;inst._fixRootBlocks();if(inst.settings.remove_trailing_nbsp)inst._fixTrailingNbsp();if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)
 tinyMCE.selectedInstance.switchSettings();inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings.visual,tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6
 ]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}keys=tinyMCE.posKeyCodes;var posKey=false;for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings.custom_undo_redo){keys=[8,46];for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;cas
 e"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTypin
 g");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='<
 /a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else
  h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self"
 >';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},formSubmit:function(f,p){var n,inst,found=false;if(f.form)f=f.form;if(tinyMCE.getParam('save_on_tinymce_forms')){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formElement){if(f==inst.formElement.form){found=true;inst.isNotDirty=true}}}}else found=true;if(found){tinyMCE.removeTinyMCEFormElements(f);tinyMCE.triggerSave()}if(f.mceOldSubmit&&p)f.mceOldSubmit()},submitPatch:functio
 n(){tinyMCE.formSubmit(this,true)},onLoad:function(){var r,i,c,mode,trigger,elements,element,settings,elementId,elm;var selector,deselector,elementRefAr,form;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body&&window.location.href!=window.top.location.href){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];selector=tinyMCE.getParam("editor_selector");deselector=tinyMCE.getParam("editor_deselector");elementRefAr=[];if(document.forms&&tinyMCE.settings.add_form_submit_trigger&&!tinyMCE.submitTriggers){for(i=0;i<document.forms.length;i++){form=document.forms[i];tinyMCE.addEvent(form,"submi
 t",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings.submit_patch){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}mode=tinyMCE.settings.mode;switch(mode){case"exact":elements=tinyMCE.getParam('elements','',true,',');for(i=0;i<elements.length;i++){element=tinyMCE._getElementById(elements[i]);trigger=element?element.getAttribute(tinyMCE.settings.textarea_trigger):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((tinyMCE.settings.ask||tinyMCE.settings.convert_on_click)&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i])}break;case"specific_textareas":case"textareas":elements=document.getElementsByTagName("textarea");for(i=0;i<elements.length;i++){elm=elements.item(i);trigger=elm.getAttribute(t
 inyMCE.settings.textarea_trigger);if(selector!==''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!=='')trigger=selector!==''?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(i=0;i<elementRefAr.length;i++){element=elementRefAr[i];elementId=element.name?element.name:element.id;if(tinyMCE.settings.ask||tinyMCE.settings.convert_on_click){if(tinyMCE.isGecko){settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus
 ",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings.auto_focus){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var i,outArray,value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);outArray=[];for(i=0;i<value.length;i++){if(value[i]&&value[i]!=='')ou
 tArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue},addToLang:function(prefix,ar){var k;for(k in ar){if(typeof(ar[k])=='function')continue;tinyMCELang[(k.indexOf('lang_')==-1?'lang_':'')+(prefix!==''?(prefix+"_"):'')+k]=ar[k]}this.loadNextScript()},triggerNodeChange:function(focus,setup_content){var elm,inst,editorId,undoIndex=-1,undoLevels=-1,doc,anySelection,st;if(tinyMCE.selectedInstance){inst=tinyMCE.selectedInstance;elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();editorId=inst.editorId;st=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)i
 nst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();anySelection=!inst.selection.isCollapsed();if(tinyMCE.settings.custom_undo_redo){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i,customCleanup;customCleanup=tinyMCE.settings.cleanup_callback;if(customCleanup!='')content=tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback,window)(type,content,inst);po=tinyMCE.themes[tinyMCE.settings.theme];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return
  content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings.theme;tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings.language+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings.language+'.js')},applyTemplate:function(h,ag){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(ag&&ag[s])return ag[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,
 scrollbars,url,name,win,modal,features;args=!args?{}:args;args.mce_template_file=template.file;args.mce_width=template.width;args.mce_height=template.height;tinyMCE.windowArgs=args;html=template.html;if(!(width=parseInt(template.width)))width=320;if(!(height=parseInt(template.height)))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args.resizable)?args.resizable:"no";scrollbars=(args&&args.scrollbars)?args.scrollbars:"no";if(template.file.charAt(0)!='/'&&template.file.indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template.file;else url=template.file;for(name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings.popups_css);html=tinyMCE.applyTemplate(html,args);win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",l
 eft="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings.dialog_type=="modal"){height+=10;features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}else{modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template.close_previous!="no")try{tinyMCE.lastWindow.close()}catch(ex){}win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked
 );return}if(template.close_previous!="no")tinyMCE.lastWindow=win;try{win.resizeTo(width,height)}catch(e){}if(tinyMCE.isGecko&&win.document){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var i,classNames,ar,className,aidClass=tinyMCE.settings.visual_table_class;if(typeof(state)=="undefined")state=tinyMCE.settings.visual;classNames=[];ar=class_name.split(' ');for(i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!=='')classNames[classNames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;className="";for(i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){var i,x,y,tableElement,anchorName,oldW,oldH,bo,cn;if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,
 inst);tableElement=null;switch(el.nodeName){case"TABLE":oldW=el.style.width;oldH=el.style.height;bo=tinyMCE.getAttrib(el,"border");bo=bo==''||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(y=0;y<el.rows.length;y++){for(x=0;x<el.rows[y].cells.length;x++){cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!==''&&state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!==''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");ret
 urn h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!==''){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!==''){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){var i,html,paras,node;html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMC
 E.settings.fix_content_duplication){paras=doc.getElementsByTagName("P");for(i=0;i<paras.length;i++){node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id],n;if(!inst){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formTargetElementId==editor_id)return inst}}else return inst;return null},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstan
 ceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var i,c,x,rule,styles,rules,csses,selectorText,inst=tinyMCE.getInstanceById(editor_id);var cssClass,addClass,p;if(!inst)inst=tinyMCE.selectedInstance;if(!inst)return[];if(!doc)doc=inst.getDoc();if(inst&&inst.cssClasses.length>0)return inst.cssClasses;if(!doc)return;styles=doc.styleSheets;if(styles&&styles.length>0){for(x=0;x<styles.length;x++){csses=null;try{csses=tinyMCE.isIE?doc.styleSheets(x).rules:styles[x].cssRules}catch(e){}if(!csses)return[];for(i=0;i<csses.length;i++){selectorText=csses[i].selectorText;if(selectorText){rules=selectorText.split(',');for(c=0;c<rules.length;c++){rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')
 !=-1)continue;if(rule.indexOf(tinyMCE.settings.visual_table_class)!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){cssClass=rule.substring(rule.indexOf('.')+1);addClass=true;for(p=0;p<inst.cssClasses.length&&addClass;p++){if(inst.cssClasses[p]==cssClass)addClass=false}if(addClass)inst.cssClasses[inst.cssClasses.length]=cssClass}}}}}}return inst.cssClasses},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v,rtl=tinyMCE.getLang('lang_dir')=='rtl';l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)
 return'<span dir="rtl">'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'</span>';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings.theme];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+v+'</span>';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!==''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE
 .themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},resolveDots:function(s,o){var i;if(typeof(s)=='string'){for(i=0,s=s.split('.');i<s.length;i++)o=o[s[i]]}else o=s;return o},xmlEncode:function(s){return s?(''+s).replace(this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},add:function(c,m){var n;for(n in m){if(m.hasOwnProperty(n))c.prototype[n]=m[n]}},extend:function(p,np){var o={},n;o.parent=p;for(n in p){if(p.hasOwnProperty(n))o[n]=p[n]}for(n in np){if(np.hasOwnProperty(n))o[n]=np[n]}return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,tos,fu,p,x,fn,
 fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.enabled=true;this.settings=s;this.settings.theme=tinyMCE.getParam("theme","default");this.settings.width=tinyMCE.getParam("width",-1);this.settings.height=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=[];this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings.theme;if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;tos={};for(i
 =0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))tos[fn[i]]=fu}tinyMCE.addTheme(t,tos)}this.plugins=[];p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;tos={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))tos[fn[x]]=fu}tinyMCE.addPlugin(pn,tos)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};return o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,nul
 l);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings.index){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings.index}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentEleme
 nt(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s,o;if(!e.altKey&&!e.ctrlKey)return false;s=this
 .shortcuts;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!this.isNotDirty},_mergeElements:function(scmd,pa,ch,override){var st,stc,className,n;if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));
 className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_fixRootBlocks:function(){var rb,b,ne,be,nx,bm;rb=tinyMCE.getParam('forced_root_block');if(!rb)return;b=this.getBody();ne=b.firstChild;while(ne){nx=ne.nextSibling;if((ne.nodeType==3&&ne.nodeValue.replace(/\s+/g,'')!='')||(ne.nodeType==1&&!tinyMCE.blockRegExp.test(ne.nodeName))){if(!bm)bm=this.selection.getBookmark();if(!be){be=this.getDoc().createElement(rb);be.appendChild(ne.cloneNode(true));b.replaceChild(be,ne)}else{be.appendChild(ne.cloneNode(true));b.removeChild(ne)}}else be=null;ne=nx}if(bm)this.selection.moveToBookmark(bm)},_fixTrailingNbsp:f
 unction(){var s=this.selection,e=s.getFocusElement(),bm,v;if(e&&tinyMCE.blockRegExp.test(e.nodeName)&&e.firstChild){v=e.firstChild.nodeValue;if(v&&v.length>1&&/(^\u00a0|\u00a0$)/.test(v)){e.firstChild.nodeValue=v.replace(/(^\u00a0|\u00a0$)/,'');s.selectNode(e.firstChild,true,false,false);}}},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var i,x,z,align,img,div,doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCS
 S(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){align=focusElm.getAttribute('align');img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','left');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.setAttribute('align','');img.removeAttribute('align');div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceC
 hild(img,div)}else{div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','right');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return}}if(tinyMCE.settings.force_br_newlines){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!==''){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=
 null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyFull":case"JustifyRight":var el=tinyMCE.getParentNode(focusElm,function(n){return tinyMCE.getAttrib(n,'align')});if(el){el.setAttribute('align','');el.removeAttribute('align')}else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,val
 ue);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==''){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMC
 E.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value.command;var sname=value.name;var svalue=value.value==null?'':value.value;var wrapper=value.wrapper?value.wrapper:"span";
 var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!==''?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table|img','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,[],1);for(z=0;z<ch.le
 ngth;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,[],1);for(z=0;z<ch.leng
 th;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i],isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.inne
 rHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout
 ('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko||tinyMCE.isOpera){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLa
 ng('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._clea
 nupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}this._addBogusBR();tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value.targets)=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value.targets;var targetNode=tin
 yMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value.name,value.value);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)
 ){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{value=doc.createTextNode(tinyMCE.entityDecode(value))}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.trig
 gerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex==-
 1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings.custom_undo_redo&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(com
 mand,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"RemoveFormat":case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}if(text.length==0)thi
 s.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_addBogusBR:function(){var b=this.getBody();if(tinyMCE.isGecko&&!b.hasChildNodes())b.innerHTML='<br _moz_editor_bogus_node="TRUE" />'},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,tos,editorTemplate,targetDoc,deltaWidth,deltaHeight,html,rng,fragment;var dynamicIFrame,tElm,doc,parentElm;th=this.settings.theme;tos=tinyMCE.themes[th];targetDoc=target_document?target_document:docume
 nt;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings.theme;this.settings.themeurl=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(tos.getEditorTemplate)editorTemplate=tos.getEditorTemplate(this.settings,this.editorId);deltaWidth=editorTemplate.delta_width?editorTemplate.delta_width:0;deltaHeight=editorTemplate.delta_height?editorTemplate.delta_height:0;html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate.html;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);if(!this.settings.default_document)this.settings.default_document=tinyMCE.baseURL+"/blank.htm";this.settings.old_width=this.settings.width;this.settings.old_height=this.settings.height;if(this.settings.width==-1)this.settings.width=replace_element.offsetWidth;if(this.settings.height==-1)this.settings.height=replace_element.offsetHeight;if(this.settings.width==0)this.settings.width=replace_eleme
 nt.style.width;if(this.settings.height==0)this.settings.height=replace_element.style.height;if(this.settings.width==0)this.settings.width=320;if(this.settings.height==0)this.settings.height=240;this.settings.area_width=parseInt(this.settings.width);this.settings.area_height=parseInt(this.settings.height);this.settings.area_width+=deltaWidth;this.settings.area_height+=deltaHeight;this.settings.width_style=""+this.settings.width;this.settings.height_style=""+this.settings.height;if((""+this.settings.width).indexOf('%')!=-1)this.settings.area_width="100%";else this.settings.width_style+='px';if((""+this.settings.height).indexOf('%')!=-1)this.settings.area_height="100%";else this.settings.height_style+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings.width=replace_element.style.width;this.settings.area_width="100%";this.settings.width_style="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings.height=replace_element.style.height;this
 .settings.area_height="100%";this.settings.height_style="100%"}html=tinyMCE.applyTemplate(html);this.settings.width=this.settings.old_width;this.settings.height=this.settings.old_height;this.visualAid=this.settings.visual;this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragmen
 t,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}dynamicIFrame=false;tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId
 ];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}doc=this.contentDocument;if(dynamicIFrame){html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings.base_href+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);parentElm=this.targetDoc.getElementById(this.editorId+'_parent');t
 his.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==''||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,this.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_ca
 llback){var e,nl=[],i,s,content,htm;if(!this.enabled)return;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings.preformatted=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings.cleanup==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,tru
 e);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings.save_callback!=='')content=tinyMCE.resolveDots(tinyMCE.settings.save_callback,window)(this.formTargetElementId,htm,this.getBody());if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};tinyMCE.add(TinyMCE_Engine,{cleanupHTMLCode:function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','g
 i'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s},parseStyle:function(str){var ar=[],st,i,re,pa;if(str==null)return ar;st=str.split(';');tinyMCE.clearArray(ar);for(i=0;i<st.length;i++){if(st[i]=='')continue;re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar},compressStyle:function(ar,pr,sf,res){var box=[],i,a;box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(i=0;i<box.length;i++){if(box[i]==null)return;if(i&&box[i]!=box[i-1])return}ar[res]
 =box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null},serializeStyle:function(ar){var str="",key,val,m;tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(key in ar){val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!==''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);val=val.replace(/\"
 /g,'\'');if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str},convertRGBToHex:function(s,k){var re,rgb;if(s.toLowerCase().indexOf('rgb')!=-1){re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]}}return s},convertHexToRGB:function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s},convertSpansToFonts:function(doc){var s,i,size,fSize,x,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');s=tinyMCE.selectElements(doc,'s
 pan,font');for(i=0;i<s.length;i++){size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();fSize=0;for(x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!==''){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}fColor=s[i].style.color;if(fColor!=null&&fColor!==''){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}},convertFontsToSpans:function(doc){var fsClasses,s,i,fSize,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!=='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!==''){fSize=parseInt(fSize
 );if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!==''){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!==''){s[i].style.color=fColor;s[i].removeAttribute('color')}}},cleanupAnchors:function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!==''&&tinyMCE.getAttrib(an[i],"href")==''){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}},getContent:function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null},_fixListElements:function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.pre
 vNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}},_fixTables:function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}},_cleanupHTML:function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();inst._fixRootBlocks();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc
 );tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=[];c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.rep
 lace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<br \/>\s*<\/li>/g,'</li>');h=h.replace(/&nbsp;\s*<\/(dd|dt)>/g,'</$1>');h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on
 _submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h}});function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray([]);this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray([]);this.vElement
 sRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];this.serializationId=0;if(s.invalid_elements!=='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this
 .inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]','g')},addRuleStr:function(s){var r=this.parseRuleStr(s),n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray([]);for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){if(!this.rulesDone)this._setupRules();if(!n)return true;n=n.replace(/[^a-z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(c
 l[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray([]);this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray([]),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r
 .tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray([]);r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray([]);dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==''?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray([]);r.validAttribValues[t
 .toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray([]);r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDo
 c.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(tinyMCE.isRealIE&&this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr,nn;if(!this.rulesDone)this._setupRules();if(tinyMCE.isRealIE&&this._isDuplicate(n))r
 eturn'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;nn=n.nodeName;if(tinyMCE.isRealIE){if(n.nodeName.indexOf('/')!=-1)break;if(n.scopeName&&n.scopeName!='HTML')nn=n.scopeName.toUpperCase()+':'+nn.toUpperCase()}else if(tinyMCE.isOpera&&nn.indexOf(':')>0)nn=nn.toUpperCase();if(this.settings.convert_fonts_to_spans){if(this.settings.on_save&&nn=='FONT')nn='SPAN';if(!this.settings.on_save&&nn=='SPAN')nn='FONT'}if(this.vElementsRe.test(nn)&&(!this.iveRe||!this.iveRe.test(nn))&&!inn){va=true;r=this.rules[nn];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(nn)){r=at[no];break}}}en=r.isWild?nn.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serialize
 Attribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(nn))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(nn))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttrib
 s[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=
 h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this,re=this.xmlEncodeRe;if(!this.entitiesDone)this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(re,function(c){var b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c){return'&#'+c.charCodeAt(0)+';'})}return s},split:function(re,s){var i,l,o=[],c=s.split(re);for(i=0,l=c.length;i<l;i++){if(c[i]!=='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){var v,ex,nn;if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;try{v=e.getAttribute(n,0)}catch(ex){v=e.getAttribute(n,2)}if(n=="class"&&!v)v=e.className;if
 (this.isIE){if(n=="http-equiv")v=e.httpEquiv;nn=e.nodeName;if(nn=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(nn=="INPUT"&&n=="size"&&v=="20")v="";if(nn=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="width"||n=="height")v=e.getAttribute(n,2)}if(n=='style'&&v){if(!tinyMCE.isOpera)v=e.style.cssText;v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v))}if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!=='')v=tinyMCE.cleanupEventStr(v);return(v&&v!=='')?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls')){if(!this.urlConverter)this.urlConverter=eval(tinyMCE.settings.urlconverter_callback);return this.urlConverter(v,n,true)}return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=t
 his._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(s.entity_encoding=="named"){n=tinyMCE.clearArray([]);a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true},_setupRules:function(){var s=this.settings;this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elements);this.rulesDone=true},_isDuplicate:function(n){var i,l,sn;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{sn=this.serializedNodes;for(i=0,l=sn.length;i<l;i++){if(sn[i]==n)return true}sn.push(n)}return false}};tinyMCE.add(TinyMCE_Engine,{createTagHTM
 L:function(tn,a,h){var o='',f=tinyMCE.xmlEncode,n;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o},createTag:function(d,tn,a,h){var o=d.createElement(tn),n;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o},getElementByAttributeValue:function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o},isBlockElement:function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)},getParentBlockElement:function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null},insertAfter:function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.a
 ppendChild(n)},setInnerHTML:function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<embed([^>]*)>/gi,'<tmpembed$1>');h=h.replace(/<em([^>]*)>/gi,'<i$1>');h=h.replace(/<tmpembed([^>]*)>/gi,'<embed$1>');h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}},getOuterHTML:function(e){var d;if(tinyMCE.isIE)return e.outerHTML;d=e.ownerDocument.createElement("body");d.app
 endChild(e.cloneNode(true));return d.innerHTML},setOuterHTML:function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}},_getElementById:function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}}return e},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:[])},getParentElement:function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!==''});return this.getParentNode(n,function(n){return((n.
 nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)},getParentNode:function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null},getAttrib:function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;try{v=elm.getAttribute(name,0)}catch(ex){v=elm.getAttribute(name,2)}if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko){if(name=="src"&&elm.src!=null&&elm.src!=='')v=elm.src;if(name=="href"&&elm.href!=null&&elm.href!=='')v=elm.href}else if(tinyMCE.isIE){switch(name){case"http-equiv":v=elm.httpEquiv;break;case"width":case"height":v=elm.getAttribute(name,2);break}}if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!=='')?v:dv},setAttrib:function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!==''&&va!=-1)el.setAttribute(name,va);else el.re
 moveAttribute(name)},setStyleAttrib:function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}},switchClass:function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}},getAbsPosition:function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n.offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}},prevNode:function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},nextNode:function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.spli
 t(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a},addCSSClass:function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!==''?(' '+o):''):(o!==''?(o+' '):'')+c},removeCSSClass:function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''},hasCSSClass:function(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className)},renameElement:function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.
 replaceChild(ne,e)}},getViewPort:function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}},getStyle:function(n,na,d){if(!n)return false;if(tinyMCE.isGecko&&n.ownerDocument.defaultView){try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(na)}catch(n){return null}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase()});if(n.currentStyle)return n.currentStyle[na];return false}});tinyMCE.add(TinyMCE_Engine,{parseURL:function(url_str){var urlParts=[],i,pos,lastPos,chr;if(url_str){pos=url_str.indexOf('://');if(pos!=-1){urlParts.protocol=url_str.substring(0,pos);lastPos=pos+3}for(i=lastPos;i<url_str.length;i++){chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts.host=url_str.substrin
 g(lastPos,pos);urlParts.port="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts.port=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts.path=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts.query=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts.anchor=url_str.substring(lastPos+1,pos)}}return urlParts},serializeURL:function(up){var o="";if(up.protocol)o+=up.protocol+"://";if(up.host)o+=up.host;if(up.port)o+=":"+up.port;if(up.path)o+=up.path;if(up.query)o+="?"+up.query;if(up.anchor)o+="#"+up.anchor;return o},convertAbsoluteURLToRelativeURL:function(base_url,url_to_relative){var baseURL=this.parseURL(base_url),targetURL=this.parseURL(url_to_relative);var i,strTok1,strTok2,breakPoint=0,outPath=""
 ,forceSlash=false;var fileName,pos;if(targetURL.path=='')targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==''&&forceSlash?"/":outPath;fileName=baseURL.path;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!=='')targetURL.path="";if(targ
 etURL.path==''&&!targetURL.anchor)targetURL.path=fileName!==''?fileName:"/";return this.serializeURL(targetURL)},convertRelativeToAbsoluteURL:function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts,newRelURLParts,numBack,relURL=this.parseURL(relative_url),i;var len,absPath,start,end,newBaseURLParts;if(relative_url==''||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL.path.split('/');relURLParts=relURL.path.split('/');newBaseURLParts=[];for(i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();newRelURLParts=[];numBack=0;for(i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=ne
 wRelURLParts.reverse();len=baseURLParts.length-numBack;absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');start="";end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)},convertURL:function(url,node,on_save){var dl=document.location,start,portPart,urlParts,baseUrlParts,tmpUrlParts,curl;var prot=dl.protocol,host=dl.hostname,port=dl.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||/^[ \t\r\n\+]*[#\?]/.test(url))return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings.base_href+url;if(on_save&&tinyMCE.getParam('relative_urls')){curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(curl.charAt(0)=='/')curl=tinyMCE.settings.doc
 ument_base_prefix+curl;urlParts=tinyMCE.parseURL(curl);tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings.document_base_url);if(urlParts.host==tmpUrlParts.host&&(urlParts.port==tmpUrlParts.port))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,curl)}if(!tinyMCE.getParam('relative_urls')){urlParts=tinyMCE.parseURL(url);baseUrlParts=tinyMCE.parseURL(tinyMCE.settings.base_href);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(urlParts.anchor&&urlParts.path==baseUrlParts.path)return"#"+urlParts.anchor}if(tinyMCE.getParam('remove_script_host')){start="";portPart="";if(port!=='')portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url},convertAllRelativeURLs:function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!=='')src=m
 src;if(src!==''){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!=='')href=mhref;if(href&&href!==''){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,href);elms[i].setAttribute("href",href)}}}});tinyMCE.add(TinyMCE_Engine,{clearArray:function(a){var n;for(n in a)a[n]=null;return a},explode:function(d,s){var ar=s.split(d),oar=[],i;for(i=0;i<ar.length;i++){if(ar[i]!=='')oar[oar.length]=ar[i]}return oar}});tinyMCE.add(TinyMCE_Engine,{_setEventsEnabled:function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings.event_elements.split(',');for(y=0;y<evs.length;y++){elms=node.getEl
 ementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!==''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}},_eventPatch:function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}},findEvent:function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.is
 Instance(inst)&&inst.getWin().event)return inst.getWin().event}return null},unloadHandler:function(){tinyMCE.triggerSave(true,true)},addEventHandlers:function(inst){this.setEventHandlers(inst,1)},setEventHandlers:function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototype._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);try{doc.designMode="On"}catch(e){}}},onMouseMove:function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBook
 mark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}},cancelEvent:function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}else{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false},addEvent:function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)},removeEvent:function(o,n,h){if(o.detachEvent)o.detachEvent("on"+n,h);else o.removeEventListener(n,h,false)},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false},accessibleEventHandler:function(e){var elm,win=this._win;e=tinyMCE.isIE?win.event:e;elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange
 =elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true},_resetIframeHeight:function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}}});function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance,e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(document.importNode(r.cloneContents(),true));else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);r
 eturn h},getSelectedText:function(){var inst=this.instance,d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}else t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance,rng=this.getRng(),doc=inst.getDoc(),b=inst.getBody();var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();var sp,le,s,e,nl,i,si,ei,w;sx=vp.left;sy=vp.top;if(simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isRealIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp
 ;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}else{s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,index:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:sy}}}return null},moveToBookmark:function(bookmark){var inst=this.instance,rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc(),win=inst.getWin(),sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari&&bookmark.rng){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if
 (bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.length>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return false;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);if(!tinyMCE.isOpera)win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookm
 ark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRang
 e();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,[],3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp
 .width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;re
 turn r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=
 this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){inst.isNotDirty=false;tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings.custom_undo_redo_levels;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyM
 CE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){var inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(
 0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents,i;function isEmpty(para){var nodes;function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==''}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;nodes=tinyMCE.getNodeTree(para,[],3);for(i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direc
 t?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="HTML"?doc.body:startNode;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&(startBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(startBlock.style.position)))startBlock=null;if(endBlock&&(endBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(endBlock.style.position)))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(/(TD|TABLE|TH|CAPTION)/.test(blockName)||(blockName=="DIV"&&/left|right/gi.test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.node
 Name=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){
 rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefor
 e)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockNa
 me&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.b
 lockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re),e=this.getElement(),x,y;var w=parseInt(re.offsetWidth),h=parseInt(re.offsetHeight);var ew=parseInt(e.offsetWidth),eh=parseInt(e.offsetHeight);switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=
 this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(t
 his.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+
 tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=[];this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=[]},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].te
 xt);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="'+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="'+tinyMCE.xmlEncode(m[i].js)+'" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});tinyMCE.add(TinyMCE_Engine,{debug:function(){var m="",a,i,l=tinyMCE.log.length;for(
 i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m}});
\ No newline at end of file

Modified: plog/trunk/js/tinymce/tiny_mce_popup.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce_popup.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/tiny_mce_popup.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -116,7 +116,7 @@
 	},
 
 	executeOnLoad : function(str) {
-		if (tinyMCE.isOpera)
+		if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
 			this.onLoadEval = str;
 		else
 			eval(str);

Modified: plog/trunk/js/tinymce/tiny_mce_src.js
===================================================================
--- plog/trunk/js/tinymce/tiny_mce_src.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/tinymce/tiny_mce_src.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -5,8 +5,8 @@
 	var ua;
 
 	this.majorVersion = "2";
-	this.minorVersion = "1.2";
-	this.releaseDate = "2007-08-21";
+	this.minorVersion = "1.3";
+	this.releaseDate = "2007-11-27";
 
 	this.instances = [];
 	this.switchClassCache = [];
@@ -1082,8 +1082,8 @@
 		// s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
 
 		if (!s.match(/(mce_src|mce_href)/gi, s)) {
-			s = s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'src="$1" mce_src="$1"');
-			s = s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"', 'gi'), 'href="$1" mce_href="$1"');
+			s = s.replace(new RegExp('src\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'src="$1" mce_src="$1"');
+			s = s.replace(new RegExp('href\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'href="$1" mce_href="$1"');
 		}
 
 		return s;
@@ -1158,19 +1158,15 @@
 			// Workaround for drag drop/copy paste base href bug
 			case "drop":
 			case "beforepaste":
-				if (tinyMCE.selectedInstance)
+/*				if (tinyMCE.selectedInstance)
 					tinyMCE.selectedInstance.setBaseHREF(null);
 
 				// Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
 				// This logic forces the width/height to be in pixels while the user is drag/dropping
+				// NOTE: This has been disabled for now since it messes up copy/paste that is far more important than image drag
 				if (tinyMCE.isRealIE) {
 					var ife = tinyMCE.selectedInstance.iframeElement;
 
-					/*if (ife.style.width.indexOf('%') != -1) {
-						ife._oldWidth = ife.width.height;
-						ife.style.width = ife.clientWidth;
-					}*/
-
 					if (ife.style.height.indexOf('%') != -1) {
 						ife._oldHeight = ife.style.height;
 						ife.style.height = ife.clientHeight;
@@ -1178,6 +1174,7 @@
 				}
 
 				window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1);
+				*/
 				return;
 
 			case "submit":
@@ -1777,7 +1774,7 @@
 	},
 
 	triggerNodeChange : function(focus, setup_content) {
-		var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection = false, st;
+		var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection, st;
 
 		if (tinyMCE.selectedInstance) {
 			inst = tinyMCE.selectedInstance;
@@ -1798,10 +1795,8 @@
 				elm = inst.getBody();
 
 			inst.switchSettings();
+			anySelection = !inst.selection.isCollapsed();
 
-			if (tinyMCE.selectedElement)
-				anySelection = (tinyMCE.selectedElement.nodeName.toLowerCase() == "img") || (st && st.length > 0);
-
 			if (tinyMCE.settings.custom_undo_redo) {
 				undoIndex = inst.undoRedo.undoIndex;
 				undoLevels = inst.undoRedo.undoLevels.length;
@@ -1972,7 +1967,7 @@
 				}
 
 				// Make it bigger if statusbar is forced
-				if (tinyMCE.isGecko) {
+				if (tinyMCE.isGecko && win.document) {
 					if (win.document.defaultView.statusbar.visible)
 						win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
 				}
@@ -6338,7 +6333,7 @@
 		e = document.createElement("body");
 
 		if (r.cloneContents)
-			e.appendChild(r.cloneContents());
+			e.appendChild(document.importNode(r.cloneContents(), true));
 		else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
 			e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
 		else

Modified: plog/trunk/js/ui/autosave.js
===================================================================
--- plog/trunk/js/ui/autosave.js	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/js/ui/autosave.js	2009-12-24 17:43:57 UTC (rev 6934)
@@ -13,6 +13,8 @@
 var maxBackupCookieLength = 3240;
 
 // How many cookies we can use per postText and PostExtentedText
+// see comment in clearAutoSaveCookie in adminaddnewpostaction.class.php if you change
+// this to be something other than 1
 var maxBackupCookiesPerBlog = 1;
 
 // It doesn't make sense just backup few characters, use this to control the minimal backup length
@@ -149,4 +151,4 @@
 	Lifetype.Dom.$('autoSaveMessage').innerHTML = '';
 	//Element.hide(Lifetype.Dom.$('autoSaveMessage'));
 	Lifetype.Dom.$('autoSaveMessage').style.display = 'none';
-}
\ No newline at end of file
+}

Modified: plog/trunk/locale/admin/locale_de_DE.php
===================================================================
--- plog/trunk/locale/admin/locale_de_DE.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/locale/admin/locale_de_DE.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -187,7 +187,6 @@
 $messages['comment_marked_as_nonspam_ok'] = 'Der Kommentar wurde erfolgreich als "kein Spam" markiert.';
 
 // post trackbacks
-$messages['blog'] = 'Blog';
 $messages['excerpt'] = 'Auszug';
 $messages['error_fetching_trackbacks'] = 'Beim Abrufen der Trackbacks ist ein Fehler aufgetreten.';
 $messages['error_deleting_trackbacks'] = 'Beim L&ouml;schen der Trackbacks ist ein Fehler aufgetreten.';
@@ -207,7 +206,6 @@
 $messages['referrers_deleted_ok'] = '%s Referrer wurden erfolgreich gel&ouml;scht.';
 
 // categories
-$messages['posts'] = 'Artikel';
 $messages['show_in_main_page'] = 'Auf der &Uuml;bersichtsseite anzeigen.';
 $messages['error_category_has_articles'] = 'Der Kategorie "%s" sind noch Artikel zugeordnet. Bitte &auml;ndern Sie erst die entsprechenden Artikel und versuchen Sie anschließend die Kategorie zu l&ouml;schen.';
 $messages['category_deleted_ok'] = 'Die Kategorie "%s" wurde erfolgreich gel&ouml;scht.';
@@ -336,7 +334,6 @@
 $messages['album_added_ok'] = 'Das Album wurde "%s" erfolgreich hinzugef&uuml;gt.';
 
 // edit album
-$messages['error_incorrect_album_id'] = 'Die ID des Albums ist ung&uuml;ltig.';
 $messages['error_fetching_album'] = 'Beim Zugriff auf das Album ist ein Fehler aufgetreten.';
 $messages['error_updating_album'] = 'Beim Aktualisieren des Albums ist ein Fehler aufgetreten. Bitte &uuml;berpr&uuml;fen Sie Ihre Eingaben.';
 $messages['album_updated_ok'] = 'Das Album "%s" wurde erfolgreich aktualisiert!';
@@ -352,7 +349,6 @@
 $messages['resource_added_ok'] = 'Ressource "%s" erfolgreich hinzugef&uuml;gt!';
 $messages['error_resource_forbidden_extension'] = 'Die Datei konnte nicht hinzugef&uuml;gt werden, da dieser Dateityp nicht erlaubt ist.';
 $messages['error_resource_too_big'] = 'Die Datei konnte nicht hinzugef&uuml;gt werden, da sie zu gro&szlig; ist.';
-$messages['error_uploads_disabled'] = 'Die M&ouml;glichkeit, Dateien hochzuladen wurde f&uuml;r diese Site deaktiviert.';
 $messages['error_quota_exceeded'] = 'Die Datei konnte nicht hinzugef&uuml;gt werden, da Sie den f&uuml;r Sie reservierten Speicherplatz &uuml;berschritten haben.';
 $messages['error_adding_resource'] = 'Beim Hinzuf&uuml;gen der Datei ist ein Fehler aufgetreten.';
 
@@ -450,10 +446,8 @@
 $messages['send_user_notification_help'] = 'E-Mail Benachrichtigung an diesen Benutzer senden';
 $messages['notification_text'] = 'Benachrichtigungstext';
 $messages['notification_text_help'] = 'Dieser Text wird in die Benachrichtigung eingef&uuml;gt.';
-$messages['error_adding_user'] = 'Beim Hinzuf&uuml;gen des Benutzers ist ein Fehler aufgetreten. Bitte &uuml;berpr&uuml;fen Sie Ihre Eingaben.';
 $messages['error_empty_text'] = 'Sie haben keinen Text eingegeben.';
 $messages['error_adding_user'] = 'Beim Hinzuf&uuml;gen des Benutzers ist ein Fehler aufgetreten. Bitte &uuml;berpr&uuml;fen Sie Ihre Eingaben.';
-$messages['error_invalid_user'] = 'Die Benutzer-ID ist nicht g&uuml;ltig, oder der Benutzer existiert nicht.';
 $messages['user_added_to_blog_ok'] = 'Dem Benutzer "%s" wurde erfolgreich Zugang zu diesem Blog einger&auml;umt.';
 
 // blog templates
@@ -466,7 +460,6 @@
 // new blog template
 $messages['template_installed_ok'] = 'Template "%s" wurde erfolgreich hinzugef&uuml;gt.';
 $messages['error_installing_template'] = 'Beim Installieren des Templates "%s" ist ein Fehler aufgetreten.';
-$messages['error_missing_base_files'] = 'Einige Dateien des Template Sets sind nicht vorhanden.';
 $messages['error_add_template_disabled'] = 'Es k&ouml;nnen keine Templates hinzugef&uuml;gt werden, da diese Funktion f&uuml;r diese Site deaktiviert wurde.';
 $messages['error_must_upload_file'] = 'Es wurde kein Template-Set hochgeladen.';
 $messages['error_uploads_disabled'] = 'Die M&ouml;glichkeit, Dateien hochzuladen wurde f&uuml;r diese Site deaktiviert.';
@@ -500,11 +493,9 @@
 // edit user
 $messages['error_invalid_user'] = 'Die Benutzer-ID ist nicht g&uuml;ltig, oder der Benutzer existiert nicht.';
 $messages['error_updating_user'] = 'Beim Aktualisieren der Benutzereinstellungen ist ein Fehler aufgetreten. Bitte &uuml;berpr&uuml;fen Sie Ihre Eingaben.';
-$messages['Blogs'] = 'Blogs verwalten';
 $messages['user_blogs_help'] = 'Blogs des Benutzers oder zu denen der Benutzer Zugang hat.';
 $messages['site_admin'] = 'Administrator';
 $messages['site_admin_help'] = 'Entscheiden Sie, ob der Benutzer Administrationsrechte zugewiesen bekommt und Zugang zum Administrationsbereich bekommt, um dort Verwaltungsaufgaben durchf&uuml;hren zu d&uuml;rfen.';
-$messages['user_updated_ok'] = 'Benutzer "%s" erfolgreich aktualisiert';
 
 // site blogs
 $messages['blog_status_all'] = 'Alle';
@@ -873,7 +864,6 @@
 $messages['trackbacks_updated_ok'] = '%s Trackbacks erfolgreich aktualisiert.';
 $messages['trackback_updated_ok'] = 'Trackback erfolgreich aktualisiert.';
 $messages['error_trackback_status'] = 'Bitte w&auml;hlen Sie einen g&uuml;ltigen Status.';
-$messages['select'] = 'Auswahl';
 $messages['remove_selected'] = 'Entferne Auswahl';
 
 $messages['notification_subject'] = 'LifeType Benachrichtigungssystem';
@@ -936,7 +926,6 @@
 $messages['search_type'] = 'Suche in';
 $messages['posts'] = 'Artikel';
 $messages['blogs'] = 'Blogs';
-$messages['resources'] = 'Resourcen';
 $messages['upload_in_progress'] = 'Daten werden gesendet, bitte warten...';
 $messages['error_incorrect_username'] = 'Der Benutzername ist nicht korrekt, er ist entweder schon vergeben, enth&auml;lt nicht erlaubte Zeichen oder ist zu lang (keine Sonderzeichen, keine Grossbuchstaben, maximal 15 Zeichen!)';
 
@@ -1117,13 +1106,9 @@
 $messages['help_default_global_article_category_id'] = 'Standard-ID f&uuml;r globale Artikelkategorien';
 $messages['help_blog_does_not_exist_url'] = 'URL, der aufgerufen werden soll, wenn ein Blog nicht existiert';
 
-$messages['error_invalid_blog_name'] = 'Der Blog Name ist ung&uuml;ltig.';
-
 /* strings for /default/ templates */
 
 
-$messages['help_forbidden_blognames'] = 'Leerschlag getrennte Liste von W&ouml;rtern, welche nicht als Blog Namen zugelassen sind. Regul&auml;r Ausdr&uuml;cke sind erlaubt. [ Standard = (leer) ]';
-
 $messages['posts_updated_ok'] = '%s Artikel erfolgreich aktualisiert.';
 $messages['error_updating_post2'] = 'Fehler beim Aktualisieren des Artikels mit der ID %s.';
 $messages['resources_updated_ok'] = '%s Ressourcen erfolgreich aktualisiert';
@@ -1145,7 +1130,7 @@
 $messages['error_updating_blog2'] = 'Fehler beim Aktualisieren des Blogs mit der ID "%s".';
 $messages['error_updating_blog'] = 'Fehler beim Aktualisieren des Blogs "%s".';
 
-$messages['error_updating_user'] = 'Fehler beim Aktualisieren des Benutzers "%s".';
+//$messages['error_updating_user'] = 'Fehler beim Aktualisieren des Benutzers "%s".';
 $messages['user_updated_ok'] = 'Benutzer "%s" wurde erfolgreich aktualisiert.';
 $messages['users_updated_ok'] = '%s Benutzer wurden erfolgreich aktualisiert.';
 $messages['eror_updating_user2'] = 'Fehler beim Aktualisieren des Benutzers mit der ID "%s".';

Modified: plog/trunk/locale/admin/locale_en_UK.php
===================================================================
--- plog/trunk/locale/admin/locale_en_UK.php	2009-12-24 12:01:15 UTC (rev 6933)
+++ plog/trunk/locale/admin/locale_en_UK.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -156,7 +156,7 @@
 $messages['url'] = 'URL';
 $messages['comment_status_all'] = 'All';
 $messages['comment_status_spam'] = 'Spam';
-$messages['comment_status_nonspam'] = 'No Spam';
+$messages['comment_status_nonspam'] = 'Not Spam';
 $messages['error_fetching_comments'] = 'There was an error while fetching the article comments';
 $messages['error_deleting_comments'] = 'There was an error removing the comments or there was no comment selected';
 $messages['comment_deleted_ok'] = 'Comment "%s" deleted successfully';
@@ -165,12 +165,12 @@
 $messages['error_deleting_comment2'] = 'There was an error deleting comment with identifier %s';
 $messages['editComments'] = 'Comments';
 $messages['mark_as_spam'] = 'Mark as spam';
-$messages['mark_as_no_spam'] = 'Mark as no spam';
+$messages['mark_as_no_spam'] = 'Mark as not spam';
 $messages['error_incorrect_comment_id'] = 'The comment identifier is not correct';
 $messages['error_marking_comment_as_spam'] = 'There was an error marking the comment as spam';
 $messages['comment_marked_as_spam_ok'] = 'The comment was marked as spam successfully';
-$messages['error_marking_comment_as_nonspam'] = 'There was an error marking the comment as no spam';
-$messages['comment_marked_as_nonspam_ok'] = 'The comment was marked as no spam successfully';
+$messages['error_marking_comment_as_nonspam'] = 'There was an error marking the comment as not spam';
+$messages['comment_marked_as_nonspam_ok'] = 'The comment was marked as not spam successfully';
 
 
 // post trackbacks
@@ -867,7 +867,7 @@
 $messages['trackbacks_no_trackback'] = 'Sending a trackback to the following URL failed: ';
 
 $messages['error_comment_spam_throw_away'] = 'You cannot post this message. Anti-spam filter has blocked it.';
-$messages['error_comment_spam_keep'] = 'The anti-spam filter has put your comment in the moderation queue and it will have to be approved by the blog owner.';
+$messages['error_comment_spam_keep'] = 'Comments are moderated to prevent spam. This may cause a delay before your post appears. Rest assured, your post or comment has been received, and is now waiting to be approved by the blog owner. Thank you!';
 
 $messages['blog_categories'] = 'Blog Categories';
 $messages['global_article_categories'] = 'Global Article Categories';
@@ -1124,7 +1124,8 @@
 $messages['error_updating_blog2'] = 'There was an error updating the blog with identifier "%s"';
 $messages['error_updating_blog'] = 'There was an error updating blog "%s"';
 
-$messages['error_updating_user'] = 'There was an error updating user "%s".';
+// TODO: this string was already used above, change it, and fix all locales
+//$messages['error_updating_user'] = 'There was an error updating user "%s".';
 $messages['user_updated_ok'] = 'User "%s" was successfully updated.';
 $messages['users_updated_ok'] = '%s users were successfully updated';
 $messages['eror_updating_user2'] = 'There was an error updating the user with identifier "%s"';

Copied: plog/trunk/locale/admin/locale_pl_PL.php (from rev 6933, plog/branches/lifetype-1.2/locale/admin/locale_pl_PL.php)
===================================================================
--- plog/trunk/locale/admin/locale_pl_PL.php	                        (rev 0)
+++ plog/trunk/locale/admin/locale_pl_PL.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,1202 @@
+<?php
+
+/////////////////                                          //////////////////
+///////////////// STRINGS FOR THE ADMINISTRATION INTERFACE //////////////////
+/////////////////                                          //////////////////
+
+// login page
+$messages['login'] = 'Login';
+$messages['welcome_message'] = 'Welcome to LifeType';
+$messages['error_incorrect_username_or_password'] = 'Sorry, Incorrect username or password.';
+$messages['error_dont_belong_to_any_blog'] = 'Sorry, you do not belong to any blog yet.';
+$messages['logout_message'] = 'You have been successfully logged out.';
+$messages['logout_message_2'] = 'Click <a href="%1$s">here</a> to go to %2$s.';
+$messages['error_access_forbidden'] = 'Access is forbidden. You must authenticate first here.';
+$messages['username'] = 'Username';
+$messages['password'] = 'Password';
+
+// dashboard
+$messages['dashboard'] = 'Dashboard';
+$messages['recent_articles'] = 'Most Recent Articles';
+$messages['recent_comments'] = 'Most Recent Comments';
+$messages['recent_trackbacks'] = 'Most Recent Trackbacks';
+$messages['blog_statistics'] = 'Blog Statistics';
+$messages['total_posts'] = 'Total Posts';
+$messages['total_comments'] = 'Total Comments';
+$messages['total_trackbacks'] = 'Total Trackbacks';
+$messages['total_viewed'] = 'Total Viewed Posts';
+$messages['in'] = 'In';
+
+// menu options
+$messages['newPost'] = 'New Post';
+$messages['Manage'] = 'Manage';
+$messages['managePosts'] = 'Manage Posts';
+$messages['editPosts'] = 'Posts';
+$messages['editArticleCategories'] = 'Categories';
+$messages['newArticleCategory'] = 'New Category';
+$messages['manageLinks'] = 'Manage Links';
+$messages['editLinks'] = 'Links';
+$messages['newLink'] = 'New Link';
+$messages['editLink'] = 'Edit Link';
+$messages['editLinkCategories'] = 'Link Categories';
+$messages['newLinkCategory'] = 'New Link Category';
+$messages['editLinkCategory'] = 'Edit Link Category';
+$messages['manageCustomFields'] = 'Manage Custom Fields';
+$messages['blogCustomFields'] = 'Custom Fields';
+$messages['newCustomField'] = 'New Custom Field';
+$messages['resourceCenter'] = 'Resource Centre';
+$messages['resources'] = 'Resources';
+$messages['newResourceAlbum'] = 'New Album';
+$messages['newResource'] = 'New Resource';
+$messages['controlCenter'] = 'Control Centre';
+$messages['manageSettings'] = 'Settings';
+$messages['blogSettings'] = 'Blog Settings';
+$messages['userSettings'] = 'User Settings';
+$messages['pluginCenter'] = 'Plugin Centre';
+$messages['Stats'] = 'Statistics';
+$messages['manageBlogUsers'] = 'Manage Blog Users';
+$messages['newBlogUser'] = 'New Blog User';
+$messages['showBlogUsers'] = 'Blog Users';
+$messages['manageBlogTemplates'] = 'Blog Templates';
+$messages['newBlogTemplate'] = 'New Blog Template';
+$messages['blogTemplates'] = 'Blog Templates';
+$messages['adminSettings'] = 'Administration';
+$messages['Users'] = 'Users';
+$messages['createUser'] = 'Create User';
+$messages['editSiteUsers'] = 'Site Users';
+$messages['Blogs'] = 'Manage Blogs';
+$messages['createBlog'] = 'Create Blog';
+$messages['editSiteBlogs'] = 'Blogs';
+$messages['Locales'] = 'Manage Locales';
+$messages['newLocale'] = 'New Locale';
+$messages['siteLocales'] = 'Site Locales';
+$messages['Templates'] = 'Manage Templates';
+$messages['newTemplate'] = 'New Template';
+$messages['siteTemplates'] = 'Site Templates';
+$messages['GlobalSettings'] = 'Global Settings';
+$messages['editSiteSettings'] = 'General';
+$messages['summarySettings'] = 'Summary';
+$messages['templateSettings'] = 'Templates';
+$messages['urlSettings'] = 'URLs';
+$messages['emailSettings'] = 'Email';
+$messages['uploadSettings'] = 'Uploads';
+$messages['helpersSettings'] = 'External Helpers';
+$messages['interfacesSettings'] = 'Interfaces';
+$messages['securitySettings'] = 'Security';
+$messages['bayesianSettings'] = 'Bayesian Filter';
+$messages['resourcesSettings'] = 'Resources';
+$messages['searchSettings'] = 'Search';
+$messages['cleanUpSection'] = 'Clean Up';
+$messages['cleanUp'] = 'Clean Up';
+$messages['editResourceAlbum'] = 'Edit Album';
+$messages['resourceInfo'] = 'Edit Resource';
+$messages['editBlog'] = 'Edit Blog';
+$messages['Logout'] = 'Logout';
+
+// new post
+$messages['topic'] = 'Topic';
+$messages['topic_help'] = 'Title of the post.';
+$messages['text'] = 'Text';
+$messages['text_help'] = 'Text of the post. This part will always appear in the front page.';
+$messages['extended_text'] = 'Extended Text';
+$messages['extended_text_help'] = 'Extended text of the post. This part can optionally appear only in the post page or in the main page. See the blog settings for more information.';
+$messages['trackback_urls'] = 'Real Trackback Urls';
+$messages['trackback_urls_help'] = 'If the article you want to send the trackback to does not support Trackback Auto-Discover mechanism, you may put its real trackback url here and use a new line for each url.';
+$messages['post_slug'] = 'Slug';
+$messages['post_slug_help'] = 'The slug will be used to generate nice permanent links.';
+$messages['date'] = 'Date';
+$messages['post_date_help'] = 'Date when this post is going to be published.';
+$messages['status'] = 'Status';
+$messages['post_status_help'] = 'Select one of these status.';
+$messages['post_status_published'] = 'Published';
+$messages['post_status_draft'] = 'Draft';
+$messages['post_status_deleted'] = 'Deleted';
+$messages['post_categories_help'] = 'Select one or more categories.';
+$messages['post_comments_enabled_help'] = 'Enable comments';
+$messages['send_notification_help'] = 'Notification of new comments.';
+$messages['send_trackback_pings_help'] = 'Send trackbacks';
+$messages['send_xmlrpc_pings_help'] = 'Send XMLRPC pings';
+$messages['save_draft_and_continue'] = 'Save draft';
+$messages['preview'] = 'Preview';
+$messages['add_post'] = 'Blog this!';
+$messages['error_saving_draft'] = 'There was an error saving the draft';
+$messages['draft_saved_ok'] = 'Draft article %s saved successfully';
+$messages['error_sending_request'] = 'There was an error sending the request';
+$messages['error_no_category_selected'] = 'Please select at least one category';
+$messages['error_missing_post_topic'] = 'Please type a post topic';
+$messages['error_missing_post_text'] = 'Please type some text for the post';
+$messages['error_adding_post'] = 'There was an error adding the post';
+$messages['post_added_not_published'] = 'Post added successfully but not published';
+$messages['post_added_ok'] = 'Post added successfully.';
+$messages['send_notifications_ok'] = 'A notification will be sent every time there is a new comment or trackback.';
+$messages['bookmarklet'] = "Bookmarklet";
+$messages['bookmarklet_help'] = "Drag this link to your toolbar or right-click it and choose Add to Favorites or Bookmark.";
+$messages['blogit_to_lifetype'] = "Blog It to LifeType!";
+$messages['original_post'] = "(Original Post)";
+
+// send trackbacks
+$messages['error_sending_trackbacks'] = 'There was an error sending the following trackbacks';
+$messages['send_trackbacks_help'] = 'Please select those URLs where you would like to send the trackback ping. Please make sure that the sites support trackback.';
+$messages['send_trackbacks'] = 'Send trackbacks';
+$messages['ping_selected'] = 'Ping selected';
+$messages['trackbacks_sent_ok'] = 'Trackbacks successfully sent to the selected URLs';
+
+// posts page
+$messages['show_by'] = 'Show By';
+$messages['author'] = 'Author';
+$messages['post_status_all'] = 'All';
+$messages['author_all'] = 'All';
+$messages['search_terms'] = 'Search terms';
+$messages['show'] = 'Show';
+$messages['delete'] = 'Delete';
+$messages['actions'] = 'Actions';
+$messages['all'] = 'All';
+$messages['category_all'] = 'All';
+$messages['error_incorrect_article_id'] = 'Incorrect article identifier';
+$messages['error_deleting_article'] = 'There was an error deleting post "%s"';
+$messages['article_deleted_ok'] = 'Post "%s" deleted successfully';
+$messages['articles_deleted_ok'] = '%s posts deleted successfully';
+$messages['error_deleting_article2'] = 'There was an error deleting the post with identifier "%s"';
+
+// edit post page
+$messages['update'] = 'Update';
+$messages['editPost'] = 'Edit Post';
+$messages['post_updated_ok'] = 'Post "%s" updated successfully.';
+$messages['error_updating_post'] = 'There was an error updating the post';
+$messages['notification_added'] = 'You will receive notifications of new comments or trackbacks';
+$messages['notification_removed'] = 'No notifications about new comments or trackbacks will be sent';
+
+// post comments
+$messages['url'] = 'URL';
+$messages['comment_status_all'] = 'All';
+$messages['comment_status_spam'] = 'Spam';
+$messages['comment_status_nonspam'] = 'No Spam';
+$messages['error_fetching_comments'] = 'There was an error while fetching the article comments';
+$messages['error_deleting_comments'] = 'There was an error removing the comments or there was no comment selected';
+$messages['comment_deleted_ok'] = 'Comment "%s" deleted successfully';
+$messages['comments_deleted_ok'] = '%s comments deleted successfully';
+$messages['error_deleting_comment'] = 'There was an error deleting comment "%s"';
+$messages['error_deleting_comment2'] = 'There was an error deleting comment with identifier %s';
+$messages['editComments'] = 'Comments';
+$messages['mark_as_spam'] = 'Mark as spam';
+$messages['mark_as_no_spam'] = 'Mark as no spam';
+$messages['error_incorrect_comment_id'] = 'The comment identifier is not correct';
+$messages['error_marking_comment_as_spam'] = 'There was an error marking the comment as spam';
+$messages['comment_marked_as_spam_ok'] = 'The comment was marked as spam successfully';
+$messages['error_marking_comment_as_nonspam'] = 'There was an error marking the comment as no spam';
+$messages['comment_marked_as_nonspam_ok'] = 'The comment was marked as no spam successfully';
+
+
+// post trackbacks
+$messages['blog'] = 'Blog';
+$messages['excerpt'] = 'Excerpt';
+$messages['error_fetching_trackbacks'] = 'There was an error while fetching the trackbacks';
+$messages['error_deleting_trackbacks'] = 'There was an error deleting the trackbacks or there were no items selected';
+$messages['error_deleting_trackback'] = 'There was an error while deleting trackback "%s"';
+$messages['error_deleting_trackback2'] = 'There was an error while deleting trackback with identifier "%s"';
+$messages['trackback_deleted_ok'] = 'Trackback "%s" deleted successfully';
+$messages['trackbacks_deleted_ok'] = '%s trackbacks deleted successfully';
+$messages['editTrackbacks'] = 'Trackbacks';
+
+// post statistics
+$messages['referrer'] = 'Referrer';
+$messages['hits'] = 'Hits';
+$messages['error_no_items_selected'] = 'No items were selected to remove';
+$messages['error_deleting_referrer'] = 'There was an error deleting referrer "%s"';
+$messages['error_deleting_referrer2'] = 'There was an error deleting referrer with identifier "%s"';
+$messages['referrer_deleted_ok'] = 'Referrer "%s" deleted successfully';
+$messages['referrers_deleted_ok'] = '%s referrers deleted successfully';
+
+// categories
+$messages['posts'] = 'Posts';
+$messages['show_in_main_page'] = 'Show in front page';
+$messages['error_category_has_articles'] = 'Category "%s" is used by some articles. Please edit the articles first and then remove the category';
+$messages['category_deleted_ok'] = 'Category "%s" deleted successfully';
+$messages['categories_deleted_ok'] = '%s categories deleted successfully';
+$messages['error_deleting_category'] = 'There was an error deleting category "%s"';
+$messages['error_deleting_category2'] = 'There was an error deleting category with identifier "%s"';
+$messages['yes'] = 'Yes';
+$messages['no'] = 'No';
+
+// new category
+$messages['name'] = 'Name';
+$messages['category_name_help'] = 'Name that will be used to display the category.';
+$messages['description'] = 'Description';
+$messages['category_description_help'] = 'Longer description for this category.';
+$messages['show_in_main_page_help'] = 'Whether posts under this category should be shown in the main page, or only when this particular category is browsed.';
+$messages['error_empty_name'] = 'You must provide a name';
+$messages['error_empty_description'] = 'You must provide a description';
+$messages['error_adding_article_category'] = 'There was an error adding the new category. Please check the data and try again';
+$messages['category_added_ok'] = 'Category "%s" was successfully added to the blog';
+$messages['add'] = 'Add';
+$messages['reset'] = 'Reset';
+
+// update category
+$messages['error_updating_article_category'] = 'There was an error updating the article category';
+$messages['article_category_updated_ok'] = 'Category "%s" was updated successfully';
+
+// links
+$messages['feed'] = 'Feed';
+$messages['error_no_links_selected'] = 'The link identifier was incorrect or no items were selected to remove';
+$messages['error_incorrect_link_id'] = 'The link identifier was not correct';
+$messages['error_removing_link'] = 'There was an error removing link "%s"';
+$messages['error_removing_link2'] = 'There was an error removing link with identifier "%s"';
+$messages['link_deleted_ok'] = 'Link "%s" was deleted successfully';
+$messages['links_deleted_ok'] = '%s links deleted successfully';
+
+// new link
+$messages['link_name_help'] = 'Name given to this link.';
+$messages['link_url_help'] = 'Address where this link points. Example: http://www.domainname.com/ (NOTE: http:// must be included!)';
+$messages['link_description_help'] = 'Brief description of this link.';
+$messages['link_feed_help'] = 'A link to any of the RSS or Atom feeds of this link can also be provided.';
+$messages['link_category_help'] = 'Choose one of the available link categories.';
+$messages['error_adding_link'] = 'There was an error adding the link. Please check the data and try again';
+$messages['error_invalid_url'] = 'The address is not correct';
+$messages['link_added_ok'] = 'Link "%s" was successfully added';
+$messages['bookmarkit_to_lifetype'] = "Bookmark It to LifeType!";
+
+// update link
+$messages['error_updating_link'] = 'There was an error updating the link. Please check the data and try again';
+$messages['error_fetching_link'] = 'There was an error fetching the link';
+$messages['link_updated_ok'] = 'Link "%s" was updated successfully';
+
+// link categories
+$messages['error_invalid_link_category_id'] = 'The link category identifier was not correct or there was no link category selected';
+$messages['error_links_in_link_category'] = 'Link category "%s" is used by some links. Modify the links first and try again';
+$messages['error_removing_link_category'] = 'There was an error removing link category "%s"';
+$messages['link_category_deleted_ok'] = 'Link category "%s" deleted successfully';
+$messages['link_categories_deleted_ok'] = '%s link categories deleted successfully';
+$messages['error_removing_link_category2'] = 'There was an error removing link category with identifier "%s"';
+
+// new link category
+$messages['link_category_name_help'] = 'Name given to this link category.';
+$messages['error_adding_link_category'] = 'There was an error adding the new link category';
+$messages['link_category_added_ok'] = 'Link category "%s" was successfully added';
+
+// edit link category
+$messages['error_updating_link_category'] = 'There was an error updating the link category. Please check the data and try again';
+$messages['link_category_updated_ok'] = 'Link category "%s" updated successfully';
+$messages['error_fetching_link_category'] = 'There was an error fetching the link category';
+
+// custom fields
+$messages['type'] = 'Type';
+$messages['hidden'] = 'Hidden';
+$messages['fields_deleted_ok'] = '%s custom fields deleted successfully';
+$messages['field_deleted_ok'] = 'Custom field "%s" deleted successfully';
+$messages['error_deleting_field'] = 'There was an error deleting custom field "%s"';
+$messages['error_deleting_field2'] = 'There was an error deleting custom field with identifier "%s"';
+$messages['error_incorrect_field_id'] = 'The custom field identifier was not valid';
+
+// new custom field
+$messages['field_name_help'] = 'Identifier that will be used to refer to the value of this field in posts.';
+$messages['field_description_help'] = 'Brief description of this field that will be shown when adding or editing posts.';
+$messages['field_type_help'] = 'Select one of the available field types.';
+$messages['field_hidden_help'] = 'If a field is hidden, it will not be shown when adding a or editing a post. This feature is mainly used by plugins.';
+$messages['error_adding_custom_field'] = 'There was an error adding the custom field. Please check the data and try again';
+$messages['custom_field_added_ok'] = 'Custom field "%s" added successfully';
+$messages['text_field'] = 'Text field';
+$messages['text_area'] = 'Text box';
+$messages['checkbox'] = 'Checkbox';
+$messages['date_field'] = 'Date chooser';
+
+// edit custom field
+$messages['error_fetching_custom_field'] = 'There was an error fetching the custom field';
+$messages['error_updating_custom_field'] = 'There was an error updating the custom field. Please check the data and try again';
+$messages['custom_field_updated_ok'] = 'Custom field "%s" updated successfully';
+
+// resources
+$messages['root_album'] = 'Root album';
+$messages['num_resources'] = 'Number of resources';
+$messages['total_size'] = 'Total size';
+$messages['album'] = 'Album';
+$messages['error_incorrect_album_id'] = 'The album identifier is not correct';
+$messages['error_base_storage_folder_missing_or_unreadable'] = 'It was not possible for LifeType to create the necessary folders where resources are going to be installed. This might be due to several reasons, such as your PHP installation running with safe mode enabled or your user not having enough permissions to do so. You may still try to carry out the operation manually, by creating the following folders: <br/><br/>%s<br/><br/>If these folders already exist please make sure that they can be read and written by the user running the web server.';
+$messages['items_deleted_ok'] = '%s items deleted successfully';
+$messages['error_album_has_children'] = 'Album "%s" has children. Please empty the album first and then try again.';
+$messages['item_deleted_ok'] = 'Item "%s"deleted successfully';
+$messages['error_deleting_album'] = 'There was an error deleting album "%s"';
+$messages['error_deleting_album2'] = 'There was an error deleting album with identifier "%s"';
+$messages['error_deleting_resource'] = 'There was an error deleting resource "%s"';
+$messages['error_deleting_resource2'] = 'There was an error deleting resource with identifier "%s"';
+$messages['error_no_resources_selected'] = 'No items were selected to delete';
+$messages['resource_deleted_ok'] = 'Resource "%s" was deleted successfully';
+$messages['album_deleted_ok'] = 'Album "%s" was deleted successfully';
+$messages['add_resource'] = 'Add resource';
+$messages['add_resource_preview'] = 'Add preview';
+$messages['add_resource_medium'] = 'Add medium preview';
+$messages['add_album'] = 'Add album';
+
+// new album
+$messages['album_name_help'] = 'Short name for the new album.';
+$messages['parent'] = 'Parent';
+$messages['no_parent'] = 'No parent';
+$messages['parent_album_help'] = 'Use this to have albums within albums and better organize your files.';
+$messages['album_description_help'] = 'Longer description of the contents of this album.';
+$messages['error_adding_album'] = 'There was an error adding the new album. Please check the data and try again';
+$messages['album_added_ok'] = 'Album "%s" successfully added';
+
+// edit album
+$messages['error_incorrect_album_id'] = 'The album identifier is not correct';
+$messages['error_fetching_album'] = 'There was an error fetching the album';
+$messages['error_updating_album'] = 'There was an error updating the album. Please check the data and try again';
+$messages['album_updated_ok'] = 'Album "%s" updated successfully';
+$messages['show_album_help'] = 'If disabled, the album will not be shown in the list of albums available in this blog.';
+
+// new resource
+$messages['file'] = 'File';
+$messages['resource_file_help'] = 'File that will be added to the current blog. Use the "Add field" link to upload more than one file at the same time.';
+$messages['add_field'] = 'Add field';
+$messages['resource_description_help'] = 'Longer description of the contents of this file.';
+$messages['resource_album_help'] = 'Select the album to which this file will be added.';
+$messages['error_no_resource_uploaded'] = 'There was no file selected to upload';
+$messages['resource_added_ok'] = 'Resource "%s" added successfully';
+$messages['error_resource_forbidden_extension'] = 'The file was not added because it is of a forbidden type';
+$messages['error_resource_too_big'] = 'The file was not added because it is too big';
+$messages['error_uploads_disabled'] = 'The file was not added because uploads have been disabled';
+$messages['error_quota_exceeded'] = 'The file was not added because resource quota has been exceeded';
+$messages['error_adding_resource'] = 'There was an error adding the resource file';
+
+// edit resource
+$messages['editResource'] = 'Edit Resource';
+$messages['resource_information_help'] = 'Below is some information about this resource file.';
+$messages['information'] = 'Information';
+$messages['thumbnail_format'] = 'Thumbnail format';
+$messages['regenerate_preview'] = 'Regenerate preview';
+$messages['error_fetching_resource'] = 'There was an error fetching the resource';
+$messages['error_updating_resource'] = 'There was an error updating the resource';
+$messages['resource_updated_ok'] = 'Resource "%s" updated successfully';
+
+// blog settings
+$messages['blog_link'] = 'Blog link';
+$messages['blog_link_help'] = 'Permanent link to this blog';
+$messages['blog_name_help'] = 'Title for this blog';
+$messages['blog_description_help'] = 'Longer description about the contents of this blog.';
+$messages['language'] = 'Language';
+$messages['blog_language_help'] = 'Language used to display the texts of this blog, both in the public and administration side.';
+$messages['max_main_page_items'] = 'Number of items in the main page';
+$messages['max_main_page_items_help'] = 'Number of posts that should be displayed at all times in the main page of the blog.';
+$messages['max_recent_items'] = 'Number of recent items';
+$messages['max_recent_items_help'] = 'Maximum number of posts that will be shown as recent in the front page.';
+$messages['template'] = 'Template';
+$messages['choose'] = 'Choose';
+$messages['blog_template_help'] = 'Template that will be used to display the contents of the blog. This list includes global templates plus all the templates installed only for this blog.';
+$messages['use_read_more'] = 'Use "more..." link in posts';
+$messages['use_read_more_help'] = 'If enabled, only the text typed in the "Text" textbox will be shown in the main page. In order to display the "Extended text", a "more..." link will be added to each post.';
+$messages['enable_wysiwyg'] = 'Enable the visual editor of posts';
+$messages['enable_wysiwyg_help'] = 'Enables a more powerful, visual editor of HTML mark up. The editor only works in Internet Explorer 5.5 or higher or Mozilla 1.3 or higher.';
+$messages['enable_comments'] = 'Enable comments';
+$messages['enable_comments_help'] = 'Enable comments for all posts.';
+$messages['show_future_posts'] = 'Show future posts in the calendar';
+$messages['show_future_posts_help'] = 'Whether posts which have a date in the future should appear in the calendar and visible to users.';
+$messages['comments_order'] = 'Comments order';
+$messages['comments_order_help'] = 'Order in which comments should be displayed in the front page.';
+$messages['articles_order'] = 'Articles order';
+$messages['articles_order_help'] = 'Order in which articles should be displayed.';
+$messages['oldest_first'] = 'Oldest first';
+$messages['newest_first'] = 'Newest first';
+$messages['categories_order'] = 'Categories order';
+$messages['categories_order_help'] = 'Order in which categories should be displayed in the front page.';
+$messages['most_recent_updated_first'] = 'Most recently updated first';
+$messages['alphabetical_order'] = 'Alphabetical order';
+$messages['reverse_alphabetical_order'] = 'Reverse alphabetical order';
+$messages['most_articles_first'] = 'Most articles first';
+$messages['link_categories_order'] = 'Link categories order';
+$messages['link_categories_order_help'] = 'Order in which link categories should appear in the front page.';
+$messages['most_links_first'] = 'Most links first';
+$messages['most_links_last'] = 'Most links last';
+$messages['time_offset'] = 'Time offset';
+$messages['time_offset_help'] = 'Time difference in hours that will be dynamically added to each date and time in the blog.';
+$messages['close'] = 'Close';
+$messages['select'] = 'Select';
+$messages['error_updating_settings'] = 'There was an error updating the blog settings. Please check the data and try again';
+$messages['error_invalid_number'] = 'The number is not correct';
+$messages['error_incorrect_time_offset'] = 'The time offset is not valid';
+$messages['blog_settings_updated_ok'] = 'Blog settings updated successfully';
+$messages['hours'] = 'Hours';
+
+// user settings
+$messages['username_help'] = 'Public username. It cannot be changed.';
+$messages['full_name'] = 'Full name';
+$messages['full_name_help'] = 'Complete full name';
+$messages['password_help'] = 'Type and confirm a new password, or leave empty for no change.';
+$messages['confirm_password'] = 'Confirm password';
+$messages['email'] = 'Email';
+$messages['email_help'] = 'Email address where notifications will be sent.';
+$messages['bio'] = 'Your bio';
+$messages['bio_help'] = 'A longer description of yourself can be provided here.';
+$messages['picture'] = 'Picture';
+$messages['user_picture_help'] = 'Please select a picture from the ones uploaded to this blog as your personal picture.';
+$messages['error_invalid_password'] = 'The password is not correct. Please make sure that it is not too short';
+$messages['error_passwords_dont_match'] = 'Sorry, passwords do not match';
+$messages['error_updating_user_settings'] = 'There was an error updating your user settings. Please check the data and try again';
+$messages['user_settings_updated_ok'] = 'User settings updated successfully';
+$messages['resource'] = 'Resource';
+
+// plugin centre
+$messages['identifier'] = 'Identifier';
+$messages['error_plugins_disabled'] = 'Sorry, Plugins are disabled.';
+
+// blog users
+$messages['revoke_permissions'] = 'Revoke permissions';
+$messages['error_no_users_selected'] = 'There were no users selected';
+$messages['user_removed_from_blog_ok'] = 'User "%s" does not have permissions to access this blog any more';
+$messages['users_removed_from_blog_ok'] = '%s users do not have access to this blog any more';
+$messages['error_removing_user_from_blog'] = 'There was an error removing access to this blog from user "%s"';
+$messages['error_removing_user_from_blog2'] = 'There was an error removing access to this blog from user whose identifier is "%s"';
+
+// new blog user
+$messages['new_blog_username_help'] = 'Username of the user to whom you would like to give access to this blog. New users will only have access to the "Manage" and "Resources" sections.';
+$messages['send_notification'] = 'Send notification';
+$messages['send_user_notification_help'] = 'Send an email notification to this user.';
+$messages['notification_text'] = 'Notification Text';
+$messages['notification_text_help'] = 'Text that will be included in the notification message.';
+$messages['error_adding_user'] = 'There was an error granting access to the user. Please check the data and try again';
+$messages['error_empty_text'] = 'You must provide some text';
+$messages['error_adding_user'] = 'There was an error adding the user. Please check the data and try again';
+$messages['error_invalid_user'] = 'The user "%s" is not valid or does not exist';
+$messages['user_added_to_blog_ok'] = 'User "%s" has been given access to this blog successfully';
+
+// blog templates
+$messages['error_no_templates_selected'] = 'There were no templates selected';
+$messages['error_template_is_current'] = 'Template "%s" cannot be deleted because it is the current one';
+$messages['error_removing_template'] = 'There was an error deleting template "%s"';
+$messages['template_removed_ok'] = 'Template "%s" deleted successfully';
+$messages['templates_removed_ok'] = '%s templates deleted successfully';
+
+// new blog template
+$messages['template_installed_ok'] = 'Template "%s" added successfully';
+$messages['error_installing_template'] = 'There was an error installing template "%s"';
+$messages['error_missing_base_files'] = 'Some of the template files are missing';
+$messages['error_add_template_disabled'] = 'New templates cannot be added because this feature has been disabled in this site';
+$messages['error_must_upload_file'] = 'There was no template package uploaded';
+$messages['error_uploads_disabled'] = 'Uploads have been disabled in this site';
+$messages['error_no_new_templates_found'] = 'No new templates were found';
+$messages['error_template_not_inside_folder'] = 'The files used in the template set must be inside a folder with the same name as the template set';
+$messages['error_missing_base_files'] = 'Some of the basic template files are missing';
+$messages['error_unpacking'] = 'There was an error unpacking the file';
+$messages['error_forbidden_extensions'] = 'The template set included files with forbidden extensions';
+$messages['error_creating_working_folder'] = 'There was an error creating a temporary folder to unpack the files';
+$messages['error_checking_template'] = 'There was an error checking the template: %s';
+$messages['template_package'] = 'Template package';
+$messages['blog_template_package_help']  = 'Use this form to upload a new template set, which will only be available to your blog. If it is not possible to upload a template package using this form, upload the template set manually and place it in <b>%s</b>, which is the folder where your blog templates are stored and click the "<b>Scan templates</b>" button. LifeType will scan the folder and will automatically add any new template it can find.';
+$messages['scan_templates'] = 'Scan Templates';
+
+// site users
+$messages['user_status_active'] = 'Active';
+$messages['user_status_disabled'] = 'Disabled';
+$messages['user_status_all'] = 'All';
+$messages['user_status_unconfirmed'] = 'Unconfirmed';
+$messages['error_invalid_user2'] = 'User with identifier "%s" does not exist';
+$messages['error_deleting_user'] = 'There was an error disabling user "%s"';
+$messages['user_deleted_ok'] = 'User "%s" disabled successfully';
+$messages['users_deleted_ok'] = '%s users disabled successfully';
+
+// create user
+$messages['user_added_ok'] = 'User "%s" added successfully';
+$messages['user_status_help'] = 'Current status for this user';
+$messages['user_blog_help'] = 'Blog to which this user will be initially assigned.';
+$messages['none'] = 'None';
+
+// edit user
+$messages['error_invalid_user'] = 'The user identifier is not correct or the user does not exist';
+$messages['error_updating_user'] = 'There was an error updating the user settings. Please check the data and try again';
+$messages['blogs'] = 'Blogs';
+$messages['user_blogs_help'] = 'Blogs which this user currently owns or where this user has access.';
+$messages['site_admin'] = 'Administrator';
+$messages['site_admin_help'] = 'Whether this user has administrator privileges and is allowed to see the "Administration" area and perform administrative tasks.';
+$messages['user_updated_ok'] = 'User "%s" updated successfully';
+
+// site blogs
+$messages['blog_status_all'] = 'All';
+$messages['blog_status_active'] = 'Active';
+$messages['blog_status_disabled'] = 'Disabled';
+$messages['blog_status_unconfirmed'] = 'Unconfirmed';
+$messages['owner'] = 'Owner';
+$messages['quota'] = 'Quota';
+$messages['bytes'] = 'bytes';
+$messages['error_no_blogs_selected'] = 'No blogs were selected to disable';
+$messages['error_blog_is_default_blog'] = 'Blog "%s" cannot be deleted because it is set as the default blog';
+$messages['blog_deleted_ok'] = 'Blog "%s" disabled successfully';
+$messages['blogs_deleted_ok'] = '%s blogs deleted successfully';
+$messages['error_deleting_blog'] = 'There was an error disabling blog "%s"';
+$messages['error_deleting_blog2'] = 'There was an error disabling blog with identifier "%s"';
+
+// create blog
+$messages['error_adding_blog'] = 'There was an error adding the blog. Please check the data and try again';
+$messages['blog_added_ok'] = 'Blog "%s" successfully added';
+
+// edit blog
+$messages['blog_status_help'] = 'Blog status';
+$messages['blog_owner_help'] = 'User who will be set as the owner, with full control on the blog settings.';
+$messages['users'] = 'Users';
+$messages['blog_quota_help'] = 'Resource quota in bytes. Set as 0 for unlimited or leave empty to make the blog use the global quota.';
+$messages['edit_blog_settings_updated_ok'] = 'Blog "%s" updated successfully';
+$messages['error_updating_blog_settings'] = 'There was an error updating blog "%s"';
+$messages['error_incorrect_blog_owner'] = 'The user selected as blog owner is not correct';
+$messages['error_fetching_blog'] = 'There was an error fetching the blog';
+$messages['error_updating_blog_settings2'] = 'There was an error updating the blog. Please check the data and try again';
+$messages['add_or_remove'] = 'Add or remove users';
+
+// site locales
+$messages['locale'] = 'Locale';
+$messages['locale_encoding'] = 'Encoding';
+$messages['locale_deleted_ok'] = 'Locale "%s" deleted successfully';
+$messages['error_no_locales_selected'] = 'There were no locales selected to remove';
+$messages['error_deleting_only_locale'] = 'The locale cannot be deleted because is is the only one left in the system';
+$messages['locales_deleted_ok']= '%s locales deleted successfully';
+$messages['error_deleting_locale'] = 'There was an error deleting locale "%s"';
+$messages['error_locale_is_default'] = 'Locale "%s" cannot be deleted because it is the default locale for new blogs';
+
+// add locale
+$messages['error_invalid_locale_file'] = 'The locale file is not valid';
+$messages['error_no_new_locales_found'] = 'No new locale files were found';
+$messages['locale_added_ok'] = 'Locale "%s" added successfully';
+$messages['error_saving_locale'] = 'There was an error saving the new locale';
+$messages['scan_locales'] = 'Scan Locales';
+$messages['add_locale_help'] = 'Use this form to upload a new locale file. If it is not possible to upload files using this form, upload the locale file manually and place it in <b>./locales/</b>, which is the folder where locale files are stored and click the "<b>Scan Locales</b>" button. LifeType will scan the folder and will automatically add any new locale file can find.';
+
+// site templates
+$messages['error_template_is_default'] = 'Template "%s" cannot be deleted because it is the default one for new blogs';
+
+// add template
+$messages['global_template_package_help'] = 'Use this form to upload a new template set, which will be available to all blogs in the site. If it is not possible to upload a template package using this form, upload the template set manually and place it in <b>%s</b>, which is the folder where globally available templates are stored and click the "<b>Scan templates</b>" button. LifeType will scan the folder and will automatically add any new template it can find.';
+
+// global settings
+$messages['site_config_saved_ok'] = 'Site settings saved successfully';
+$messages['error_saving_site_config'] = 'There was an error saving the site settings';
+/// general settings
+$messages['help_comments_enabled'] = 'Enable comments for new blogs by default. [Default = Yes]';
+$messages['help_beautify_comments_text'] = 'If enabled, comments posted by users will be formatted by adding paragraphs and auto-linking all URLs. [Default = Yes]';
+$messages['help_temp_folder'] = 'Folder that LifeType can use to write its temporary data such as compiled templates, etc. Use a folder outside the web server tree for increased security. [Default = ./tmp]';
+$messages['help_base_url'] = 'Base URL where this blog is installed.';
+$messages['help_subdomains_enabled'] = 'Enable subdomains. Please see the documentation for more information regarding subdomains. [Default = No]';
+$messages['help_include_blog_id_in_url'] = 'Meaningful only when subdomains are enabled and "normal" URLs are enabled, forces internally-generated URLs not to have the "blogId" parameter. Do not change unless you know what you are doing. [Default = Yes]';
+$messages['help_script_name'] = 'Set this if you need to rename index.php to something else. [Default = index.php]';
+$messages['help_show_posts_max'] = 'Maximum number of posts shown in the main page. Only meaningful for new blogs. [Default = 15]';
+$messages['help_recent_posts_max'] = 'Maximum number of recent posts shown in the main page. Only meaningful for new blogs. [Default = 10]';
+$messages['help_save_drafts_via_xmlhttprequest_enabled'] = 'Whether the feature that allows to save drafts via Javascript and XmlHttpRequest is enabled. [Default = Yes]';
+$messages['help_locale_folder'] = 'Folder where the locale files are stored. [Default = ./locale]';
+$messages['help_default_locale'] = 'Default language settings for new blogs. [Default = en_UK]';
+$messages['help_default_blog_id'] = 'Default blog that will be shown if no other is specified. [Default = 1]';
+$messages['help_default_time_offset'] = 'Default time offset for new blogs. [Default = 0]';
+$messages['help_html_allowed_tags_in_comments'] = 'Space-separated list of the HTML tags that are allowed in comments. [Default = &lt;a&gt;&lt;i&gt;&lt;br&gt;&lt;br/&gt;&lt;b&gt;]';
+$messages['help_referer_tracker_enabled'] = 'Enable the feature to save referrers to the database. Set to "No" for higher performance. [Default = Yes]';
+$messages['help_show_more_enabled'] = 'Enable the "more..." feature by default for new blogs. [Default = Yes]';
+$messages['help_update_article_reads'] = 'Enable the update of the counter of times that an article has been read is updated or not. Set to "No" for higher performance. [Default = Yes]';
+$messages['help_update_cached_article_reads'] = 'Enable the update of the counter of times that an article has been read is updated, even when caching has been turned on. [Default = Yes]';
+$messages['help_xmlrpc_ping_enabled'] = 'Enable sending XMLRPC pings to sites that support this feature. [Default = Yes]';
+$messages['help_send_xmlrpc_pings_enabled_by_default'] = 'Enable sending XMLRPC pings by default when posting or updating an article. [Default = Yes]';
+$messages['help_xmlrpc_ping_hosts'] = 'URL pointing to the XMLRPC interface of sites that support the XMLRPC ping specification. Put each URL in one new line. [Default = http://rpc.weblogs.com/RPC2]';
+$messages['help_trackback_server_enabled'] = 'Enable incoming trackbacks. [Default = Yes]';
+$messages['help_htmlarea_enabled'] = 'Enable the WYSIWYG post editor by default in new blogs. [Default = Yes]';
+$messages['help_plugin_manager_enabled'] = 'Enable plugins. [Default = Yes]';
+$messages['help_minimum_password_length'] = 'Minimum length for passwords. [Default = 4]';
+$messages['help_xhtml_converter_enabled'] = 'If enabled, LifeType will try to convert all HTML code into proper XHTML code. [Default = Yes]';
+$messages['help_xhtml_converter_aggressive_mode_enabled'] = 'If enabled, LifeType will try even harder to generate XHTML out of HTML code, but it will be more prone to errors. [Default = No]';
+$messages['help_session_save_path'] = 'Please use this setting to change the folder where LifeType stores its session data, via the PHP function session_save_path() Please make sure that the folder is writable by the web server. Leave empty to use PHP\'s default session folder. [Default = (empty)]';
+// summary settings
+$messages['help_summary_page_show_max'] = 'Number of items that will be shown in the summary page. This setting control all lists in the summary page (recent articles, most active blogs, etc). [Default = 10]';
+$messages['help_summary_items_per_page'] = 'Number of blogs per page in the "Blogs List" section. [Default = 25]';
+$messages['help_forbidden_usernames'] = 'List of usernames separated by a blank space that are not allowed to be registered. [Default = admin www blog ftp]';
+$messages['help_force_one_blog_per_email_account'] = 'Restrict to only one blog per email account. [Default = No]';
+$messages['help_summary_show_agreement'] = 'Show an agreement text and make users accept it before proceeding to the registration process. [Default = Yes]';
+$messages['help_need_email_confirm_registration'] = 'Force users to confirm their registration by clicking a link embedded in an email sent to their account. [Default = Yes]';
+$messages['help_summary_disable_registration'] = 'Disable users registration of new blogs in this site. [Default = Yes]';
+// templates
+$messages['help_template_folder'] = 'Folder where templates are stored. [Default = ./templates]';
+$messages['help_default_template'] = 'Default template for new blogs. [Default = standard]';
+$messages['help_users_can_add_templates'] = 'Allow users to upload their own custom templates. [Default = Yes]';
+$messages['help_template_compile_check'] = 'If enabled, Smarty will check every time if template files have changed and if so, use the new version. Set this to disabled for higher performance. [Default = Yes]';
+$messages['help_template_cache_enabled'] = 'Enable the template cache. If enabled, the cached version of a page will be used whenever possible. No data will need to be fetched from the database and templates will not need to be recompiled. [Default = Yes]';
+$messages['help_template_cache_lifetime'] = 'Lifetime in seconds of the cache. Set to -1 to force the cache to never expire. If set to 0, the cache will be disabled but it is recommended to set template_cache_enabled to "No" in order to disable the cache. [Default = -1]';
+$messages['help_template_http_cache_enabled'] = 'Enable support for HTTP conditional requests. If enabled, LifeType will take the "If-Modified-Since" HTTP header into account and send only content if strictly needed. Enable this to save bandwidth [Default = Yes]';
+$messages['help_allow_php_code_in_templates'] = 'Allows to embed native PHP code in Smarty templates inside {php}...{/php} blocks. [Default = No]';
+// urls
+$messages['help_request_format_mode'] = 'Select one of the available URL format. If using custom URLs, make sure to configure the settings below. [Default = Plain]';
+$messages['plain'] = 'Plain';
+$messages['search_engine_friendly'] = 'Search engine friendly';
+$messages['custom_url_format'] = 'Custom URLs';
+$messages['help_permalink_format'] = 'Format for permalinks when using custom URLs. [Default = /blog/{blogname}/{catname}/{year}/{month}/{day}/{postname}$]';
+$messages['help_category_link_format'] = 'Format for links to categories when using custom URLs. [Default = /blog/{blogname}/{catname}$]';
+$messages['help_blog_link_format'] = 'Format for links to blogs when using custom URLs. [Default = /blog/{blogname}$]';
+$messages['help_archive_link_format'] = 'Format for links to archives when using custom URLs. [Default = /blog/{blogname}/archives/{year}/?{month}/?{day}]';
+$messages['help_user_posts_link_format'] = 'Format for articles posted by a certain user when using custom URLs. [Default = /blog/{blogname}/user/{username}$]';
+$messages['help_post_trackbacks_link_format'] = 'Format for links to the trackbacks page when using custom URLs. [Default = /blog/{blogname}/post/trackbacks/{postname}$]';
+$messages['help_template_link_format'] = 'Format for links to custom static template pages when using custom URLs. [Default = /blog/{blogname}/page/{templatename}$]';
+$messages['help_album_link_format'] = 'Format for links to resource albums when using custom URLs. [Default = /blog/{blogname}/album/{albumname}$]';
+$messages['help_resource_link_format'] = 'Format for links to resource pages with files when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/{resourcename}$]';
+$messages['help_resource_preview_link_format'] = 'Format for links to resource previews when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/preview/{resourcename}$]';
+$messages['help_resource_medium_size_preview_link_format'] = 'Format for links to medium-sized resource previews when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/preview-med/{resourcename}$]';
+$messages['help_resource_download_link_format'] = 'Format for links to files when using custom URLs. [Default = /blog/{blogname}/resource/{albumname}/download/{resourcename}$]';
+// email
+$messages['help_check_email_address_validity'] = 'When checking email addresses, perform some basic checks to see whether an MX record exists in the given domain and if so, if the email address is actually a valid mailbox. [Default = No]';
+$messages['help_email_service_enabled'] = 'Enable outgoing emails [Default = Yes]';
+$messages['help_post_notification_source_address'] = 'Email address that will appear in the "From:" field when sending emails from LifeType. [Default = noreply at your.host.com]';
+$messages['help_email_service_type'] = 'Which system to use in order to send emails. [Default = PHP]';
+$messages['help_smtp_host'] = 'If using SMTP as the email sending system, set this to the SMTP server that will be used to send out the messages. [Default = (empty)]';
+$messages['help_smtp_port'] = 'If the SMTP server is running in a port other than 25, configure this value. [Default = (empty)]';
+$messages['help_smtp_use_authentication'] = 'Enable this if the SMTP server requires basic authentication.  [Default = No]';
+$messages['help_smtp_username'] = 'If the SMTP server requires authentication, set this to the right username. [Default = (empty)]';
+$messages['help_smtp_password'] = 'If the SMTP server requires authentication, set this to the password of the username above. [Default = (empty)]';
+// helpers
+$messages['help_path_to_tar'] = 'Path to the "tar" tool, needed to unpack template sets in .tar.gz or tar.bz2 formats. [Default = /bin/tar]';
+$messages['help_path_to_gzip'] = 'Path to the "gzip" tool, needed to unpack template sets in .tar.gz format. [Default = /bin/gzip]';
+$messages['help_path_to_bz2'] = 'Path to the "bzip2" tool, needed to unpack template sets in .tar.bz2 format. [Default = /usr/bin/bzip2]';
+$messages['help_path_to_unzip'] = 'Path to the "unzip" tool, needed to unpack template sets in .zip format. [Default = /usr/bin/unzip]';
+$messages['help_unzip_use_native_version'] = 'Use a bundled PHP native version to unpack .zip files. [Default = No]';
+// uploads
+$messages['help_uploads_enabled'] = 'Whether users are allowed to upload files. This affects the resources section and the upload of custom templates and locales. [Default = Yes]';
+$messages['help_maximum_file_upload_size'] = 'Maximum file size allowed in bytes. This limit will never be higher than PHP\'s own limit. [Default = 2000000]';
+$messages['help_upload_forbidden_files'] = 'Space-separated list of file types not allowed to be uploaded. Usage of \'*\' and \'?\' is allowed. [Default = *.php *.php3 *.php4 *.phtml]';
+// interfaces
+$messages['help_xmlrpc_api_enabled'] = 'Enable XMLRPC access to blogs. [Default = Yes]';
+$messages['help_rdf_enabled'] = 'Enable the syndication of contents via Atom or RSS. [Default = Yes]';
+$messages['help_default_rss_profile'] = 'Default version of RSS or Atom used to syndicate contents unless otherwise specified. [Default = RSS 1.0]';
+// security
+$messages['help_security_pipeline_enabled'] = 'Enable the security pipeline and all related filters. This also affects plugins that register new filters. [Default = Yes]';
+$messages['help_maximum_comment_size'] = 'Maximum size in bytes that a comment can have, set to 0 to disable this feature. [Default = 0]';
+// bayesian filter
+$messages['help_bayesian_filter_enabled'] = 'Enable the Bayesian filter for improved automatic spam filtering. [Default = Yes]';
+$messages['help_bayesian_filter_spam_probability_treshold'] = 'Maximum threshold before which a comment can be considered spam. [Default = 0.9]';
+$messages['help_bayesian_filter_nonspam_probability_treshold'] = 'Minimum threshold after which a post can be considered non-spam. [Default = 0.2]';
+$messages['help_bayesian_filter_min_length_token'] = 'Minimum length of a token in order for it to be considered meaningful for the Bayesian filter. [Default = 3]';
+$messages['help_bayesian_filter_max_length_token'] = 'Maximum length of a token in order for it to be considered meaningful for the Bayesian filter. [Default = 100]';
+$messages['help_bayesian_filter_number_significant_tokens'] = 'Number of significant tokens. [Default = 15]';
+$messages['help_bayesian_filter_spam_comments_action'] = 'What to do with comments that are considered spam. Set to "Throw away" only when your filter has been properly trained. [Default = Keep]';
+$messages['keep_spam_comments'] = 'Keep in the database marked as "Spam"';
+$messages['throw_away_spam_comments'] = 'Throw them away (do not save them)';
+// resources
+$messages['help_resources_enabled'] = 'Enable resources. [Default = Yes]';
+$messages['help_resources_folder'] = 'Relative path to the folder where resource files (pictures, videos etc.) will be kept. [Default = ./gallery]';
+$messages['help_thumbnail_method'] = 'Method used to generate thumbnails. If using PHP, support for GD is required. [Default = PHP]';
+$messages['help_path_to_convert'] = 'Path to the "convert" tool from the ImageMagick package. Mandatory if the thumbnail method is "ImageMagick". [Default = /usr/bin/convert]';
+$messages['help_thumbnail_format'] = 'Format in which thumbnails are saved. [Default = Same as image]';
+$messages['help_thumbnail_height'] = 'Default height for small thumbnails. [Default = 120]';
+$messages['help_thumbnail_width'] = 'Default width for small thumbnails. [Default = 120]';
+$messages['help_medium_size_thumbnail_height'] = 'Default height for medium thumbnails. [Default = 480]';
+$messages['help_medium_size_thumbnail_width'] = 'Default width for medium thumbnails. [Default = 640]';
+$messages['help_thumbnails_keep_aspect_ratio'] = 'Keep the aspect ratio when generating thumbnails. Might generate thumbnails bigger than the sizes specified above but quality is better. [Default = Yes]';
+$messages['help_thumbnail_generator_force_use_gd1'] = 'Force LifeType to use GD1-only functions. [Default = No]';
+$messages['help_thumbnail_generator_user_smoothing_algorithm'] = 'Algorithm used to smooth thumbnails. Only used when the thumbnail method is GD. [Default = PHP Imagecopyresampled]';
+$messages['help_resources_quota'] = 'Global resource quota for blogs in bytes (i.e. 5242880 Bytes = 5MB), or set to 0 for unlimited quota. [Default = 0]';
+$messages['help_resource_server_http_cache_enabled'] = 'Enable support for the "If-Modified-Since" header and HTTP conditional requests. Enable for increased bandwidth savings. [Default = No]';
+$messages['help_resource_server_http_cache_lifetime'] = 'Time in seconds that clients should use the cached version of resources. [Default = 86400]';
+$messages['same_as_image'] = 'Same as original image';
+// search
+$messages['help_search_engine_enabled'] = 'Enable the search engine. [Default = Yes]';
+$messages['help_search_in_custom_fields'] = 'Search in custom fields. [Default = Yes]';
+$messages['help_search_in_comments'] = 'Search in comments. [Default = Yes]';
+
+// cleanup
+$messages['purge'] = 'Purge';
+$messages['cleanup_spam'] = 'Purge Spam';
+$messages['cleanup_spam_help'] = 'This will remove all comments that have been marked as spam by users. It will not be possible to recover them once they have been removed.';
+$messages['spam_comments_purged_ok'] = 'Spam comments purged successfully';
+$messages['cleanup_posts'] = 'Purge Posts';
+$messages['cleanup_posts_help'] = 'This will remove all posts that have been deleted by users (marked as "Deleted") It will not be possible to recover them once they have been removed.';
+$messages['posts_purged_ok'] = 'Posts purged successfully';
+$messages['purging_error'] = 'There was a failure while purging the data';
+
+/// summary ///
+// front page
+$messages['summary'] = 'Summary';
+$messages['register'] = 'Register';
+$messages['summary_welcome'] = 'Welcome!';
+$messages['summary_most_active_blogs'] = 'Most Active Blogs';
+$messages['summary_most_commented_articles'] = 'Most Commented Articles';
+$messages['summary_most_read_articles'] = 'Most Read articles';
+$messages['password_forgotten'] = 'Forgot your password?';
+$messages['summary_newest_blogs'] = 'Newest Blogs';
+$messages['summary_latest_posts'] = 'Latest Posts';
+$messages['summary_search_blogs'] = 'Search Blogs';
+
+// blog list
+$messages['updated'] = 'Updated';
+$messages['total_reads'] = 'total';
+
+// blog profile
+$messages['blog'] = 'Blog';
+$messages['latest_posts'] = 'Latest posts';
+
+// registration
+$messages['register_step0_title'] = 'Service terms acceptance';
+$messages['agreement'] = 'Agreement'; 
+$messages['decline'] = 'Decline';
+$messages['accept'] = 'Accept';
+$messages['read_service_agreement'] = 'Please read the terms of this service and click the "Accept" button if you agree';
+$messages['register_step1_title'] = 'Create a user [1/4]';
+$messages['register_step1_help'] = 'First you need to create a new user in order to get a blog. This user will be the owner of the blog and will have access to all its functionalities.';
+$messages['register_next'] = 'Next';
+$messages['register_back'] = 'Back';
+$messages['register_step2_title'] = 'Create a blog [2/4]';
+$messages['register_blog_name_help'] = 'Name for your new blog';
+$messages['register_step3_title'] = 'Choose a Template [3/4]';
+$messages['step1'] = 'Step 1';
+$messages['step2'] = 'Step 2';
+$messages['step3'] = 'Step 3';
+$messages['register_step3_help'] = 'Please select one of the available templates as the default one for your blog. If you do not like it later on, it can always be changed.';
+$messages['error_must_choose_template'] = 'Please select one template';
+$messages['select_template'] = 'Select template';
+$messages['register_step5_title'] = 'Congratulations! [4/4]';
+$messages['finish'] = 'Finish';
+$messages['register_need_confirmation'] = 'An email message including the confirmation has been sent to your email address, please click the link as soon as you receive the message to start blogging!';
+$messages['register_step5_help'] = 'Congratulations, your new user and blog have been successfully created!';
+$messages['register_blog_link'] = 'If you would like to take a look at your new blog, you can go there now: <a href="%2$s">%1$s</a>';
+$messages['register_blog_admin_link'] = 'If you prefer to start posting right away, please click to go to the <a href="admin.php">administration interface</a>';
+$messages['register_error'] = 'There was an error during the process';
+$messages['error_registration_disabled'] = 'Sorry, registration of new blogs in this site has been disabled';
+// registration article topic and text
+$messages['register_default_article_topic'] = 'Congratulations!';
+$messages['register_default_article_text'] = 'If you can read this post, it means that the registration process was successful and that you can start blogging';
+$messages['register_default_category'] = 'General';
+// confirmation email
+$messages['register_confirmation_email_text'] = 'Please click the link below in order to activate your blog:
+
+%s
+
+Have a nice day';
+$messages['error_invalid_activation_code'] = 'Sorry, the confirmation code is not valid';
+$messages['blog_activated_ok'] = 'Congratulations, your new user and blog have been successfully validated!';
+// forgot your password?
+$messages['reset_password'] = 'Reset your password';
+$messages['reset_password_username_help'] = 'Name of the user whose password you would like to reset.';
+$messages['reset_password_email_help'] = 'Email address which was used to register this user.';
+$messages['reset_password_help'] = 'Use this form to reset the password of your user, should you not remember it. Please type the name of the user whose password you would like to reset, as well as the email address that was used to register this user.';
+$messages['error_resetting_password'] = 'There was an error resetting the password. Please check the data and try again';
+$messages['reset_password_error_incorrect_email_address'] = 'The email address is not correct or it is not the email address used to register this user';
+$messages['password_reset_message_sent_ok'] = 'An email message with a link has been sent to your email address. Please click the link in order to reset your password';
+$messages['error_incorrect_request'] = 'The parameters in the URL are not correct';
+$messages['change_password'] = 'Set new password';
+$messages['change_password_help'] = 'Please type and confirm your new password.';
+$messages['new_password'] = 'New password';
+$messages['new_password_help'] = 'Type here your new password.';
+$messages['password_updated_ok'] = 'Your password has been successfully updated';
+
+// Suggested by BCSE, some useful messages that not available in official locale
+$messages['upgrade_information'] = 'This page looks plain and un-styled because you\'re using a non-standard compliant browser. To see it in its best form, please <a href="http://www.webstandards.org/upgrade/" title="The Web Standards Project\'s Browser Upgrade initiative">upgrade</a> to a browser that supports web standards. It\'s free and painless.';
+$messages['jump_to_navigation'] = 'Jump to Navigation.';
+$messages['comment_email_never_display'] = 'Line and paragraph breaks automatic, e-mail address never displayed.';
+$messages['comment_html_allowed'] = '<acronym title="Hypertext Markup Language">HTML</acronym> allowed: &lt;<acronym title="Hyperlink">a</acronym> href=&quot;&quot; title=&quot;&quot; rel=&quot;&quot;&gt; &lt;<acronym title="Acronym Description">acronym</acronym> title=&quot;&quot;&gt; &lt;<acronym title="Quote">blockquote</acronym> cite=&quot;&quot;&gt; &lt;<acronym title="Strike">del</acronym>&gt; &lt;<acronym title="Italic">em</acronym>&gt; &lt;<acronym title="Underline">ins</acronym>&gt; &lt;<acronym title="Bold">strong</acronym>&gt;';
+$messages['trackback_uri'] = 'The <acronym title="Uniform Resource Identifier">URI</acronym> to trackback this entry is: ';
+
+$messages['xmlrpc_ping_ok'] = 'XMLRPC Ping sent successfully: ';
+$messages['error_sending_xmlrpc_ping'] = 'There was an error sending the XMLRPC ping to: ';
+$messages['error_sending_xmlrpc_ping_message'] = 'There was an error sending the XMLRPC ping: ';
+
+//
+// new strings for 1.1
+//
+$messages['error_incorrect_trackback_id'] = 'The trackback identifier is not correct';
+$messages['error_marking_trackback_as_spam'] = 'There was an error marking the trackback as spam';
+$messages['trackback_marked_as_spam_ok'] = 'The trackback was marked as successfully as spam';
+$messages['error_marking_trackback_as_nonspam'] = 'There was an error marking the trackback as non-spam';
+$messages['trackback_marked_as_nonspam_ok'] = 'The trackback was marked successfully as non-spam';
+$messages['upload_here'] = 'Upload here';
+$messages['reply_string'] = 'Re: ';
+$messages['cleanup_users'] = 'Purge Users';
+$messages['cleanup_users_help'] = 'This will remove all users that have been disabled by administrator (marked as "Disabled"). It will also remove any blogs that user own including everything in that blog. If user has permission to post in other blog, all posts made by them will be deleted as well.  It will not be possible to recover once users have been removed.';
+$messages['users_purged_ok'] = 'Users purged successfully';
+$messages['cleanup_blogs'] = 'Purge Blogs';
+$messages['cleanup_blogs_help'] = 'This will remove all blogs that have been disabled by administrator (marked as "Disabled"). It will remove everything in that blog.  It will not be possible to recover once blogs have been removed.';
+$messages['blogs_purged_ok'] = 'Blogs purged successfully';
+$messages['help_use_http_accept_language_detection'] = 'Most web browsers such as Mozilla Firefox, Safari or Internet Explorer send at least one language code the user <i>should</i> understand. If this feature is activated, LifeType tries to serve the user with the requested language if it\'s available. [Default = No]';
+
+$messages['error_invalid_blog_category'] = 'Invalid blog category';
+$messages['error_adding_blog_category'] = 'There was an error adding the blog category';
+$messages['newBlogCategory'] = 'New Blog Category';
+$messages['editBlogCategories'] = 'Blog Categories';
+$messages['blog_category_added_ok'] = 'Blog category added successfully';
+$messages['error_blog_category_has_blogs'] = 'The blog category "%s" has some blogs assigned to it. Please remove the blogs from the category and then try again.';
+$messages['error_deleting_blog_category'] = 'There was an error deleting blog category "%s"';
+$messages['blog_category_deleted_ok'] = 'Blog category "%s" was deleted successfully';
+$messages['blog_categories_deleted_ok'] = '%s blog categories deleted successfully';
+$messages['error_deleting_blog_category2'] = 'There was an error removing the blog category with id %s';
+$messages['blog_category'] = 'Blog Category';
+$messages['blog_category_help'] = 'Global blog category assigned to this blog.';
+
+$messages['help_use_captcha_auth'] = 'Use a CAPTCHA mechanism in the registration process to prevent automatic registration by robotic scripts. [ Default = No ]';
+$messages['help_skip_dashboard'] = 'The dashboard page will not be shown anymore and instead users will be taken to the first blog to which they belong right away. [ Default = No ]';
+
+$messages['manageGlobalArticleCategory'] = 'Global Article Categories';
+$messages['newGlobalArticleCategory'] = 'New Global Article Category';
+$messages['editGlobalArticleCategories'] = 'Global Article Categories';
+$messages['global_category_name_help'] = 'Name of the new global article category.';
+$messages['global_category_description_help'] = 'Description of the new global article category.';
+$messages['error_incorrect_global_category_id'] = 'Invalid global article category';
+$messages['global_category_deleted_ok'] = 'Article category "%s" deleted successfully';
+$messages['global_category_added_ok'] = 'Global category "%s" added successfully';
+$messages['error_deleting_global_category2'] = 'There was an error removing article category with id = %s';
+
+$messages['help_page_suffix_format'] = 'Suffix that will be appended to URLs that support paging. [ Default = /page/{page} ]';
+
+$messages['help_final_size_thumbnail_width'] = 'Final width of uploaded images. Leave empty or as zero to store the full size image. [ Default = 0 ]';
+$messages['help_final_size_thumbnail_height'] = 'Final height of uploaded images. Leave empty or as zero to store the full size image. [ Default = 0 ]';
+$messages['error_comment_too_big'] = 'The comment is too big';
+$messages['error_you_have_been_blocked'] = 'Blocked: this request was not completed.';
+$messages['created'] = 'Created';
+$messages['view'] = 'View';
+$messages['editUser'] = 'Edit User';
+$messages['help_urlize_word_separator'] = 'Character that will be used as the word separator when generating URLs pointing to LifeType pages. This will also be used when generating hostnames from blog names if support for subdomains is activated. [ Default = - ]';
+$messages['help_summary_template_cache_lifetime'] = 'Life time in seconds of the summary cached pages. If set to something else than \'0\' the summary pages will be kept for as long as indicated here insted of being refreshed every time data changes. [ Default = 0 ]';
+$messages['register_default_album_name'] = 'General';
+$messages['register_default_album_description'] = 'Use this album to upload new pictures.';
+$messages['show_in_summary'] = 'Show in Summary';
+$messages['show_in_summary_help'] = 'Include this blog in the summary page of this site.';
+
+$messages['saving_message'] = 'Saving ...';
+$messages['show_option_panel'] = 'Show Options';
+$messages['hide_option_panel'] = 'Hide Options';
+
+$messages['quick_launches'] = 'Quick Launches';
+
+$messages['confirmation_message_resent_ok'] = 'Confirmation message resent successfully.';
+
+$messages['goto_blog_page'] = 'Go to %s';
+
+$messages['help_num_blogs_per_user'] = 'Number of blogs that an owner can create through the administration interface.';
+
+$messages['massive_change_option'] = 'Bulk Edit Options';
+$messages['show_massive_change_option'] = 'Show Bulk Edit Options';
+$messages['hide_massive_change_option'] = 'Hide Bulk Edit Options';
+$messages['change_status'] = 'Change Status';
+$messages['change_category'] = 'Change Category';
+$messages['error_updating_comment_no_comment'] = 'There was an error updating the comment. Comment #%s could not be found';
+$messages['error_updating_comment_wrong_blog'] = 'There was an error updating the comment. Comment (%s) is not posted on this blog.';
+$messages['error_updating_comment'] = 'There was an error updating (%s)';
+$messages['error_updating_comment_already_updated'] = 'No change made to (%s)';
+$messages['comment_updated_ok'] = 'Comment successfully updated.';
+$messages['comments_updated_ok'] = '%s comments successfully updated.';
+
+$messages['error_post_status'] = 'Please select post status.';
+$messages['error_comment_status'] = 'Please select comment status.';
+$messages['admin_mode'] = 'Admin Mode';
+$messages['administrate_user_blog'] = 'Administrate this blog';
+$messages['trackbacks_updated_ok'] = '%s trackbacks updated successfully';
+$messages['trackback_updated_ok'] = 'Trackback updated successfully';
+$messages['error_trackback_status'] = 'Please select a valid status';
+$messages['select'] = 'Select';
+$messages['remove_selected'] = 'Remove Selected';
+
+$messages['notification_subject'] = 'LifeType Notification System';
+$messages['error_no_trackback_links_sent'] = 'Warning: No Trackbacks were sent.';
+
+$messages['help_http_cache_lifetime'] = 'Lifetime in seconds of the client side cache (browsers will not return to the server for this long, and pages will be served from the local cache.  This greatly speeds up the browsing experience, but will delay post and comment visibility. [Default = 1800]';
+
+$messages['trackbacks_no_trackback'] = 'Sending a trackback to the following URL failed: ';
+
+$messages['error_comment_spam_throw_away'] = 'You cannot post this message. Anti-spam filter has blocked it.';
+$messages['error_comment_spam_keep'] = 'The anti-spam filter has put your comment in the moderation queue and it will have to be approved by the blog owner.';
+
+$messages['blog_categories'] = 'Blog Categories';
+$messages['global_article_categories'] = 'Global Article Categories';
+
+$messages['help_force_posturl_unique'] = 'Force all post URLs within a blog to be unique.  This is only needed if you are changing the URLs and are removing the date portions of the URL. [ Default = no ]';
+
+$messages['default_send_notification'] = 'Default Send Notification';
+
+$messages['enable_pull_down_menu'] = 'Pull Down Menu';
+$messages['enable_pull_down_menu_help'] = 'Enable the pull down menu.';
+
+$messages['change_album'] = 'Change Album';
+
+$messages['warning_autosave_message'] = '<img src="imgs/admin/icon_warning-16.png" alt="Error" class="InfoIcon"/><p class="ErrorText">You seem to have left here without saving your post. If so, you may <a href="#" onclick="restoreAutoSave();">click here to restore it</a> or <a href="#" onclick="eraseAutoSave();">delete it</a>.</p>';
+
+$messages['check_username'] = 'Check User Name';
+$messages['check_username_ok'] = 'The user name is available!';
+$messages['error_username_exist'] = 'Sorry! The user name is not available, please try others.';
+
+$messages['error_rule_email_dns_server_temp_fail'] = 'Temporary failure - try again later.';
+$messages['error_rule_email_dns_server_unreachable'] = 'Email server unreachable.';
+$messages['error_rule_email_dns_not_permitted'] = 'E-mail not permitted.';
+
+$messages['blog_users_help'] = 'Users who have access to this blog.';
+
+$messages['summary_welcome_paragraph'] = 'This message is only a placeholder and should be edited when customizing this page for your service. This message is currently stored in the en_UK locale file but you may also edit the template templates/summary/index.template and place your text there.';
+
+$messages['first_day_of_week'] = 0;
+$messages['first_day_of_week_label'] = 'First Day of Week';
+$messages['first_day_of_week_help'] = 'First Day of Week in calendar.';
+
+$messages['help_subdomains_base_url'] = 'When subdomains are enabled, this base URL is used instead of base_url. Use {blogname} to get the blog name, {username} to get the name of the user owner of the blog and {blogdomain} to allow the user to specify any subdomain in order to generate a link to a blog. (e.g. http://{blogname}.yourdomain.com)';
+
+$messages['registration_default_subject'] = 'LifeType registration confirmation';
+
+$messages['error_invalid_subdomain'] = 'The subdomain name is not valid or it is not unique';
+$messages['register_blog_domain_help'] = 'Name and subdomain that you would like to use for your new blog.';
+$messages['domain'] = 'Domain';
+$messages['help_subdomains_available_domains'] = 'Enter a space delimited set of main domains allowed.  The user will be presented with a dropdown list of these values, and can add any subdomain he wants.  This is only used if you enabled subdomains and used {blogdomain} in the subdomain_base_url above. Use a \'?\' if you want to allow any domain.';
+$messages['subdomains_any_domain'] = '<- Multi-domain enabled. Type in the full domain.';
+$messages['error_updating_blog_subdomain'] = 'There was an error updating the subdomain.  Please check the data and try again.';
+$messages['error_updating_blog_main_domain'] = 'There was an error updating the main domain setting. This probably means the site administrator has configured something incorrectly.';
+
+$messages['monthsshort'] = Array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
+$messages['weekdaysshort'] = Array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' );
+
+$messages['search_type'] = 'Search in';
+$messages['posts'] = 'Posts';
+$messages['blogs'] = 'Blogs';
+$messages['resources'] = 'Resources';
+$messages['upload_in_progress'] = 'Uploading. Please wait...';
+$messages['error_incorrect_username'] = 'The username is not correct, it is already in use or it is too long (maximum 15 characters)';
+
+$messages['Miscellaneous'] = 'Miscellaneous';
+$messages['Plugins'] = 'Plugins';
+
+$messages['auth_img'] = 'Authentication code';
+$messages['auth_img_help'] = 'Please type the code you see in the image below.';
+
+$messages['global_category'] = 'Global category';
+$messages['global_article_category_help'] = 'Site wide category for this post.';
+
+$messages['password_reset_subject'] = 'LifeType Password Request';
+
+//
+// new strings for LifeType 1.2
+//
+$messages['auth'] = 'Auth';
+$messages['authenticated'] = 'Authenticated';
+$messages['dropdown_list_field'] = 'Drop-down list';
+$messages['values'] = 'Field values';
+$messages['field_values'] = 'Values that will be shown as options in this field. The first one will be used as the default option.';
+
+$messages['permission_added_ok'] = 'Permission added successfullly';
+$messages['core_perm'] = 'Core Permission';
+$messages['admin_only'] = 'Admin Only';
+$messages['permissionsList'] = 'Permissions';
+$messages['newPermission'] = 'New Permission';
+$messages['permission_name_help'] = 'Unique name for the permission';
+$messages['permission_description_help'] = 'Description given for the permission';
+$messages['core_perm_help'] = 'If this permission is part of the core permissions, it will not be possible to delete it';
+$messages['admin_only_help'] = 'Whether this permission can only be assigned by administrator users';
+$messages['error_adding_new_permission'] = 'There was an error adding the new permission, please check your data';
+$messages['error_incorrect_permission_id'] = 'The permission identifier was not correct';
+$messages['error_permission_cannot_be_deleted'] = 'Permission "%s" cannot be deleted because either it has been granted to at least one user or it is a core permission.';
+$messages['error_deleting_permission'] = 'There was an error deleting permission "%s"';
+$messages['permission_deleted_ok'] = 'Permission "%s" was deleted successfully';
+$messages['permissions_deleted_ok'] = '%s permissions successfully deleted';
+$messages['error_deleting_permission2'] = 'There was an error deleting permission with identifier "%s"';
+
+$messages['help_hard_show_posts_max'] = 'Maximum upper limit for articles shown in blog pages. If users set a custom value over this limit, it will be ignored and the value specified here will be used. [ Default = 50 ]';
+$messages['help_hard_recent_posts_max'] = 'Maximum upper limit for recent articles shown in blog pages. If users set a custom value over this limit, it will be ignored and the value specified here will be used [ Default = 25 ]';
+
+$messages['error_permission_required'] = 'You don\'t have enough permissions to perform the requested action';
+$messages['user_permissions_updated_ok'] = 'User permissions updated successfully';
+
+// blog permissions
+$messages['add_album_desc'] = 'Add new albums';
+$messages['add_blog_template_desc'] = 'Add new blog templates';
+$messages['add_blog_user_desc'] = 'Add new blog users';
+$messages['add_category_desc'] = 'Add new categories';
+$messages['add_custom_field_desc'] = 'Add new custom fields';
+$messages['add_link_desc'] = 'Add new links';
+$messages['add_link_category_desc'] = 'Add new link categories';
+$messages['add_post_desc'] = 'Add new posts';
+$messages['add_resource_desc'] = 'Add new resources';
+$messages['blog_access_desc'] = 'Allow access to this blog';
+$messages['update_album_desc'] = 'Update existing albums';
+$messages['update_blog_desc'] = 'Update the blog settings';
+$messages['update_blog_template_desc'] = 'Update a blog template';
+$messages['update_blog_user_desc'] = 'Update user permissions';
+$messages['update_category_desc'] = 'Updating existing categories';
+$messages['update_comment_desc'] = 'Update existing comments';
+$messages['update_custom_field_desc'] = 'Update existing custom fields';
+$messages['update_link_desc'] = 'Update existing links';
+$messages['update_link_category_desc'] = 'Update existing link categories';
+$messages['update_post_desc'] = 'Update existing posts';
+$messages['update_resource_desc'] = 'Update existing resources';
+$messages['update_trackback_desc'] = 'Update existing trackbacks';
+$messages['view_blog_templates_desc'] = 'View the blog templates';
+$messages['view_blog_users_desc'] = 'View the blog users';
+$messages['view_categories_desc'] = 'View the blog categories';
+$messages['view_comments_desc'] = 'View the blog comments';
+$messages['view_custom_fields_desc'] = 'View the blog custom fields';
+$messages['view_links_desc'] = 'View the blog links';
+$messages['view_link_categories_desc'] = 'View the blog link categories';
+$messages['view_posts_desc'] = 'View the blog posts';
+$messages['view_resources_desc'] = 'View the blog resources';
+$messages['view_trackbacks_desc'] = 'View the blog trackbacks';
+$messages['login_perm_desc'] = 'User is allowed to log in';
+// admin permissions
+$messages['add_blog_category_desc'] = 'User can add blog categories';
+$messages['add_global_article_category_desc'] = 'User can add global article categories';
+$messages['add_locale_desc'] = 'User can add new locales';
+$messages['add_permission_desc'] = 'User can add new permissions';
+$messages['add_site_blog_desc'] = 'User can add new blogs';
+$messages['add_template_desc'] = 'User can add new templates';
+$messages['add_user_desc'] = 'User can add new users';
+$messages['edit_blog_admin_mode_desc'] = 'User can administrate other blogs (admin mode)';
+$messages['purge_data_desc'] = 'User can purge data';
+$messages['update_blog_category_desc'] = 'User can update and delete blog categories';
+$messages['update_global_article_category_desc'] = 'User can update and delete global article categories';
+$messages['update_global_settings_desc'] = 'User can update the site settings';
+$messages['update_locale_desc'] = 'User can update and delete locales';
+$messages['update_permission_desc'] = 'User can update and delete permissions';
+$messages['update_plugin_settings_desc'] = 'User can update plugin settings';
+$messages['update_site_blog_desc'] = 'User can update and delete blogs';
+$messages['update_template_desc'] = 'User can update and delete templates';
+$messages['update_user_desc'] = 'User can update and delete users';
+$messages['view_blog_categories'] = 'User can view the blog categories';
+$messages['view_global_article_categories_desc'] = 'User can view the global article categories';
+$messages['view_global_settings_desc'] = 'User can view the site settings';
+$messages['view_locales_desc'] = 'User can view the locales';
+$messages['view_permissions_desc'] = 'User can view the permissions';
+$messages['view_plugins_desc'] = 'User can view the installed plugins';
+$messages['view_site_blogs_desc'] = 'User can view the site blogs';
+$messages['view_templates_desc'] = 'User can view the templates';
+$messages['view_users_desc'] = 'User can view the users';
+$messages['update_blog_stats_desc'] = 'User can delete referrers';
+$messages['manage_admin_plugins_desc'] = 'Manage the admin-only features of plugins';
+
+$messages['summary_welcome_msg'] = 'Welcome, %s!';
+$messages['summary_go_to_admin'] = 'Go to admin interface';
+
+$messages['error_can_only_update_own_articles'] = 'Your permissions allow you only to modify your own articles.';
+$messages['update_all_user_articles_desc'] = 'Allow to modify other users\' articles';
+$messages['error_can_only_view_own_articles'] = 'Your permissions allow you only to see your own articles.';
+$messages['view_all_user_articles_desc'] = 'Allow to view other users\' articles';
+$messages['error_fetching_permission'] = 'There was an error loading the permission';
+$messages['editPermission'] = 'Edit Permission';
+$messages['error_updating_permission'] = 'There was an error updating the permission';
+$messages['permission_updated_ok'] = 'Permission updated succesfully';
+$messages['error_adding_permission'] = 'There was an error adding the permission';
+$messages['error_cannot_login'] = 'Sorry, you are not allowed to log in';
+$messages['admin_user_permissions_help'] = 'Site-wide permissions granted to this user';
+
+$messages['permissions'] = 'Permissions';
+$messages['blog_user_permissions_help'] = 'Permissions assigned to this user in this blog';
+$messages['pluginSettings'] = 'Plugin Settings';
+$messages['user_can_override'] = 'Users can override';
+$messages['user_cannot_override'] = 'Users cannot override';
+$messages['global_plugin_settings_saved_ok'] = 'Global plugin settings saved successfully';
+$messages['error_updating_global_plugin_settings'] = 'There was an error saving the the global plugin settings';
+$messages['error_incorrect_value'] = 'The value is not correct';
+$messages['parameter'] = 'Parameter';
+$messages['value'] = 'Value';
+$messages['override'] = 'Override';
+$messages['editCustomField'] = 'Edit Custom Field';
+$messages['view_blog_stats_desc'] = 'View the blog statistics';
+$messages['manage_plugins_desc'] = 'Manage blog plugins';
+
+$messages['error_global_category_has_articles'] = 'The global article category cannot be deleted because it still has articles';
+$messages['error_adding_global_article_category'] = 'There was an error adding the global article category';
+
+$messages['temp_folder_reset_ok'] = 'The temporary folder was successfully cleaned up';
+$messages['cleanup_temp_help'] = 'This will trigger a clean up of the temporary folder, forcing the data cache and the template cache to be reset for all blogs.';
+$messages['cleanup_temp'] = 'Purge temporary folder';
+
+$messages['comment_only_auth_users'] = 'Only authenticated users can comment';
+$messages['comment_only_auth_users_help'] = 'Only those users who have logged in with a valid user name and password will be allowed to write comments';
+$messages['show_comments_max'] = 'Comments per page';
+$messages['show_comments_max_help'] = 'Maximum number of comments per page [ Default = 20 ]';
+$messages['hard_show_comments_max_help'] = 'Hard limit for the number of comments per page [ Default = 50 ]';
+
+$messages['error_resource_not_whitelisted_extension'] = 'This file is not one of the allowed types.';
+$messages['help_upload_allowed_files'] = 'Space-separated list of file types that are allowed to be uploaded. Usage of \'*\' and \'?\' is allowed. If both upload_forbidden_file and this option are set, the whitelist (upload_allowed_files) takes precedence over the blacklist [Default = None]';
+
+$messages['help_template_load_order'] = 'Defines in which order template files are searched and loaded. If using \'Load default templates first\', LifeType will try to find files first in the templates/default/ folder and if not available there, then it will load the user\'s template files. If the same template file exists in both places, the default one takes precedence. If set to \'Load user templates first\', user templates are always loaded first and if unavailable, then the default one is used. If the same template file exists in both places, the user template always takes precedence.';
+$messages['template_load_order_user_first'] = 'Load default templates first';
+$messages['template_load_order_default_first'] = 'Load user templates first';
+
+$messages['editBlogUser'] = 'Edit Blog User';
+
+$messages['help_summary_service_name'] = 'Name of your site/service that will appear in several places in the front page as well as in the RSS feeds [ Default = empty ]';
+
+$messages['register_step2_help'] = 'Please provide the required information in order to create a blog.';
+
+$messages['create_date'] = 'Date created';
+
+$messages['insert_media'] = 'Insert media';
+$messages['insert_more'] = 'Toggle "More..." link';
+
+$messages['purging_please_wait'] = 'Please wait while data is being purged. This page will keep refreshing itself until all data has been processed, please do not attempt to stop this process';
+
+$messages['error_cannot_delete_last_blog_category'] = 'You cannot delete the last blog category.';
+
+$messages['help_logout_destination_url'] = 'URL where users will be forwarded when logging out of the administration interface instead of the login page. [ Default Value = empty ]';
+$messages['help_default_global_article_category_id'] = 'Identifier of the default global article category [ Default = empty ]';
+$messages['help_blog_does_not_exist_url'] = 'URL where users will be forwarded when they attempt to reach a blog that does not exist in this site, instead of being forwarded to the site\'s default blog [ Default = empty ]';
+
+$messages['error_invalid_blog_name'] = 'The blog name is not valid';
+
+/* strings for /default/ templates */
+
+
+$messages['help_forbidden_blognames'] = 'List of strings separated by a blank space that are not allowed to be used as blog names. It is possible to use regular expressions instead of plain strings. [ Default = (empty) ]';
+
+$messages['posts_updated_ok'] = '%s posts updated successfully';
+$messages['error_updating_post2'] = 'There was an error updating the article with idenfitier "%s"';
+$messages['resources_updated_ok'] = '% resources updated successfully';
+$messages['error_updating_resource2'] = 'There was an error updating the resource with identifier "%s"';
+$messages['albums_updated_ok'] = '%s albums updated successfully';
+$messages['error_updating_album2'] = 'There was an error updating album with identifier "%s"';
+$messages['links_updated_ok'] = '%s links updated successfully';
+$messages['error_updating_link2'] = 'There was an error updating the link with identifier "%s"';
+
+$messages['version'] = 'Version';
+
+$messages['error_resources_disabled'] = 'Sorry, support for uploading new resources has been disabled in this site';
+$messages['help_login_admin_panel'] = 'Click the blog name to enter the administration page.';
+
+$messages['blog_updated_ok'] = 'Blog "%s" was successfully updated';
+$messages['blogs_updated_ok'] = '%s blogs were successfully updated';
+$messages['error_updating_blog2'] = 'There was an error updating the blog with identifier "%s"';
+$messages['error_updating_blog'] = 'There was an error updating blog "%s"';
+
+$messages['error_updating_user'] = 'There was an error updating user "%s".';
+$messages['user_updated_ok'] = 'User "%s" was successfully updated.';
+$messages['users_updated_ok'] = '%s users were successfully updated';
+$messages['eror_updating_user2'] = 'There was an error updating the user with identifier "%s"';
+
+$messages['error_select_status'] = 'Please select a valid status';
+$messages['error_invalid_blog_name'] = 'Sorry, the blog name is not valid';
+
+$messages['help_resources_naming_rule'] = 'The file naming rules for uploaded resources. \'Original File Name\' will use the original name of the file. \'Encoded File Name\' will use the encoded file name for uploaded resources, the naming rule is [BlogId]-[ResourceId].[Ext]. Please use \'Encoded File Name\' if you are running LifeType on a Multi-Byte Microsoft Windows server. <strong>NOTE: Please don\'t change this option after users have uploaded files into LifeType or older files will not be accessible anymore.</strong> [Default = Original File Name]';
+$messages['original_file_name'] = 'Original File Name';
+$messages['encoded_file_name'] = 'Encoded File Name';
+
+$messages['quick_permission_selection'] = 'Quick permission selection';
+$messages['basic_blog_permission'] = 'Allow blog user to add, update and delete posts, links and resources';
+$messages['full_blog_permission'] = 'Allow blog user to access all blog functions as blog owner';
+
+$messages['error_template_exist'] = 'There was an error uploading the template, template "%s" already exist.';
+
+/// new strings in LT 1.2.2 ///
+$messages['posted_by_help'] = 'Select article owner';
+$messages['insert_player'] = 'Insert Player';
+
+/// new strings in LT 1.2.3 ///
+$messages['help_allow_javascript_blocks_in_posts'] = 'Allow blocks of Javascript code in posts via &lt;script&gt; tags. Please be aware that it may pose a security risk to your blog(s) [ Default = No ]';
+
+$messages['Versions'] = 'Versions';
+$messages['incorrect_file_version_error'] = 'The following files do not match the expected contents:';
+$messages['lifetype_version'] = 'LifeType';
+$messages['lifetype_version_help'] = 'The currently installed version of LifeType is:';
+$messages['file_version_check'] = 'File Version Check';
+$messages['file_version_check_help'] = 'This will perform a basic check on most of LifeType\'s core files, in order to ensure that the current version of the files matches the expected contents according to the installed version. If you have not performed any customizations or changes,
+all files should match the expected version. Please be patient, this process may take a while.';
+$messages['check'] = 'Check';
+$messages['all_files_ok'] = 'All files are correct';
+
+/// new strings for LT 1.2.4 ///
+$messages['plugin_latest_version'] = 'Most recent version available: ';
+$messages['check_versions'] = 'Check versions';
+$messages['lt_version_ok'] = 'The current version of Lifetype is up to date.';
+$messages['lt_version_error'] = 'The most recent version of Lifetype is: ';
+$messages['release_notes'] = 'Release notes';
+
+$messages['kb'] = 'Kb';
+$messages['mb'] = 'Mb';
+$messages['gb'] = 'Gb';
+$messages['edit'] = 'Edit';
+
+/// new strings for LT 1.2.5 ///
+$messages['bookmark_this_filter'] = 'Bookmark this filter';
+$messages['help_trim_whitespace_output'] = 'Removes all unnecessary blank spaces from rendered templates, which can make pages up to 40% smaller. It is advisable to keep this enabled, unless you are concerned with performance [ Default = Yes ]';
+$messages['help_notify_new_blogs'] = 'Notify site administrators every time a new blog is created in this site';
+$messages['new_blog_admin_notification_text'] = 'This is LifeType\'s automatic notification system.
+
+A new blog named "%1$s" (%2$s) has been created in your LifeType installation.
+
+Have a nice day.
+';
+?>

Copied: plog/trunk/locale/admin/locale_ua_UA.php (from rev 6933, plog/branches/lifetype-1.2/locale/admin/locale_ua_UA.php)
===================================================================
--- plog/trunk/locale/admin/locale_ua_UA.php	                        (rev 0)
+++ plog/trunk/locale/admin/locale_ua_UA.php	2009-12-24 17:43:57 UTC (rev 6934)
@@ -0,0 +1,1188 @@
+<?php
+
+$messages['login'] = 'Логін';
+$messages['welcome_message'] = 'Ласкаво просимо!';
+$messages['error_incorrect_username_or_password'] = 'Неправильне ім\'я користувача або пароль.';
+$messages['error_dont_belong_to_any_blog'] = 'Вибачте, Ваш блог ще не створений.';
+$messages['logout_message'] = 'Вихід завершено успішно.';
+$messages['logout_message_2'] = 'Натисніть <a href="%1$s">тут</a> для того, щоб перейти на %2$s</a>.';
+$messages['error_access_forbidden'] = 'Ви не маєте прав доступу. Спочатку ввійдіть в систему';
+$messages['username'] = 'Ім\'я користувача';
+$messages['password'] = 'Пароль';
+
+$messages['dashboard'] = 'Панель інструментів';
+$messages['recent_articles'] = 'Останні публікації';
+$messages['recent_comments'] = 'Останні коментарі';
+$messages['recent_trackbacks'] = 'Останні зворотні лінки';
+$messages['blog_statistics'] = 'Статистика блогу';
+$messages['total_posts'] = 'Всього публікацій';
+$messages['total_comments'] = 'Всього коментарів';
+$messages['total_trackbacks'] = 'Всього зворотніх лінків';
+$messages['total_viewed'] = 'Переглядів за весь час';
+$messages['in'] = 'Публікація';
+
+$messages['newPost'] = 'Нова публікація';
+$messages['Manage'] = 'Керування';
+$messages['managePosts'] = 'Керування публікаціями';
+$messages['editPosts'] = 'Редагувати публікації';
+$messages['editArticleCategories'] = 'Редагувати категорії';
+$messages['newArticleCategory'] = 'Нова категорія';
+$messages['manageLinks'] = 'Керування лінками';
+$messages['editLinks'] = 'Редагувати лінки';
+$messages['newLink'] = 'Новий лінк';
+$messages['editLink'] = 'Редагувати лінк';
+$messages['editLinkCategories'] = 'Категорії лінків';
+$messages['newLinkCategory'] = 'Нова категорія лінків';
+$messages['editLinkCategory'] = 'Редагувати категорію лінків';
+$messages['manageCustomFields'] = 'Керування персоналізованими полями';
+$messages['blogCustomFields'] = 'Персоналізовані поля';
+$messages['newCustomField'] = 'Нове персоналізоване поле';
+$messages['resourceCenter'] = 'Панель файлів';
+$messages['resources'] = 'Файли';
+
+$messages['newResourceAlbum'] = 'Новий альбом';
+$messages['newResource'] = 'Новий файл';
+$messages['controlCenter'] = 'Панель керування';
+$messages['manageSettings'] = 'Налаштування';
+$messages['blogSettings'] = 'Налаштування блогу';
+$messages['userSettings'] = 'Налаштування користувача';
+$messages['pluginCenter'] = 'Керування допоміжними програмами';
+$messages['Stats'] = 'Статистика';
+$messages['manageBlogUsers'] = 'Керування користувачами блогу';
+$messages['newBlogUser'] = 'Новий користувач блогу';
+$messages['showBlogUsers'] = 'Користувачі блогу';
+$messages['manageBlogTemplates'] = 'Керувати темплейтами';
+$messages['newBlogTemplate'] = 'Новий темплейт';
+$messages['blogTemplates'] = 'Темплейти';
+$messages['adminSettings'] = 'Адміністрування';
+$messages['Users'] = 'Користувачі';
+$messages['createUser'] = 'Створити користувача';
+$messages['editSiteUsers'] = 'Користувачі';
+$messages['Blogs'] = 'Керування блогами';
+$messages['createBlog'] = 'Створити блог';
+$messages['editSiteBlogs'] = 'Редагувати блог';
+$messages['Locales'] = 'Вибрати мову';
+$messages['newLocale'] = 'Нова мова';
+$messages['siteLocales'] = 'Локалізація веб-сторінки';
+$messages['Templates'] = 'Керування темплейтами';
+$messages['newTemplate'] = 'Новий темплейт';
+$messages['siteTemplates'] = 'Темплейти';
+$messages['GlobalSettings'] = 'Загальні налаштування';
+$messages['editSiteSettings'] = 'Загальні';
+$messages['summarySettings'] = 'Зміст';
+$messages['templateSettings'] = 'Налаштування темплейтів';
+$messages['urlSettings'] = 'Лінки';
+$messages['emailSettings'] = 'Налаштування E-mail';
+$messages['uploadSettings'] = 'Завантаження';
+$messages['helpersSettings'] = 'Віддалені допоміжні програми';
+$messages['interfacesSettings'] = 'Інтерфейс';
+$messages['securitySettings'] = 'Безпека';
+$messages['bayesianSettings'] = 'Спам фільтр';
+$messages['resourcesSettings'] = 'Файли';
+$messages['searchSettings'] = 'Пошук';
+$messages['cleanUpSection'] = 'Очистити';
+$messages['cleanUp'] = 'Очистити';
+$messages['editResourceAlbum'] = 'Редагувати альбом';
+$messages['resourceInfo'] = 'Редагувати інформацію на ресурсі';
+$messages['editBlog'] = 'Редагувати блог';
+$messages['Logout'] = 'Вихід';
+
+$messages['topic'] = 'Тема';
+$messages['topic_help'] = 'Заголовок';
+$messages['text'] = 'Зміст';
+$messages['text_help'] = 'Стислий зміст публікації. Зміст публікації буде відображатися на головній сторінці';
+$messages['extended_text'] = 'Повний текст';
+$messages['extended_text_help'] = 'Повний текст. Ця частина може по бажанню з\'являтися на головній сторінці. Детальніше дивіться в налаштуваннях блогу';
+$messages['trackback_urls'] = 'Вказати адресу зворотніх лінків';
+$messages['trackback_urls_help'] = 'Якщо публікація не визначає адресу зворотніх лінків автоматично, Ви можете вказати тут адресу, куди буде надсилатися пінг.';
+$messages['post_slug'] = 'Псевдолінк';
+$messages['post_slug_help'] = 'Псевдолінк використовується для генерування постійного відповідного лінку';
+$messages['date'] = 'Дата';
+$messages['post_date_help'] = 'Дата опублікування';
+$messages['status'] = 'Статус';
+$messages['post_status_help'] = 'Виберіть один із статусів';
+$messages['post_status_published'] = 'Опубліковано';
+$messages['post_status_draft'] = 'Чернетка';
+$messages['post_status_deleted'] = 'Видалено';
+$messages['categories'] = 'Категорії';
+$messages['post_categories_help'] = 'Виберіть одну або декілька категорій';
+$messages['post_comments_enabled_help'] = 'Включити коментарі';
+$messages['send_notification_help'] = 'Повідомлення про нові коментарі';
+$messages['send_trackback_pings_help'] = 'Відправити зворотні лінки';
+$messages['send_xmlrpc_pings_help'] = 'Перевірити XMLRPC';
+$messages['save_draft_and_continue'] = 'Зберегти чернетку';
+$messages['preview'] = 'Попередній перегляд';
+$messages['add_post'] = 'Додати публікацію';
+$messages['error_saving_draft'] = 'Помилака при збереженні чернетки';
+$messages['draft_saved_ok'] = 'Чернетка успішно збережена';
+$messages['error_sending_request'] = 'Помилка при відправці запиту';
+$messages['error_no_category_selected'] = 'Виберіть категорію';
+$messages['error_missing_post_topic'] = 'Вкажіть заголовок публікації';
+$messages['error_missing_post_text'] = 'Введіть текст публікації';
+$messages['error_adding_post'] = 'Помилка при додаванні публікації';
+$messages['post_added_not_published'] = 'Публікація успішно додана, але не опублікована';
+$messages['post_added_ok'] = 'Публікацію успішно додано.';
+$messages['send_notifications_ok'] = 'Вам буде надіслане повідомлення, якщо з\'являться нові коментарі або зворотні лінки.';
+$messages['bookmarklet'] = "Закладки";
+$messages['bookmarklet_help'] = "Перетягніть цей лінк на панель інструментів Вашого браузеру або клацніть правою кнопкою миші і виберіть команду Додати в Вибране.";
+$messages['blogit_to_lifetype'] = "Блог";
+$messages['original_post'] = "(Оригінал)";
+
+$messages['error_sending_trackbacks'] = 'Помилка при відправленні наступних зворотніх лінків';
+$messages['send_trackbacks_help'] = 'Виберіть адресу, для перевірки зв\'язку зворотніх лінків. Переконайтесь, що ресурси підтримують зворотні лінки .';
+$messages['send_trackbacks'] = 'Відіслати зворотні лінки';
+$messages['ping_selected'] = 'Пінг вибраний';
+$messages['trackbacks_sent_ok'] = 'Обрані Вами лінки успішно відіслані';
+
+$messages['show_by'] = 'Сортувати за';
+$messages['category'] = 'Категорії';
+$messages['author'] = 'Автор';
+$messages['post_status_all'] = 'Всі публікації';
+$messages['author_all'] = 'Всі автори';
+$messages['search_terms'] = 'Пошук';
+$messages['show'] = 'Відображати';
+$messages['delete'] = 'Видалити';
+$messages['actions'] = 'Дії';
+$messages['all'] = 'Всі';
+$messages['category_all'] = 'Всі категорії';
+$messages['error_incorrect_article_id'] = 'Невірний ідентифікатор публікації';
+$messages['error_deleting_article'] = 'Помилка при видаленні публікації "%s"';
+$messages['article_deleted_ok'] = 'Публікація "%s" успішно видалена';
+$messages['articles_deleted_ok'] = '%s Публікації успішно видаленні';
+$messages['error_deleting_article2'] = 'Помилка під час видалення публікації з ідентифікатором "%s"';
+
+$messages['update'] = 'Застосувати';
+$messages['editPost'] = 'Редагувати публікацію';
+$messages['error_fetching_post'] = 'Помилка під час відображення публікації';
+$messages['post_updated_ok'] = 'Публікація "%s" успішно відредагована.';
+$messages['error_updating_post'] = 'Помилка під час редагування публікації';
+$messages['notification_added'] = 'Повідомляти про нові коментарі та зворотні лінки';
+$messages['notification_removed'] = 'Не повідомляти про нові коментарі та зворотні лінки';
+
+$messages['url'] = 'Лінк';
+$messages['comment_status_all'] = 'Всі';
+$messages['comment_status_spam'] = 'Спам';
+$messages['comment_status_nonspam'] = 'Не спам';
+$messages['error_fetching_comments'] = 'Помилка під час відображення коментарів до публікації';
+$messages['error_deleting_comments'] = 'Помилка при видаленні коментарів';
+$messages['comment_deleted_ok'] = 'Коментар "%s" успішно видалено';
+$messages['comments_deleted_ok'] = '%s Коментарі успішно видалені';
+$messages['error_deleting_comment'] = 'Помилка під час видалення коментаря "%s"';
+$messages['error_deleting_comment2'] = 'Помилка під час видалення коментаря з ідентифікатором %s';
+$messages['editComments'] = 'Редагувати коментарі';
+$messages['mark_as_spam'] = 'Позначити як спам';
+$messages['mark_as_no_spam'] = 'Не спам';
+$messages['error_incorrect_comment_id'] = 'Невірний ідентифікатор коментаря';
+$messages['error_marking_comment_as_spam'] = 'Помилка при позначенні коментаря як спам';
+$messages['comment_marked_as_spam_ok'] = 'Коментар позначено як спам';
+$messages['error_marking_comment_as_nonspam'] = 'Помилка при позначенні коментаря як не спам';
+$messages['comment_marked_as_nonspam_ok'] = 'Коментар позначено як не спам';
+
+$messages['blog'] = 'Блог';
+$messages['excerpt'] = 'Витяг';
+$messages['error_fetching_trackbacks'] = 'Помилка при відображенні зворотнього лінку';
+$messages['error_deleting_trackbacks'] = 'Помилка під час видалення зворотніх лінків';
+$messages['error_deleting_trackback'] = 'Помилка при видаленні зворотнього лінку "%s"';
+$messages['error_deleting_trackback2'] = 'Помилка під час видалення зворотнього лінку з ідентифікатором "%s"';
+$messages['trackback_deleted_ok'] = 'Зворотній лінк "%s" успішно видалено';
+$messages['trackbacks_deleted_ok'] = '%s зворотні лінки успішно видалені';
+$messages['editTrackbacks'] = 'Редагувати зворотні лінки';
+
+$messages['referrer'] = 'Посилання';
+$messages['hits'] = 'Хіти';
+$messages['error_no_items_selected'] = 'Жодних позицій не вибрано для видалення';
+$messages['error_deleting_referrer'] = 'Помилка при видалені посилання "%s"';
+$messages['error_deleting_referrer2'] = 'Помилка під час видалення посилання з ідентифікатором "%s"';
+$messages['referrer_deleted_ok'] = 'Посилання "%s" успішно видалено';
+$messages['referrers_deleted_ok'] = '%s посилання успішно видалені';
+
+$messages['posts'] = 'Публікації';
+$messages['show_in_main_page'] = 'Відображати на головній сторінці';
+$messages['error_incorrect_category_id'] = 'Невірний ідентифікатор категорії';
+$messages['error_category_has_articles'] = 'Некоректні публікації в категорії "%s". Спочатку відредагуйте публікації, а потім видаліть категорію';
+$messages['category_deleted_ok'] = 'Категорію "%s" успішно видалено';
+$messages['categories_deleted_ok'] = '%s категорії успішно видалені';
+$messages['error_deleting_category'] = 'Помилка під час видалення категорії "%s"';
+$messages['error_deleting_category2'] = 'Помилка під час видалення категорії з ідентифікатором "%s"';
+$messages['yes'] = 'Так';
+$messages['no'] = 'Ні';
+
+// new category
+$messages['name'] = 'Назва';
+$messages['category_name_help'] = 'Назва категорії';
+$messages['description'] = 'Опис';
+$messages['category_description_help'] = 'Детальний опис категорії';
+$messages['show_in_main_page_help'] = 'Відображати публікації категорії на головній сторінці';
+$messages['error_empty_name'] = 'Вкажіть будь-ласка назву категорії';
+$messages['error_empty_description'] = 'Відсутній опис категорії';
+$messages['error_adding_article_category'] = 'Помлка під час додавання нової категорії. Перевірте введені дані і спробуйте ще раз';
+$messages['category_added_ok'] = 'Категорія "%s" успішно додана';
+$messages['add'] = 'Додати';
+$messages['reset'] = 'Очистити форму';
+
+// update category
+$messages['error_updating_article_category'] = 'Помилка при редагуванні категорії';
+$messages['error_fetching_category'] = 'Помилка при відображенні категорії';
+$messages['article_category_updated_ok'] = 'Категорія "%s" успішно відредагована';
+
+// links
+$messages['feed'] = 'Feed';
+$messages['error_no_links_selected'] = 'Виберіть будь-ласка лінк';
+$messages['error_incorrect_link_id'] = 'Невірний ідентифікатор лінку';
+$messages['error_removing_link'] = 'Помилка під час видалення лінку "%s"';
+$messages['error_removing_link2'] = 'Помилка під час видалення лінку з ідентифікатором "%s"';
+$messages['link_deleted_ok'] = 'Лінк "%s" успішно видалено';
+$messages['links_deleted_ok'] = '%s Лінки успішно видалені';
+
+// new link
+$messages['link_name_help'] = 'Назва лінку';
+$messages['link_url_help'] = 'Адреса, на яку вказує лінк';
+$messages['link_description_help'] = 'Короткий опис лінку';
+$messages['link_feed_help'] = 'Лінк вказаний на RSS або Atom цього лінку';
+$messages['link_category_help'] = 'Виберіть категорію лінків';
+$messages['error_adding_link'] = 'Помилка при додаванні лінку.';
+$messages['error_invalid_url'] = 'Невірно введений лінк';
+$messages['link_added_ok'] = 'Лінк "%s" успішно додано';
+$messages['bookmarkit_to_lifetype'] = "Закладки!";
+
+// update link
+$messages['error_updating_link'] = 'Помилка під час редагування лінку.';
+$messages['error_fetching_link'] = 'Помилка при відображенні лінку';
+$messages['link_updated_ok'] = 'Лінк "%s" успішно відредагований';
+
+// link categories
+$messages['links'] = 'Лінки';
+$messages['error_invalid_link_category_id'] = 'Невірний ідентифікатор категорії лінків';
+$messages['error_links_in_link_category'] = 'Категорія лінків "%s" використовується іншими лінками. Відредагуйте лінки та спробуйте ще раз';
+$messages['error_removing_link_category'] = 'Помилка при видаленні категорії лінків "%s"';
+$messages['link_category_deleted_ok'] = 'Категорія лінків "%s" успішно видалена';
+$messages['link_categories_deleted_ok'] = '%s Категорії лінків успішно видалені';
+$messages['error_removing_link_category2'] = 'Помилка під час видалення категорії лінків з ідентифікатором "%s"';
+
+// new link category
+$messages['link_category_name_help'] = 'Назва категорії лінків';
+$messages['error_adding_link_category'] = 'Помилка при додаванні нової категорії лінків';
+$messages['link_category_added_ok'] = 'Категорія лінків "%s" успішно додана';
+
+// edit link category
+$messages['error_updating_link_category'] = 'Помилка під час редагування категорії лінків. Перевірте будь-ласка введені дані та спробуйте ще раз';
+$messages['link_category_updated_ok'] = 'Категорія лінків "%s" успішно відредагована';
+$messages['error_fetching_link_category'] = 'Помилка при відображенні категорії лінків';
+
+// custom fields
+$messages['type'] = 'Тип';
+$messages['hidden'] = 'Прихований';
+$messages['fields_deleted_ok'] = '%s персоналізовані поля успішно видалені';
+$messages['field_deleted_ok'] = 'Персоналізоване поле "%s" успішно видалено';
+$messages['error_deleting_field'] = 'Помилка під час видалення персоналізованого поля "%s"';
+$messages['error_deleting_field2'] = 'Помилка під час видалення персоналізованого поля з ідентифікатором "%s"';
+$messages['error_incorrect_field_id'] = 'Невірний ідентифікатор персоналізованого поля';
+
+// new custom field
+$messages['field_name_help'] = 'Назва поля';
+$messages['field_description_help'] = 'Короткий опис поля';
+$messages['field_type_help'] = 'Виберіть один із існуючих типів полів';
+$messages['field_hidden_help'] = 'Якщо поле приховане, це поле не буде відображатися при додаванні або редагуванні публікації.';
+$messages['error_adding_custom_field'] = 'Помилка під час додавання персоналізованого поля.';
+$messages['custom_field_added_ok'] = 'Персоналізоване поле "%s" успішно додано';
+$messages['text_field'] = 'Текстовое поле';
+$messages['text_area'] = 'Багаторядкова область вводу';
+$messages['checkbox'] = 'Чекбокс';
+$messages['date_field'] = 'Вибір дати';
+
+// edit custom field
+$messages['error_fetching_custom_field'] = 'Помилка при відображенні персоналізованого поля';
+$messages['error_updating_custom_field'] = 'Помилка при редагуванні персоналізованого поля.';
+$messages['custom_field_updated_ok'] = 'Персоналізоване поле "%s" успішно відредаговано';
+
+// resources
+$messages['root_album'] = 'Основний альбом';
+$messages['num_resources'] = 'Кількість файлів';
+$messages['total_size'] = 'Розмір';
+$messages['album'] = 'Альбом';
+$messages['error_incorrect_album_id'] = 'Невірний ідентифікатор альбому';
+$messages['error_base_storage_folder_missing_or_unreadable'] = 'LifeType неможе створити директорії, для відповідних файлів.';
+$messages['items_deleted_ok'] = '%s елементи успішно видалені';
+$messages['error_album_has_children'] = 'Альбом "%s" містить дочірні альбоми. Спочатку відредагуйте альбом, а потім спробуйте ще раз';
+$messages['item_deleted_ok'] = 'Елемент "%s" успішно видалено';
+$messages['error_deleting_album'] = 'Помилка під час видалення альбому "%s"';
+$messages['error_deleting_album2'] = 'Помилка під час видалення альбому з ідентифікатором "%s"';
+$messages['error_deleting_resource'] = 'Помилка під час видалення файлу "%s"';
+$messages['error_deleting_resource2'] = 'Помилка під час видалення файлу з ідентифікатором "%s"';
+$messages['error_no_resources_selected'] = 'Не вибрано жодних елементів для видалення';
+$messages['resource_deleted_ok'] = 'Файл "%s" успішно видалено';
+$messages['album_deleted_ok'] = 'Альбом "%s" успішно видалено';
+$messages['add_resource'] = 'Додати файл';
+$messages['add_resource_preview'] = 'Додати ескіз';
+$messages['add_resource_medium'] = 'Додати середній ескіз';
+$messages['add_album'] = 'Додати альбом';
+
+// new album
+$messages['album_name_help'] = 'Коротка назва альбому';
+$messages['parent'] = 'Батьківський';
+$messages['no_parent'] = 'Не батьківський';
+$messages['parent_album_help'] = 'Для кращої організації, використовуйте вкладені альбоми';
+$messages['album_description_help'] = 'Детальний опис альбому';
+$messages['error_adding_album'] = 'Помилки під час додавання нового альбому. Перевірте будь-ласка введені дані та спробуйте ще раз';
+$messages['album_added_ok'] = 'Альбом "%s" успішно додано';
+
+// edit album
+$messages['error_incorrect_album_id'] = 'Невірний ідентифікатор альбому';
+$messages['error_fetching_album'] = 'Помилка під час відображення альбому';
+$messages['error_updating_album'] = 'Помилка під час редагування альбому. Перевірте будь-ласка введену інформацію та спробуйте ще раз';
+$messages['album_updated_ok'] = 'Альбом "%s" успішно відредаговано';
+$messages['show_album_help'] = 'Якщо відключена опція, альбом не буде відображатися серед списку доступних альбомів блогу';
+
+// new resource
+$messages['file'] = 'Файл';
+$messages['resource_file_help'] = 'Файл, який буде доданий до цього блогу. Використовуйте лінк "Додати поле" для одночасного завантаження більш як одного файла.';
+$messages['add_field'] = 'Додати поле';
+$messages['resource_description_help'] = 'Детальний опис файлу';
+$messages['resource_album_help'] = 'Виберіть альбом, до якого буде доданий цей файл';
+$messages['error_no_resource_uploaded'] = 'Не вибрані файли для завантаження';
+$messages['resource_added_ok'] = 'Файл "%s" успішно додано';
+$messages['error_resource_forbidden_extension'] = 'Увага, заборонений тип файлу';
+$messages['error_resource_too_big'] = 'Файл не додано';
+$messages['error_uploads_disabled'] = 'Завантаження файлів заборонене';
+$messages['error_quota_exceeded'] = 'Файл не додано, перебільшена дискова квота';
+$messages['error_adding_resource'] = 'Помилка при додаванні файлу';
+
+// edit resource
+$messages['editResource'] = 'Редагувати файл';
+$messages['resource_information_help'] = 'Інформація про файл знаходиться внизу';
+$messages['information'] = 'Інформація';
+$messages['size'] = 'Розмір';
+$messages['format'] = 'Формат';
+$messages['dimensions'] = 'Величина';
+$messages['bits_per_sample'] = 'Bps';
+$messages['sample_rate'] = 'Частота';
+$messages['number_of_channels'] = 'Кількість каналів';
+$messages['legnth'] = 'Довжина';
+$messages['thumbnail_format'] = 'Формат ескізів';
+$messages['regenerate_preview'] = 'Згенеровані ескізи';
+$messages['error_fetching_resource'] = 'Помилка при відображені файлу';
+$messages['error_updating_resource'] = 'Помилка при редагуванні файлу';
+$messages['resource_updated_ok'] = 'Файл "%s" успішно відредаговано';
+
+// blog settings
+$messages['blog_link'] = 'Лінк на блог';
+$messages['blog_link_help'] = 'Постійний лінк на блог';
+$messages['blog_name_help'] = 'Назва блогу';
+$messages['blog_description_help'] = 'Детальний опис блогу';
+$messages['language'] = 'Мова';
+$messages['blog_language_help'] = '<b>Мова.</b><br/>Виберіть локалізацію, яка буде використовуватися для вашого блогу';
+$messages['max_main_page_items'] = 'Кількість публікацій на головній сторінці';
+$messages['max_main_page_items_help'] = 'Кількість публікацій, яка завжди буде відображатися на головній сторінці блогу';
+$messages['max_recent_items'] = 'Кількість останніх публікацій';
+$messages['max_recent_items_help'] = 'Максимальна кількість публікацій, які будуть відображатися, як останні на головнй сторінці';
+$messages['template'] = 'Темплейт';
+$messages['choose'] = 'Вибрати';
+$messages['blog_template_help'] = 'Темплейт, який буде використовуватися для відображення блогу.';
+$messages['use_read_more'] = 'Використовувати в публікаціях лінк "детальніше..."';
+$messages['use_read_more_help'] = 'Якщо включити це налаштування, лише текст, введений в поле Текст відображатиметься на головній сторінці. Для відображення  "Всієї публікації", буде використовуватися лінк "детальніше..."';
+$messages['enable_wysiwyg'] = 'Включити візуальний редактор публікацій';
+$messages['enable_wysiwyg_help'] = 'Включити розширений візуальний редактор. Редактор працює в Internet Explorer починаючи з версії 5.5 або в Mozilla починаючи з версії 1.3';
+$messages['enable_comments'] = 'Включити коментарі по замовчуванні';
+$messages['enable_comments_help'] = 'Включити коментарі по замовчуванні для всіх публікацій.';
+$messages['show_future_posts'] = 'Показати майбутні публікації в календарі';
+$messages['show_future_posts_help'] = 'Показати майбутні публікації в календарі';
+$messages['comments_order'] = 'Впорядкувати коментарі';
+$messages['comments_order_help'] = 'Послідовність відображення коментарів на головній сторінці';
+$messages['articles_order'] = 'Сортування публікацій';
+$messages['articles_order_help'] = 'Послідовність відображення публікацій.';
+$messages['oldest_first'] = 'По спаданню';
+$messages['newest_first'] = 'По зростанню';
+$messages['categories_order'] = 'Впорядкувати категорії';
+$messages['categories_order_help'] = 'Послідовність відображення категорій на головній сторінці';
+$messages['most_recent_updated_first'] = 'Спочатку останні оновлення';
+$messages['alphabetical_order'] = 'Згідно алфавітного порядку';
+$messages['reverse_alphabetical_order'] = 'В зворотньому алфавітному порядку';
+$messages['most_articles_first'] = 'Згідно найбільшої кількості публікацій';
+$messages['link_categories_order'] = 'Впорядкувати категорії лінків';
+$messages['link_categories_order_help'] = 'Послідовність відображення категорій лінків на головній сторінці';
+$messages['most_links_first'] = 'Згідно найбільшої кількості лінків';
+$messages['most_links_last'] = 'Згідно найменшої кількості лінків';
+$messages['time_offset'] = 'Встановити час';
+$messages['time_offset_help'] = 'Різниця в часі, котра буде динамічно додаватися до кожної дати і часу в блозі';
+$messages['close'] = 'Закрити';
+$messages['select'] = 'Вибрати';
+$messages['error_updating_settings'] = 'Помилка під час редагування налаштувань блогу. Перевірте введені дані та спробуйте ще раз';
+$messages['error_invalid_number'] = 'Не вірно введене число';
+$messages['error_incorrect_time_offset'] = 'Неправильні налаштування часу';
+$messages['blog_settings_updated_ok'] = 'Налаштування блогу успішно відредаговані';
+$messages['hours'] = 'Години';
+
+// user settings
+$messages['username_help'] = '<b>Ім\'я користувача.</b> <br />Ім\'я повинно складатися з латинських букв та цифр, не більш ніж 15 знаків. <br />Увага: Відповідне поле не можна змінитювати в подальшому!<br />Також зверніть увагу на те що, адреса Вашого блогу буде включати в себе це ім\'я';
+$messages['full_name'] = 'Ім\'я';
+$messages['full_name_help'] = '<b>Ім\'я.</b> <br />Вкажіть Ваше ім\'я';
+$messages['password_help'] = 'Введіть новий пароль або залиште поле порожнім, якщо не хочете змінювати';
+$messages['confirm_password'] = 'Підтвердити пароль';
+$messages['email'] = 'Адреса електронної скриньки';
+$messages['email_help'] = '<b>Адреса електронної скриньки.</b> <br />E-mail, на який будуть приходити всі повідомлення, або будь-яка інформація щодо вашого блогу';
+$messages['bio'] = 'Про себе';
+$messages['bio_help'] = 'Тут ви можете детальніше описати про себе';
+$messages['picture'] = 'Фотографія';
+$messages['user_picture_help'] = 'Виберіть фотографію серед завантажених, і встановіть у вигляді аватару';
+$messages['error_invalid_password'] = 'Неправильний пароль. Переконайтесь в тому, що пароль не занадто короткий ';
+$messages['error_passwords_dont_match'] = 'Паролі не співпадають';
+$messages['error_incorrect_email_address'] = 'Невірно введена адреса електронної скриньки';
+$messages['error_updating_user_settings'] = 'Помилка при редагуванні налаштувань користувача. Перевірте введену інформацію та спробуйте ще раз';
+$messages['user_settings_updated_ok'] = 'Налаштування користувача успішно відредаговані';
+$messages['resource'] = 'Ресурси';
+
+// plugin centre
+$messages['identifier'] = 'Ідентифікатор';
+$messages['error_plugins_disabled'] = 'Вибачте, допоміжні програми відключені.';
+
+// blog users
+$messages['revoke_permissions'] = 'Скасувати доступ';
+$messages['error_no_users_selected'] = 'Користувачі не вибрані';
+$messages['user_removed_from_blog_ok'] = 'Користувач "%s" більше немає прав доступу до цього блогу';
+$messages['users_removed_from_blog_ok'] = '%s користувачі більше немають прав доступу до цього блогу';
+$messages['error_removing_user_from_blog'] = 'Помилка під час видалення доступу користувача "%s"';
+$messages['error_removing_user_from_blog2'] = 'Помилка під час видалення доступу користувача з ідентифікатором "%s"';
+
+// new blog user
+$messages['new_blog_username_help'] = 'Ім\'я користувача, який буде мати доступ до блогу. Інші користувачі будуть мати доступ лише до категорій "Керування" та "Ресурси".';
+$messages['send_notification'] = 'Надіслати повідомлення';
+$messages['send_user_notification_help'] = 'Надіслати повідомлення на e-mail користувача';
+$messages['notification_text'] = 'Текст повідомлення';
+$messages['notification_text_help'] = 'Текст, який буде додано до повідомлення';
+$messages['error_adding_user'] = 'Помилка при наданні прав доступу користувачу. Перевірте введені дані та спробуйте ще раз';
+$messages['error_empty_text'] = 'Введіть будь-ласка текст';
+$messages['error_adding_user'] = 'Помилка під час додавання користувача. Перевірте введені дані та спробуйте ще раз';
+$messages['error_invalid_user'] = 'Користувача "%s" не знайдено';
+$messages['user_added_to_blog_ok'] = 'Користувач "%s" отримав права доступу до блогу';
+
+// blog templates
+$messages['error_no_templates_selected'] = 'Темплейти не вибрані';
+$messages['error_template_is_current'] = 'Поточний темплейт "%s" не може бути видалено';
+$messages['error_removing_template'] = 'Помилка під час видалення темплейту "%s"';
+$messages['template_removed_ok'] = 'Темплейт "%s" успішно видалено';
+$messages['templates_removed_ok'] = '%s Темплейти успішно видалені';
+
+// new blog template
+$messages['template_installed_ok'] = 'Темплейт "%s" успішно додано';
+$messages['error_installing_template'] = 'Помилка під час встановлення темплейту "%s"';
+$messages['error_missing_base_files'] = 'Втрата деяких файлів темплейту';
+$messages['error_add_template_disabled'] = 'Неможливо додати нові темплейти, оскільки ця опція відключена';
+$messages['error_must_upload_file'] = 'Набір темплейтів не завантажено';
+$messages['error_uploads_disabled'] = 'На цьому ресурсі завантаження відключені';
+$messages['error_no_new_templates_found'] = 'Нових темплейтів не знайдено';
+$messages['error_template_not_inside_folder'] = 'Файли, які використовуютÑ