OSDN Git Service

Merge branch 'skinnable-master' master
authorsakamocchi <o-takashi@sakamocchi.jp>
Mon, 17 Sep 2012 11:10:23 +0000 (20:10 +0900)
committersakamocchi <o-takashi@sakamocchi.jp>
Mon, 17 Sep 2012 11:10:23 +0000 (20:10 +0900)
Conflicts:
action.php
index.php
install/index.php
nucleus/bookmarklet.php
nucleus/convert/functions.inc.php
nucleus/convert/wordpress.php
nucleus/index.php
nucleus/libs/ACTION.php
nucleus/libs/ACTIONLOG.php
nucleus/libs/ACTIONS.php
nucleus/libs/ADMIN.php
nucleus/libs/BAN.php
nucleus/libs/BLOG.php
nucleus/libs/BODYACTIONS.php
nucleus/libs/BaseActions.php
nucleus/libs/COMMENT.php
nucleus/libs/COMMENTACTIONS.php
nucleus/libs/COMMENTS.php
nucleus/libs/ITEM.php
nucleus/libs/ITEMACTIONS.php
nucleus/libs/KARMA.php
nucleus/libs/MANAGER.php
nucleus/libs/MEDIA.php
nucleus/libs/MEMBER.php
nucleus/libs/NOTIFICATION.php
nucleus/libs/PAGEFACTORY.php
nucleus/libs/PARSER.php
nucleus/libs/PLUGIN.php
nucleus/libs/PLUGINADMIN.php
nucleus/libs/SEARCH.php
nucleus/libs/SKIN.php
nucleus/libs/TEMPLATE.php
nucleus/libs/backup.php
nucleus/libs/globalfunctions.php
nucleus/libs/i18n.php
nucleus/libs/include/admin-add.template
nucleus/libs/include/admin-edit.template
nucleus/libs/include/bookmarklet-add.template
nucleus/libs/include/bookmarklet-edit.template
nucleus/libs/showlist.php
nucleus/libs/skinie.php
nucleus/libs/sql/DB.php
nucleus/libs/sql/MYSQLPDO.php
nucleus/libs/sql/sql.php
nucleus/locales/bg_Cyrl_BG.ISO-8859-5.php
nucleus/locales/bg_Cyrl_BG.UTF-8.php
nucleus/locales/ca_Latn_ES.ISO-8859-1.php
nucleus/locales/ca_Latn_ES.UTF-8.php
nucleus/locales/cs_Latn_CZ.UTF-8.php
nucleus/locales/cs_Latn_CZ.WINDOWS-1250.php
nucleus/locales/de_Latn_DE.ISO-8859-1.php
nucleus/locales/de_Latn_DE.UTF-8.php
nucleus/locales/en_Latn_US.ISO-8859-1.php
nucleus/locales/en_Latn_US.UTF-8.php
nucleus/locales/es_Latn_ES.ISO-8859-1.php
nucleus/locales/es_Latn_ES.UTF-8.php
nucleus/locales/fa_Arab_IR.UTF-8.php
nucleus/locales/fi_Latn_FI.ISO-8859-1.php
nucleus/locales/fi_Latn_FI.UTF-8.php
nucleus/locales/fr_Latn_FR.ISO-8859-15.php
nucleus/locales/fr_Latn_FR.UTF-8.php
nucleus/locales/gl_Latn_ES.ISO-8859-1.php
nucleus/locales/gl_Latn_ES.UTF-8.php
nucleus/locales/hr_Latn_HR.UTF-8.php
nucleus/locales/hr_Latn_HR.WINDOWS-1250.php
nucleus/locales/hu_Latn_HU.ISO-8859-2.php
nucleus/locales/hu_Latn_HU.UTF-8.php
nucleus/locales/id_Latn_ID.ISO-8859-1.php
nucleus/locales/id_Latn_ID.UTF-8.php
nucleus/locales/it_Latn_IT.ISO-8859-1.php
nucleus/locales/it_Latn_IT.UTF-8.php
nucleus/locales/ja_Jpan_JP.EUC-JP.php
nucleus/locales/ja_Jpan_JP.UTF-8.php
nucleus/locales/ko_Kore_KR.EUC-KR.php
nucleus/locales/ko_Kore_KR.UTF-8.php
nucleus/locales/ku_Arab_TR.UTF-8.php
nucleus/locales/lv_Latn_LV.ISO-8859-13.php
nucleus/locales/lv_Latn_LV.UTF-8.php
nucleus/locales/nl_Latn_NL.ISO-8859-15.php
nucleus/locales/nl_Latn_NL.UTF-8.php
nucleus/locales/pl_Latn_PL.UTF-8.php
nucleus/locales/pt_Latn_BR.ISO-8859-1.php
nucleus/locales/pt_Latn_BR.UTF-8.php
nucleus/locales/ro_Latn_RO.ISO-8859-1.php
nucleus/locales/ro_Latn_RO.UTF-8.php
nucleus/locales/ru_Cyrl_RU.UTF-8.php
nucleus/locales/ru_Cyrl_RU.WINDOWS-1251.php
nucleus/locales/sk_Latn_SK.ISO-8859-2.php
nucleus/locales/sk_Latn_SK.UTF-8.php
nucleus/locales/sr_Cyrl_RS.UTF-8.php
nucleus/locales/ur_Arab_PK.UTF-8.php
nucleus/locales/vi_Latn_VN.UTF-8.php
nucleus/locales/zh_Hans_CN.GB2312.php
nucleus/locales/zh_Hans_CN.UTF-8.php
nucleus/locales/zh_Hant_TW.UTF-8.php
nucleus/media.php
nucleus/plugins/NP_SecurityEnforcer.php
nucleus/plugins/NP_SkinFiles.php
nucleus/upgrades/upgrade.functions.php
nucleus/upgrades/upgrade4.0.php
nucleus/xmlrpc/server.php
skins/admin/bookmarklet/styles/addedit.css
skins/default/nicetitle.js

109 files changed:
1  2 
.buildpath
.project
.settings/org.eclipse.core.resources.prefs
.settings/org.eclipse.php.core.prefs
action.php
index.php
install/index.php
nucleus/bookmarklet.php
nucleus/convert/functions.inc.php
nucleus/convert/wordpress.php
nucleus/index.php
nucleus/libs/ACTION.php
nucleus/libs/ACTIONLOG.php
nucleus/libs/ACTIONS.php
nucleus/libs/ADMIN.php
nucleus/libs/BAN.php
nucleus/libs/BLOG.php
nucleus/libs/BODYACTIONS.php
nucleus/libs/BaseActions.php
nucleus/libs/COMMENT.php
nucleus/libs/COMMENTACTIONS.php
nucleus/libs/COMMENTS.php
nucleus/libs/ITEM.php
nucleus/libs/ITEMACTIONS.php
nucleus/libs/KARMA.php
nucleus/libs/MANAGER.php
nucleus/libs/MEDIA.php
nucleus/libs/MEMBER.php
nucleus/libs/NOTIFICATION.php
nucleus/libs/PARSER.php
nucleus/libs/PLUGIN.php
nucleus/libs/PLUGINADMIN.php
nucleus/libs/SEARCH.php
nucleus/libs/SKIN.php
nucleus/libs/TEMPLATE.php
nucleus/libs/backup.php
nucleus/libs/globalfunctions.php
nucleus/libs/i18n.php
nucleus/libs/showlist.php
nucleus/libs/skinie.php
nucleus/libs/sql/DB.php
nucleus/libs/sql/MYSQLPDO.php
nucleus/libs/sql/sql.php
nucleus/locales/bg_Cyrl_BG.ISO-8859-5.php
nucleus/locales/bg_Cyrl_BG.UTF-8.php
nucleus/locales/ca_Latn_ES.ISO-8859-1.php
nucleus/locales/ca_Latn_ES.UTF-8.php
nucleus/locales/cs_Latn_CZ.UTF-8.php
nucleus/locales/cs_Latn_CZ.WINDOWS-1250.php
nucleus/locales/de_Latn_DE.ISO-8859-1.php
nucleus/locales/de_Latn_DE.UTF-8.php
nucleus/locales/en_Latn_US.ISO-8859-1.php
nucleus/locales/en_Latn_US.UTF-8.php
nucleus/locales/es_Latn_ES.ISO-8859-1.php
nucleus/locales/es_Latn_ES.UTF-8.php
nucleus/locales/fa_Arab_IR.UTF-8.php
nucleus/locales/fi_Latn_FI.ISO-8859-1.php
nucleus/locales/fi_Latn_FI.UTF-8.php
nucleus/locales/fr_Latn_FR.ISO-8859-15.php
nucleus/locales/fr_Latn_FR.UTF-8.php
nucleus/locales/gl_Latn_ES.ISO-8859-1.php
nucleus/locales/gl_Latn_ES.UTF-8.php
nucleus/locales/hr_Latn_HR.UTF-8.php
nucleus/locales/hr_Latn_HR.WINDOWS-1250.php
nucleus/locales/hu_Latn_HU.ISO-8859-2.php
nucleus/locales/hu_Latn_HU.UTF-8.php
nucleus/locales/id_Latn_ID.ISO-8859-1.php
nucleus/locales/id_Latn_ID.UTF-8.php
nucleus/locales/it_Latn_IT.ISO-8859-1.php
nucleus/locales/it_Latn_IT.UTF-8.php
nucleus/locales/ja_Jpan_JP.EUC-JP.php
nucleus/locales/ja_Jpan_JP.UTF-8.php
nucleus/locales/ko_Kore_KR.EUC-KR.php
nucleus/locales/ko_Kore_KR.UTF-8.php
nucleus/locales/ku_Arab_TR.UTF-8.php
nucleus/locales/lv_Latn_LV.ISO-8859-13.php
nucleus/locales/lv_Latn_LV.UTF-8.php
nucleus/locales/nl_Latn_NL.ISO-8859-15.php
nucleus/locales/nl_Latn_NL.UTF-8.php
nucleus/locales/pl_Latn_PL.UTF-8.php
nucleus/locales/pt_Latn_BR.ISO-8859-1.php
nucleus/locales/pt_Latn_BR.UTF-8.php
nucleus/locales/ro_Latn_RO.ISO-8859-1.php
nucleus/locales/ro_Latn_RO.UTF-8.php
nucleus/locales/ru_Cyrl_RU.UTF-8.php
nucleus/locales/ru_Cyrl_RU.WINDOWS-1251.php
nucleus/locales/sk_Latn_SK.ISO-8859-2.php
nucleus/locales/sk_Latn_SK.UTF-8.php
nucleus/locales/sr_Cyrl_RS.UTF-8.php
nucleus/locales/ur_Arab_PK.UTF-8.php
nucleus/locales/vi_Latn_VN.UTF-8.php
nucleus/locales/zh_Hans_CN.GB2312.php
nucleus/locales/zh_Hans_CN.UTF-8.php
nucleus/locales/zh_Hant_TW.UTF-8.php
nucleus/plugins/NP_SecurityEnforcer.php
nucleus/plugins/NP_SkinFiles.php
nucleus/upgrades/upgrade.functions.php
nucleus/upgrades/upgrade0.96.php
nucleus/upgrades/upgrade1.0.php
nucleus/upgrades/upgrade1.1.php
nucleus/upgrades/upgrade1.5.php
nucleus/upgrades/upgrade2.5.php
nucleus/upgrades/upgrade3.3.php
nucleus/upgrades/upgrade4.0.php
nucleus/xmlrpc/server.php
skins/admin/bookmarklet/javascripts/edit.js
skins/admin/bookmarklet/styles/addedit.css
skins/admin/default/styles/admin_original.css
skins/default/nicetitle.js

diff --cc .buildpath
index 0000000,0000000..8bcb4b5
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,5 @@@
++<?xml version="1.0" encoding="UTF-8"?>
++<buildpath>
++      <buildpathentry kind="src" path=""/>
++      <buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
++</buildpath>
diff --cc .project
index 0000000,0000000..7e1a46c
new file mode 100644 (file)
--- /dev/null
--- /dev/null
+++ b/.project
@@@ -1,0 -1,0 +1,22 @@@
++<?xml version="1.0" encoding="UTF-8"?>
++<projectDescription>
++      <name>nucleus-next</name>
++      <comment></comment>
++      <projects>
++      </projects>
++      <buildSpec>
++              <buildCommand>
++                      <name>org.eclipse.wst.validation.validationbuilder</name>
++                      <arguments>
++                      </arguments>
++              </buildCommand>
++              <buildCommand>
++                      <name>org.eclipse.dltk.core.scriptbuilder</name>
++                      <arguments>
++                      </arguments>
++              </buildCommand>
++      </buildSpec>
++      <natures>
++              <nature>org.eclipse.php.core.PHPNature</nature>
++      </natures>
++</projectDescription>
index 0000000,0000000..730e5d2
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,24 @@@
++eclipse.preferences.version=1
++encoding//nucleus/locales/bg_Cyrl_BG.ISO-8859-5.php=ISO-8859-5
++encoding//nucleus/locales/ca_Latn_ES.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/cs_Latn_CZ.WINDOWS-1250.php=WINDOWS-1250
++encoding//nucleus/locales/de_Latn_DE.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/el_Grek_GR.WINDOWS-1253.php=WINDOWS-1253
++encoding//nucleus/locales/en_Latn_US.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/es_Latn_ES.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/fi_Latn_FI.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/fr_Latn_FR.ISO-8859-15.php=ISO-8859-15
++encoding//nucleus/locales/gl_Latn_ES.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/hr_Latn_HR.WINDOWS-1250.php=WINDOWS-1250
++encoding//nucleus/locales/hu_Latn_HU.ISO-8859-2.php=ISO-8859-2
++encoding//nucleus/locales/id_Latn_ID.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/it_Latn_IT.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/ja_Jpan_JP.EUC-JP.php=EUC-JP
++encoding//nucleus/locales/ko_Kore_KR.EUC-KR.php=EUC-KR
++encoding//nucleus/locales/lv_Latn_LV.ISO-8859-13.php=ISO-8859-13
++encoding//nucleus/locales/nl_Latn_NL.ISO-8859-15.php=ISO-8859-15
++encoding//nucleus/locales/pt_Latn_BR.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/ro_Latn_RO.ISO-8859-1.php=ISO-8859-1
++encoding//nucleus/locales/ru_Cyrl_RU.WINDOWS-1251.php=WINDOWS-1251
++encoding//nucleus/locales/sk_Latn_SK.ISO-8859-2.php=ISO-8859-2
++encoding//nucleus/locales/zh_Hans_CN.GB2312.php=GB2312
index 0000000,0000000..5f7d896
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,2 @@@
++eclipse.preferences.version=1
++include_path=
diff --cc action.php
@@@ -1,35 -1,35 +1,72 @@@
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2009 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +\r
 +/**\r
 + * File containing actions that can be performed by visitors of the site,\r
 + * like adding comments, etc...\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: action.php 1721 2012-03-31 10:18:25Z sakamocchi $\r
 + */\r
 +\r
 +$CONF = array();\r
 +require('./config.php');\r
 +include_libs('ACTION.php');\r
 +\r
 +$action = requestVar('action');\r
 +$a = new Action();\r
 +$errorInfo = $a->doAction($action);\r
 +\r
 +if ( $errorInfo )\r
 +{\r
 +      $skin = new SKIN($errorInfo['skinid']);\r
 +      doError($errorInfo['message'], $skin);\r
 +}\r
 +\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * File containing actions that can be performed by visitors of the site,
+  * like adding comments, etc...
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: action.php 1888 2012-06-17 08:38:54Z sakamocchi $
+  */
+ $CONF = array();
+ require('./config.php');
+ include_libs('ACTION.php');
+ $action = requestVar('action');
+ $a = new Action();
+ $errorInfo = $a->doAction($action);
+ if ( $errorInfo )
+ {
+       $skin =& $manager->getSkin($errorInfo['skinid']);
+       doError($errorInfo['message'], $skin);
+ }
++>>>>>>> skinnable-master
  exit;
diff --cc index.php
+++ b/index.php
@@@ -1,8 -1,9 +1,20 @@@
++<<<<<<< HEAD
 +<?php\r
 +// This file will generate and return the main page of the site\r
 +$CONF = array();\r
 +$CONF['Self'] = 'index.php';\r
 +\r
 +include('./config.php');\r
 +\r
 +selector();\r
++=======
+ <?php
+ // This file will generate and return the main page of the site
+ $CONF = array();
+ $CONF['Self'] = 'index.php';
+ include('./config.php');
+ selector();
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + *\r
 + * This script will install the Nucleus tables in your SQL-database,\r
 + * and initialize the data in those tables.\r
 + */\r
 +\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: index.php 1745 2012-04-12 23:45:47Z sakamocchi $\r
 + */\r
 +\r
 +/* global values initialize */\r
 +$CONF = array();\r
 +\r
 +/* reporting all errors for support */\r
 +error_reporting(E_ALL);\r
 +\r
 +$minimum_php_version = '5.0.6';\r
 +$minimum_mysql_version = '3.23';\r
 +\r
 +$page_footer_copyright = '&copy; 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';\r
 +\r
 +// begin if: server's PHP version is below the minimum; halt installation\r
 +if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )\r
 +{\r
 +      exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version ' . $minimum_php_version . '</div>');\r
 +}\r
 +\r
 +// make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);\r
 +if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
 +{\r
 +      ini_set('magic_quotes_runtime', '0');\r
 +}\r
 +\r
 +/* default installed plugins and skins */\r
 +$aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles');\r
 +$aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default');\r
 +\r
 +// Check if some important files\r
 +do_check_files();\r
 +\r
 +/* i18n class is needed for internationalization */\r
 +include_once('../nucleus/libs/i18n.php');\r
 +if ( !i18n::init('UTF-8', '../nucleus/locales') )\r
 +{\r
 +      exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');\r
 +}\r
 +\r
 +// include core classes that are needed for login & plugin handling\r
 +\r
 +// added for 3.5 sql_* wrapper\r
 +global $MYSQL_HANDLER;\r
 +\r
 +if ( !isset($MYSQL_HANDLER) )\r
 +{\r
 +      $MYSQL_HANDLER = array('mysql', '');\r
 +      \r
 +      // check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x\r
 +      if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )\r
 +      {\r
 +              exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');\r
 +      }\r
 +}\r
 +include_once('../nucleus/libs/sql/sql.php');\r
 +\r
 +session_start();\r
 +if ( count($_GET) == 0 && count($_POST) == 0 )\r
 +{\r
 +      unset($_SESSION['param_manager']);\r
 +}\r
 +\r
 +// restore the $param from the session\r
 +if ( array_key_exists('param_manager', $_SESSION) )\r
 +{\r
 +      $param = $_SESSION['param_manager'];\r
 +}\r
 +else\r
 +{\r
 +      $param = new ParamManager();\r
 +}\r
 +\r
 +// include translation file\r
 +if ( array_key_exists('locale', $_POST) ) $param->set_locale();\r
 +i18n::set_current_locale($param->locale);\r
 +$translation_file = './locales/' . i18n::get_current_locale() . '.' . i18n::get_current_charset() . '.php';\r
 +if ( !file_exists($translation_file) )\r
 +{\r
 +      $translation_file = './locales/en_Latn_US.UTF-8.php';\r
 +}\r
 +include($translation_file);\r
 +\r
 +do_action();\r
 +\r
 +// $param is saved to the session\r
 +if ( isset($param) )\r
 +{\r
 +      $_SESSION['param_manager'] = $param;\r
 +}\r
 +else\r
 +{\r
 +      unset($_SESSION['param_manager']);\r
 +}\r
 +exit;\r
 +\r
 +/**\r
 + * installer action\r
 + */\r
 +function do_action()\r
 +{\r
 +      global $param;\r
 +\r
 +      if ( array_key_exists('action', $_POST) )\r
 +      {\r
 +              $isPostback = true;\r
 +      }\r
 +      else\r
 +      {\r
 +              $isPostback = false;\r
 +      }\r
 +\r
 +      // mode change\r
 +      if ( array_key_exists('mode', $_REQUEST) )\r
 +      {\r
 +              if ( $_REQUEST['mode'] == 'detail' )\r
 +              {\r
 +                      $param->set_state('detail');\r
 +              }\r
 +              elseif ( $_REQUEST['mode'] == 'simple' )\r
 +              {\r
 +                      $param->set_state('mysql');\r
 +              }\r
 +      }\r
 +\r
 +      // input parameter check\r
 +      if ( $isPostback )\r
 +      {\r
 +              switch ( $param->state )\r
 +              {\r
 +                      case 'locale':\r
 +                              $param->set_locale();\r
 +                              $param->set_state('mysql');\r
 +                              $isPostback = false;\r
 +                              break;\r
 +                      case 'mysql':\r
 +                              if ( count($param->check_mysql_parameters()) == 0 )\r
 +                              {\r
 +                                      $param->set_state('weblog');\r
 +                                      $isPostback = false;\r
 +                              }\r
 +                              break;\r
 +                      case 'weblog':\r
 +                              if ( count($param->check_user_parameters()) == 0\r
 +                                      && count($param->check_weblog_parameters()) == 0 )\r
 +                              {\r
 +                                      $param->set_state('install');\r
 +                                      $isPostback = false;\r
 +                              }\r
 +                              break;\r
 +                      case 'detail':\r
 +                              if ( $param->check_all_parameters() )\r
 +                              {\r
 +                                      $param->set_state('install');\r
 +                                      $isPostback = false;\r
 +                              }\r
 +                              break;\r
 +              }\r
 +      }\r
 +\r
 +      // page render\r
 +      show_header();\r
 +      switch ( $param->state )\r
 +      {\r
 +              case 'locale':\r
 +                      show_select_locale_form();\r
 +                      break;\r
 +              case 'mysql':\r
 +                      show_database_setting_form($isPostback);\r
 +                      break;\r
 +              case 'weblog':\r
 +                      show_blog_setting_form($isPostback);\r
 +                      break;\r
 +              case 'detail':\r
 +                      show_detail_setting_form($isPostback);\r
 +                      break;\r
 +              case 'install':\r
 +                      show_install_complete_form();\r
 +                      break;\r
 +      }\r
 +      show_footer();\r
 +}\r
 +\r
 +/**\r
 + * header tag of the installation screens\r
 + **/\r
 +function show_header()\r
 +{\r
 +      global $param;\r
 +\r
 +      /* HTTP 1.1 application for no caching */\r
 +      header("Cache-Control: no-cache, must-revalidate");\r
 +      header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");\r
 +      header('Content-Type: text/html; charset=' . i18n::get_current_charset());\r
 +?>\r
 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
 +<html xmlns="http://www.w3.org/1999/xhtml">\r
 +      <head>\r
 +              <title><?php echo _TITLE; ?></title>\r
 +              <link rel="stylesheet" type="text/css" href="./styles/inst.css" />\r
 +              <style type="text/css">\r
 +              <!--\r
 +              <?php echo _BODYFONTSTYLE; ?>\r
 +              -->\r
 +              </style>\r
 +              <script type="text/javascript">\r
 +                      function SelectText( element ) {\r
 +                              window.setTimeout( function() { element.select() }, 0 );\r
 +                      }\r
 +                      var isSubmit = false;\r
 +                      function OnceSubmit() {\r
 +                              if (!isSubmit) {\r
 +                                      isSubmit = true;\r
 +                                      window.setTimeout( function() { isSubmit = false; }, 10000 );\r
 +                                      return true;\r
 +                              }\r
 +                              return false;\r
 +                      }\r
 +              </script>\r
 +      </head>\r
 +      <body>\r
 +              <div id="header">\r
 +                      <div id="navigation">\r
 +                              <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>\r
 +                              <ul>\r
 +<?php\r
 +      if ( in_array($param->state, array('mysql', 'weblog', 'install')) )\r
 +      {\r
 +              echo '<li>', _STEP1, '</li><li';\r
 +              if ( $param->state == 'mysql' )\r
 +              {\r
 +                      echo ' class="gry"';\r
 +              }\r
 +              echo '>&nbsp; &gt; &nbsp;', _STEP2, '</li><li';\r
 +              if ( in_array($param->state, array('mysql', 'weblog')) )\r
 +              {\r
 +                      echo ' class="gry"';\r
 +              }\r
 +              echo '>&nbsp; &gt; &nbsp;', _STEP3, "</li>\n";\r
 +      }\r
 +      if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )\r
 +      {\r
 +              echo '<li class="rightbox">';\r
 +              if ( in_array($param->state, array('mysql', 'weblog')) )\r
 +              {\r
 +                      echo '<a href="./?mode=detail">', _MODE2, '</a>';\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo '<a href="./?mode=simple">', _MODE1, '</a>';\r
 +              }\r
 +              echo '</li>';\r
 +      }\r
 +?>\r
 +                              </ul>\r
 +                      </div>\r
 +              </div>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * footer tag of the installation screens\r
 + **/\r
 +function show_footer()\r
 +{\r
 +      global $page_footer_copyright;\r
 +?>\r
 +              <div id="footer">\r
 +                      <?php echo $page_footer_copyright; ?>\r
 +              </div>\r
 +      </body>\r
 +</html>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * Display the form for language select\r
 + */\r
 +function show_select_locale_form()\r
 +{\r
 +      // get locale list\r
 +      $localelist = i18n::get_available_locale_list();\r
 +      $locales = array();\r
 +      foreach ( $localelist as $locale ) {\r
 +              $checkfile = './locales/' . $locale . '.' . i18n::get_current_charset() . '.php';\r
 +              $locales[] = array( $locale, (!file_exists($checkfile) ? '*&nbsp;' : '') . $locale );\r
 +      }\r
 +?>\r
 +              <div id="container">\r
 +                      <p style="font-size:152%;font-weight:bold;">\r
 +                              Select your locale:\r
 +                      </p>\r
 +                      <form method="post" action="./index.php">\r
 +\r
 +                              <div class="prt">\r
 +                                      <select name="locale">\r
 +<?php\r
 +      // Get the browser language that can be displayed\r
 +      // TODO: default locale select simple implementation\r
 +      $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);\r
 +      $language = (is_array($languages) && count($languages) > 0) ? preg_replace('#^([\w]+).*$#', '$1', $languages[0]) : '';\r
 +\r
 +      foreach ( $locales as $locale )\r
 +      {\r
 +              echo "<option value=\"$locale[0]\"";\r
 +              if ( i18n::strpos($locale[0], $language) === 0 )\r
 +              {\r
 +                      echo ' selected';\r
 +              }\r
 +              echo ">$locale[1]</option>\n";\r
 +      }\r
 +?>\r
 +                                      </select>\r
 +                                      <p>Nucleus is installed in the selected locale, the locale of the Asterisk prefixed will be displayed in English because there is no translation of the installer file.</p>\r
 +                                      <p>We will wait for the translator by volunteers!</p>\r
 +                                      </p>\r
 +                                      <p class="sbt">\r
 +                                              <button type="submit" name="action" value="locale" class="sbt_arw">START</button>\r
 +                                      </p>\r
 +                              </div>\r
 +                      </form>\r
 +              </div>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * Display the form to set up a database\r
 + * @param bool $isPostback\r
 + */\r
 +function show_database_setting_form($isPostback)\r
 +{\r
 +      global $param, $minimum_mysql_version;\r
 +\r
 +      $config_writable = canConfigFileWritable();\r
 +      $mysql_version = getMySqlVersion();\r
 +?>\r
 +              <div id="container">\r
 +                      <p class="msg">\r
 +<?php\r
 +      echo _SIMPLE_NAVI1;\r
 +      if ( $config_writable != '' )\r
 +      {\r
 +              echo '<span class="err">', $config_writable, '</span>';\r
 +      }\r
 +      if ( $mysql_version == '0.0.0' )\r
 +      {\r
 +              echo '<span class="err">', _DBVERSION_UNKOWN, '</span>';\r
 +      }\r
 +      elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
 +      {\r
 +              echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
 +      }\r
 +?>\r
 +                      </p>\r
 +                      <form method="post" action="./index.php">\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _DB_HEADER; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_mysql_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +                                      <p class="sbt">\r
 +                                              <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>\r
 +                                              <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>\r
 +                                      </p>\r
 +                                      <p class="msg">\r
 +                                              <?php echo _DB_TEXT1; ?>\r
 +                                      </p>\r
 +                              </div>\r
 +                      </form>\r
 +              </div>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * Displays a form to the blog settings\r
 + * @param bool $isPostback\r
 + */\r
 +function show_blog_setting_form($isPostback)\r
 +{\r
 +      global $param;\r
 +?>\r
 +              <div id="container">\r
 +                      <p class="msg">\r
 +                              <?php echo _SIMPLE_NAVI2; ?>\r
 +                      </p>\r
 +                      <form method="post" action="./index.php">\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _BLOG_HEADER; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_weblog_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
 +                                                              <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +                              </div>\r
 +\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _ADMIN_HEADER; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_user_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
 +                                                              <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
 +                                                              <td><input type="password" name="user_password" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
 +                                                              <td><input type="password" name="user_password2" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
 +                                                              <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +                                      <p class="sbt">\r
 +                                              <button type="submit" name="action" value="weblog" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
 +                                      </p>\r
 +                              </div>\r
 +                      </form>\r
 +              </div>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * Displays a form to the detail settings\r
 + * @param bool $isPostback\r
 + */\r
 +function show_detail_setting_form($isPostback)\r
 +{\r
 +      global $param, $minimum_mysql_version;\r
 +\r
 +      $mysql_version = getMySqlVersion();\r
 +?>\r
 +              <div id="container_detailed">\r
 +                      <p class="msg">\r
 +                              <?php echo _DETAIL_NAVI1; ?>\r
 +<?php\r
 +      if ( $isPostback && !$param->check_all_parameters() )\r
 +      {\r
 +              echo '<span class="err">', _VALID_ERROR, "</span>\n";\r
 +      }\r
 +?>\r
 +                      </p>\r
 +                      <ul class="msg">\r
 +                              <li>PHP: <?php echo phpversion(); ?></li>\r
 +                              <li>MySQL:\r
 +<?php\r
 +      echo ($mysql_version == '0.0.0') ? _DBVERSION_UNKOWN : $mysql_version;\r
 +      if ( version_compare($mysql_version, $minimum_mysql_version, '<') )\r
 +      {\r
 +              echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';\r
 +      }\r
 +?></li>\r
 +                      </ul>\r
 +                      <form method="post" action="">\r
 +\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _DETAIL_HEADER1; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_mysql_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +\r
 +                                      <h2><?php echo _DETAIL_HEADER2; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_uri_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +              $errors = $param->check_path_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>\r
 +                                                              <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>\r
 +                                                              <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>\r
 +                                                              <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>\r
 +                                                              <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>\r
 +                                                              <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>\r
 +                                                              <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>\r
 +                                                              <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>\r
 +                                                              <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>\r
 +                                                              <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +                                      <p class="msg">\r
 +                                              <?php echo _DETAIL_TEXT3; ?>\r
 +                                      </p>\r
 +\r
 +                                      <h2><?php echo _DETAIL_HEADER3; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      echo _DETAIL_TEXT4;\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_user_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>\r
 +                                                              <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>\r
 +                                                              <td><input type="password" name="user_password" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>\r
 +                                                              <td><input type="password" name="user_password2" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>\r
 +                                                              <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +\r
 +                                      <h2><?php echo _DETAIL_HEADER4; ?></h2>\r
 +                                      <p class="msg">\r
 +<?php\r
 +      echo _DETAIL_TEXT5;\r
 +      if ( $isPostback )\r
 +      {\r
 +              $errors = $param->check_weblog_parameters();\r
 +              if ( is_array($errors) )\r
 +              {\r
 +                      foreach ( $errors as $error )\r
 +                      {\r
 +                              echo '<span class="err">', $error, "</span>\n";\r
 +                      }\r
 +              }\r
 +      }\r
 +?>\r
 +                                      </p>\r
 +                                      <table>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>\r
 +                                                              <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>\r
 +                                              </tr>\r
 +                                              <tr>\r
 +                                                      <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>\r
 +                                                              <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>\r
 +                                              </tr>\r
 +                                      </table>\r
 +\r
 +                                      <p class="msg">\r
 +                                              <?php echo _DETAIL_TEXT6; ?>\r
 +                                      </p>\r
 +\r
 +                                      <p class="sbt">\r
 +                                              <button type="submit" name="action" value="detail" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>\r
 +                                      </p>\r
 +                              </div>\r
 +                      </form>\r
 +              </div>\r
 +<?php\r
 +}\r
 +\r
 +/**\r
 + * Displays a screen to signal the completion of the installation\r
 + */\r
 +function show_install_complete_form()\r
 +{\r
 +      global $MYSQL_HANDLER, $param;\r
 +      $errors = do_install();\r
 +?>\r
 +              <div id="container">\r
 +                      <p class="msg">\r
 +<?php\r
 +      if ( is_array($errors) && count($errors) > 0 )\r
 +      {\r
 +              echo _INST_ERROR;\r
 +              foreach ( $errors as $error )\r
 +              {\r
 +                      echo '<span class="err">', $error, "</span>\n";\r
 +              }\r
 +      }\r
 +      else\r
 +      {\r
 +              echo _INST_TEXT;\r
 +              if ( array_key_exists('config_data', $_SESSION) )\r
 +              {\r
 +                      echo '<span class="err">', _INST_TEXT4, '</span>';\r
 +?>\r
 +<textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset()) ?></textarea>\r
 +<?php\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo '<span class="err">', _INST_TEXT5, '</span>';\r
 +              }\r
 +?>\r
 +                      </p>\r
 +                      <form method="post" action="./index.php">\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _INST_HEADER1; ?></h2>\r
 +                                      <p class="msg">\r
 +                                              <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>\r
 +                                      </p>\r
 +                                      <p class="sbt">\r
 +                                              <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>\r
 +                                      </p>\r
 +                              </div>\r
 +\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _INST_HEADER2; ?></h2>\r
 +                                      <p class="msg">\r
 +                                              <?php echo _INST_TEXT2; ?>\r
 +                                      </p>\r
 +                                      <p class="sbt">\r
 +                                              <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>\r
 +                                      </p>\r
 +                              </div>\r
 +\r
 +                              <div class="prt">\r
 +                                      <h2><?php echo _INST_HEADER3; ?></h2>\r
 +                                      <p class="msg">\r
 +                                              <?php echo _INST_TEXT3; ?>\r
 +                                      </p>\r
 +                                      <p class="sbt">\r
 +                                              <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>\r
 +                                      </p>\r
 +                              </div>\r
 +                      </form>\r
 +<?php\r
 +      }\r
 +?>\r
 +              </div>\r
 +<?php\r
 +      unset($param);\r
 +}\r
 +\r
 +/**\r
 + * The installation process itself\r
 + * @return array error messages\r
 + */\r
 +function do_install()\r
 +{\r
 +      global $param;\r
 +      global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;\r
 +      global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;\r
 +      $errors = array();\r
 +\r
 +      /*\r
 +       * 1. put all param-vars into vars\r
 +       */\r
 +      $MYSQL_HOST             = $param->mysql_host;\r
 +      $MYSQL_USER             = $param->mysql_user;\r
 +      $MYSQL_PASSWORD = $param->mysql_password;\r
 +      $MYSQL_DATABASE = $param->mysql_database;\r
 +      $MYSQL_PREFIX   = $param->mysql_tablePrefix;\r
 +\r
 +      $DIR_NUCLEUS    = $param->AdminPath;\r
 +      $DIR_MEDIA              = $param->MediaPath;\r
 +      $DIR_SKINS              = $param->SkinsPath;\r
 +      $DIR_PLUGINS    = $DIR_NUCLEUS . 'plugins/';\r
 +      $DIR_LOCALES    = $DIR_NUCLEUS . 'locales/';\r
 +      $DIR_LIBS               = $DIR_NUCLEUS . 'libs/';\r
 +\r
 +      /*\r
 +       * 2.open mySQL connection\r
 +       */\r
 +      $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);\r
 +      if ( $MYSQL_CONN == FALSE )\r
 +      {\r
 +              $errors[] = _DBCONNECT_ERROR;\r
 +              return $errors;\r
 +      }\r
 +\r
 +      /*\r
 +       * 3. try to create database if needed\r
 +       */\r
 +      if ( DB::execute("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR1 . ': ' . $errinfo[2];\r
 +      }\r
 +\r
 +      /*\r
 +       * 4. try to select database\r
 +       */\r
 +      $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
 +      if ( !$MYSQL_CONN )\r
 +      {\r
 +              $errors[] = _INST_ERROR2;\r
 +      }\r
 +\r
 +      if ( count($errors) > 0 )\r
 +      {\r
 +              return $errors;\r
 +      }\r
 +\r
 +      /*\r
 +       * 5. execute queries\r
 +       */\r
 +      $table_names = array(\r
 +              'nucleus_actionlog',\r
 +              'nucleus_ban',\r
 +              'nucleus_blog',\r
 +              'nucleus_category',\r
 +              'nucleus_comment',\r
 +              'nucleus_config',\r
 +              'nucleus_item',\r
 +              'nucleus_karma',\r
 +              'nucleus_member',\r
 +              'nucleus_plugin',\r
 +              'nucleus_skin',\r
 +              'nucleus_template',\r
 +              'nucleus_team',\r
 +              'nucleus_activation',\r
 +              'nucleus_tickets'\r
 +      );\r
 +\r
 +      $prefixed_table_names = array();\r
 +      foreach ( $table_names as $table_name )\r
 +      {\r
 +              $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;\r
 +      }\r
 +\r
 +      // table exists check\r
 +      $result = DB::getResult('SHOW TABLES');\r
 +      foreach ( $result as $row )\r
 +      {\r
 +              if ( in_array($row[0], $prefixed_table_names) )\r
 +              {\r
 +                      $errors[] = _INST_ERROR3;\r
 +                      break;\r
 +              }\r
 +      }\r
 +      if ( count($errors) > 0 )\r
 +      {\r
 +              return $errors;\r
 +      }\r
 +\r
 +      $filename = 'install.sql';\r
 +      $fd = fopen($filename, 'r');\r
 +      $queries = fread($fd, filesize($filename));\r
 +      fclose($fd);\r
 +\r
 +      $queries = preg_split('#(;\n|;\r)#', $queries);\r
 +\r
 +      foreach ( $queries as $query )\r
 +      {\r
 +              if ( preg_match('/\w+/', $query) )\r
 +              {\r
 +                      if ( $MYSQL_PREFIX )\r
 +                      {\r
 +                              $query = str_replace($table_names, $prefixed_table_names, $query);\r
 +                      }\r
 +\r
 +                      if ( DB::execute($query) === FALSE )\r
 +                      {\r
 +                              $errinfo = DB::getError();\r
 +                              $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
 +                      }\r
 +              }\r
 +      }\r
 +\r
 +      /*\r
 +       * 6. put needed records\r
 +       */\r
 +      /* push first post */\r
 +      $query = "INSERT INTO %s VALUES (1, %s, %s, %s, 1, 1, %s, 0, 0, 0, 1, 0, 1)";\r
 +      $query = sprintf($query,\r
 +              tableName('nucleus_item'),\r
 +              DB::quoteValue(_1ST_POST_TITLE),\r
 +              DB::quoteValue(_1ST_POST),\r
 +              DB::quoteValue(_1ST_POST2),\r
 +              DB::formatDateTime()\r
 +      );\r
 +      if ( DB::execute($query) === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];\r
 +      }\r
 +\r
 +      /* push configurations */\r
 +      array_merge($errors, updateConfig('IndexURL', $param->IndexURL));\r
 +      array_merge($errors, updateConfig('AdminURL', $param->AdminURL));\r
 +      array_merge($errors, updateConfig('MediaURL', $param->MediaURL));\r
 +      array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));\r
 +      array_merge($errors, updateConfig('PluginURL', $param->PluginURL));\r
 +      array_merge($errors, updateConfig('ActionURL', $param->ActionURL));\r
 +      array_merge($errors, updateConfig('AdminEmail', $param->user_email));\r
 +      array_merge($errors, updateConfig('SiteName', $param->blog_name));\r
 +      array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));\r
 +\r
 +      /* push super admin */\r
 +      $query = "UPDATE %s SET mname = %s, mrealname = %s, mpassword = %s, memail = %s, murl = %s, madmin = 1, mcanlogin = 1 WHERE mnumber = 1";\r
 +      $query = sprintf($query,\r
 +              tableName('nucleus_member'),\r
 +              DB::quoteValue($param->user_name),\r
 +              DB::quoteValue($param->user_realname),\r
 +              DB::quoteValue(md5($param->user_password)),\r
 +              DB::quoteValue($param->user_email),\r
 +              DB::quoteValue($param->IndexURL)\r
 +      );\r
 +      if ( DB::execute($query) === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR5 . ': ' . $errinfo[2];\r
 +      }\r
 +\r
 +      /* push new weblog */\r
 +      $query = "UPDATE %s SET bname = %s, bshortname = %s, burl = %s WHERE bnumber = 1";\r
 +      $query = sprintf($query,\r
 +              tableName('nucleus_blog'),\r
 +              DB::quoteValue($param->blog_name),\r
 +              DB::quoteValue($param->blog_shortname),\r
 +              DB::quoteValue($param->IndexURL)\r
 +      );\r
 +      if ( DB::execute($query) === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
 +      }\r
 +\r
 +      /* push default category */\r
 +      $query = "UPDATE %s SET cname = %s, cdesc = %s WHERE catid = 1";\r
 +      $query = sprintf($query,\r
 +              tableName('nucleus_category'),\r
 +              DB::quoteValue(_GENERALCAT_NAME),\r
 +              DB::quoteValue(_GENERALCAT_DESC)\r
 +      );\r
 +      if ( DB::execute($query) === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];\r
 +      }\r
 +\r
 +      /*\r
 +       * 7. install default plugins and skins\r
 +       */\r
 +      global $aConfPlugsToInstall, $aConfSkinsToImport;\r
 +      $aSkinErrors = array();\r
 +      $aPlugErrors = array();\r
 +\r
 +      if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )\r
 +      {\r
 +              include_once($DIR_LIBS . 'globalfunctions.php');\r
 +              global $manager;\r
 +              if ( !isset($manager) )\r
 +              {\r
 +                      $manager = new Manager();\r
 +              }\r
 +\r
 +              include_once($DIR_LIBS . 'skinie.php');\r
 +              \r
 +              $aSkinErrors = installCustomSkins();\r
 +              if ( count($aSkinErrors) > 0 )\r
 +              {\r
 +                      array_merge($errors, $aSkinErrors);\r
 +              }\r
 +\r
 +              $query          = "SELECT sdnumber FROM %s WHERE sdname='default'";\r
 +              $query          = sprintf($query, tableName('nucleus_skin_desc'));\r
 +              $defSkinID      = intval(DB::getValue($query));\r
 +\r
 +              $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";\r
 +              $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);\r
 +              DB::execute($query);\r
 +              \r
 +              $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";\r
 +              $query = sprintf($query, tableName('nucleus_config'), $defSkinID);\r
 +              DB::execute($query);\r
 +\r
 +              $aPlugErrors = installCustomPlugs();\r
 +              if ( count($aPlugErrors) > 0 )\r
 +              {\r
 +                      array_merge($errors, $aPlugErrors);\r
 +              }\r
 +      }\r
 +\r
 +      /*\r
 +       * 8. Write config file ourselves (if possible)\r
 +       */\r
 +      $config_data = '<' . '?php' . "\n";\r
 +      $config_data .= "// mySQL connection information\n";\r
 +      $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";\r
 +      $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";\r
 +      $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";\r
 +      $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";\r
 +      $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";\r
 +      $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";\r
 +      $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";\r
 +      $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";\r
 +      $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";\r
 +      $config_data .= "\$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";\r
 +      $config_data .= "\n";\r
 +      $config_data .= "// main nucleus directory\n";\r
 +      $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";\r
 +      $config_data .= "\n";\r
 +      $config_data .= "// path to media dir\n";\r
 +      $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";\r
 +      $config_data .= "\n";\r
 +      $config_data .= "// extra skin files for imported skins\n";\r
 +      $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";\r
 +      $config_data .= "\n";\r
 +      $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";\r
 +      $config_data .= "// you can redefine them if you wish\n";\r
 +      $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";\r
 +      $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";\r
 +      $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";\r
 +      $config_data .= "\n";\r
 +      $config_data .= "// include libs\n";\r
 +      $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";\r
 +      $config_data .= "?" . ">";\r
 +\r
 +      $result = false;\r
 +      if ( @!file_exists('../config.php') || is_writable('../config.php') )\r
 +      {\r
 +              if ( $fp = @fopen('../config.php', 'w') )\r
 +              {\r
 +                      $result = @fwrite($fp, $config_data, i18n::strlen($config_data));\r
 +                      fclose($fp);\r
 +              }\r
 +      }\r
 +\r
 +      if ( $result )\r
 +      {\r
 +              // try to change the read-only permission.\r
 +              if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
 +              {\r
 +                      @chmod('../config.php', 0444);\r
 +              }\r
 +      }\r
 +      else\r
 +      {\r
 +              $_SESSION['config_data'] = $config_data;\r
 +      }\r
 +\r
 +      return $errors;\r
 +}\r
 +\r
 +/**\r
 + * Confirm that you can write to the configuration file\r
 + * @return string error message\r
 + */\r
 +function canConfigFileWritable()\r
 +{\r
 +      if ( @file_exists('../config.php') && @!is_writable('../config.php') )\r
 +      {\r
 +              // try to change the read-write permission.\r
 +              if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )\r
 +              {\r
 +                      @chmod('../config.php', 0666);\r
 +              }\r
 +\r
 +              if ( @!is_writable('../config.php') )\r
 +              {\r
 +                      return _INST_ERROR8;\r
 +              }\r
 +      }\r
 +      return '';\r
 +}\r
 +\r
 +/**\r
 + * To obtain the version of MySQL\r
 + * @return string\r
 + */\r
 +function getMySqlVersion()\r
 +{\r
 +      global $MYSQL_HANDLER, $minimum_mysql_version, $errors;\r
 +      // Turn on output buffer\r
 +      // Needed to repress the output of the sql function that are\r
 +      // not part of php (in this case the @ operator doesn't work)\r
 +      ob_start();\r
 +\r
 +      // note: this piece of code is taken from phpMyAdmin\r
 +      $conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], 'localhost', '', '');\r
 +\r
 +      if ( $conn )\r
 +      {\r
 +              $row = DB::getAttribute(PDO::ATTR_SERVER_VERSION);\r
 +              $match = preg_split('#\.#', $row);\r
 +      }\r
 +      else\r
 +      {\r
 +              $row = @DB::getRow('SHOW VARIABLES LIKE \'version\'');\r
 +\r
 +              if ( $row )\r
 +              {\r
 +                      $match = preg_split('#\.#', $row[1]);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';\r
 +                      preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);\r
 +                      $match = preg_split('#\.#', $version[0]);\r
 +\r
 +                      if ( $match[0] == '' )\r
 +                      {\r
 +                              $match = array('0', '0', '0');\r
 +                      }\r
 +              }\r
 +      }\r
 +\r
 +      @DB::disConnect();\r
 +\r
 +      //End and clean output buffer\r
 +      ob_end_clean();\r
 +\r
 +      return implode($match, '.');\r
 +}\r
 +\r
 +/**\r
 + * Add a table prefix if it is used\r
 + *\r
 + * @param string $input table name with prefix\r
 + * @return string\r
 + */\r
 +function tableName($input)\r
 +{\r
 +      global $MYSQL_PREFIX;\r
 +      if ( $MYSQL_PREFIX )\r
 +      {\r
 +              return $MYSQL_PREFIX . $input;\r
 +      }\r
 +      else\r
 +      {\r
 +              return $input;\r
 +      }\r
 +}\r
 +\r
 +/**\r
 + * Install custom plugins\r
 + */\r
 +function installCustomPlugs()\r
 +{\r
 +      global $aConfPlugsToInstall, $DIR_LIBS, $manager;\r
 +\r
 +      $aErrors = array();\r
 +      if ( count($aConfPlugsToInstall) == 0 )\r
 +      {\r
 +              return $aErrors;\r
 +      }\r
 +\r
 +      $query = sprintf('SELECT * FROM %s', tableName('nucleus_plugin'));\r
 +      $res = DB::getResult($query);\r
 +      $numCurrent = $res->rowCount();\r
 +\r
 +      foreach ( $aConfPlugsToInstall as $plugName )\r
 +      {\r
 +              $query = sprintf('INSERT INTO %s (porder, pfile) VALUES (%d, %s)',\r
 +                      tableName('nucleus_plugin'),\r
 +                      (++$numCurrent),\r
 +                      DB::quoteValue($plugName));\r
 +              DB::execute($query);\r
 +\r
 +              $manager->clearCachedInfo('installedPlugins');\r
 +              $plugin =& $manager->getPlugin($plugName);\r
 +              $plugin->setID($numCurrent);\r
 +\r
 +              if ( !$plugin )\r
 +              {\r
 +                      $query = sprintf('DELETE FROM %s WHERE pfile = %s',\r
 +                              tableName('nucleus_plugin'),\r
 +                              DB::quoteValue($plugName));\r
 +                      DB::execute($query);\r
 +                      $numCurrent--;\r
 +                      array_push($aErrors, sprintf(_INST_ERROR9, $plugName));\r
 +                      continue;\r
 +              }\r
 +              $plugin->install();\r
 +      }\r
 +\r
 +      $query = sprintf('DELETE FROM %s', tableName('nucleus_plugin_event'));\r
 +      DB::execute($query);\r
 +      $query = sprintf('SELECT pid, pfile FROM %s', tableName('nucleus_plugin'));\r
 +      $res = DB::getResult($query);\r
 +\r
 +      foreach ( $res as $row )\r
 +      {\r
 +              $plug =& $manager->getPlugin($row['pfile']);\r
 +\r
 +              if ( $plug )\r
 +              {\r
 +                      $eventList = $plug->getEventList();\r
 +                      foreach ( $eventList as $eventName )\r
 +                      {\r
 +                              $query = sprintf('INSERT INTO %s (pid, event) VALUES (%d, %s)',\r
 +                                      tableName('nucleus_plugin_event'),\r
 +                                      intval($row['pid']),\r
 +                                      DB::quoteValue($eventName));\r
 +                              DB::execute($query);\r
 +                      }\r
 +              }\r
 +      }\r
 +      return $aErrors;\r
 +}\r
 +\r
 +/**\r
 + * Install custom skins\r
 + * Prepares the installation of custom skins\r
 + */\r
 +function installCustomSkins()\r
 +{\r
 +      global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;\r
 +\r
 +      $aErrors = array();\r
 +      if ( count($aConfSkinsToImport) == 0 )\r
 +      {\r
 +              return $aErrors;\r
 +      }\r
 +\r
 +      $importer = new SkinImport();\r
 +\r
 +      foreach ( $aConfSkinsToImport as $skinName )\r
 +      {\r
 +              $importer->reset();\r
 +              $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';\r
 +\r
 +              if ( !@file_exists($skinFile) )\r
 +              {\r
 +                      array_push($aErrors, sprintf(_INST_ERROR10, $skinFile));\r
 +                      continue;\r
 +              }\r
 +\r
 +              $error = $importer->readFile($skinFile);\r
 +\r
 +              if ( $error )\r
 +              {\r
 +                      array_push($aErrors, sprintf(_INST_ERROR11, $skinName) . ' : ' . $error);\r
 +                      continue;\r
 +              }\r
 +\r
 +              $error = $importer->writeToDatabase(1);\r
 +\r
 +              if ( $error )\r
 +              {\r
 +                      array_push($aErrors, sprintf(_INST_ERROR12, $skinName) . ' : ' . $error);\r
 +                      continue;\r
 +              }\r
 +      }\r
 +      return $aErrors;\r
 +}\r
 +\r
 +/**\r
 + * Check if some important files of the Nucleus CMS installation are available\r
 + * Give an error if one or more files are not accessible\r
 + */\r
 +function do_check_files()\r
 +{\r
 +      $missingfiles = array();\r
 +      $files = array(\r
 +              './install.sql',\r
 +              '../index.php',\r
 +              '../action.php',\r
 +              '../nucleus/index.php',\r
 +              '../nucleus/media.php',\r
 +              '../nucleus/libs/ACTION.php',\r
 +              '../nucleus/libs/ACTIONLOG.php',\r
 +              '../nucleus/libs/ACTIONS.php',\r
 +              '../nucleus/libs/ADMIN.php',\r
 +              '../nucleus/libs/BaseActions.php',\r
 +              '../nucleus/libs/BLOG.php',\r
 +              '../nucleus/libs/BODYACTIONS.php',\r
 +              '../nucleus/libs/COMMENT.php',\r
 +              '../nucleus/libs/COMMENTACTIONS.php',\r
 +              '../nucleus/libs/COMMENTS.php',\r
 +              '../nucleus/libs/ENCAPSULATE.php',\r
 +              '../nucleus/libs/ENTITY.php',\r
 +              '../nucleus/libs/globalfunctions.php',\r
 +              '../nucleus/libs/i18n.php',\r
 +              '../nucleus/libs/ITEM.php',\r
 +              '../nucleus/libs/ITEMACTIONS.php',\r
 +              '../nucleus/libs/LINK.php',\r
 +              '../nucleus/libs/MANAGER.php',\r
 +              '../nucleus/libs/MEDIA.php',\r
 +              '../nucleus/libs/MEMBER.php',\r
 +              '../nucleus/libs/NOTIFICATION.php',\r
 +              '../nucleus/libs/PAGEFACTORY.php',\r
 +              '../nucleus/libs/PARSER.php',\r
 +              '../nucleus/libs/PLUGIN.php',\r
 +              '../nucleus/libs/PLUGINADMIN.php',\r
 +              '../nucleus/libs/SEARCH.php',\r
 +              '../nucleus/libs/showlist.php',\r
 +              '../nucleus/libs/SKIN.php',\r
 +              '../nucleus/libs/TEMPLATE.php',\r
 +              '../nucleus/libs/vars4.1.0.php',\r
 +              '../nucleus/libs/xmlrpc.inc.php',\r
 +              '../nucleus/libs/xmlrpcs.inc.php',\r
 +              '../nucleus/libs/sql/DB.php',\r
 +              '../nucleus/libs/sql/MYSQLPDO.php'\r
 +      );\r
 +\r
 +      $count = count($files);\r
 +      for ( $i = 0; $i < $count; $i++ )\r
 +      {\r
 +              if ( !is_readable($files[$i]) )\r
 +              {\r
 +                      array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');\r
 +              }\r
 +      }\r
 +\r
 +      if ( count($missingfiles) > 0 )\r
 +      {\r
 +              exit(implode("\n", $missingfiles));\r
 +      }\r
 +}\r
 +\r
 +/**\r
 + * Updates the configuration in the database\r
 + *\r
 + * @param string $name name of the config var\r
 + * @param string $value new value of the config var\r
 + * @return array\r
 + */\r
 +function updateConfig($name, $value)\r
 +{\r
 +      $errors = array();\r
 +\r
 +      $query = "UPDATE %s SET value = %s WHERE name = %s";\r
 +      $query = sprintf($query, tableName('nucleus_config'), DB::quoteValue(trim($value)), DB::quoteValue($name));\r
 +\r
 +      if ( DB::execute($query) === FALSE )\r
 +      {\r
 +              $errinfo = DB::getError();\r
 +              $errors[] = _INST_ERROR4 . ': ' . $errinfo[2];\r
 +      }\r
 +      return $errors;\r
 +}\r
 +\r
 +class ParamManager\r
 +{\r
 +      /* process parameter */\r
 +      public $state;\r
 +      public $locale;\r
 +\r
 +      /* mysql connection parameters */\r
 +      public $mysql_host;\r
 +      public $mysql_user;\r
 +      public $mysql_password;\r
 +      public $mysql_database;\r
 +      public $mysql_tablePrefix;\r
 +\r
 +      /* weblog configuration parameters */\r
 +      public $blog_name;\r
 +      public $blog_shortname;\r
 +\r
 +      /* member configuration parameters */\r
 +      public $user_name;\r
 +      public $user_realname;\r
 +      public $user_password;\r
 +      private $user_password2;\r
 +      public $user_email;\r
 +\r
 +      /* URI parameters  */\r
 +      private $root_url;\r
 +      public $IndexURL;\r
 +      public $AdminURL;\r
 +      public $MediaURL;\r
 +      public $SkinsURL;\r
 +      public $PluginURL;\r
 +      public $ActionURL;\r
 +\r
 +      /* path parameters */\r
 +      private $root_path;\r
 +      public $AdminPath;\r
 +      public $MediaPath;\r
 +      public $SkinsPath;\r
 +\r
 +      /**\r
 +       * constructor\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              $this->init();\r
 +      }\r
 +\r
 +      public function init()\r
 +      {\r
 +              // set default values\r
 +              $this->state = 'locale';\r
 +              $this->install_mode = 'simple';\r
 +              $this->locale = 'en_Latn_US';\r
 +              $this->mysql_host = @ini_get('mysql.default_host');\r
 +              $this->blog_name = 'My Nucleus CMS';\r
 +              $this->blog_shortname = 'mynucleuscms';\r
 +\r
 +              /* root path */\r
 +              $directory_separator = preg_quote(DIRECTORY_SEPARATOR, '|');\r
 +              $this->root_path = implode('/', preg_split("|$directory_separator|", realpath(dirname(__FILE__) . '/..')));\r
 +              if ( substr($this->root_path, -1, 1) !== '/' )\r
 +              {\r
 +                      $this->root_path .= '/';\r
 +              }\r
 +              $base_path_pcre = preg_quote($this->root_path, '|');\r
 +\r
 +              /* current directry name */\r
 +              $directory_name = preg_replace("#{$base_path_pcre}#", '', implode('/', preg_split("#{$directory_separator}#", realpath(dirname(__FILE__)))));\r
 +              $directory_name_pcre = preg_quote($directory_name, '|');\r
 +\r
 +              /* root uri */\r
 +              $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];\r
 +              $this->root_url = preg_replace("|$directory_name_pcre(.*)$|", '', $root_url);\r
 +\r
 +              $this->AdminPath = $this->root_path . 'nucleus/';\r
 +              $this->MediaPath = $this->root_path . 'media/';\r
 +              $this->SkinsPath = $this->root_path . 'skins/';\r
 +\r
 +              $this->IndexURL  = $this->root_url;\r
 +              $this->AdminURL  = $this->root_url . 'nucleus/';\r
 +              $this->MediaURL  = $this->root_url . 'media/';\r
 +              $this->SkinsURL  = $this->root_url . 'skins/';\r
 +              $this->PluginURL = $this->root_url . 'nucleus/plugins/';\r
 +              $this->ActionURL = $this->root_url . 'action.php';\r
 +      }\r
 +\r
 +      private function read_parameter($parameter)\r
 +      {\r
 +              foreach ( $parameter as $element )\r
 +              {\r
 +                      if ( array_key_exists($element, $_POST) )\r
 +                      {\r
 +                              $this->$element = $_POST[$element];\r
 +                      }\r
 +              }\r
 +      }\r
 +\r
 +      public function set_state($state)\r
 +      {\r
 +              $states = array('locale', 'mysql', 'weblog', 'detail', 'install');\r
 +              if ( in_array($state, $states) )\r
 +              {\r
 +                      $this->state = $state;\r
 +              }\r
 +      }\r
 +\r
 +      public function set_locale()\r
 +      {\r
 +              $this->read_parameter(array('locale'));\r
 +\r
 +              if ( !in_array($this->locale, i18n::get_available_locale_list()) )\r
 +              {\r
 +                      $this->locale = 'en_Latn_US';\r
 +              }\r
 +      }\r
 +\r
 +      public function check_mysql_parameters()\r
 +      {\r
 +              global $MYSQL_HANDLER;\r
 +              \r
 +              $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');\r
 +              $this->read_parameter($parameters);\r
 +\r
 +              $errors = array();\r
 +              if ( $this->mysql_host == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD1);\r
 +              }\r
 +\r
 +              if ( $this->mysql_user == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD2);\r
 +              }\r
 +              \r
 +              if ( $this->mysql_user != ''\r
 +                      && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD2);\r
 +              }\r
 +              \r
 +              if ( $this->mysql_database == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD4);\r
 +              }\r
 +\r
 +              if ( $this->mysql_database != ''\r
 +                      && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD4);\r
 +              }\r
 +\r
 +              if ( $this->mysql_tablePrefix != ''\r
 +                      && !preg_match('/^[a-z0-9_]+$/i', $this->mysql_tablePrefix) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR3, _DB_FIELD5);\r
 +              }\r
 +              \r
 +              if ( count($errors) == 0 )\r
 +              {\r
 +                      $mysql_conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], $this->mysql_host, $this->mysql_user, $this->mysql_password);\r
 +                      if ( $mysql_conn == false )\r
 +                      {\r
 +                              $errors[] = _DBCONNECT_ERROR;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              @DB::disConnect();\r
 +                      }\r
 +              }\r
 +\r
 +              return $errors;\r
 +      }\r
 +\r
 +      public function check_user_parameters()\r
 +      {\r
 +              $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');\r
 +              $this->read_parameter($parameters);\r
 +\r
 +              $errors = array();\r
 +              if ( $this->user_realname == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD1);\r
 +              }\r
 +\r
 +              if ( $this->user_name == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD2);\r
 +              }\r
 +              elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )\r
 +              {\r
 +                      $errors[] = _VALID_ERROR5;\r
 +              }\r
 +\r
 +              if ( $this->user_password == '' || $this->user_password2 == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD3);\r
 +                      $this->user_password = '';\r
 +              }\r
 +              elseif ( $this->user_password != $this->user_password2 )\r
 +              {\r
 +                      $errors[] = _VALID_ERROR6;\r
 +                      $this->user_password = '';\r
 +              }\r
 +\r
 +              if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )\r
 +              {\r
 +                      $errors[] = _VALID_ERROR7;\r
 +              }\r
 +\r
 +              return $errors;\r
 +      }\r
 +\r
 +      public function check_weblog_parameters()\r
 +      {\r
 +              $parameters = array('blog_name', 'blog_shortname');\r
 +              $this->read_parameter($parameters);\r
 +\r
 +              $errors = array();\r
 +              if ( $this->blog_name == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD1);\r
 +              }\r
 +\r
 +              if ( $this->blog_shortname == '' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD2);\r
 +              }\r
 +\r
 +              if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )\r
 +              {\r
 +                      $errors[] = _VALID_ERROR4;\r
 +              }\r
 +\r
 +              return $errors;\r
 +      }\r
 +\r
 +      public function check_uri_parameters()\r
 +      {\r
 +              $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');\r
 +              $this->read_parameter($parameters);\r
 +\r
 +              $errors = array();\r
 +              if ( substr($this->IndexURL, -1, 1) !== '/' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD1);\r
 +              }\r
 +\r
 +              if ( substr($this->AdminURL, -1, 1) !== '/' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD2);\r
 +              }\r
 +\r
 +              if ( substr($this->MediaURL, -1, 1) !== '/' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD4);\r
 +              }\r
 +\r
 +              if ( substr($this->SkinsURL, -1, 1) !== '/' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD6);\r
 +              }\r
 +\r
 +              if ( substr($this->PluginURL, -1, 1) !== '/' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD8);\r
 +              }\r
 +\r
 +              if ( strrchr($this->ActionURL, '/') != '/action.php' )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR9, _PATH_FIELD9);\r
 +              }\r
 +\r
 +              return $errors;\r
 +      }\r
 +\r
 +      public function check_path_parameters()\r
 +      {\r
 +              $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');\r
 +              $this->read_parameter($parameters);\r
 +\r
 +              $separators = array('/', DIRECTORY_SEPARATOR);\r
 +              $errors = array();\r
 +              if ( !in_array(substr($this->AdminPath, -1, 1), $separators) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD3);\r
 +              }\r
 +              elseif ( !file_exists($this->AdminPath) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD3);\r
 +              }\r
 +\r
 +              if ( !in_array(substr($this->MediaPath, -1, 1), $separators) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD5);\r
 +              }\r
 +              elseif ( !file_exists($this->MediaPath) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD5);\r
 +              }\r
 +\r
 +              if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD7);\r
 +              }\r
 +              elseif ( !file_exists($this->SkinsPath) )\r
 +              {\r
 +                      $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD7);\r
 +              }\r
 +\r
 +              return $errors;\r
 +      }\r
 +\r
 +      /**\r
 +       * check all parameters\r
 +       * @return bool\r
 +       */\r
 +      public function check_all_parameters()\r
 +      {\r
 +              $this->set_locale();\r
 +\r
 +              $isValid = true;\r
 +              $isValid &= (count($this->check_mysql_parameters()) == 0);\r
 +              $isValid &= (count($this->check_user_parameters()) == 0);\r
 +              $isValid &= (count($this->check_weblog_parameters()) == 0);\r
 +              $isValid &= (count($this->check_uri_parameters()) == 0);\r
 +              $isValid &= (count($this->check_path_parameters()) == 0);\r
 +\r
 +              return $isValid;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  *
+  * This script will install the Nucleus tables in your SQL-database,
+  * and initialize the data in those tables.
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2012 The Nucleus Group
+  * @version $Id: index.php 1889 2012-06-17 08:46:45Z sakamocchi $
+  */
+ /* global values initialize */
+ $CONF = array();
+ /* reporting all errors for support */
+ error_reporting(E_ALL);
+ $minimum_php_version = '5.0.6';
+ $minimum_mysql_version = '3.23';
+ $page_footer_copyright = '&copy; 2001-2012 The Nucleus Groupe . Running Nucleus CMS v4.00';
+ // begin if: server's PHP version is below the minimum; halt installation
+ if ( version_compare(PHP_VERSION, $minimum_php_version, '<') )
+ {
+       exit('<div style="font-size: xx-large;"> Nucleus requires at least PHP version ' . $minimum_php_version . '</div>');
+ }
+ // make sure there's no unnecessary escaping: # set_magic_quotes_runtime(0);
+ if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+ {
+       ini_set('magic_quotes_runtime', '0');
+ }
+ /* default installed plugins and skins */
+ $aConfPlugsToInstall = array('NP_SecurityEnforcer', 'NP_SkinFiles', 'NP_Medium');
+ $aConfSkinsToImport = array('atom', 'rss2.0', 'rsd', 'default', 'admin/default', 'admin/bookmarklet');
+ // Check if some important files
+ do_check_files();
+ /* i18n class is needed for internationalization */
+ include_once('../nucleus/libs/i18n.php');
+ if ( !i18n::init('UTF-8', '../nucleus/locales') )
+ {
+       exit('<div style="font-size: xx-large;"> Failed to initialize iconv or mbstring extension. Would you please contact the administrator of your PHP server? </div>');
+ }
+ // include core classes that are needed for login & plugin handling
+ // added for 3.5 sql_* wrapper
+ global $MYSQL_HANDLER;
+ if ( !isset($MYSQL_HANDLER) )
+ {
+       $MYSQL_HANDLER = array('mysql', '');
+       
+       // check if mysql support is installed; this check may not make sense, as is, in a version past 3.5x
+       if ( !function_exists('mysql_query') && !function_exists('mysqli_query') )
+       {
+               exit('<div style="font-size: xx-large;"> Your PHP version does not have support for MySQL :( </div>');
+ }
+ }
+ include_once('../nucleus/libs/sql/sql.php');
+ session_start();
+ if ( count($_GET) == 0 && count($_POST) == 0 )
+ {
+       unset($_SESSION['param_manager']);
+ }
+ // restore the $param from the session
+ if ( array_key_exists('param_manager', $_SESSION) )
+ {
+       $param = $_SESSION['param_manager'];
+ }
+ else
+ {
+       $param = new ParamManager();
+ }
+ // include translation file
+ $param->set_locale();
+ do_action();
+ // $param is saved to the session
+ if ( isset($param) )
+ {
+       $_SESSION['param_manager'] = $param;
+ }
+ else
+ {
+       unset($_SESSION['param_manager']);
+ }
+ exit;
+ /**
+  * installer action
+  */
+ function do_action()
+ {
+       global $param;
+       if ( array_key_exists('action', $_POST) )
+       {
+               $isPostback = true;
+       }
+       else
+       {
+               $isPostback = false;
+       }
+       // mode change
+       if ( array_key_exists('mode', $_REQUEST) )
+       {
+               if ( $_REQUEST['mode'] == 'detail' )
+               {
+                       $param->set_state('detail');
+               }
+               elseif ( $_REQUEST['mode'] == 'simple' )
+               {
+                       $param->set_state('mysql');
+               }
+       }
+       // input parameter check
+       if ( $isPostback )
+       {
+               switch ( $param->state )
+               {
+                       case 'locale':
+                               $param->set_state('mysql');
+                               $isPostback = false;
+                               break;
+                       case 'mysql':
+                               if ( count($param->check_mysql_parameters()) == 0 )
+                               {
+                                       $param->set_state('weblog');
+                                       $isPostback = false;
+                               }
+                               break;
+                       case 'weblog':
+                               if ( count($param->check_user_parameters()) == 0
+                                       && count($param->check_weblog_parameters()) == 0 )
+                               {
+                                       $param->set_state('install');
+                                       $isPostback = false;
+                               }
+                               break;
+                       case 'detail':
+                               if ( $param->check_all_parameters() )
+                               {
+                                       $param->set_state('install');
+                                       $isPostback = false;
+                               }
+                               break;
+               }
+       }
+       // page render
+       show_header();
+       switch ( $param->state )
+       {
+               case 'locale':
+                       show_select_locale_form();
+                       break;
+               case 'mysql':
+                       show_database_setting_form($isPostback);
+                       break;
+               case 'weblog':
+                       show_blog_setting_form($isPostback);
+                       break;
+               case 'detail':
+                       show_detail_setting_form($isPostback);
+                       break;
+               case 'install':
+                       show_install_complete_form();
+                       break;
+       }
+       show_footer();
+ }
+ /**
+  * header tag of the installation screens
+  **/
+ function show_header()
+ {
+       global $param;
+       /* HTTP 1.1 application for no caching */
+       header("Cache-Control: no-cache, must-revalidate");
+       header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
+       header('Content-Type: text/html; charset=' . i18n::get_current_charset());
+ ?>
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+       <head>
+               <title><?php echo _TITLE; ?></title>
+               <link rel="stylesheet" type="text/css" href="./styles/inst.css" />
+               <style type="text/css">
+               <!--
+               <?php echo _BODYFONTSTYLE; ?>
+               -->
+               </style>
+               <script type="text/javascript">
+                       function SelectText( element ) {
+                               window.setTimeout( function() { element.select() }, 0 );
+                       }
+                       var isSubmit = false;
+                       function OnceSubmit() {
+                               if (!isSubmit) {
+                                       isSubmit = true;
+                                       window.setTimeout( function() { isSubmit = false; }, 10000 );
+                                       return true;
+                               }
+                               return false;
+                       }
+               </script>
+       </head>
+       <body>
+               <div id="header">
+                       <div id="navigation">
+                               <h1><img src="./styles/nucleus_rogo.png" alt="NucleusCMS" /></h1>
+                               <ul>
+ <?php
+       echo '<li>';
+       $label = '_LOCALE_' . strtoupper($param->locale);
+       if ( !defined($label) )
+       {
+               echo $param->locale;
+       }
+       else
+       {
+               echo constant($label);
+       }
+       echo "</li>\n";
+       
+       if ( in_array($param->state, array('mysql', 'weblog', 'install')) )
+       {
+               echo '<li>&nbsp; &gt; &nbsp;' . _STEP1, '</li><li';
+               if ( $param->state == 'mysql' )
+               {
+                       echo ' class="gry"';
+               }
+               echo '>&nbsp; &gt; &nbsp;', _STEP2, '</li><li';
+               if ( in_array($param->state, array('mysql', 'weblog')) )
+               {
+                       echo ' class="gry"';
+               }
+               echo '>&nbsp; &gt; &nbsp;', _STEP3, "</li>\n";
+       }
+       if ( in_array($param->state, array('mysql', 'weblog', 'detail')) )
+       {
+               echo '<li class="rightbox">';
+               if ( in_array($param->state, array('mysql', 'weblog')) )
+               {
+                       echo '<a href="./?mode=detail">', _MODE2, '</a>';
+               }
+               else
+               {
+                       echo '<a href="./?mode=simple">', _MODE1, '</a>';
+               }
+               echo '</li>';
+       }
+ ?>
+                               </ul>
+                       </div>
+               </div>
+ <?php
+ }
+ /**
+  * footer tag of the installation screens
+  **/
+ function show_footer()
+ {
+       global $page_footer_copyright;
+ ?>
+               <div id="footer">
+                       <?php echo $page_footer_copyright; ?>
+               </div>
+       </body>
+ </html>
+ <?php
+ }
+ /**
+  * Display the form for language select
+  */
+ function show_select_locale_form()
+ {
+       global $param;
+       
+ ?>
+               <div id="container">
+                       <p style="font-size:152%;font-weight:bold;">
+                               <?php echo _LOCALE_HEADER; ?>
+                       </p>
+                       <form method="post" action="./index.php">
+                               <div class="prt">
+                                       <select name="locale">
+ <?php
+       $locales = i18n::get_available_locale_list();
+       foreach ( $locales as $locale )
+       {
+               if ( $param->locale != $locale )
+               {
+                       echo "<option value=\"{$locale}\">";
+               }
+               else
+               {
+                       echo "<option value=\"{$locale}\" selected=\"selected\">";
+               }
+               
+               $checkfile = "./locales/{$locale}." . i18n::get_current_charset() . '.php';
+               if ( !file_exists($checkfile) )
+               {
+                       echo '*&nbsp;';
+               }
+               $label = '_LOCALE_' . strtoupper($locale);
+               if ( !defined($label) )
+       {
+                       echo $locale;
+               }
+               else
+               {
+                       echo constant($label);
+               }
+               echo "</option>\n";
+       }
+ ?>
+                                       </select>
+                                       <p><?php echo _LOCALE_DESC1; ?></p>
+                                       <p><?php echo _LOCALE_DESC2; ?></p>
+                                       <p><?php echo _LOCALE_NEED_HELP;?></p>
+                                       <p class="sbt">
+                                               <button type="submit" name="action" value="locale" class="sbt_arw">START</button>
+                                       </p>
+                               </div>
+                       </form>
+               </div>
+ <?php
+ }
+ /**
+  * Display the form to set up a database
+  * @param bool $isPostback
+  */
+ function show_database_setting_form($isPostback)
+ {
+       global $param, $minimum_mysql_version;
+       $config_writable = canConfigFileWritable();
+       $mysql_version = getMySqlVersion();
+ ?>
+               <div id="container">
+                       <p class="msg">
+ <?php
+       echo _SIMPLE_NAVI1;
+       if ( $config_writable != '' )
+       {
+               echo '<span class="err">', $config_writable, '</span>';
+       }
+       if ( $mysql_version == '0.0.0' )
+       {
+               echo '<span class="err">', _DBVERSION_UNKOWN, '</span>';
+       }
+       elseif ( version_compare($mysql_version, $minimum_mysql_version, '<') )
+       {
+               echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';
+       }
+ ?>
+                       </p>
+                       <form method="post" action="./index.php">
+                               <div class="prt">
+                                       <h2><?php echo _DB_HEADER; ?></h2>
+                                       <p class="msg">
+ <?php
+       if ( $isPostback )
+       {
+               $errors = $param->check_mysql_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>
+                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <p class="sbt">
+                                               <button type="submit" name="mode" value="detail" class="sbt_sqr"><?php echo _MODE2; ?></button>
+                                               <button type="submit" name="action" value="mysql" class="sbt_arw"><?php echo _NEXT; ?></button>
+                                       </p>
+                                       <p class="msg">
+                                               <?php echo _DB_TEXT1; ?>
+                                       </p>
+                               </div>
+                       </form>
+               </div>
+ <?php
+ }
+ /**
+  * Displays a form to the blog settings
+  * @param bool $isPostback
+  */
+ function show_blog_setting_form($isPostback)
+ {
+       global $param;
+ ?>
+               <div id="container">
+                       <p class="msg">
+                               <?php echo _SIMPLE_NAVI2; ?>
+                       </p>
+                       <form method="post" action="./index.php">
+                               <div class="prt">
+                                       <h2><?php echo _BLOG_HEADER; ?></h2>
+                                       <p class="msg">
+ <?php
+       if ( $isPostback )
+       {
+               $errors = $param->check_weblog_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
+                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
+                                               </tr>
+                                       </table>
+                               </div>
+                               <div class="prt">
+                                       <h2><?php echo _ADMIN_HEADER; ?></h2>
+                                       <p class="msg">
+ <?php
+       if ( $isPostback )
+       {
+               $errors = $param->check_user_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
+                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>
+                                                               <td><input type="password" name="user_password" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>
+                                                               <td><input type="password" name="user_password2" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
+                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <p class="sbt">
+                                               <button type="submit" name="action" value="weblog" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>
+                                       </p>
+                               </div>
+                       </form>
+               </div>
+ <?php
+ }
+ /**
+  * Displays a form to the detail settings
+  * @param bool $isPostback
+  */
+ function show_detail_setting_form($isPostback)
+ {
+       global $param, $minimum_mysql_version;
+       $mysql_version = getMySqlVersion();
+ ?>
+               <div id="container_detailed">
+                       <p class="msg">
+                               <?php echo _DETAIL_NAVI1; ?>
+ <?php
+       if ( $isPostback && !$param->check_all_parameters() )
+       {
+               echo '<span class="err">', _VALID_ERROR, "</span>\n";
+       }
+ ?>
+                       </p>
+                       <ul class="msg">
+                               <li>PHP: <?php echo phpversion(); ?></li>
+                               <li>MySQL:
+ <?php
+       echo ($mysql_version == '0.0.0') ? _DBVERSION_UNKOWN : $mysql_version;
+       if ( version_compare($mysql_version, $minimum_mysql_version, '<') )
+       {
+               echo '<span class="err">', sprintf(_DBVERSION_TOOLOW, $minimum_mysql_version), '</span>';
+       }
+ ?></li>
+                       </ul>
+                       <form method="post" action="">
+                               <div class="prt">
+                                       <h2><?php echo _DETAIL_HEADER1; ?></h2>
+                                       <p class="msg">
+ <?php
+       if ( $isPostback )
+       {
+               $errors = $param->check_mysql_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD1; ?></span><span class="sub"><?php echo _DB_FIELD1_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_host" value="<?php echo $param->mysql_host; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD2; ?></span><span class="sub"><?php echo _DB_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_user" value="<?php echo $param->mysql_user; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD3; ?></span></th>
+                                                               <td><input type="text" name="mysql_password" value="<?php echo $param->mysql_password; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD4; ?></span><span class="sub"><?php echo _DB_FIELD4_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_database" value="<?php echo $param->mysql_database; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _DB_FIELD5; ?></span><span class="sub"><?php echo _DB_FIELD5_DESC; ?></span></th>
+                                                               <td><input type="text" name="mysql_tablePrefix" value="<?php echo $param->mysql_tablePrefix; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <h2><?php echo _DETAIL_HEADER2; ?></h2>
+                                       <p class="msg">
+ <?php
+       if ( $isPostback )
+       {
+               $errors = $param->check_uri_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+               $errors = $param->check_path_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD1; ?></span></th>
+                                                               <td><input type="text" name="IndexURL" value="<?php echo $param->IndexURL; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD2; ?></span></th>
+                                                               <td><input type="text" name="AdminURL" value="<?php echo $param->AdminURL; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD3; ?></span></th>
+                                                               <td><input type="text" name="AdminPath" value="<?php echo $param->AdminPath; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD4; ?></span></th>
+                                                               <td><input type="text" name="MediaURL" value="<?php echo $param->MediaURL; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD5; ?></span></th>
+                                                               <td><input type="text" name="MediaPath" value="<?php echo $param->MediaPath; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD6; ?></span></th>
+                                                               <td><input type="text" name="SkinsURL" value="<?php echo $param->SkinsURL; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD7; ?></span></th>
+                                                               <td><input type="text" name="SkinsPath" value="<?php echo $param->SkinsPath; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD8; ?></span></th>
+                                                               <td><input type="text" name="PluginURL" value="<?php echo $param->PluginURL; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _PATH_FIELD9; ?></span></th>
+                                                               <td><input type="text" name="ActionURL" value="<?php echo $param->ActionURL; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <p class="msg">
+                                               <?php echo _DETAIL_TEXT3; ?>
+                                       </p>
+                                       <h2><?php echo _DETAIL_HEADER3; ?></h2>
+                                       <p class="msg">
+ <?php
+       echo _DETAIL_TEXT4;
+       if ( $isPostback )
+       {
+               $errors = $param->check_user_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD1; ?></span></th>
+                                                               <td><input type="text" name="user_realname" value="<?php echo $param->user_realname; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD2; ?></span><span class="sub"><?php echo _ADMIN_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="user_name" value="<?php echo $param->user_name; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD3; ?></span></th>
+                                                               <td><input type="password" name="user_password" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD4; ?></span></th>
+                                                               <td><input type="password" name="user_password2" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _ADMIN_FIELD5; ?></span></th>
+                                                               <td><input type="text" name="user_email" value="<?php echo $param->user_email; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <h2><?php echo _DETAIL_HEADER4; ?></h2>
+                                       <p class="msg">
+ <?php
+       echo _DETAIL_TEXT5;
+       if ( $isPostback )
+       {
+               $errors = $param->check_weblog_parameters();
+               if ( is_array($errors) )
+               {
+                       foreach ( $errors as $error )
+                       {
+                               echo '<span class="err">', $error, "</span>\n";
+                       }
+               }
+       }
+ ?>
+                                       </p>
+                                       <table>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD1; ?></span></th>
+                                                               <td><input type="text" name="blog_name" value="<?php echo $param->blog_name; ?>" /></td>
+                                               </tr>
+                                               <tr>
+                                                       <th><span class="nam"><?php echo _BLOG_FIELD2; ?></span><span class="sub"><?php echo _BLOG_FIELD2_DESC; ?></span></th>
+                                                               <td><input type="text" name="blog_shortname" value="<?php echo $param->blog_shortname; ?>" /></td>
+                                               </tr>
+                                       </table>
+                                       <p class="msg">
+                                               <?php echo _DETAIL_TEXT6; ?>
+                                       </p>
+                                       <p class="sbt">
+                                               <button type="submit" name="action" value="detail" class="sbt_arw" onclick="OnceSubmit()"><?php echo _INSTALL; ?></button>
+                                       </p>
+                               </div>
+                       </form>
+               </div>
+ <?php
+ }
+ /**
+  * Displays a screen to signal the completion of the installation
+  */
+ function show_install_complete_form()
+ {
+       global $MYSQL_HANDLER, $param;
+       $errors = do_install();
+ ?>
+               <div id="container">
+                       <p class="msg">
+ <?php
+       if ( is_array($errors) && count($errors) > 0 )
+       {
+               echo _INST_ERROR;
+               foreach ( $errors as $error )
+               {
+                       echo '<span class="err">', $error, "</span>\n";
+               }
+       }
+       else
+       {
+               echo _INST_TEXT;
+               if ( array_key_exists('config_data', $_SESSION) )
+               {
+                       echo '<span class="err">', _INST_TEXT4, '</span>';
+ ?>
+ <textarea id="config_text" readonly="readonly" onfocus="SelectText(this);"><?php echo htmlentities($_SESSION['config_data'], null, i18n::get_current_charset()) ?></textarea>
+ <?php
+               }
+               else
+               {
+                       echo '<span class="err">', _INST_TEXT5, '</span>';
+               }
+ ?>
+                       </p>
+                       <form method="post" action="./index.php">
+                               <div class="prt">
+                                       <h2><?php echo _INST_HEADER1; ?></h2>
+                                       <p class="msg">
+                                               <?php echo sprintf(_INST_TEXT1, $param->blog_name); ?>
+                                       </p>
+                                       <p class="sbt">
+                                               <button type="button" name="toBlog" onclick="location.href='<?php echo $param->IndexURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON1; ?></button>
+                                       </p>
+                               </div>
+                               <div class="prt">
+                                       <h2><?php echo _INST_HEADER2; ?></h2>
+                                       <p class="msg">
+                                               <?php echo _INST_TEXT2; ?>
+                                       </p>
+                                       <p class="sbt">
+                                               <button type="button" name="toMng" onclick="location.href='<?php echo $param->AdminURL; ?>';" class="sbt_arw"><?php echo _INST_BUTTON2; ?></button>
+                                       </p>
+                               </div>
+                               <div class="prt">
+                                       <h2><?php echo _INST_HEADER3; ?></h2>
+                                       <p class="msg">
+                                               <?php echo _INST_TEXT3; ?>
+                                       </p>
+                                       <p class="sbt">
+                                               <button type="button" name="toAddBlog" onclick="location.href='<?php echo $param->AdminURL; ?>index.php?action=createnewlog';" class="sbt_arw"><?php echo _INST_BUTTON3; ?></button>
+                                       </p>
+                               </div>
+                       </form>
+ <?php
+       }
+ ?>
+               </div>
+ <?php
+       unset($param);
+ }
+ /**
+  * The installation process itself
+  * @return array error messages
+  */
+ function do_install()
+ {
+       global $param;
+       global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_PREFIX, $MYSQL_CONN;
+       global $DIR_NUCLEUS, $DIR_MEDIA, $DIR_SKINS, $DIR_PLUGINS, $DIR_LANG, $DIR_LIBS;
+       $errors = array();
+       /*
+        * 1. put all param-vars into vars
+        */
+       $MYSQL_HOST             = $param->mysql_host;
+       $MYSQL_USER             = $param->mysql_user;
+       $MYSQL_PASSWORD = $param->mysql_password;
+       $MYSQL_DATABASE = $param->mysql_database;
+       $MYSQL_PREFIX   = $param->mysql_tablePrefix;
+       $DIR_NUCLEUS    = $param->AdminPath;
+       $DIR_MEDIA              = $param->MediaPath;
+       $DIR_SKINS              = $param->SkinsPath;
+       $DIR_PLUGINS    = $DIR_NUCLEUS . 'plugins/';
+       $DIR_LOCALES    = $DIR_NUCLEUS . 'locales/';
+       $DIR_LIBS               = $DIR_NUCLEUS . 'libs/';
+       /*
+        * 2.open mySQL connection
+        */
+       $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD);
+       if ( $MYSQL_CONN == FALSE )
+       {
+               $errors[] = _DBCONNECT_ERROR;
+               return $errors;
+       }
+       /*
+        * 3. try to create database if needed
+        */
+       if ( DB::execute("CREATE DATABASE IF NOT EXISTS {$MYSQL_DATABASE}") === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR1 . ': ' . $errinfo[2];
+       }
+       /*
+        * 4. try to select database
+        */
+       $MYSQL_CONN = @DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);
+       if ( !$MYSQL_CONN )
+       {
+               $errors[] = _INST_ERROR2;
+       }
+       if ( count($errors) > 0 )
+       {
+               return $errors;
+       }
+       /*
+        * 5. execute queries
+        */
+       $table_names = array(
+               'nucleus_actionlog',
+               'nucleus_ban',
+               'nucleus_blog',
+               'nucleus_category',
+               'nucleus_comment',
+               'nucleus_config',
+               'nucleus_item',
+               'nucleus_karma',
+               'nucleus_member',
+               'nucleus_plugin',
+               'nucleus_skin',
+               'nucleus_template',
+               'nucleus_team',
+               'nucleus_activation',
+               'nucleus_tickets'
+       );
+       $prefixed_table_names = array();
+       foreach ( $table_names as $table_name )
+       {
+               $prefixed_table_names[] = $MYSQL_PREFIX . $table_name;
+       }
+       // table exists check
+       $result = DB::getResult('SHOW TABLES');
+       foreach ( $result as $row )
+       {
+               if ( in_array($row[0], $prefixed_table_names) )
+               {
+                       $errors[] = _INST_ERROR3;
+                       break;
+               }
+       }
+       if ( count($errors) > 0 )
+       {
+               return $errors;
+       }
+       $filename = 'install.sql';
+       $fd = fopen($filename, 'r');
+       $queries = fread($fd, filesize($filename));
+       fclose($fd);
+       $queries = preg_split('#(;\n|;\r)#', $queries);
+       foreach ( $queries as $query )
+       {
+               if ( preg_match('/\w+/', $query) )
+               {
+                       if ( $MYSQL_PREFIX )
+                       {
+                               $query = str_replace($table_names, $prefixed_table_names, $query);
+                       }
+                       if ( DB::execute($query) === FALSE )
+                       {
+                               $errinfo = DB::getError();
+                               $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];
+                       }
+               }
+       }
+       /*
+        * 6. put needed records
+        */
+       /* push first post */
+       $query = "INSERT INTO %s VALUES (1, %s, %s, %s, 1, 1, %s, 0, 0, 0, 1, 0, 1)";
+       $query = sprintf($query,
+               tableName('nucleus_item'),
+               DB::quoteValue(_1ST_POST_TITLE),
+               DB::quoteValue(_1ST_POST),
+               DB::quoteValue(_1ST_POST2),
+               DB::formatDateTime()
+       );
+       if ( DB::execute($query) === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR4 . ' (<small>' . $query . '</small>): ' . $errinfo[2];
+       }
+       /* push configurations */
+       array_merge($errors, updateConfig('IndexURL', $param->IndexURL));
+       array_merge($errors, updateConfig('AdminURL', $param->AdminURL));
+       array_merge($errors, updateConfig('MediaURL', $param->MediaURL));
+       array_merge($errors, updateConfig('SkinsURL', $param->SkinsURL));
+       array_merge($errors, updateConfig('PluginURL', $param->PluginURL));
+       array_merge($errors, updateConfig('ActionURL', $param->ActionURL));
+       array_merge($errors, updateConfig('AdminEmail', $param->user_email));
+       array_merge($errors, updateConfig('SiteName', $param->blog_name));
+       array_merge($errors, updateConfig('Locale', i18n::get_current_locale()));
+       /* push super admin */
+       $query = "UPDATE %s SET mname = %s, mrealname = %s, mpassword = %s, memail = %s, murl = %s, madmin = 1, mcanlogin = 1 WHERE mnumber = 1";
+       $query = sprintf($query,
+               tableName('nucleus_member'),
+               DB::quoteValue($param->user_name),
+               DB::quoteValue($param->user_realname),
+               DB::quoteValue(md5($param->user_password)),
+               DB::quoteValue($param->user_email),
+               DB::quoteValue($param->IndexURL)
+       );
+       if ( DB::execute($query) === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR5 . ': ' . $errinfo[2];
+       }
+       /* push new weblog */
+       $query = "UPDATE %s SET bname = %s, bshortname = %s, burl = %s WHERE bnumber = 1";
+       $query = sprintf($query,
+               tableName('nucleus_blog'),
+               DB::quoteValue($param->blog_name),
+               DB::quoteValue($param->blog_shortname),
+               DB::quoteValue($param->IndexURL)
+       );
+       if ( DB::execute($query) === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];
+       }
+       /* push default category */
+       $query = "UPDATE %s SET cname = %s, cdesc = %s WHERE catid = 1";
+       $query = sprintf($query,
+               tableName('nucleus_category'),
+               DB::quoteValue(_GENERALCAT_NAME),
+               DB::quoteValue(_GENERALCAT_DESC)
+       );
+       if ( DB::execute($query) === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR6 . ': ' . $errinfo[2];
+       }
+       /*
+        * 7. install default plugins and skins
+        */
+       global $aConfPlugsToInstall, $aConfSkinsToImport;
+       $aSkinErrors = array();
+       $aPlugErrors = array();
+       if ( (count($aConfPlugsToInstall) > 0) || (count($aConfSkinsToImport) > 0) )
+       {
+               include_once($DIR_LIBS . 'globalfunctions.php');
+               global $manager;
+               if ( !isset($manager) )
+               {
+                       $manager = new Manager();
+               }
+               include_once($DIR_LIBS . 'skinie.php');
+               
+               $aSkinErrors = installCustomSkins();
+               if ( count($aSkinErrors) > 0 )
+               {
+                       array_merge($errors, $aSkinErrors);
+               }
+               $query  = "SELECT sdnumber FROM %s WHERE sdname='admin/default'";
+               $query  = sprintf($query, tableName('nucleus_skin_desc'));
+               $res    = intval(DB::getValue($query));
+               array_merge($errors, updateConfig('AdminSkin', $res));
+               
+               $query  = "SELECT sdnumber FROM %s WHERE sdname='admin/bookmarklet'";
+               $query  = sprintf($query, tableName('nucleus_skin_desc'));
+               $res    = intval(DB::getValue($query));
+               array_merge($errors, updateConfig('BookmarkletSkin', $res));
+               
+               $query          = "SELECT sdnumber FROM %s WHERE sdname='default'";
+               $query          = sprintf($query, tableName('nucleus_skin_desc'));
+               $defSkinID      = intval(DB::getValue($query));
+               $query = "UPDATE %s SET bdefskin=%d WHERE bnumber=1";
+               $query = sprintf($query, tableName('nucleus_blog'), $defSkinID);
+               DB::execute($query);
+               $query = "UPDATE %s SET value=%d WHERE name='BaseSkin'";
+               $query = sprintf($query, tableName('nucleus_config'), $defSkinID);
+               DB::execute($query);
+               $aPlugErrors = installCustomPlugs();
+               if ( count($aPlugErrors) > 0 )
+               {
+                       array_merge($errors, $aPlugErrors);
+               }
+       }
+       /*
+        * 8. Write config file ourselves (if possible)
+        */
+       $config_data = '<' . '?php' . "\n";
+       $config_data .= "// mySQL connection information\n";
+       $config_data .= "\$MYSQL_HOST = '" . $MYSQL_HOST . "';\n";
+       $config_data .= "\$MYSQL_USER = '" . $MYSQL_USER . "';\n";
+       $config_data .= "\$MYSQL_PASSWORD = '" . $MYSQL_PASSWORD . "';\n";
+       $config_data .= "\$MYSQL_DATABASE = '" . $MYSQL_DATABASE . "';\n";
+       $config_data .= "\$MYSQL_PREFIX = '" . $MYSQL_PREFIX . "';\n";
+       $config_data .= "// new in 3.50. first element is db handler, the second is the db driver used by the handler\n";
+       $config_data .= "// default is \$MYSQL_HANDLER = array('mysql','mysql');\n";
+       $config_data .= "//\$MYSQL_HANDLER = array('mysql','mysql');\n";
+       $config_data .= "//\$MYSQL_HANDLER = array('pdo','mysql');\n";
+       $config_data .= "\$MYSQL_HANDLER = array('" . $MYSQL_HANDLER[0] . "','" . $MYSQL_HANDLER[1] . "');\n";
+       $config_data .= "\n";
+       $config_data .= "// main nucleus directory\n";
+       $config_data .= "\$DIR_NUCLEUS = '" . $DIR_NUCLEUS . "';\n";
+       $config_data .= "\n";
+       $config_data .= "// path to media dir\n";
+       $config_data .= "\$DIR_MEDIA = '" . $DIR_MEDIA . "';\n";
+       $config_data .= "\n";
+       $config_data .= "// extra skin files for imported skins\n";
+       $config_data .= "\$DIR_SKINS = '" . $DIR_SKINS . "';\n";
+       $config_data .= "\n";
+       $config_data .= "// these dirs are normally sub dirs of the nucleus dir, but \n";
+       $config_data .= "// you can redefine them if you wish\n";
+       $config_data .= "\$DIR_PLUGINS = \$DIR_NUCLEUS . 'plugins/';\n";
+       $config_data .= "\$DIR_LOCALES = \$DIR_NUCLEUS . 'locales/';\n";
+       $config_data .= "\$DIR_LIBS = \$DIR_NUCLEUS . 'libs/';\n";
+       $config_data .= "\n";
+       $config_data .= "// include libs\n";
+       $config_data .= "include(\$DIR_LIBS.'globalfunctions.php');\n";
+       $config_data .= "?" . ">";
+       $result = false;
+       if ( @!file_exists('../config.php') || is_writable('../config.php') )
+       {
+               if ( $fp = @fopen('../config.php', 'w') )
+               {
+                       $result = @fwrite($fp, $config_data, i18n::strlen($config_data));
+                       fclose($fp);
+               }
+       }
+       if ( $result )
+       {
+               // try to change the read-only permission.
+               if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
+               {
+                       @chmod('../config.php', 0444);
+               }
+       }
+       else
+       {
+               $_SESSION['config_data'] = $config_data;
+       }
+       return $errors;
+ }
+ /**
+  * Confirm that you can write to the configuration file
+  * @return string error message
+  */
+ function canConfigFileWritable()
+ {
+       if ( @file_exists('../config.php') && @!is_writable('../config.php') )
+       {
+               // try to change the read-write permission.
+               if ( strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN' )
+               {
+                       @chmod('../config.php', 0666);
+               }
+               if ( @!is_writable('../config.php') )
+               {
+                       return _INST_ERROR8;
+               }
+       }
+       return '';
+ }
+ /**
+  * To obtain the version of MySQL
+  * @return string
+  */
+ function getMySqlVersion()
+ {
+       global $MYSQL_HANDLER, $minimum_mysql_version, $errors;
+       // Turn on output buffer
+       // Needed to repress the output of the sql function that are
+       // not part of php (in this case the @ operator doesn't work)
+       ob_start();
+       // note: this piece of code is taken from phpMyAdmin
+       $conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], 'localhost', '', '');
+       if ( $conn )
+       {
+               $row = DB::getAttribute(PDO::ATTR_SERVER_VERSION);
+               $match = preg_split('#\.#', $row);
+       }
+       else
+       {
+               $row = @DB::getRow('SHOW VARIABLES LIKE \'version\'');
+               if ( $row )
+               {
+                       $match = preg_split('#\.#', $row[1]);
+               }
+               else
+               {
+                       $output = (function_exists('shell_exec')) ? @shell_exec('mysql -V') : '0.0.0';
+                       preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
+                       $match = preg_split('#\.#', $version[0]);
+                       if ( $match[0] == '' )
+                       {
+                               $match = array('0', '0', '0');
+                       }
+               }
+       }
+       @DB::disConnect();
+       //End and clean output buffer
+       ob_end_clean();
+       return implode($match, '.');
+ }
+ /**
+  * Add a table prefix if it is used
+  *
+  * @param string $input table name with prefix
+  * @return string
+  */
+ function tableName($input)
+ {
+       global $MYSQL_PREFIX;
+       if ( $MYSQL_PREFIX )
+       {
+               return $MYSQL_PREFIX . $input;
+       }
+       else
+       {
+               return $input;
+       }
+ }
+ /**
+  * Install custom plugins
+  */
+ function installCustomPlugs()
+ {
+       global $aConfPlugsToInstall, $DIR_LIBS, $manager;
+       $aErrors = array();
+       if ( count($aConfPlugsToInstall) == 0 )
+       {
+               return $aErrors;
+       }
+       $query = sprintf('SELECT * FROM %s', tableName('nucleus_plugin'));
+       $res = DB::getResult($query);
+       $numCurrent = $res->rowCount();
+       foreach ( $aConfPlugsToInstall as $plugName )
+       {
+               $query = sprintf('INSERT INTO %s (porder, pfile) VALUES (%d, %s)',
+                       tableName('nucleus_plugin'),
+                       (++$numCurrent),
+                       DB::quoteValue($plugName));
+               DB::execute($query);
+               $manager->clearCachedInfo('installedPlugins');
+               $plugin =& $manager->getPlugin($plugName);
+               $plugin->setID($numCurrent);
+               if ( !$plugin )
+               {
+                       $query = sprintf('DELETE FROM %s WHERE pfile = %s',
+                               tableName('nucleus_plugin'),
+                               DB::quoteValue($plugName));
+                       DB::execute($query);
+                       $numCurrent--;
+                       array_push($aErrors, sprintf(_INST_ERROR9, $plugName));
+                       continue;
+               }
+               $plugin->install();
+       }
+       $query = sprintf('DELETE FROM %s', tableName('nucleus_plugin_event'));
+       DB::execute($query);
+       $query = sprintf('SELECT pid, pfile FROM %s', tableName('nucleus_plugin'));
+       $res = DB::getResult($query);
+       foreach ( $res as $row )
+       {
+               $plug =& $manager->getPlugin($row['pfile']);
+               if ( $plug )
+               {
+                       $eventList = $plug->getEventList();
+                       foreach ( $eventList as $eventName )
+                       {
+                               $query = sprintf('INSERT INTO %s (pid, event) VALUES (%d, %s)',
+                                       tableName('nucleus_plugin_event'),
+                                       intval($row['pid']),
+                                       DB::quoteValue($eventName));
+                               DB::execute($query);
+                       }
+               }
+       }
+       return $aErrors;
+ }
+ /**
+  * Install custom skins
+  * Prepares the installation of custom skins
+  */
+ function installCustomSkins()
+ {
+       global $aConfSkinsToImport, $DIR_LIBS, $DIR_SKINS;
+       $aErrors = array();
+       if ( count($aConfSkinsToImport) == 0 )
+       {
+               return $aErrors;
+       }
+       $importer = new SkinImport();
+       foreach ( $aConfSkinsToImport as $skinName )
+       {
+               $importer->reset();
+               $skinFile = $DIR_SKINS . $skinName . '/skinbackup.xml';
+               if ( !@file_exists($skinFile) )
+               {
+                       array_push($aErrors, sprintf(_INST_ERROR10, $skinFile));
+                       continue;
+               }
+               $error = $importer->readFile($skinFile);
+               if ( $error )
+               {
+                       array_push($aErrors, sprintf(_INST_ERROR11, $skinName) . ' : ' . $error);
+                       continue;
+               }
+               $error = $importer->writeToDatabase(1);
+               if ( $error )
+               {
+                       array_push($aErrors, sprintf(_INST_ERROR12, $skinName) . ' : ' . $error);
+                       continue;
+               }
+       }
+       return $aErrors;
+ }
+ /**
+  * Check if some important files of the Nucleus CMS installation are available
+  * Give an error if one or more files are not accessible
+  */
+ function do_check_files()
+ {
+       $missingfiles = array();
+       $files = array(
+               './install.sql',
+               '../index.php',
+               '../action.php',
+               '../nucleus/index.php',
+               '../nucleus/libs/ACTION.php',
+               '../nucleus/libs/ACTIONLOG.php',
+               '../nucleus/libs/ACTIONS.php',
+               '../nucleus/libs/ADMIN.php',
+               '../nucleus/libs/BaseActions.php',
+               '../nucleus/libs/BLOG.php',
+               '../nucleus/libs/BODYACTIONS.php',
+               '../nucleus/libs/COMMENT.php',
+               '../nucleus/libs/COMMENTACTIONS.php',
+               '../nucleus/libs/COMMENTS.php',
+               '../nucleus/libs/ENTITY.php',
+               '../nucleus/libs/globalfunctions.php',
+               '../nucleus/libs/i18n.php',
+               '../nucleus/libs/ITEM.php',
+               '../nucleus/libs/ITEMACTIONS.php',
+               '../nucleus/libs/LINK.php',
+               '../nucleus/libs/MANAGER.php',
+               '../nucleus/libs/MEDIA.php',
+               '../nucleus/libs/MEMBER.php',
+               '../nucleus/libs/NOTIFICATION.php',
+               '../nucleus/libs/PARSER.php',
+               '../nucleus/libs/PLUGIN.php',
+               '../nucleus/libs/PLUGINADMIN.php',
+               '../nucleus/libs/SEARCH.php',
+               '../nucleus/libs/showlist.php',
+               '../nucleus/libs/SKIN.php',
+               '../nucleus/libs/TEMPLATE.php',
+               '../nucleus/libs/vars4.1.0.php',
+               '../nucleus/libs/xmlrpc.inc.php',
+               '../nucleus/libs/xmlrpcs.inc.php',
+               '../nucleus/libs/sql/DB.php',
+               '../nucleus/libs/sql/MYSQLPDO.php'
+       );
+       $count = count($files);
+       for ( $i = 0; $i < $count; $i++ )
+       {
+               if ( !is_readable($files[$i]) )
+               {
+                       array_push($missingfiles, 'File <b>' . $files[$i] . '</b> is missing or not readable.<br />');
+               }
+       }
+       if ( count($missingfiles) > 0 )
+       {
+               exit(implode("\n", $missingfiles));
+       }
+ }
+ /**
+  * Updates the configuration in the database
+  *
+  * @param string $name name of the config var
+  * @param string $value new value of the config var
+  * @return array
+  */
+ function updateConfig($name, $value)
+ {
+       $errors = array();
+       $query = "UPDATE %s SET value = %s WHERE name = %s";
+       $query = sprintf($query, tableName('nucleus_config'), DB::quoteValue(trim($value)), DB::quoteValue($name));
+       if ( DB::execute($query) === FALSE )
+       {
+               $errinfo = DB::getError();
+               $errors[] = _INST_ERROR4 . ': ' . $errinfo[2];
+       }
+       return $errors;
+ }
+ class ParamManager
+ {
+       /* process parameter */
+       public $state;
+       public $locale;
+       /* mysql connection parameters */
+       public $mysql_host;
+       public $mysql_user;
+       public $mysql_password;
+       public $mysql_database;
+       public $mysql_tablePrefix;
+       /* weblog configuration parameters */
+       public $blog_name;
+       public $blog_shortname;
+       /* member configuration parameters */
+       public $user_name;
+       public $user_realname;
+       public $user_password;
+       private $user_password2;
+       public $user_email;
+       /* URI parameters  */
+       private $root_url;
+       public $IndexURL;
+       public $AdminURL;
+       public $MediaURL;
+       public $SkinsURL;
+       public $PluginURL;
+       public $ActionURL;
+       /* path parameters */
+       private $root_path;
+       public $AdminPath;
+       public $MediaPath;
+       public $SkinsPath;
+       /**
+        * constructor
+        */
+       public function __construct()
+       {
+               $this->init();
+       }
+       public function init()
+       {
+               // set default values
+               $this->state = 'locale';
+               $this->install_mode = 'simple';
+               $this->locale = '';
+               $this->mysql_host = @ini_get('mysql.default_host');
+               $this->blog_name = 'My Nucleus CMS';
+               $this->blog_shortname = 'mynucleuscms';
+               /* root path */
+               $directory_separator = preg_quote(DIRECTORY_SEPARATOR, '|');
+               $this->root_path = implode('/', preg_split("|$directory_separator|", realpath(dirname(__FILE__) . '/..')));
+               if ( substr($this->root_path, -1, 1) !== '/' )
+               {
+                       $this->root_path .= '/';
+               }
+               $base_path_pcre = preg_quote($this->root_path, '|');
+               /* current directry name */
+               $directory_name = preg_replace("#{$base_path_pcre}#", '', implode('/', preg_split("#{$directory_separator}#", realpath(dirname(__FILE__)))));
+               $directory_name_pcre = preg_quote($directory_name, '|');
+               /* root uri */
+               $root_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'];
+               $this->root_url = preg_replace("|$directory_name_pcre(.*)$|", '', $root_url);
+               $this->AdminPath = $this->root_path . 'nucleus/';
+               $this->MediaPath = $this->root_path . 'media/';
+               $this->SkinsPath = $this->root_path . 'skins/';
+               $this->IndexURL  = $this->root_url;
+               $this->AdminURL  = $this->root_url . 'nucleus/';
+               $this->MediaURL  = $this->root_url . 'media/';
+               $this->SkinsURL  = $this->root_url . 'skins/';
+               $this->PluginURL = $this->root_url . 'nucleus/plugins/';
+               $this->ActionURL = $this->root_url . 'action.php';
+       }
+       private function read_parameter($parameter)
+       {
+               foreach ( $parameter as $element )
+               {
+                       if ( array_key_exists($element, $_POST) )
+                       {
+                               $this->$element = $_POST[$element];
+                       }
+               }
+       }
+       public function set_state($state)
+       {
+               $states = array('locale', 'mysql', 'weblog', 'detail', 'install');
+               if ( in_array($state, $states) )
+               {
+                       $this->state = $state;
+               }
+       }
+       public function set_locale()
+       {
+               $this->read_parameter(array('locale'));
+               if ( !$this->locale )
+               {
+                       /**
+                        * default locale select simple implementation
+                        * 
+                        * NOTE:
+                        * RFC2616: Hypertext Transfer Protocol -- HTTP/1.1
+                        * http://www.ietf.org/rfc/rfc2616.txt
+                        * 
+                        * 14.4 Accept-Language
+                        * 
+                        *    The Accept-Language request-header field is similar to Accept, but
+                        *    restricts the set of natural languages that are preferred as a
+                        *    response to the request. Language tags are defined in section 3.10.
+                        * 
+                        *        Accept-Language = "Accept-Language" ":"
+                        *                          1#( language-range [ ";" "q" "=" qvalue ] )
+                        *        language-range  = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
+                        *        
+                        *    Each language-range MAY be given an associated quality value which
+                        *    represents an estimate of the user's preference for the languages
+                        *    specified by that range. The quality value defaults to "q=1". For
+                        *    example,
+                        * 
+                        *        Accept-Language: da, en-gb;q=0.8, en;q=0.7
+                        * 
+                        *    would mean: "I prefer Danish, but will accept British English and
+                        *    other types of English." A language-range matches a language-tag if
+                        *    it exactly equals the tag, or if it exactly equals a prefix of the
+                        *    tag such that the first tag character following the prefix is "-".
+                        *    The special range "*", if present in the Accept-Language field,
+                        *    matches every tag not matched by any other range present in the
+                        *    Accept-Language field.
+                        * 
+                        * TODO: this is appropriate implement or not
+                        */
+                       $languages = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+                       
+                       /* retrieve language token of language tag from first token */
+                       $language = '';
+                       if ( is_array($languages) && count($languages) > 0 )
+                       {
+                               $language = preg_replace('#^([\w]+).*$#', '$1', $languages[0]);
+                       }
+                       
+                       $locales = i18n::get_available_locale_list();
+                       foreach ( $locales as $locale )
+                       {
+                               if ( i18n::strpos($locale, $language) === 0 )
+                               {
+                                       $this->locale = $locale;
+                                       break;
+                               }
+                       }
+               }
+               
+               /* include installer translation messages */
+               $translation_file = "./locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+               if ( !file_exists($translation_file) )
+               {
+                       $translation_file = './locales/en_Latn_US.UTF-8.php';
+               }
+               include($translation_file);
+               
+               /* include global translation messages */
+               $translation_file = "../nucleus/locales/{$this->locale}." . i18n::get_current_charset() . '.php';
+               if ( !file_exists($translation_file) )
+               {
+                       $translation_file = './locales/en_Latn_US.UTF-8.php';
+               }
+               include($translation_file);
+               
+               i18n::set_current_locale($this->locale);
+               
+               return;
+       }
+       public function check_mysql_parameters()
+       {
+               global $MYSQL_HANDLER;
+               
+               $parameters = array('mysql_host', 'mysql_user', 'mysql_password', 'mysql_database', 'mysql_tablePrefix');
+               $this->read_parameter($parameters);
+               $errors = array();
+               if ( $this->mysql_host == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD1);
+               }
+               if ( $this->mysql_user == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD2);
+               }
+               
+               if ( $this->mysql_user != ''
+                       && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_user) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD2);
+               }
+               
+               if ( $this->mysql_database == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _DB_FIELD4);
+               }
+               if ( $this->mysql_database != ''
+                       && !preg_match('/^[a-z0-9_\-]+$/i', $this->mysql_database) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR2, _DB_FIELD4);
+               }
+               if ( $this->mysql_tablePrefix != ''
+                       && !preg_match('/^[a-z0-9_]+$/i', $this->mysql_tablePrefix) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR3, _DB_FIELD5);
+               }
+               
+               if ( count($errors) == 0 )
+               {
+                       $mysql_conn = @DB::setConnectionInfo($MYSQL_HANDLER[1], $this->mysql_host, $this->mysql_user, $this->mysql_password);
+                       if ( $mysql_conn == false )
+                       {
+                               $errors[] = _DBCONNECT_ERROR;
+                       }
+                       else
+                       {
+                               @DB::disConnect();
+                       }
+               }
+               return $errors;
+       }
+       public function check_user_parameters()
+       {
+               $parameters = array('user_name', 'user_realname', 'user_password', 'user_password2', 'user_email');
+               $this->read_parameter($parameters);
+               $errors = array();
+               if ( $this->user_realname == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD1);
+               }
+               if ( $this->user_name == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD2);
+               }
+               elseif ( !preg_match("/^[a-z0-9]+([ a-z0-9]*[a-z0-9]+)?$/i", $this->user_name) )
+               {
+                       $errors[] = _VALID_ERROR5;
+               }
+               if ( $this->user_password == '' || $this->user_password2 == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _ADMIN_FIELD3);
+                       $this->user_password = '';
+               }
+               elseif ( $this->user_password != $this->user_password2 )
+               {
+                       $errors[] = _VALID_ERROR6;
+                       $this->user_password = '';
+               }
+               if ( !preg_match("/^[a-z0-9\._+\-]+@[a-z0-9\._\-]+\.[a-z]{2,6}$/i", $this->user_email) )
+               {
+                       $errors[] = _VALID_ERROR7;
+               }
+               return $errors;
+       }
+       public function check_weblog_parameters()
+       {
+               $parameters = array('blog_name', 'blog_shortname');
+               $this->read_parameter($parameters);
+               $errors = array();
+               if ( $this->blog_name == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD1);
+               }
+               if ( $this->blog_shortname == '' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR1, _BLOG_FIELD2);
+               }
+               if ( !preg_match("/^[a-z0-9]+$/i", $this->blog_shortname) )
+               {
+                       $errors[] = _VALID_ERROR4;
+               }
+               return $errors;
+       }
+       public function check_uri_parameters()
+       {
+               $parameters = array('IndexURL', 'AdminURL', 'MediaURL', 'SkinsURL', 'PluginURL', 'ActionURL');
+               $this->read_parameter($parameters);
+               $errors = array();
+               if ( substr($this->IndexURL, -1, 1) !== '/' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD1);
+               }
+               if ( substr($this->AdminURL, -1, 1) !== '/' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD2);
+               }
+               if ( substr($this->MediaURL, -1, 1) !== '/' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD4);
+               }
+               if ( substr($this->SkinsURL, -1, 1) !== '/' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD6);
+               }
+               if ( substr($this->PluginURL, -1, 1) !== '/' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR8, _PATH_FIELD8);
+               }
+               if ( strrchr($this->ActionURL, '/') != '/action.php' )
+               {
+                       $errors[] = sprintf(_VALID_ERROR9, _PATH_FIELD9);
+               }
+               return $errors;
+       }
+       public function check_path_parameters()
+       {
+               $parameters = array('AdminPath', 'MediaPath', 'SkinsPath');
+               $this->read_parameter($parameters);
+               $separators = array('/', DIRECTORY_SEPARATOR);
+               $errors = array();
+               if ( !in_array(substr($this->AdminPath, -1, 1), $separators) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD3);
+               }
+               elseif ( !file_exists($this->AdminPath) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD3);
+               }
+               if ( !in_array(substr($this->MediaPath, -1, 1), $separators) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD5);
+               }
+               elseif ( !file_exists($this->MediaPath) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD5);
+               }
+               if ( !in_array(substr($this->SkinsPath, -1, 1), $separators) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR10, _PATH_FIELD7);
+               }
+               elseif ( !file_exists($this->SkinsPath) )
+               {
+                       $errors[] = sprintf(_VALID_ERROR11, _PATH_FIELD7);
+               }
+               return $errors;
+       }
+       /**
+        * check all parameters
+        * @return bool
+        */
+       public function check_all_parameters()
+       {
+               $this->set_locale();
+               $isValid = true;
+               $isValid &= (count($this->check_mysql_parameters()) == 0);
+               $isValid &= (count($this->check_user_parameters()) == 0);
+               $isValid &= (count($this->check_weblog_parameters()) == 0);
+               $isValid &= (count($this->check_uri_parameters()) == 0);
+               $isValid &= (count($this->check_path_parameters()) == 0);
+               return $isValid;
+       }
+ }
++>>>>>>> skinnable-master
@@@ -25,11 -25,25 +25,32 @@@ $CONF['UsingAdminArea'] = 1
  // include all classes and config data
  include('../config.php');
  
++<<<<<<< HEAD
++=======
+ // get skin object
+ $skinid = $member->bookmarklet;
+ if ( !Skin::existsID($skinid) )
+ {
+       $skinid = $CONF['BookmarkletSkin'];
+       if ( !Skin::existsID($skinid) )
+       {
+               sendContentType('text/html');
+               echo _ERROR_SKIN;
+               exit;
+       }
+ }
+ $skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');
++>>>>>>> skinnable-master
  // check logged-in or pass through
  $action = requestVar('action');
  if ( !$member->isLoggedIn() )
  {
++<<<<<<< HEAD
 +      bm_loginAndPassThrough($action);
++=======
+       bm_loginAndPassThrough($skin, $action);
++>>>>>>> skinnable-master
        exit;
  }
  else if ( $action == 'login')
@@@ -49,9 -63,6 +70,12 @@@ else if ( $action == '' 
        $action = 'add';
  }
  
++<<<<<<< HEAD
 +// send HTTP 1.1 message header for Content-Type
 +sendContentType('text/html', 'bookmarklet-' . $action);
 +
++=======
++>>>>>>> skinnable-master
  // check ticket
  $aActionsNotToCheck = array('login', 'add', 'edit');
  if ( !in_array($action, $aActionsNotToCheck) )
@@@ -118,7 -129,7 +142,11 @@@ function bm_doAddItem($skin
                $extrahead = '';
        }
        
++<<<<<<< HEAD
 +      bm_message(_ITEM_ADDED, _ITEM_ADDED, $message,$extrahead);
++=======
+       bm_message($skin, _ITEM_ADDED, $message,$extrahead);
++>>>>>>> skinnable-master
        
        return;
  }
@@@ -204,46 -218,33 +235,66 @@@ function bm_doEditItem($skin
        }
        else
        {
-               bm_message(_ITEM_UPDATED, _ITEM_UPDATED, _ITEM_UPDATED, '');
+               $message = _ITEM_ADDED;
        }
        
++<<<<<<< HEAD
 +      return;
 +}
 +
 +function bm_loginAndPassThrough($action='add')
++=======
+       // show success message
+       bm_message($skin, _ITEM_ADDED, $message, '');
+       return;
+ }
+ function bm_loginAndPassThrough($skin, $action='add')
++>>>>>>> skinnable-master
  {
+       /*
+        * TODO: これを出力させる
        $blogid = intRequestVar('blogid');
        $itemid = intRequestVar('itemid');
        $log_text = requestVar('logtext');
        $log_link = requestVar('loglink');
        $log_linktitle = requestVar('loglinktitle');
        
++<<<<<<< HEAD
 +      echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
 +      echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
 +      echo "<head>\n";
 +      echo "<title>Nucleus CMS Bookmarklet</title>\n";
 +      
 +      bm_style();
 +      
 +      echo "</head>\n";
 +      echo "<body>\n";
 +      echo '<h1>' . _LOGIN_PLEASE . "</h1>\n";
 +      echo "<form method=\"post\" action=\"bookmarklet.php\">\n";
 +      echo "<p>\n";
 +      echo _LOGINFORM_NAME . "<input type=\"text\" name=\"login\" value=\"\" /><br />\n";
 +      echo _LOGINFORM_PWD . "<input type=\"password\" name=\"password\" value=\"\" /><br />\n";
++=======
++>>>>>>> skinnable-master
        echo '<input type="hidden" name="blogid" value="' . Entity::hsc($blogid). '" />' . "\n";
        echo '<input type="hidden" name="itemid" value="' . Entity::hsc($itemid). '" />' . "\n";
        echo '<input type="hidden" name="logtext" value="' . Entity::hsc($log_text) . '" />' . "\n";
        echo '<input type="hidden" name="loglink" value="' . Entity::hsc($log_link) . '" />' . "\n";
        echo '<input type="hidden" name="loglinktitle" value="' . Entity::hsc($log_linktitle) . '" />' . "\n";
        echo "<input type=\"hidden\" name=\"nextaction\" value=\"{$action}\" />\n";
++<<<<<<< HEAD
 +      echo '<button type="submit" name="action" value="login">' . _LOGIN . "</button>\n";
 +      echo "</p>\n";
 +      echo "</form>\n";
 +      echo '<p><a href="bookmarklet.php" onclick="window.close();">' . _POPUP_CLOSE . "</a></p>\n";
 +      echo "</body>\n";
 +      echo "</html>\n";
++=======
+       */
+       
+       $skin->parse('showlogin');
++>>>>>>> skinnable-master
        
        return;
  }
@@@ -259,18 -260,15 +310,24 @@@ function bm_doShowForm($skin
        
        if ( !Blog::existsID($blogid) )
        {
-               bm_doError(_ERROR_NOSUCHBLOG);
+               bm_doError($skin, _ERROR_NOSUCHBLOG);
        }
++<<<<<<< HEAD
 +      else
 +      {
 +              $blog =& $manager->getBlog($blogid);
 +      }
 +      
 +      if ( !$member->isTeamMember($blogid) )
++=======
+       else if ( !$member->isTeamMember($blogid) )
++>>>>>>> skinnable-master
        {
-               bm_doError(_ERROR_NOTONTEAM);
+               bm_doError($skin, _ERROR_NOTONTEAM);
        }
        
+       $blog =& $manager->getBlog($blogid);
+       
        $logje = '';
        
        if ( $log_text )
                $logje .= '<a href="' . Entity::hsc($log_link) . '">' . Entity::hsc($log_linktitle) . '</a>';
        }
        
++<<<<<<< HEAD
 +      $variables = array();
 +      $variables['body'] = $logje;
 +      $variables['title'] = Entity::hsc($log_linktitle);
 +      
 +      $handler = new PageFactory($blog);
 +      $handler->setVariables($variables);
 +      
 +      $contents = $handler->getTemplateFor('bookmarklet', 'add');
 +      $manager->notify('PreAddItemForm', array('contents' => &$contents, 'blog' => &$blog));
 +      
 +      $parser = new Parser($handler);
 +      $parser->parse($contents);
 +      
++=======
+       $item = array();
+       $item['body'] = $logje;
+       $item['title'] = Entity::hsc($log_linktitle);
+       
+       $data = array(
+               'blog'          => &$blog,
+               'item'          => &$item,
+               'contents'      => &$item
+       );
+       $manager->notify('PreAddItemForm', $data);
+       
+       if ( $blog->convertBreaks() )
+       {
+               $item['body'] = removeBreaks($item['body']);
+       }
+       
+       Admin::$blog = &$blog;
+       Admin::$contents = &$item;
+       
+       Admin::$action = 'createitem';
+       $skin->parse('createitem');
+       
++>>>>>>> skinnable-master
        return;
  }
  
@@@ -312,74 -319,54 +394,105 @@@ function bm_doEditForm($skin
        
        if ( !$manager->existsItem($itemid, 0, 0) )
        {
-               bm_doError(_ERROR_NOSUCHITEM);
+               bm_doError($skin, _ERROR_NOSUCHITEM);
        }
-       
-       if ( !$member->canAlterItem($itemid) )
+       else if ( !$member->canAlterItem($itemid) )
        {
-               bm_doError(_ERROR_DISALLOWED);
+               bm_doError($skin, _ERROR_DISALLOWED);
        }
        
++<<<<<<< HEAD
 +      $variables =& $manager->getItem($itemid, 1, 1);
++=======
++>>>>>>> skinnable-master
        $blog =& $manager->getBlog(getBlogIDFromItemID($itemid) );
+       $item =& $manager->getItem($itemid, 1, 1);
        
++<<<<<<< HEAD
 +      $manager->notify('PrepareItemForEdit', array('item' => &$variables) );
++=======
+       $data = array(
+               'blog' => &$blog,
+               'item' => &$item
+       );
+       $manager->notify('PrepareItemForEdit', $data);
++>>>>>>> skinnable-master
        
        if ( $blog->convertBreaks() )
        {
 -              $item['body'] = removeBreaks($item['body']);
 -              $item['more'] = removeBreaks($item['more']);
 +              $variables['body'] = removeBreaks($variables['body']);
 +              $variables['more'] = removeBreaks($variables['more']);
        }
        
++<<<<<<< HEAD
 +      $handler = new PageFactory($blog);
 +      $handler->setVariables($variables);
 +      
 +      $contents = $handler->getTemplateFor('bookmarklet', 'edit');
 +      
 +      $parser = new Parser($handler);
 +      $parser->parse($contents);
 +      
 +      return;
 +}
++=======
+       Admin::$blog = &$blog;
+       Admin::$contents = &$item;
+       
+       Admin::$action = 'itemedit';
+       $skin->parse('itemedit');
+       
+       return;}
++>>>>>>> skinnable-master
  
- function bm_doError($msg)
+ function bm_doError($skin, $msg)
  {
-       bm_message(_ERROR, _ERRORMSG, $msg);
+       bm_message($skin, _ERRORMSG, $msg);
        die;
  }
  
- function bm_message($title, $head, $msg, $extrahead = '')
+ function bm_message($skin, $title, $msg, $extrahead = '')
  {
++<<<<<<< HEAD
 +      echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
 +      echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
 +      echo "<head>\n";
 +      echo "<title>{$title}</title>\n";
 +      
 +      bm_style();
 +      
 +      echo $extrahead . "\n";
 +      echo "</head>\n";
 +      echo "<body>\n";
 +      echo "<h1>{$head}</h1>\n";
 +      echo "<p>{$msg}</p>\n";
 +      echo '<p><a href="bookmarklet.php" onclick="window.close();window.opener.location.reload();">' . _POPUP_CLOSE . "</a></p>\n";
 +      echo "</body>\n";
 +      echo "</html>\n";
++=======
+       Admin::$extrahead = $extrahead;
+       Admin::$headMess = $msg;
+       $skin->parse('adminerrorpage');
++>>>>>>> skinnable-master
        
        return;
  }
  
- function bm_style()
+ function bm_doContextMenuCode($width=600, $height=500)
  {
++<<<<<<< HEAD
 +      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/bookmarklet.css\" />\n";
 +      echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles/addedit.css\" />\n";
 +      return;
 +}
 +
 +function bm_doContextMenuCode($width=600, $height=500)
 +{
 +      global $CONF;
 +      
++=======
+       global $CONF;   
++>>>>>>> skinnable-master
        $blogid = (integer) intGetVar('blogid');
        
        echo "<script type=\"text/javascript\" defer=\"defer\">\n";
@@@ -806,7 -808,7 +808,11 @@@ class BlogImport 
  
                if ( DB::execute($query) === FALSE )
                {
++<<<<<<< HEAD
 +                      die("Error while executing query: " . $query);
++=======
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
  
                return DB::getInsertId();
                DB::execute('INSERT INTO '.sql_table('category')." (CNAME, CDESC) VALUES ('General','Items that do not fit in another category')");
                $defcat = DB::getInsertId();
  
++<<<<<<< HEAD
 +              $query = 'INSERT INTO '.sql_table('blog')." (BNAME, BSHORTNAME, BCOMMENTS, BMAXCOMMENTS, BDEFCAT) VALUES ('$name','$shortname',1 ,0, $defcat)";
 +              if ( DB::execute($query) === FALSE )
 +              {
 +                      die("Error while executing query: " . $query);
++=======
+               $query = 'INSERT INTO '.sql_table('blog')." (BNAME, BSHORTNAME, BCOMMENTS, BMAXCOMMENTS, BDEFCAT) VALUES ($name, $shortname, 1, 0, $defcat)";
+               if ( DB::execute($query) === FALSE )
+               {
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
                $id = DB::getInsertId();
  
  
                if ( DB::execute($query) === FALSE )
                {
++<<<<<<< HEAD
 +                      die("Error while executing query: " . $query);
++=======
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
  
                return DB::getInsertId();
  
                if ( DB::execute($query) === FALSE )
                {
++<<<<<<< HEAD
 +                      die("Error while executing query: " . $query);
++=======
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
  
                return DB::getInsertId();
@@@ -902,7 -904,7 +923,11 @@@ if ($ver > 250
  
                if ( DB::execute($query) === FALSE )
                {
++<<<<<<< HEAD
 +                      die("Error while executing query: " . $query);
++=======
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
  
                return DB::getInsertId();
                DB::execute('INSERT INTO '.sql_table('category')." (CNAME, CDESC) VALUES ('General','Items that do not fit in another categort')");
                $defcat = DB::getInsertId();
  
++<<<<<<< HEAD
 +              $query = 'INSERT INTO '.sql_table('blog')." (BNAME, BSHORTNAME, BCOMMENTS, BMAXCOMMENTS, BDEFCAT) VALUES ('$name','$shortname',1 ,0, $defcat)";
 +              if ( DB::execute($query) === FALSE )
 +              {
 +                      die("Error while executing query: " . $query);
++=======
+               $query = 'INSERT INTO '.sql_table('blog')." (BNAME, BSHORTNAME, BCOMMENTS, BMAXCOMMENTS, BDEFCAT) VALUES ($name, $shortname, 1, 0, $defcat)";
+               if ( DB::execute($query) === FALSE )
+               {
+                       die('Error while executing query: ' . $query);
++>>>>>>> skinnable-master
                }
                $id = DB::getInsertId();
  
  
  include("../../config.php");
  
++<<<<<<< HEAD
 +function def($s)
 +{
 +      if ( isset($_POST[$s]) )
 +              echo addslashes(stripslashes($_POST[$s]));
 +      else
 +      {
 +              if ( i18n::strpos($s, 'host') !== FALSE ) echo "localhost";
 +              if ( i18n::strpos($s, 'username') !== FALSE ) echo "root";
 +              if ( i18n::strpos($s, 'wpprefix') !== FALSE ) echo "wp_";
 +      }
 +}
 +
 +function error($s)
 +{
 +      global $isok;
 +      $isok = false;
 +      echo "<h3>Error: $s</h3>";
 +}
 +
 +// line breaks into properly formatted paragraphs
 +function paragraph($text, $br = false)
 +{
 +      $text = trim($text);
 +      $text = str_replace("\r", '', $text);
 +      $text = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $text);
 +      if ( $text == "" ) return "";
 +      $text = $text . "\n"; // just to make things a little easier, pad the end
 +      $text = preg_replace('|<br/>\s*<br/>|', "\n\n", $text);
 +      $text = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $text); // Space things out a little
 +      $text = preg_replace('!(</(?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $text); // Space things out a little
 +      $text = preg_replace("/(\r\n|\r)/", "\n", $text); // cross-platform newlines 
 +      $text = preg_replace("/\n\n+/", "\n\n", $text); // take care of duplicates
 +      $text = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $text); // make paragraphs, including one at the end 
 +      $text = preg_replace('|<p>\s*?</p>|', '', $text); // under certain strange conditions it could create a P of entirely whitespace 
 +      $text = preg_replace("|<p>(<li.+?)</p>|", "$1", $text); // problem with nested lists
 +      // blockquote
 +      $text = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $text);
 +      $text = str_replace('</blockquote></p>', '</p></blockquote>', $text);
 +      // now the hard work
 +      $text = preg_replace('!<p>\s*(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $text);
 +      $text = preg_replace('!(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*</p>|</div>"!', "$1", $text);
 +      if ( $br ) $text = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $text);
 +      // optionally make line breaks
 +      $text = preg_replace('!(</?(?:table|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br/>!', "$1", $text);
 +      $text = preg_replace('!<br/>(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $text);
 +      // some cleanup
 +      $text = str_replace('</p><br />', '</p>', $text);
 +      $text = str_replace("<br />\n</p>", '</p>', $text);
 +      return $text;
 +}
 +
 +function encoding($s)
 +{
 +      global $input;
 +      if ( is_callable("iconv") )
 +              return iconv($input, 'utf-8', $s);
 +      else
 +              return $s;
 +}
++=======
+   function def($s){ 
+     if (isset($_POST[$s])) 
+       echo Entity::hsc($_POST[$s]); 
+     else {
+       if (i18n::strpos($s,'host')!==FALSE) echo "localhost";
+       if (i18n::strpos($s,'username')!==FALSE) echo "root";
+       if (i18n::strpos($s,'wpprefix')!==FALSE) echo "wp_";
+     }
+   }
+   
+   function error($s){
+     global $isok;
+     $isok=false;
+     echo "<h3>Error: $s</h3>";
+   }
+   
+   // line breaks into properly formatted paragraphs
+   function paragraph($text, $br = false) {
+     $text=trim($text);
+     $text = str_replace("\r",'',$text);
+     $text = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&amp;$1', $text);
+     if ($text=="") return "";
+     $text = $text . "\n"; // just to make things a little easier, pad the end
+     $text = preg_replace('|<br/>\s*<br/>|', "\n\n", $text);
+     $text = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $text); // Space things out a little
+     $text = preg_replace('!(</(?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $text); // Space things out a little
+     $text = preg_replace("/(\r\n|\r)/", "\n", $text); // cross-platform newlines 
+     $text = preg_replace("/\n\n+/", "\n\n", $text); // take care of duplicates
+     $text = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "\t<p>$1</p>\n", $text); // make paragraphs, including one at the end 
+     $text = preg_replace('|<p>\s*?</p>|', '', $text); // under certain strange conditions it could create a P of entirely whitespace 
+     $text = preg_replace("|<p>(<li.+?)</p>|", "$1", $text); // problem with nested lists
+     // blockquote
+     $text = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $text);
+     $text = str_replace('</blockquote></p>', '</p></blockquote>', $text);
+     // now the hard work
+     $text = preg_replace('!<p>\s*(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $text);
+     $text = preg_replace('!(</?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*</p>|</div>"!', "$1", $text); 
+     if ($br) $text = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $text); // optionally make line breaks
+     $text = preg_replace('!(</?(?:table|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*<br/>!', "$1", $text);
+     $text = preg_replace('!<br/>(\s*</?(?:p|li|div|th|pre|td|ul|ol)>)!', '$1', $text);
+     // some cleanup
+     $text = str_replace('</p><br />','</p>',$text);
+     $text = str_replace("<br />\n</p>",'</p>',$text);
+     return $text; 
+   }
++>>>>>>> skinnable-master
  
 -  function encoding($s){
 -    global $input;
 -    if (is_callable("iconv"))
 -      return iconv($input,'utf-8',$s);
 -    else 
 -      return $s;
 -  }
 -  
  ?>
  <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='cs' lang='cs'>
@@@ -130,65 -124,65 +178,127 @@@ els
        {
                @mysql_select_db($_POST['wpdatabase'], $linkwp) or error("Cannot select WordPress DB...");
        }
++<<<<<<< HEAD
 +
 +      // connect to Nucleus CMS database
 +      /*
 +      $linkblogcms = @mysql_connect($_POST['blogcmshost'],$_POST['blogcmsusername'],$_POST['blogcmspassword'],true);
 +      if($linkblogcms==false) 
 +        error("Cannot connect to Nucleus DB..");
 +      else {
 +        @mysql_select_db($_POST['blogcmsdatabase'],$linkblogcms) or error("Cannot select Nucleus DB...");
 +      }
 +       */
 +
 +      if ( !$isok )
 +      {
 +              echo "<p>Please correct these errors first!</p><hr />";
 +      }
 +      else
 +      {
 +              /*                 */
 +              /* transfer data ! */
 +              /*                 */
 +              $prefixwp = $_POST['wpprefix'];
 +
 +              /* *********************************************** */
 +              echo "<h2>Getting encoding...</h2>";
 +              $query = "SELECT option_value FROM " . $prefixwp . "options WHERE option_name='blog_charset'";
 +              $querywp = mysql_query($query, $linkwp) or die($query);
 +              if ( $row = mysql_fetch_object($querywp) )
 +                      $input = $row->option_value;
 +              else
 +                      $input = "utf-8";
 +              echo "<p>Encoding: $input</p>";
 +
 +              /* *********************************************** */
 +              echo "<h2>Transfering categories...</h2>";
 +              DB::execute("DELETE FROM " . sql_table('category') . " WHERE cdesc='@wordpress'");
 +              $total_num = DB::getValue("SELECT count(*) as result FROM " . sql_table('category'));
 +              $catdd = $total_num;
 +              $total_num++;
 +
 +              $query = "SELECT * FROM " . $prefixwp . "term_taxonomy , " . $prefixwp . "terms WHERE " . $prefixwp . "term_taxonomy.term_taxonomy_id = "
 +                      . $prefixwp . "terms.term_id AND " . $prefixwp . "term_taxonomy.taxonomy='category'";
 +              $querywp = mysql_query($query, $linkwp) or die($query);
 +              echo "<p>rows to transfer: " . mysql_num_rows($querywp) . "</p>";
 +              echo "<p>";
 +              $cate_map = array();
 +              while ( $row = mysql_fetch_object($querywp) )
 +              {
 +                      echo $total_num . ", ";
 +                      $cate_map[$row->term_id] = $total_num;
 +                      $query = sprintf("INSERT INTO %s (catid,cblog,cname,cdesc) VALUES (%d,1,'%s','@wordpress')"
 +                              , sql_table('category'), intval($total_num), encoding($row->name));
 +                      if ( DB::execute($query) === FALSE )
 +                      {
 +                              die($query);
 +                      }
 +                      $total_num++;
 +              }
 +              echo "</p>";
 +
++=======
+       // connect to Nucleus CMS database
+       /*
+       $linkblogcms = @mysql_connect($_POST['blogcmshost'],$_POST['blogcmsusername'],$_POST['blogcmspassword'],true);
+       if($linkblogcms==false) 
+         error("Cannot connect to Nucleus DB..");
+       else {
+         @mysql_select_db($_POST['blogcmsdatabase'],$linkblogcms) or error("Cannot select Nucleus DB...");
+       }
+        */
+       if ( !$isok )
+       {
+               echo "<p>Please correct these errors first!</p><hr />";
+       }
+       else
+       {
+               /*                 */
+               /* transfer data ! */
+               /*                 */
+               $prefixwp = $_POST['wpprefix'];
+               /* *********************************************** */
+               echo "<h2>Getting encoding...</h2>";
+               $query = "SELECT option_value FROM " . $prefixwp . "options WHERE option_name='blog_charset'";
+               $querywp = mysql_query($query, $linkwp) or die($query);
+               if ( $row = mysql_fetch_object($querywp) )
+                       $input = $row->option_value;
+               else
+                       $input = "utf-8";
+               echo "<p>Encoding: $input</p>";
+               /* *********************************************** */
+               echo "<h2>Transfering categories...</h2>";
+               DB::execute("DELETE FROM " . sql_table('category') . " WHERE cdesc='@wordpress'");
+               $total_num = DB::getValue("SELECT count(*) as result FROM " . sql_table('category'));
+               $catdd = $total_num;
+               $total_num++;
+               $query = "SELECT * FROM " . $prefixwp . "term_taxonomy , " . $prefixwp . "terms WHERE " . $prefixwp . "term_taxonomy.term_taxonomy_id = "
+                       . $prefixwp . "terms.term_id AND " . $prefixwp . "term_taxonomy.taxonomy='category'";
+               $querywp = mysql_query($query, $linkwp) or die($query);
+               echo "<p>rows to transfer: " . mysql_num_rows($querywp) . "</p>";
+               echo "<p>";
+               $cate_map = array();
+               while ( $row = mysql_fetch_object($querywp) )
+               {
+                       echo $total_num . ", ";
+                       $cate_map[$row->term_id] = $total_num;
+                       $query = sprintf("INSERT INTO %s (catid,cblog,cname,cdesc) VALUES (%d,1,'%s','@wordpress')"
+                               , sql_table('category'), intval($total_num), encoding($row->name));
+                       if ( DB::execute($query) === FALSE )
+                       {
+                               die($query);
+                       }
+                       $total_num++;
+               }
+               echo "</p>";
++>>>>>>> skinnable-master
                /* *********************************************** */
                echo "<h2>Transfering posts and comments...</h2>";
                DB::execute("DELETE FROM " . sql_table('comment') . " WHERE chost='@wordpress'");
   */
  /**
   * @license http://nucleuscms.org/license.txt GNU General Public License
++<<<<<<< HEAD
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group
 + * @version $Id: index.php 1748 2012-04-13 13:27:57Z sakamocchi $
++=======
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: index.php 1888 2012-06-17 08:38:54Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  // we are using admin stuff:
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2009 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Actions that can be called via action.php\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: ACTION.php 1646 2012-01-29 10:47:32Z sakamocchi $\r
 + */\r
 +class Action\r
 +{\r
 +      /**\r
 +       * Action::__construct()\r
 +       *  Constructor for an new ACTION object\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::doAction()\r
 +       *  Calls functions that handle an action called from action.php\r
 +       * \r
 +       * @param       string  $action action type\r
 +       * @return      mixed\r
 +       */\r
 +      public function doAction($action)\r
 +      {\r
 +              switch ( $action )\r
 +              {\r
 +                      case 'autodraft':\r
 +                              return $this->autoDraft();\r
 +                              break;\r
 +                      case 'updateticket':\r
 +                              return $this->updateTicket();\r
 +                              break;\r
 +                      case 'addcomment':\r
 +                              return $this->addComment();\r
 +                              break;\r
 +                      case 'sendmessage':\r
 +                              return $this->sendMessage();\r
 +                              break;\r
 +                      case 'createaccount':\r
 +                              return $this->createAccount();\r
 +                              break;\r
 +                      case 'forgotpassword':\r
 +                              return $this->forgotPassword();\r
 +                              break;\r
 +                      case 'votepositive':\r
 +                              return $this->doKarma('pos');\r
 +                              break;\r
 +                      case 'votenegative':\r
 +                              return $this->doKarma('neg');\r
 +                              break;\r
 +                      case 'plugin':\r
 +                              return $this->callPlugin();\r
 +                              break;\r
 +                      default:\r
 +                              doError(_ERROR_BADACTION);\r
 +                              break;\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::addComment()\r
 +       * Adds a new comment to an item (if IP isn't banned)\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function addComment()\r
 +      {\r
 +              global $CONF, $errormessage, $manager;\r
 +              \r
 +              $post['itemid'] = intPostVar('itemid');\r
 +              $post['user']   = postVar('user');\r
 +              $post['userid'] = postVar('userid');\r
 +              $post['email']  = postVar('email');\r
 +              $post['body']   = postVar('body');\r
 +              $post['remember'] = intPostVar('remember');\r
 +              \r
 +              // begin if: "Remember Me" box checked\r
 +              if ( $post['remember'] == 1 )\r
 +              {\r
 +                      $lifetime = time() + 2592000;\r
 +                      setcookie($CONF['CookiePrefix'] . 'comment_user', $post['user'], $lifetime, '/', '', 0);\r
 +                      setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'], $lifetime, '/', '', 0);\r
 +                      setcookie($CONF['CookiePrefix'] . 'comment_email', $post['email'], $lifetime, '/', '', 0);\r
 +              }\r
 +              \r
 +              $comments = new Comments($post['itemid']);\r
 +              \r
 +              $blog_id = getBlogIDFromItemID($post['itemid']);\r
 +              $this->checkban($blog_id);\r
 +              $blog =& $manager->getBlog($blog_id);\r
 +              \r
 +              // note: PreAddComment and PostAddComment gets called somewhere inside addComment\r
 +              $errormessage = $comments->addComment($blog->getCorrectTime(), $post);\r
 +              \r
 +              if ( $errormessage != '1' )\r
 +              {\r
 +                      // show error message using default skin for blo\r
 +                      return array(\r
 +                              'message'       => $errormessage,\r
 +                              'skinid'        => $blog->getDefaultSkin()\r
 +                      );\r
 +              }\r
 +              else\r
 +              {\r
 +                      // redirect when adding comments succeeded\r
 +                      if ( postVar('url') )\r
 +                      {\r
 +                              redirect(postVar('url') );\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $url = Link::create_item_link($post['itemid']);\r
 +                              redirect($url);\r
 +                      }\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::sendMessage()\r
 +       * Sends a message from the current member to the member given as argument\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function sendMessage()\r
 +      {\r
 +              global $CONF, $member;\r
 +              \r
 +              $error = $this->validateMessage();\r
 +              \r
 +              if ( $error != '' )\r
 +              {\r
 +                      return array('message' => $error);\r
 +              }\r
 +              \r
 +              if ( !$member->isLoggedIn() )\r
 +              {\r
 +                      $fromMail = postVar('frommail');\r
 +                      $fromName = _MMAIL_FROMANON;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $fromMail = $member->getEmail();\r
 +                      $fromName = $member->getDisplayName();\r
 +              }\r
 +              \r
 +              /* TODO: validation */\r
 +              $memberid = postVar('memberid');\r
 +              $tomem = new Member();\r
 +              $tomem->readFromId($memberid);\r
 +              \r
 +              /* TODO: validation */\r
 +              $message = postVar('message');\r
 +              $message  = _MMAIL_MSG . ' ' . $fromName . "\n"\r
 +                      . '(' . _MMAIL_FROMNUC. ' ' . $CONF['IndexURL'] .") \n\n"\r
 +                      . _MMAIL_MAIL . " \n\n"\r
 +                      . $message;\r
 +              $message .= Notification::get_mail_footer();\r
 +              \r
 +              $title = _MMAIL_TITLE . ' ' . $fromName;\r
 +              Notification::mail($tomem->getEmail(), $title, $message, $fromMail, i18n::get_current_charset());\r
 +              \r
 +              /* TODO: validation */\r
 +              $url = postVar('url');\r
 +              if ( empty($url) )\r
 +              {\r
 +                      $CONF['MemberURL'] = $CONF['IndexURL'];\r
 +                      \r
 +                      if ( $CONF['URLMode'] == 'pathinfo' )\r
 +                      {\r
 +                              $data = array(\r
 +                                      'memberid'      => $tomem->getID(),\r
 +                                      'name'          => $tomem->getDisplayName()\r
 +                              );\r
 +                              $url = Link::create_link('member', $data);\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $url = $CONF['IndexURL'] . Link::create_member_link($tomem->getID());\r
 +                      }\r
 +              }\r
 +              redirect($url );\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::validateMessage()\r
 +       *  Checks if a mail to a member is allowed\r
 +       *  Returns a string with the error message if the mail is disallowed\r
 +       * \r
 +       * @param               void\r
 +       * @return      String  Null character string\r
 +       */\r
 +      private function validateMessage()\r
 +      {\r
 +              global $CONF, $member, $manager;\r
 +              \r
 +              if ( !$CONF['AllowMemberMail'] )\r
 +              {\r
 +                      return _ERROR_MEMBERMAILDISABLED;\r
 +              }\r
 +              \r
 +              if ( !$member->isLoggedIn() && !$CONF['NonmemberMail'] )\r
 +              {\r
 +                      return _ERROR_DISALLOWED;\r
 +              }\r
 +              \r
 +              if ( !$member->isLoggedIn() && !Notification::address_validation(postVar('frommail')) )\r
 +              {\r
 +                      return _ERROR_BADMAILADDRESS;\r
 +              }\r
 +              \r
 +              /*\r
 +               * let plugins do verification (any plugin which thinks the comment is\r
 +               * invalid can change 'error' to something other than '')\r
 +               */\r
 +              $result = '';\r
 +              $data = array(\r
 +                      'type'  => 'membermail',\r
 +                      'error' => &$result\r
 +              );\r
 +              $manager->notify('ValidateForm', $data);\r
 +              \r
 +              return $result;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::createAccount()\r
 +       * Creates a new user account\r
 +       *  \r
 +       * @param       void\r
 +       * @return      mixed\r
 +       */\r
 +      private function createAccount()\r
 +      {\r
 +              global $CONF, $manager;\r
 +              \r
 +              if ( array_key_exists('AllowMemberCreate', $CONF) && !$CONF['AllowMemberCreate'] )\r
 +              {\r
 +                      doError(_ERROR_MEMBERCREATEDISABLED);\r
 +              }\r
 +              \r
 +              // evaluate content from FormExtra\r
 +              $result = 1;\r
 +              $data = array(\r
 +                      'type'  => 'membermail',\r
 +                      'error' => &$result\r
 +              );\r
 +              $manager->notify('ValidateForm', $data);\r
 +              \r
 +              if ( $result != 1 )\r
 +              {\r
 +                      return $result;\r
 +              }\r
 +              \r
 +              // even though the member can not log in, set some random initial password. One never knows.\r
 +              srand((double) microtime() * 1000000);\r
 +              $initialPwd = md5(uniqid(rand(), TRUE) );\r
 +              \r
 +              // create member (non admin/can not login/no notes/random string as password)\r
 +              $name           = Entity::shorten(postVar('name'), 32, '');\r
 +              $relname        = postVar('realname');\r
 +              $email          = postVar('email');\r
 +              $url            = postVar('url');\r
 +              \r
 +              $r = Member::create($name, $realname, $initialPwd, $email, $url, 0, 0, '');\r
 +              \r
 +              if ( $r != 1 )\r
 +              {\r
 +                      return $r;\r
 +              }\r
 +              \r
 +              // send message containing password.\r
 +              $newmem = new Member();\r
 +              $newmem->readFromName($name);\r
 +              $newmem->sendActivationLink('register');\r
 +              \r
 +              $manager->notify('PostRegister', array('member' => &$newmem) );\r
 +              \r
 +              if ( postVar('desturl') )\r
 +              {\r
 +                      redirect(postVar('desturl') );\r
 +              }\r
 +              \r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::forgotPassword()\r
 +       * Sends a new password\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function forgotPassword()\r
 +      {\r
 +              $membername = trim(postVar('name') );\r
 +              \r
 +              if ( !Member::exists($membername) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHMEMBER);\r
 +              }\r
 +              \r
 +              $mem = Member::createFromName($membername);\r
 +              \r
 +              // check if e-mail address is correct\r
 +              $email = postVar('email');\r
 +              if ( $mem->getEmail() != $email )\r
 +              {\r
 +                      doError(_ERROR_INCORRECTEMAIL);\r
 +              }\r
 +              \r
 +              // send activation link\r
 +              $mem->sendActivationLink('forgot');\r
 +              \r
 +              // redirection\r
 +              $url = postVar('url');\r
 +              if ( !empty($url) )\r
 +              {\r
 +                      redirect(postVar('url') );\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo _MSG_ACTIVATION_SENT;\r
 +                      echo "<br />"\r
 +                          . "<br />"\r
 +                          . "Return to <a href=\"{$CONF['IndexURL']}\" title=\"{$CONF['SiteName']}\">{$CONF['SiteName']}</a>\n";\r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::doKarma()\r
 +       * Handle karma votes\r
 +       * \r
 +       * @param       string  $type   pos or neg\r
 +       * @return      Void\r
 +       */\r
 +      private function doKarma($type)\r
 +      {\r
 +              global $itemid, $member, $CONF, $manager;\r
 +              \r
 +              // check if itemid exists\r
 +              if ( !$manager->existsItem($itemid, 0, 0) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHITEM);\r
 +              }\r
 +              \r
 +              $blogid = getBlogIDFromItemID($itemid);\r
 +              $this->checkban($blogid);\r
 +              \r
 +              $karma =& $manager->getKarma($itemid);\r
 +              \r
 +              // check if not already voted\r
 +              if ( !$karma->isVoteAllowed(serverVar('REMOTE_ADDR') ) )\r
 +              {\r
 +                      doError(_ERROR_VOTEDBEFORE);\r
 +              }\r
 +              \r
 +              // check if item does allow voting\r
 +              $item =& $manager->getItem($itemid, 0, 0);\r
 +              \r
 +              if ( $item['closed'] )\r
 +              {\r
 +                      doError(_ERROR_ITEMCLOSED);\r
 +              }\r
 +              \r
 +              switch ( $type )\r
 +              {\r
 +                      case 'pos':\r
 +                              $karma->votePositive();\r
 +                      break;\r
 +                      \r
 +                      case 'neg':\r
 +                              $karma->voteNegative();\r
 +                      break;\r
 +              }\r
 +              \r
 +              $blog =& $manager->getBlog($blogid);\r
 +              \r
 +              // send email to notification address, if any\r
 +              if ( $blog->getNotifyAddress() && $blog->notifyOnVote() )\r
 +              {\r
 +                      $message = _NOTIFY_KV_MSG . ' ' . $itemid . "\n";\r
 +                      $itemLink = Link::create_item_link((integer)$itemid);\r
 +                      $temp = parse_url($itemLink);\r
 +                      \r
 +                      if ( !$temp['scheme'] )\r
 +                      {\r
 +                              $itemLink = $CONF['IndexURL'] . $itemLink;\r
 +                      }\r
 +                      \r
 +                      $message .= $itemLink . "\n\n";\r
 +                      \r
 +                      if ( $member->isLoggedIn() )\r
 +                      {\r
 +                              $message .= _NOTIFY_MEMBER . ' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";\r
 +                      }\r
 +                      \r
 +                      $message .= _NOTIFY_IP . ' ' . serverVar('REMOTE_ADDR') . "\n";\r
 +                      $message .= _NOTIFY_HOST . ' ' .  gethostbyaddr(serverVar('REMOTE_ADDR'))  . "\n";\r
 +                      $message .= _NOTIFY_VOTE . "\n " . $type . "\n";\r
 +                      $message .= Notification::get_mail_footer();\r
 +                      \r
 +                      $subject = _NOTIFY_KV_TITLE . ' ' . strip_tags($item['title']) . ' (' . $itemid . ')';\r
 +                      \r
 +                      $from = $member->getNotifyFromMailAddress();\r
 +                      \r
 +                      Notification::mail($blog->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
 +              }\r
 +              \r
 +              $refererUrl = serverVar('HTTP_REFERER');\r
 +              \r
 +              if ( !$refererUrl )\r
 +              {\r
 +                      $url = $itemLink;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $url = $refererUrl;\r
 +              }\r
 +              \r
 +              redirect($url);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::callPlugin()\r
 +       * Calls a plugin action\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function callPlugin()\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $name = requestVar('name');\r
 +              $pluginName = "NP_{$name}";\r
 +              $actionType = requestVar('type');\r
 +              \r
 +              // 1: check if plugin is installed\r
 +              if ( !$manager->pluginInstalled($pluginName) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHPLUGIN);\r
 +              }\r
 +              \r
 +              // 2: call plugin\r
 +              $pluginObject =& $manager->getPlugin($pluginName);\r
 +              if ( !$pluginObject )\r
 +              {\r
 +                      $error = 'Could not load plugin (see actionlog)';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $error = $pluginObject->doAction($actionType);\r
 +              }\r
 +              \r
 +              /*\r
 +               * doAction returns error when:\r
 +               *  - an error occurred (duh)\r
 +               *  - no actions are allowed (doAction is not implemented)\r
 +               */\r
 +              if ( $error )\r
 +              {\r
 +                      doError($error);\r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::checkban()\r
 +       *  Checks if an IP or IP range is banned\r
 +       * \r
 +       * @param       integer $blogid\r
 +       * @return      void\r
 +       */\r
 +      private function checkban($blogid)\r
 +      {\r
 +              // check if banned\r
 +              $ban = Ban::isBanned($blogid, serverVar('REMOTE_ADDR') );\r
 +              \r
 +              if ( $ban != 0 )\r
 +              {\r
 +                      doError(_ERROR_BANNED1 . $ban->iprange . _ERROR_BANNED2 . $ban->message . _ERROR_BANNED3);\r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::updateTicket()\r
 +       * Gets a new ticket\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean FALSE\r
 +       */\r
 +      private function updateTicket()\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              if ( !$manager->checkTicket() )\r
 +              {\r
 +                      echo _ERROR . ':' . _ERROR_BADTICKET;\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo $manager->getNewTicket();\r
 +              }\r
 +              \r
 +              return FALSE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Action::autoDraft()\r
 +       * Handles AutoSaveDraft\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean FALSE\r
 +       */\r
 +      private function autoDraft()\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              if ( !$manager->checkTicket() )\r
 +              {\r
 +                      echo _ERROR . ':' . _ERROR_BADTICKET;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $manager->loadClass('ITEM');\r
 +                      $info = Item::createDraftFromRequest();\r
 +                      \r
 +                      if ( $info['status'] != 'error' )\r
 +                      {\r
 +                              echo $info['draftid'];\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              echo $info['message'];\r
 +                      }\r
 +              }\r
 +              \r
 +              return FALSE;\r
 +      }\r
 +}\r
 +\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Actions that can be called via action.php
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: ACTION.php 1646 2012-01-29 10:47:32Z sakamocchi $
+  */
+ class Action
+ {
+       /**
+        * Action::__construct()
+        *  Constructor for an new ACTION object
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function __construct()
+       {
+               return;
+       }
+       
+       /**
+        * Action::doAction()
+        *  Calls functions that handle an action called from action.php
+        * 
+        * @param       string  $action action type
+        * @return      mixed
+        */
+       public function doAction($action)
+       {
+               switch ( $action )
+               {
+                       case 'autodraft':
+                               return $this->autoDraft();
+                               break;
+                       case 'updateticket':
+                               return $this->updateTicket();
+                               break;
+                       case 'addcomment':
+                               return $this->addComment();
+                               break;
+                       case 'sendmessage':
+                               return $this->sendMessage();
+                               break;
+                       case 'createaccount':
+                               return $this->createAccount();
+                               break;
+                       case 'forgotpassword':
+                               return $this->forgotPassword();
+                               break;
+                       case 'votepositive':
+                               return $this->doKarma('pos');
+                               break;
+                       case 'votenegative':
+                               return $this->doKarma('neg');
+                               break;
+                       case 'plugin':
+                               return $this->callPlugin();
+                               break;
+                       default:
+                               doError(_ERROR_BADACTION);
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * Action::addComment()
+        * Adds a new comment to an item (if IP isn't banned)
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function addComment()
+       {
+               global $CONF, $errormessage, $manager;
+               
+               $post['itemid'] = intPostVar('itemid');
+               $post['user']   = postVar('user');
+               $post['userid'] = postVar('userid');
+               $post['email']  = postVar('email');
+               $post['body']   = postVar('body');
+               $post['remember'] = intPostVar('remember');
+               
+               // begin if: "Remember Me" box checked
+               if ( $post['remember'] == 1 )
+               {
+                       $lifetime = time() + 2592000;
+                       setcookie($CONF['CookiePrefix'] . 'comment_user', $post['user'], $lifetime, '/', '', 0);
+                       setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'], $lifetime, '/', '', 0);
+                       setcookie($CONF['CookiePrefix'] . 'comment_email', $post['email'], $lifetime, '/', '', 0);
+               }
+               
+               $item =& $manager->getItem($post['itemid'], 0, 0);
+               $this->checkban($item['blogid']);
+               $blog =& $manager->getBlog($item['blogid']);
+               
+               // note: PreAddComment and PostAddComment gets called somewhere inside addComment
+               $comments = new Comments($post['itemid']);
+               $errormessage = $comments->addComment($blog->getCorrectTime(), $post);
+               
+               if ( $errormessage != '1' )
+               {
+                       // show error message using default skin for blo
+                       return array(
+                               'message'       => $errormessage,
+                               'skinid'        => $blog->getDefaultSkin()
+                       );
+               }
+               else
+               {
+                       // redirect when adding comments succeeded
+                       if ( postVar('url') )
+                       {
+                               redirect(postVar('url') );
+                       }
+                       else
+                       {
+                               $url = Link::create_item_link($post['itemid']);
+                               redirect($url);
+                       }
+               }
+               return;
+       }
+       
+       /**
+        * Action::sendMessage()
+        * Sends a message from the current member to the member given as argument
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function sendMessage()
+       {
+               global $CONF, $member;
+               
+               $error = $this->validateMessage();
+               
+               if ( $error != '' )
+               {
+                       return array('message' => $error);
+               }
+               
+               if ( !$member->isLoggedIn() )
+               {
+                       $fromMail = postVar('frommail');
+                       $fromName = _MMAIL_FROMANON;
+               }
+               else
+               {
+                       $fromMail = $member->getEmail();
+                       $fromName = $member->getDisplayName();
+               }
+               
+               /* TODO: validation */
+               $memberid = postVar('memberid');
+               $tomem = new Member();
+               $tomem->readFromId($memberid);
+               
+               /* TODO: validation */
+               $message = postVar('message');
+               $message  = _MMAIL_MSG . ' ' . $fromName . "\n"
+                       . '(' . _MMAIL_FROMNUC. ' ' . $CONF['IndexURL'] .") \n\n"
+                       . _MMAIL_MAIL . " \n\n"
+                       . $message;
+               $message .= Notification::get_mail_footer();
+               
+               $title = _MMAIL_TITLE . ' ' . $fromName;
+               Notification::mail($tomem->getEmail(), $title, $message, $fromMail, i18n::get_current_charset());
+               
+               /* TODO: validation */
+               $url = postVar('url');
+               if ( empty($url) )
+               {
+                       $CONF['MemberURL'] = $CONF['IndexURL'];
+                       
+                       if ( $CONF['URLMode'] == 'pathinfo' )
+                       {
+                               $data = array(
+                                       'memberid'      => $tomem->getID(),
+                                       'name'          => $tomem->getDisplayName()
+                               );
+                               $url = Link::create_link('member', $data);
+                       }
+                       else
+                       {
+                               $url = $CONF['IndexURL'] . Link::create_member_link($tomem->getID());
+                       }
+               }
+               redirect($url );
+               
+               return;
+       }
+       
+       /**
+        * Action::validateMessage()
+        *  Checks if a mail to a member is allowed
+        *  Returns a string with the error message if the mail is disallowed
+        * 
+        * @param               void
+        * @return      String  Null character string
+        */
+       private function validateMessage()
+       {
+               global $CONF, $member, $manager;
+               
+               if ( !$CONF['AllowMemberMail'] )
+               {
+                       return _ERROR_MEMBERMAILDISABLED;
+               }
+               
+               if ( !$member->isLoggedIn() && !$CONF['NonmemberMail'] )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               if ( !$member->isLoggedIn() && !Notification::address_validation(postVar('frommail')) )
+               {
+                       return _ERROR_BADMAILADDRESS;
+               }
+               
+               /*
+                * let plugins do verification (any plugin which thinks the comment is
+                * invalid can change 'error' to something other than '')
+                */
+               $result = '';
+               $data = array(
+                       'type'  => 'membermail',
+                       'error' => &$result
+               );
+               $manager->notify('ValidateForm', $data);
+               
+               return $result;
+       }
+       
+       /**
+        * Action::createAccount()
+        * Creates a new user account
+        *  
+        * @param       void
+        * @return      mixed
+        */
+       private function createAccount()
+       {
+               global $CONF, $manager;
+               
+               if ( array_key_exists('AllowMemberCreate', $CONF) && !$CONF['AllowMemberCreate'] )
+               {
+                       doError(_ERROR_MEMBERCREATEDISABLED);
+                       return;
+               }
+               
+               // evaluate content from FormExtra
+               $result = 1;
+               $data = array(
+                       'type'  => 'membermail',
+                       'error' => &$result
+               );
+               $manager->notify('ValidateForm', $data);
+               
+               if ( $result != 1 )
+               {
+                       return $result;
+               }
+               
+               // even though the member can not log in, set some random initial password. One never knows.
+               srand((double) microtime() * 1000000);
+               $initialPwd = md5(uniqid(rand(), TRUE) );
+               
+               // create member (non admin/can not login/no notes/random string as password)
+               $name           = Entity::shorten(postVar('name'), 32, '');
+               $relname        = postVar('realname');
+               $email          = postVar('email');
+               $url            = postVar('url');
+               
+               $r = Member::create($name, $realname, $initialPwd, $email, $url, 0, 0, '');
+               
+               if ( $r != 1 )
+               {
+                       return $r;
+               }
+               
+               // send message containing password.
+               $newmem = new Member();
+               $newmem->readFromName($name);
+               $newmem->sendActivationLink('register');
+               $data = array('member' => $newmem);
+               $manager->notify('PostRegister', $data);
+               
+               if ( postVar('desturl') )
+               {
+                       redirect(postVar('desturl') );
+               }
+               
+               return 1;
+       }
+       
+       /**
+        * Action::forgotPassword()
+        * Sends a new password
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function forgotPassword()
+       {
+               $membername = trim(postVar('name') );
+               
+               if ( !Member::exists($membername) )
+               {
+                       doError(_ERROR_NOSUCHMEMBER);
+                       return;
+               }
+               
+               $mem = Member::createFromName($membername);
+               
+               // check if e-mail address is correct
+               $email = postVar('email');
+               if ( $mem->getEmail() != $email )
+               {
+                       doError(_ERROR_INCORRECTEMAIL);
+                       return;
+               }
+               
+               // send activation link
+               $mem->sendActivationLink('forgot');
+               
+               // redirection
+               $url = postVar('url');
+               if ( !empty($url) )
+               {
+                       redirect(postVar('url') );
+               }
+               else
+               {
+                       echo _MSG_ACTIVATION_SENT;
+                       echo "<br />"
+                           . "<br />"
+                           . "Return to <a href=\"{$CONF['IndexURL']}\" title=\"{$CONF['SiteName']}\">{$CONF['SiteName']}</a>\n";
+               }
+               
+               return;
+       }
+       
+       /**
+        * Action::doKarma()
+        * Handle karma votes
+        * 
+        * @param       string  $type   pos or neg
+        * @return      Void
+        */
+       private function doKarma($type)
+       {
+               global $itemid, $member, $CONF, $manager;
+               
+               // check if itemid exists
+               if ( !$manager->existsItem($itemid, 0, 0) )
+               {
+                       doError(_ERROR_NOSUCHITEM);
+                       return;
+               }
+               
+               $item =& $manager->getItem($itemid, 0, 0);
+               $this->checkban($item['blogid']);
+               
+               $karma =& $manager->getKarma($itemid);
+               
+               // check if not already voted
+               if ( !$karma->isVoteAllowed(serverVar('REMOTE_ADDR') ) )
+               {
+                       doError(_ERROR_VOTEDBEFORE);
+                       return;
+               }
+               
+               // check if item does allow voting
+               $item =& $manager->getItem($itemid, 0, 0);
+               
+               if ( $item['closed'] )
+               {
+                       doError(_ERROR_ITEMCLOSED);
+                       return;
+               }
+               
+               switch ( $type )
+               {
+                       case 'pos':
+                               $karma->votePositive();
+                       break;
+                       
+                       case 'neg':
+                               $karma->voteNegative();
+                       break;
+               }
+               
+               $blog =& $manager->getBlog($blogid);
+               
+               // send email to notification address, if any
+               if ( $blog->getNotifyAddress() && $blog->notifyOnVote() )
+               {
+                       $message = _NOTIFY_KV_MSG . ' ' . $itemid . "\n";
+                       $itemLink = Link::create_item_link((integer)$itemid);
+                       $temp = parse_url($itemLink);
+                       
+                       if ( !$temp['scheme'] )
+                       {
+                               $itemLink = $CONF['IndexURL'] . $itemLink;
+                       }
+                       
+                       $message .= $itemLink . "\n\n";
+                       
+                       if ( $member->isLoggedIn() )
+                       {
+                               $message .= _NOTIFY_MEMBER . ' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
+                       }
+                       
+                       $message .= _NOTIFY_IP . ' ' . serverVar('REMOTE_ADDR') . "\n";
+                       $message .= _NOTIFY_HOST . ' ' .  gethostbyaddr(serverVar('REMOTE_ADDR'))  . "\n";
+                       $message .= _NOTIFY_VOTE . "\n " . $type . "\n";
+                       $message .= Notification::get_mail_footer();
+                       
+                       $subject = _NOTIFY_KV_TITLE . ' ' . strip_tags($item['title']) . ' (' . $itemid . ')';
+                       
+                       $from = $member->getNotifyFromMailAddress();
+                       
+                       Notification::mail($blog->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+               }
+               
+               $refererUrl = serverVar('HTTP_REFERER');
+               
+               if ( !$refererUrl )
+               {
+                       $url = $itemLink;
+               }
+               else
+               {
+                       $url = $refererUrl;
+               }
+               
+               redirect($url);
+               return;
+       }
+       
+       /**
+        * Action::callPlugin()
+        * Calls a plugin action
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function callPlugin()
+       {
+               global $manager;
+               
+               $name = requestVar('name');
+               $pluginName = "NP_{$name}";
+               $actionType = requestVar('type');
+               
+               // 1: check if plugin is installed
+               if ( !$manager->pluginInstalled($pluginName) )
+               {
+                       doError(_ERROR_NOSUCHPLUGIN);
+                       return;
+               }
+               
+               // 2: call plugin
+               $pluginObject =& $manager->getPlugin($pluginName);
+               if ( !$pluginObject )
+               {
+                       $error = 'Could not load plugin (see actionlog)';
+               }
+               else
+               {
+                       $error = $pluginObject->doAction($actionType);
+               }
+               
+               /*
+                * doAction returns error when:
+                *  - an error occurred (duh)
+                *  - no actions are allowed (doAction is not implemented)
+                */
+               if ( $error )
+               {
+                       doError($error);
+                       return;
+               }
+               
+               return;
+       }
+       
+       /**
+        * Action::checkban()
+        *  Checks if an IP or IP range is banned
+        * 
+        * @param       integer $blogid
+        * @return      void
+        */
+       private function checkban($blogid)
+       {
+               // check if banned
+               $ban = Ban::isBanned($blogid, serverVar('REMOTE_ADDR') );
+               
+               if ( $ban != 0 )
+               {
+                       doError(_ERROR_BANNED1 . $ban->iprange . _ERROR_BANNED2 . $ban->message . _ERROR_BANNED3);
+                       return;
+               }
+               
+               return;
+       }
+       
+       /**
+        * Action::updateTicket()
+        * Gets a new ticket
+        * 
+        * @param       void
+        * @return      boolean FALSE
+        */
+       private function updateTicket()
+       {
+               global $manager;
+               
+               if ( !$manager->checkTicket() )
+               {
+                       echo _ERROR . ':' . _ERROR_BADTICKET;
+               }
+               else
+               {
+                       echo $manager->getNewTicket();
+               }
+               
+               return FALSE;
+       }
+       
+       /**
+        * Action::autoDraft()
+        * Handles AutoSaveDraft
+        * 
+        * @param       void
+        * @return      boolean FALSE
+        */
+       private function autoDraft()
+       {
+               global $manager;
+               
+               if ( !$manager->checkTicket() )
+               {
+                       echo _ERROR . ':' . _ERROR_BADTICKET;
+               }
+               else
+               {
+                       $manager->loadClass('ITEM');
+                       $info = Item::createDraftFromRequest();
+                       
+                       if ( $info['status'] != 'error' )
+                       {
+                               echo $info['draftid'];
+                       }
+                       else
+                       {
+                               echo $info['message'];
+                       }
+               }
+               
+               return FALSE;
+       }
+ }
++>>>>>>> skinnable-master
 -?>
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Actionlog class for Nucleus\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: ACTIONLOG.php 1470 2010-11-29 22:10:16Z ftruscot $\r
 + */\r
 +define('ERROR',1);            // only errors\r
 +define('WARNING',2);  // errors and warnings\r
 +define('INFO',3);             // info, errors and warnings\r
 +define('DEBUG',4);            // everything\r
 +$CONF['LogLevel'] = INFO;\r
 +\r
 +class ActionLog\r
 +{\r
 +      /**\r
 +       * ActionLog::add()\r
 +       * Method to add a message to the action log\r
 +       * \r
 +       * @static\r
 +       * @param       Integer $level  log level\r
 +       * @param       String  $message        log message\r
 +       * @return      \r
 +       * \r
 +       */\r
 +      function add($level, $message)\r
 +      {\r
 +              global $member, $CONF;\r
 +              \r
 +              if ( $CONF['LogLevel'] < $level )\r
 +              {\r
 +                      return;\r
 +              }\r
 +              \r
 +              if ( $member && $member->isLoggedIn() )\r
 +              {\r
 +                      $message = "[" . $member->getDisplayName() . "] " . $message;\r
 +              }\r
 +              \r
 +              $query = "INSERT INTO %s (timestamp, message) VALUES (%s, %s)";\r
 +              $query = sprintf($query, sql_table('actionlog'), DB::formatDateTime(), DB::quoteValue($message));\r
 +              DB::execute($query);\r
 +              \r
 +              self::trimLog();\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +        * (Static) Method to clear the whole action log\r
 +        */\r
 +      function clear() {\r
 +              global $manager;\r
 +\r
 +              $query = sprintf('DELETE FROM %s', sql_table('actionlog'));\r
 +\r
 +              $manager->notify('ActionLogCleared',array());\r
 +\r
 +              return DB::execute($query) !== FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +        * (Static) Method to trim the action log (from over 500 back to 250 entries)\r
 +        */\r
 +      function trimLog() {\r
 +              static $checked = 0;\r
 +\r
 +              // only check once per run\r
 +              if ($checked) return;\r
 +\r
 +              // trim\r
 +              $checked = 1;\r
 +\r
 +              $query = sprintf('SELECT COUNT(*) AS result FROM %s', sql_table('actionlog'));\r
 +              $iTotal = DB::getValue($query);\r
 +\r
 +              // if size > 500, drop back to about 250\r
 +              $iMaxSize = 500;\r
 +              $iDropSize = 250;\r
 +              if ($iTotal > $iMaxSize) {\r
 +                      $query = sprintf('SELECT timestamp as result FROM %s ORDER BY timestamp DESC LIMIT %d,1',\r
 +                              sql_table('actionlog'), intval($iDropSize));\r
 +                      $tsChop = DB::getValue($query);\r
 +                      $query = sprintf("DELETE FROM %s WHERE timestamp < '%s'", sql_table('actionlog'), $tsChop);\r
 +                      DB::execute($query);\r
 +              }\r
 +\r
 +      }\r
 +\r
 +}\r
 +\r
 +?>\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Actionlog class for Nucleus
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: ACTIONLOG.php 1822 2012-05-04 13:47:22Z sakamocchi $
+  */
+ define('ERROR',1);            // only errors
+ define('WARNING',2);  // errors and warnings
+ define('INFO',3);             // info, errors and warnings
+ define('DEBUG',4);            // everything
+ $CONF['LogLevel'] = INFO;
+ class ActionLog
+ {
+       /**
+        * ActionLog::add()
+        * Method to add a message to the action log
+        * 
+        * @static
+        * @param       Integer $level  log level
+        * @param       String  $message        log message
+        * @return      
+        * 
+        */
+       function add($level, $message)
+       {
+               global $member, $CONF;
+               
+               if ( $CONF['LogLevel'] < $level )
+               {
+                       return;
+               }
+               
+               if ( $member && $member->isLoggedIn() )
+               {
+                       $message = "[" . $member->getDisplayName() . "] " . $message;
+               }
+               
+               $query = "INSERT INTO %s (timestamp, message) VALUES (%s, %s)";
+               $query = sprintf($query, sql_table('actionlog'), DB::formatDateTime(), DB::quoteValue($message));
+               DB::execute($query);
+               
+               self::trimLog();
+               return;
+       }
+       
+       /**
+         * (Static) Method to clear the whole action log
+         */
+       function clear() {
+               global $manager;
+               $query = sprintf('DELETE FROM %s', sql_table('actionlog'));
+               $data = array();
+               $manager->notify('ActionLogCleared', $data);
+               return DB::execute($query) !== FALSE;
+       }
+       /**
+         * (Static) Method to trim the action log (from over 500 back to 250 entries)
+         */
+       function trimLog() {
+               static $checked = 0;
+               // only check once per run
+               if ($checked) return;
+               // trim
+               $checked = 1;
+               $query = sprintf('SELECT COUNT(*) AS result FROM %s', sql_table('actionlog'));
+               $iTotal = DB::getValue($query);
+               // if size > 500, drop back to about 250
+               $iMaxSize = 500;
+               $iDropSize = 250;
+               if ($iTotal > $iMaxSize) {
+                       $query = sprintf('SELECT timestamp as result FROM %s ORDER BY timestamp DESC LIMIT %d,1',
+                               sql_table('actionlog'), intval($iDropSize));
+                       $tsChop = DB::getValue($query);
+                       $query = sprintf("DELETE FROM %s WHERE timestamp < '%s'", sql_table('actionlog'), $tsChop);
+                       DB::execute($query);
+               }
+       }
+ }
++?>
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ACTIONS.php 1863 2012-05-19 10:50:27Z sakamocchi $
++=======
+  * @version $Id: ACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  class Actions extends BaseActions
        );
        
        /**
++<<<<<<< HEAD
 +       * Actions::$skin_type_friendly_names
 +       * friendly name for wrapped page types
 +       */
 +      static public $default_skin_types = array(
++=======
+        * Actions::$normal_skin_types
+        * friendly name for wrapped page types
+        */
+       static public $normal_skin_types = array(
++>>>>>>> skinnable-master
                'index'                 => _SKIN_PART_MAIN,
                'item'                  => _SKIN_PART_ITEM,
                'archivelist'   => _SKIN_PART_ALIST,
        );
        
        /**
++<<<<<<< HEAD
 +       * Actions::getAvailableSkinTypes()
++=======
+        * Actions::getNormalSkinTypes()
++>>>>>>> skinnable-master
         * 
         * @static
         * @param       void
         * @return      array   list of friendly names for page actions
         */
++<<<<<<< HEAD
 +      static public function getAvailableSkinTypes()
 +      {
 +              return self::$default_skin_types;
++=======
+       static public function getNormalSkinTypes()
+       {
+               return self::$normal_skin_types;
++>>>>>>> skinnable-master
        }
        
        /**
                $params = func_get_args();
                array_shift($params);
                
++<<<<<<< HEAD
 +              return call_user_func_array(array(&$plugin, 'doIf'), $params);
++=======
+               return call_user_func_array(array($plugin, 'doIf'), $params);
++>>>>>>> skinnable-master
        }
        
        /**
                // TODO: Move request uri to linkparams. this is ugly. sorry for that.
                $startpos       = (integer) $startpos;
                $parsed         = parse_url(serverVar('REQUEST_URI'));
++<<<<<<< HEAD
 +              $path           = $parsed['path'];
 +              $parsed         = $parsed['query'];
++=======
+               $path           = ( in_array('path', $parsed) ) ? $parsed['path'] : '';
+               $parsed         = ( in_array('query', $parsed) ) ? $parsed['query'] : '';
++>>>>>>> skinnable-master
                $url            = '';
                
                if ( $direction == 'prev' )
        private function preBlogContent($type, &$blog)
        {
                global $manager;
++<<<<<<< HEAD
 +              $manager->notify('PreBlogContent',array('blog' => &$blog, 'type' => $type));
++=======
+               $data = array('blog' => &$blog, 'type' => $type);
+               $manager->notify('PreBlogContent', $data);
++>>>>>>> skinnable-master
                return;
        }
  
        private function postBlogContent($type, &$blog)
        {
                global $manager;
++<<<<<<< HEAD
 +              $manager->notify('PostBlogContent', array('blog' => &$blog, 'type' => $type));
++=======
+               $data = array('blog' => &$blog, 'type' => $type);
+               $manager->notify('PostBlogContent', $data);
++>>>>>>> skinnable-master
                return;
        }
        
         * Actions::parse_archivedate()
         * %archivedate(locale,date format)%
         * 
++<<<<<<< HEAD
 +       * @param       string  $locale
 +       * @return      void
 +       */
 +      public function parse_archivedate($locale = '-def-')
 +      {
 +              global $archive;
 +              
 +              /* 
 +               * TODO: these lines are no meaning because there is no $template.
 +              if ( $locale == '-def-' )
 +              {
 +                      setlocale(LC_TIME, $template['LOCALE']);
 +              }
 +              else
 +              {
 +                      setlocale(LC_TIME, $locale);
 +              }
 +               */
 +              
++=======
+        * @param       deprecated      $locale 
+        * @return      void
+        */
+       public function parse_archivedate($locale='')
+       {
+               global $archive;
+               
++>>>>>>> skinnable-master
                // get archive date
                sscanf($archive,'%d-%d-%d',$y,$m,$d);
                
        public function parse_callback($eventName, $type)
        {
                global $manager;
++<<<<<<< HEAD
 +              $manager->notify($eventName, array('type' => $type));
++=======
+               $data = array('type' => $type);
+               $manager->notify($eventName, $data);
++>>>>>>> skinnable-master
                return;
        }
        
                global $manager, $blog, $highlight, $itemid;
                
                $template =& $manager->getTemplate($template);
++<<<<<<< HEAD
 +              $item =& $manager->getItem($itemid, 0, 0);
++=======
+               $item =& $manager->getitem($itemid, 0, 0);
++>>>>>>> skinnable-master
                
                // create parser object & action handler
                $handler = new ItemActions($blog);
        public function parse_itemtitle($format = '')
        {
                global $manager, $itemid;
++<<<<<<< HEAD
 +              $item =& $manager->getItem($itemid,0,0);
++=======
+               $item =& $manager->getItem($itemid, 1, 1);
++>>>>>>> skinnable-master
                
                switch ( $format )
                {
                // add skin type on front
                array_unshift($params, $this->skintype);
                
++<<<<<<< HEAD
 +              call_user_func_array(array(&$plugin,'doSkinVar'), $params);
++=======
+               call_user_func_array(array($plugin,'doSkinVar'), $params);
++>>>>>>> skinnable-master
                return;
        }
        
         * @param       string  $template       name of template
         * @return      void
         */
++<<<<<<< HEAD
 +      public function parse_sticky($itemnumber = 0, $template = '')
 +      {
 +              global $manager;
 +              
 +              $itemnumber = intval($itemnumber);
 +              $itemarray = array($itemnumber);
 +              
 +              $b =& $manager->getBlog(getBlogIDFromItemID($itemnumber));
 +              $this->preBlogContent('sticky',$b);
 +              $this->amountfound = $b->readLogFromList($itemarray, $template);
 +              $this->postBlogContent('sticky',$b);
++=======
+       public function parse_sticky($itemid = 0, $template = '')
+       {
+               global $manager;
+               
+               $itemid = (integer) $itemid;
+               $itemarray = array($itemid);
+               
+               $item =& $manager->getItem($post['itemid'], 1, 1);
+               $blog =& $manager->getBlog($item['blogid']);
+               
+               $this->preBlogContent('sticky', $blog);
+               $this->amountfound = $blog->readLogFromList($itemarray, $template);
+               $this->postBlogContent('sticky', $blog);
++>>>>>>> skinnable-master
                return;
        }
  }
  if ( !function_exists('requestVar') ) exit;
  require_once dirname(__FILE__) . '/showlist.php';
  
- /**
-  * Builds the admin area and executes admin actions
-  */
  class Admin
  {
++<<<<<<< HEAD
 +      private $xml_version_info = '1.0';
 +      private $formal_public_identifier = '-//W3C//DTD XHTML 1.0 Strict//EN';
 +      private $system_identifier = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd';
 +      private $xhtml_namespace = 'http://www.w3.org/1999/xhtml';
 +      
 +    /**
 +     * @var string $action action currently being executed ($action=xxxx -> action_xxxx method)
 +     */
 +    var $action;
 +
 +    /**
 +     * Class constructor
 +     */
 +    function ADMIN() {
 +
 +    }
 +
 +    /**
 +     * Executes an action
 +     *
 +     * @param string $action action to be performed
 +     */
 +    function action($action) {
 +        global $CONF, $manager;
 +
 +        // list of action aliases
 +        $alias = array(
 +            'login' => 'overview',
 +            '' => 'overview'
 +        );
 +
 +        if (isset($alias[$action]))
 +            $action = $alias[$action];
 +
 +        $methodName = 'action_' . $action;
 +
 +        $this->action = strtolower($action);
 +
 +        // check ticket. All actions need a ticket, unless they are considered to be safe (a safe action
 +        // is an action that requires user interaction before something is actually done)
 +        // all safe actions are in this array:
 +        $aActionsNotToCheck = array(
 +            'showlogin',
 +            'login',
 +            'overview',
 +            'itemlist',
 +            'blogcommentlist',
 +            'bookmarklet',
 +            'blogsettings',
 +            'banlist',
 +            'deleteblog',
 +            'editmembersettings',
 +            'browseownitems',
 +            'browseowncomments',
 +            'createitem',
 +            'itemedit',
 +            'itemmove',
 +            'categoryedit',
 +            'categorydelete',
 +            'manage',
 +            'actionlog',
 +            'settingsedit',
 +            'backupoverview',
 +            'pluginlist',
 +            'createnewlog',
 +            'usermanagement',
 +            'skinoverview',
 +            'templateoverview',
 +            'skinieoverview',
 +            'itemcommentlist',
 +            'commentedit',
 +            'commentdelete',
 +            'banlistnewfromitem',
 +            'banlistdelete',
 +            'itemdelete',
 +            'manageteam',
 +            'teamdelete',
 +            'banlistnew',
 +            'memberedit',
 +            'memberdelete',
 +            'pluginhelp',
 +            'pluginoptions',
 +            'plugindelete',
 +            'skinedittype',
 +            'skinremovetype',
 +            'skindelete',
 +            'skinedit',
 +            'templateedit',
 +            'templatedelete',
 +            'activate',
 +            'systemoverview'
 +        );
 +/*
 +        // the rest of the actions needs to be checked
 +        $aActionsToCheck = array('additem', 'itemupdate', 'itemmoveto', 'categoryupdate', 'categorydeleteconfirm', 'itemdeleteconfirm', 'commentdeleteconfirm', 'teamdeleteconfirm', 'memberdeleteconfirm', 'templatedeleteconfirm', 'skindeleteconfirm', 'banlistdeleteconfirm', 'plugindeleteconfirm', 'batchitem', 'batchcomment', 'batchmember', 'batchcategory', 'batchteam', 'commentupdate', 'banlistadd', 'changemembersettings', 'clearactionlog', 'settingsupdate', 'blogsettingsupdate', 'categorynew', 'teamchangeadmin', 'teamaddmember', 'memberadd', 'addnewlog', 'addnewlog2', 'backupcreate', 'backuprestore', 'pluginup', 'plugindown', 'pluginupdate', 'pluginadd', 'pluginoptionsupdate', 'skinupdate', 'skinclone', 'skineditgeneral', 'templateclone', 'templatenew', 'templateupdate', 'skinieimport', 'skinieexport', 'skiniedoimport', 'skinnew', 'deleteblogconfirm', 'activatesetpwd');
 +*/
 +        if (!in_array($this->action, $aActionsNotToCheck))
 +        {
 +            if (!$manager->checkTicket())
 +                $this->error(_ERROR_BADTICKET);
 +        }
 +
 +        if (method_exists($this, $methodName))
 +            call_user_func(array(&$this, $methodName));
 +        else
 +            $this->error(_BADACTION . Entity::hsc(" ($action)"));
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_showlogin() {
 +        global $error;
 +        $this->action_login($error);
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_login($msg = '', $passvars = 1) {
 +        global $member;
 +
 +        // skip to overview when allowed
 +        if ($member->isLoggedIn() && $member->canLogin()) {
 +            $this->action_overview();
 +            exit;
 +        }
 +
 +        $this->pagehead();
 +
 +        echo '<h2>', _LOGIN ,'</h2>';
 +        if ($msg) echo _MESSAGE , ': ', Entity::hsc($msg);
 +        ?>
 +
 +        <form action="index.php" method="post"><p>
 +        <?php echo _LOGIN_NAME; ?> <br /><input name="login"  tabindex="10" />
 +        <br />
 +        <?php echo _LOGIN_PASSWORD; ?> <br /><input name="password"  tabindex="20" type="password" />
 +        <br />
 +        <input name="action" value="login" type="hidden" />
 +        <br />
 +        <input type="submit" value="<?php echo _LOGIN ?>" tabindex="30" />
 +        <br />
 +        <small>
 +            <input type="checkbox" value="1" name="shared" tabindex="40" id="shared" /><label for="shared"><?php echo _LOGIN_SHARED ?></label>
 +            <br /><a href="forgotpassword.html"><?php echo _LOGIN_FORGOT ?></a>
 +        </small>
 +        <?php           // pass through vars
 +
 +            $oldaction = postVar('oldaction');
 +            if (  ($oldaction != 'logout')  && ($oldaction != 'login')  && $passvars ) {
 +                passRequestVars();
 +            }
 +
 +
 +        ?>
 +        </p></form>
 +        <?php       $this->pagefoot();
 +    }
 +
 +
 +    /**
 +     * provides a screen with the overview of the actions available
 +     * @todo document parameter
 +     */
 +    function action_overview($msg = '') {
 +        global $member;
 +
 +        $this->pagehead();
 +
 +        if ($msg)
 +            echo _MESSAGE , ': ', $msg;
 +
 +        /* ---- add items ---- */
 +        echo '<h2>' . _OVERVIEW_YRBLOGS . '</h2>';
 +
 +        $showAll = requestVar('showall');
 +
 +        if (($member->isAdmin()) && ($showAll == 'yes')) {
 +            // Super-Admins have access to all blogs! (no add item support though)
 +            $query =  'SELECT bnumber, bname, 1 as tadmin, burl, bshortname'
 +                   . ' FROM ' . sql_table('blog')
 +                   . ' ORDER BY bname';
 +        } else {
 +            $query =  'SELECT bnumber, bname, tadmin, burl, bshortname'
 +                   . ' FROM ' . sql_table('blog') . ', ' . sql_table('team')
 +                   . ' WHERE tblog=bnumber and tmember=' . $member->getID()
 +                   . ' ORDER BY bname';
 +        }
 +        $template['content'] = 'bloglist';
 +        $template['superadmin'] = $member->isAdmin();
 +        $amount = showlist($query,'table',$template);
 +
 +        if (($showAll != 'yes') && ($member->isAdmin())) {
 +            $total = DB::getValue('SELECT COUNT(*) as result FROM ' . sql_table('blog'));
 +            if ($total > $amount)
 +                echo '<p><a href="index.php?action=overview&amp;showall=yes">' . _OVERVIEW_SHOWALL . '</a></p>';
 +        }
 +
 +        if ($amount == 0)
 +            echo _OVERVIEW_NOBLOGS;
 +
 +        if ($amount != 0) {
 +            echo '<h2>' . _OVERVIEW_YRDRAFTS . '</h2>';
 +            $query =  'SELECT ititle, inumber, bshortname'
 +                   . ' FROM ' . sql_table('item'). ', ' . sql_table('blog')
 +                   . ' WHERE iauthor='.$member->getID().' and iblog=bnumber and idraft=1';
 +            $template['content'] = 'draftlist';
 +            $amountdrafts = showlist($query, 'table', $template);
 +            if ($amountdrafts == 0)
 +                echo _OVERVIEW_NODRAFTS;
 +        }
 +                              
 +              if ($amount != 0) {
 +                      $yrBlogs = $member->getAdminBlogs();
 +                      if ($showAll != 'yes') {
 +                              $admBlogs = array();
 +                              foreach ($yrBlogs as $value) {
 +                                      if ($member->isBlogAdmin(intval($value))) {
 +                                              $admBlogs[] = intval($value);
 +                                      }
 +                              }
 +                              $yrBlogs = $admBlogs;
 +                      }
 +                      
 +                      if (count($yrBlogs) > 0) {
 +                              echo '<h2>' . _OVERVIEW_OTHER_DRAFTS . '</h2>';
 +                              $query =  'SELECT ititle, inumber, bshortname, mname'
 +                                         . ' FROM ' . sql_table('item'). ', ' . sql_table('blog'). ', ' . sql_table('member')
 +                                         . ' WHERE iauthor<>'.$member->getID().' and iblog IN ('.implode(",",$yrBlogs).') and iblog=bnumber and iauthor=mnumber and idraft=1'
 +                                         . ' ORDER BY iblog ASC';
 +                              $template['content'] = 'otherdraftlist';
 +                              $amountdrafts = showlist($query, 'table', $template);
 +                              if ($amountdrafts == 0)
 +                                      echo _OVERVIEW_NODRAFTS;
 +                      }
 +        }
 +
 +        /* ---- user settings ---- */
 +        echo '<h2>' . _OVERVIEW_YRSETTINGS . '</h2>';
 +        echo '<ul>';
 +        echo '<li><a href="index.php?action=editmembersettings">' . _OVERVIEW_EDITSETTINGS. '</a></li>';
 +        echo '<li><a href="index.php?action=browseownitems">' . _OVERVIEW_BROWSEITEMS.'</a></li>';
 +        echo '<li><a href="index.php?action=browseowncomments">'._OVERVIEW_BROWSECOMM.'</a></li>';
 +        echo '</ul>';
 +
 +        /* ---- general settings ---- */
 +        if ($member->isAdmin()) {
 +            echo '<h2>' . _OVERVIEW_MANAGEMENT. '</h2>';
 +            echo '<ul>';
 +            echo '<li><a href="index.php?action=manage">',_OVERVIEW_MANAGE,'</a></li>';
 +            echo '</ul>';
 +        }
 +
 +
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * Returns a link to a weblog
 +     * @param object BLOG
 +     */
 +    function bloglink(&$blog) {
 +        return '<a href="'.Entity::hsc($blog->getURL()).'" title="'._BLOGLIST_TT_VISIT.'">'. Entity::hsc( $blog->getName() ) .'</a>';
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_manage($msg = '') {
 +        global $member;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
 +
 +        if ($msg)
 +            echo '<p>' , _MESSAGE , ': ', $msg , '</p>';
 +
 +
 +        echo '<h2>' . _MANAGE_GENERAL. '</h2>';
 +
 +        echo '<ul>';
 +        echo '<li><a href="index.php?action=createnewlog">'._OVERVIEW_NEWLOG.'</a></li>';
 +        echo '<li><a href="index.php?action=settingsedit">'._OVERVIEW_SETTINGS.'</a></li>';
 +        echo '<li><a href="index.php?action=usermanagement">'._OVERVIEW_MEMBERS.'</a></li>';
 +        echo '<li><a href="index.php?action=actionlog">'._OVERVIEW_VIEWLOG.'</a></li>';
 +        echo '</ul>';
 +
 +        echo '<h2>' . _MANAGE_SKINS . '</h2>';
 +        echo '<ul>';
 +        echo '<li><a href="index.php?action=skinoverview">'._OVERVIEW_SKINS.'</a></li>';
 +        echo '<li><a href="index.php?action=templateoverview">'._OVERVIEW_TEMPLATES.'</a></li>';
 +        echo '<li><a href="index.php?action=skinieoverview">'._OVERVIEW_SKINIMPORT.'</a></li>';
 +        echo '</ul>';
 +
 +        echo '<h2>' . _MANAGE_EXTRA . '</h2>';
 +        echo '<ul>';
 +        echo '<li><a href="index.php?action=backupoverview">'._OVERVIEW_BACKUP.'</a></li>';
 +        echo '<li><a href="index.php?action=pluginlist">'._OVERVIEW_PLUGINS.'</a></li>';
 +        echo '</ul>';
 +
 +        $this->pagefoot();
 +    }
 +
 +      /**
 +       * Admin::action_itemlist()
 +       * 
 +       * @param       integer $blogid ID for weblog
 +       * @return      void
 +       */
 +      public function action_itemlist($blogid = '')
++=======
+       static private $skin;
+       
+       static public $action;
+       static public $aOptions;
+       static public $blog;
+       static public $contents;
+       static public $extrahead;
+       static public $headMess;
+       static public $passvar;
+       
+       static private $skinless_actions = array(
+               'plugindeleteconfirm',
+               'pluginoptionsupdate',
+               'blogsettingsupdate',
+               'settingsupdate',
+               'addnewlog2',
+               'additem',
+               'banlistnewfromitem',
+               'itemdeleteconfirm',
+               'itemupdate',
+               'changemembersettings',
+               'clearactionlog',
+               'memberedit',
+               'login',
+               
+               'skinremovetypeconfirm',
+               'skinclone',
+               'skindeleteconfirm',
+               'skinnew',
+               'skineditgeneral',
+               'skinupdate',
+               
+               'skinieexport',
+               
+               'templateupdate',
+               'templatedeleteconfirm',
+               'templatenew',
+               'templateclone',
+               
+               'adminskinremovetypeconfirm',
+               'adminskinclone',
+               'adminskindeleteconfirm',
+               'adminskinnew',
+               'adminskineditgeneral',
+               'adminskinupdate',
+               
+               'adminskinieexport',
+               
+               'admintemplateupdate',
+               'admintemplatedeleteconfirm',
+               'admintemplatenew',
+               'admintemplateclone'
+       );
+       
+       static private $ticketless_actions = array(
+               'showlogin',
+               'login',
+               'overview',
+               'itemlist',
+               'blogcommentlist',
+               'bookmarklet',
+               'blogsettings',
+               'banlist',
+               'createaccount',
+               'deleteblog',
+               'editmembersettings',
+               'createaccount',
+               'forgotpassword',
+               'browseowncomments',
+               'createitem',
+               'browseownitems',
+               'itemedit',
+               'itemmove',
+               'categoryedit',
+               'categorydelete',
+               'manage',
+               'actionlog',
+               'settingsedit',
+               'backupoverview',
+               'pluginlist',
+               'createnewlog',
+               'usermanagement',
+               'itemcommentlist',
+               'commentedit',
+               'commentdelete',
+               'banlistnewfromitem',
+               'banlistdelete',
+               'itemdelete',
+               'manageteam',
+               'teamdelete',
+               'banlistnew',
+               'memberedit',
+               'memberdelete',
+               'pluginhelp',
+               'pluginoptions',
+               'plugindelete',
+               
+               'activate',
+               'systemoverview',
+               'activatesetpwd',
+               
+               'skinoverview',
+               'skinclone',
+               'skindelete',
+               'skinedit',
+               'skinedittype',
+               'skinnew',
+               'skinremovetype',
+               
+               'skinieoverview',
+               
+               'templateoverview',
+               'templateclone',
+               'templateedit',
+               'templatedelete',
+               
+               'adminskinoverview',
+               'adminskinclone',
+               'adminskindelete',
+               'adminskinedit',
+               'adminskinedittype',
+               'adminskinnew',
+               'adminskinremovetype',
+               
+               'adminskinieoverview',
+               
+               'admintemplateoverview',
+               'admintemplateclone',
+               'admintemplateedit',
+               'admintemplatedelete'
+       );
+       
+       /**
+        * NOTE: This is for condition of admin/normal skin actions
+        */
+       static public $adminskin_actions = array(
+               /* ticketless */
+               'adminskinoverview',
+               'adminskinclone',
+               'adminskindelete',
+               'adminskinedit',
+               'adminskinedittype',
+               'adminskinnew',
+               'adminskinremovetype',
+               
+               'adminskinieoverview',
+               
+               'admintemplateoverview',
+               'admintemplateclone',
+               'admintemplateedit',
+               'admintemplatedelete',
+               
+               /* ticket needed */
+               'adminskineditgeneral',
+               'adminskinupdate',
+               'adminskindeleteconfirm',
+               'adminskinremovetypeconfirm',
+               
+               'adminskinieoverview',
+               'adminskiniedoimport',
+               'adminskinieexport',
+               'adminskinieimport',
+               
+               'admintemplatenew',
+               'admintemplatedeleteconfirm',
+               'admintemplateupdate'
+       );
+       
+       static public function initialize()
+       {
+               global $CONF, $manager, $member;
+               
+               /* NOTE: 1. decide which skinid to use */
+               $skinid = $CONF['AdminSkin'];
+               if ( $member->isLoggedIn() )
+               {
+                       $memskin = $member->getAdminSkin();
+                       if ( $memskin && Skin::existsID($memskin))
+                       {
+                               $skinid = $memskin;
+                       }
+               }
+               
+               /* NOTE: 2. make an instance of skin object */
+               if ( !Skin::existsID($skinid) )
+               {
+                       return FALSE;
+               }
+               
+               /* NOTE: 3. initializing each members */
+               self::$skin                     =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');
+               self::$action           = '';
+               self::$extrahead        = '';
+               self::$passvar          = '';
+               self::$headMess         = '';
+               self::$aOptions         = '';
+               return TRUE;
+       }
+       
+       /**
+        * Admin::action()
+        * Executes an action
+        *
+        * @param       string  $action action to be performed
+        * @return      void
+        */
+       static public function action($action)
+       {
+               global $CONF, $manager, $member;
+               
+               /* 1. decide action name */
+               $customAction = postvar('customaction');
+               if ( empty($customAction) )
+               {
+                       $alias = array(
+                               'login' => 'overview',
+                               ''              => 'overview',
+                       );
+               }
+               else
+               {
+                       $alias = array(
+                               'login' => $customAction,
+                               ''              => $customAction
+                       );
+               }
+               if ( array_key_exists($action, $alias) && isset($alias[$action]) )
+               {
+                       $action = $alias[$action];
+               }
+               $method_name = "action_{$action}";
+               self::$action = strtolower($action);
+               
+               /* 2. check ticket-needed action */
+               if ( !in_array(self::$action, self::$ticketless_actions) && !$manager->checkTicket() )
+               {
+                       self::error(_ERROR_BADTICKET);
+                       return;
+               }
+               
+               /* 3. parse according to the action */
+               else if ( method_exists('Admin', $method_name) )
+               {
+                       call_user_func(array(__CLASS__, $method_name));
+                       return;
+               }
+               /* 4. parse special admin skin */
+               elseif ( in_array(self::$action, self::$skinless_actions) )
+               {
+                       /* TODO: need to be implemented or not?
+                       self::action_parseSpecialskin();
+                       */
+               }
+               else
+               {
+                       self::error(_BADACTION . ENTITY::hsc($action));
+                       return;
+               }
+               
+               return;
+       }
+       
+       /**
+        * Action::action_showlogin()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_showlogin()
+       {
+               global $error;
+               self::action_login($error);
+               return;
+       }
+       
+       /**
+        * Action::action_login()
+        * 
+        * @param       string  $msg            message for pageheader
+        * @param       integer $passvars       ???
+        */
+       static private function action_login($msg = '', $passvars = 1)
+       {
+               global $member;
+               
+               // skip to overview when allowed
+               if ( $member->isLoggedIn() && $member->canLogin() )
+               {
+                       self::action_overview();
+                       return;
+               }
+               
+               /* TODO: needless variable??? */
+               self::$passvar = $passvars;
+               if ( $msg )
+               {
+                       self::$headMess = $msg;
+               }
+               
+               self::$skin->parse('showlogin');
+       }
+       
+       /**
+        * Action::action_overview()
+        * provides a screen with the overview of the actions available
+        * 
+        * @param       string  $msg    message for pageheader
+        * @return      void
+        */
+       static private function action_overview($msg = '')
+       {
+               if ( $msg )
+               {
+                       self::$headMess = $msg;
+               }
+               
+               self::$skin->parse('overview');
+               return;
+       }
+       
+       /**
+        * Admin::action_manage()
+        * 
+        * @param       string  $msg    message for pageheader
+        * @retrn       void
+        */
+       static private function action_manage($msg = '')
+       {
+               global $member;
+               
+               if ( $msg )
+               {
+                       self::$headMess = $msg;
+               }
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('manage');
+               return;
+       }
+       
+       /**
+        * Action::action_itemlist()
+        * 
+        * @param       integer id for weblod
+        * @return      void
+        */
+       static private function action_itemlist($blogid = '')
++>>>>>>> skinnable-master
        {
                global $member, $manager, $CONF;
                
                        $blogid = intRequestVar('blogid');
                }
                
++<<<<<<< HEAD
 +              $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
 +              
 +              $this->pagehead();
 +              $blog =& $manager->getBlog($blogid);
 +              
 +              echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
 +              echo '<h2>' . _ITEMLIST_BLOG . ' ' . $this->bloglink($blog) . '</h2>';
 +              
 +              // start index
 +              if ( postVar('start') )
 +              {
 +                      $start = intPostVar('start');
 +              }
 +              else
 +              {
 +                      $start = 0;
 +              }
 +              
 +              if ( $start == 0 )
 +              {
 +                      echo '<p><a href="index.php?action=createitem&amp;blogid='.$blogid.'">' . _ITEMLIST_ADDNEW . "</a></p>\n";
 +              }
 +              
 +              // amount of items to show
 +              if ( postVar('amount') )
 +              {
 +                      $amount = intPostVar('amount');
 +              }
 +              else
 +              {
 +                      $amount = intval($CONF['DefaultListSize']);
 +                      if ( $amount < 1 )
 +                      {
 +                              $amount = 10;
 +                      }
 +              }
 +              
 +              $search = postVar('search');    // search through items
 +              
 +              $query = 'SELECT bshortname, cname, mname, ititle, ibody, inumber, idraft, itime'
 +                     . ' FROM ' . sql_table('item') . ', ' . sql_table('blog') . ', ' . sql_table('member') . ', ' . sql_table('category')
 +                     . ' WHERE iblog=bnumber and iauthor=mnumber and icat=catid and iblog=' . $blogid;
 +              
 +              if ( $search )
 +              {
 +                      $query .= " AND ((ititle LIKE " . DB::quoteValue('%'.$search.'%') . ") OR (ibody LIKE " . DB::quoteValue('%'.$search.'%') . ") OR (imore LIKE " . DB::quoteValue('%'.$search.'%') . "))";
 +              }
 +              
 +              // non-blog-admins can only edit/delete their own items
 +              if ( !$member->blogAdminRights($blogid) )
 +              {
 +                      $query .= ' and iauthor=' . $member->getID();
 +              }
 +              
 +              $query .= ' ORDER BY itime DESC'
 +                      . " LIMIT $start, $amount";
 +              
 +              $template['content'] = 'itemlist';
 +              $template['now'] = $blog->getCorrectTime(time());
 +              
 +              $manager->loadClass("ENCAPSULATE");
 +              $navList = new NavList('itemlist', $start, $amount, 0, 1000, $blogid, $search, 0);
 +              $navList->showBatchList('item',$query,'table',$template);
 +              
 +              $this->pagefoot();
 +              return;
 +      }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_batchitem() {
 +        global $member, $manager;
 +
 +        // check if logged in
 +        $member->isLoggedIn() or $this->disallow();
 +
 +        // more precise check will be done for each performed operation
 +
 +        // get array of itemids from request
 +        $selected = requestIntArray('batch');
 +        $action = requestVar('batchaction');
 +
 +        // Show error when no items were selected
 +        if (!is_array($selected) || sizeof($selected) == 0)
 +            $this->error(_BATCH_NOSELECTION);
 +
 +        // On move: when no destination blog/category chosen, show choice now
 +        $destCatid = intRequestVar('destcatid');
 +        if (($action == 'move') && (!$manager->existsCategory($destCatid)))
 +            $this->batchMoveSelectDestination('item',$selected);
 +
 +        // On delete: check if confirmation has been given
 +        if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
 +            $this->batchAskDeleteConfirmation('item',$selected);
 +
 +        $this->pagehead();
 +
 +        echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
 +        echo '<h2>',_BATCH_ITEMS,'</h2>';
 +        echo '<p>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b></p>';
 +        echo '<ul>';
 +
 +
 +        // walk over all itemids and perform action
 +        foreach ($selected as $itemid) {
 +            $itemid = intval($itemid);
 +            echo '<li>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b> ',_BATCH_ONITEM,' <b>', $itemid, '</b>...';
 +
 +            // perform action, display errors if needed
 +            switch($action) {
 +                case 'delete':
 +                    $error = $this->deleteOneItem($itemid);
 +                    break;
 +                case 'move':
 +                    $error = $this->moveOneItem($itemid, $destCatid);
 +                    break;
 +                default:
 +                    $error = _BATCH_UNKNOWN . Entity::hsc($action);
 +            }
 +
 +            echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
 +            echo '</li>';
 +        }
 +
 +        echo '</ul>';
 +        echo '<b>',_BATCH_DONE,'</b>';
 +
 +        $this->pagefoot();
 +
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_batchcomment() {
 +        global $member;
 +
 +        // check if logged in
 +        $member->isLoggedIn() or $this->disallow();
 +
 +        // more precise check will be done for each performed operation
 +
 +        // get array of itemids from request
 +        $selected = requestIntArray('batch');
 +        $action = requestVar('batchaction');
 +
 +        // Show error when no items were selected
 +        if (!is_array($selected) || sizeof($selected) == 0)
 +            $this->error(_BATCH_NOSELECTION);
 +
 +        // On delete: check if confirmation has been given
 +        if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
 +            $this->batchAskDeleteConfirmation('comment',$selected);
 +
 +        $this->pagehead();
 +
 +        echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
 +        echo '<h2>',_BATCH_COMMENTS,'</h2>';
 +        echo '<p>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b></p>';
 +        echo '<ul>';
 +
 +        // walk over all itemids and perform action
 +        foreach ($selected as $commentid) {
 +            $commentid = intval($commentid);
 +            echo '<li>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b> ',_BATCH_ONCOMMENT,' <b>', $commentid, '</b>...';
 +
 +            // perform action, display errors if needed
 +            switch($action) {
 +                case 'delete':
 +                    $error = $this->deleteOneComment($commentid);
 +                    break;
 +                default:
 +                    $error = _BATCH_UNKNOWN . Entity::hsc($action);
 +            }
 +
 +            echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
 +            echo '</li>';
 +        }
 +
 +        echo '</ul>';
 +        echo '<b>',_BATCH_DONE,'</b>';
 +
 +        $this->pagefoot();
 +
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_batchmember() {
 +        global $member;
 +
 +        // check if logged in and admin
 +        ($member->isLoggedIn() && $member->isAdmin()) or $this->disallow();
 +
 +        // get array of itemids from request
 +        $selected = requestIntArray('batch');
 +        $action = requestVar('batchaction');
 +
 +        // Show error when no members selected
 +        if (!is_array($selected) || sizeof($selected) == 0)
 +            $this->error(_BATCH_NOSELECTION);
 +
 +        // On delete: check if confirmation has been given
 +        if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
 +            $this->batchAskDeleteConfirmation('member',$selected);
 +
 +        $this->pagehead();
 +
 +        echo '<a href="index.php?action=usermanagement">(',_MEMBERS_BACKTOOVERVIEW,')</a>';
 +        echo '<h2>',_BATCH_MEMBERS,'</h2>';
 +        echo '<p>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b></p>';
 +        echo '<ul>';
 +
 +        // walk over all itemids and perform action
 +        foreach ($selected as $memberid) {
 +            $memberid = intval($memberid);
 +            echo '<li>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b> ',_BATCH_ONMEMBER,' <b>', $memberid, '</b>...';
 +
 +            // perform action, display errors if needed
 +            switch($action) {
 +                case 'delete':
 +                    $error = $this->deleteOneMember($memberid);
 +                    break;
 +                case 'setadmin':
 +                    // always succeeds
 +                    DB::execute('UPDATE ' . sql_table('member') . ' SET madmin=1 WHERE mnumber='.$memberid);
 +                    $error = '';
 +                    break;
 +                case 'unsetadmin':
 +                    // there should always remain at least one super-admin
 +                    $r = DB::getResult('SELECT * FROM '.sql_table('member'). ' WHERE madmin=1 and mcanlogin=1');
 +                    if ($r->rowCount() < 2)
 +                        $error = _ERROR_ATLEASTONEADMIN;
 +                    else
 +                        DB::execute('UPDATE ' . sql_table('member') .' SET madmin=0 WHERE mnumber='.$memberid);
 +                    break;
 +                default:
 +                    $error = _BATCH_UNKNOWN . Entity::hsc($action);
 +            }
 +
 +            echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
 +            echo '</li>';
 +        }
 +
 +        echo '</ul>';
 +        echo '<b>',_BATCH_DONE,'</b>';
 +
 +        $this->pagefoot();
 +
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_batchteam() {
 +        global $member;
 +
 +        $blogid = intRequestVar('blogid');
 +
 +        // check if logged in and admin
 +        ($member->isLoggedIn() && $member->blogAdminRights($blogid)) or $this->disallow();
 +
 +        // get array of itemids from request
 +        $selected = requestIntArray('batch');
 +        $action = requestVar('batchaction');
 +
 +        // Show error when no members selected
 +        if (!is_array($selected) || sizeof($selected) == 0)
 +            $this->error(_BATCH_NOSELECTION);
 +
 +        // On delete: check if confirmation has been given
 +        if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
 +            $this->batchAskDeleteConfirmation('team',$selected);
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manageteam&amp;blogid=',$blogid,'">(',_BACK,')</a></p>';
 +
 +        echo '<h2>',_BATCH_TEAM,'</h2>';
 +        echo '<p>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b></p>';
 +        echo '<ul>';
 +
 +        // walk over all itemids and perform action
 +        foreach ($selected as $memberid) {
 +            $memberid = intval($memberid);
 +            echo '<li>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b> ',_BATCH_ONTEAM,' <b>', $memberid, '</b>...';
 +
 +            // perform action, display errors if needed
 +            switch($action) {
 +                case 'delete':
 +                    $error = $this->deleteOneTeamMember($blogid, $memberid);
 +                    break;
 +                case 'setadmin':
 +                    // always succeeds
 +                    DB::execute('UPDATE '.sql_table('team').' SET tadmin=1 WHERE tblog='.$blogid.' and tmember='.$memberid);
 +                    $error = '';
 +                    break;
 +                case 'unsetadmin':
 +                    // there should always remain at least one admin
 +                    $r = DB::getResult('SELECT * FROM '.sql_table('team').' WHERE tadmin=1 and tblog='.$blogid);
 +                    if ($r->rowCount() < 2)
 +                        $error = _ERROR_ATLEASTONEBLOGADMIN;
 +                    else
 +                        DB::execute('UPDATE '.sql_table('team').' SET tadmin=0 WHERE tblog='.$blogid.' and tmember='.$memberid);
 +                    break;
 +                default:
 +                    $error = _BATCH_UNKNOWN . Entity::hsc($action);
 +            }
 +
 +            echo '<b>',($error ? $error : _BATCH_SUCCESS),'</b>';
 +            echo '</li>';
 +        }
 +
 +        echo '</ul>';
 +        echo '<b>',_BATCH_DONE,'</b>';
 +
 +        $this->pagefoot();
 +
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_batchcategory() {
 +        global $member, $manager;
 +
 +        // check if logged in
 +        $member->isLoggedIn() or $this->disallow();
 +
 +        // more precise check will be done for each performed operation
 +
 +        // get array of itemids from request
 +        $selected = requestIntArray('batch');
 +        $action = requestVar('batchaction');
 +
 +        // Show error when no items were selected
 +        if (!is_array($selected) || sizeof($selected) == 0)
 +            $this->error(_BATCH_NOSELECTION);
 +
 +        // On move: when no destination blog chosen, show choice now
 +        $destBlogId = intRequestVar('destblogid');
 +        if (($action == 'move') && (!$manager->existsBlogID($destBlogId)))
 +            $this->batchMoveCategorySelectDestination('category',$selected);
 +
 +        // On delete: check if confirmation has been given
 +        if (($action == 'delete') && (requestVar('confirmation') != 'yes'))
 +            $this->batchAskDeleteConfirmation('category',$selected);
 +
 +        $this->pagehead();
 +
 +        echo '<a href="index.php?action=overview">(',_BACKHOME,')</a>';
 +        echo '<h2>',BATCH_CATEGORIES,'</h2>';
 +        echo '<p>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b></p>';
 +        echo '<ul>';
 +
 +        // walk over all itemids and perform action
 +        foreach ($selected as $catid) {
 +            $catid = intval($catid);
 +            echo '<li>',_BATCH_EXECUTING,' <b>',Entity::hsc($action),'</b> ',_BATCH_ONCATEGORY,' <b>', $catid, '</b>...';
 +
 +            // perform action, display errors if needed
 +            switch($action) {
 +                case 'delete':
 +                    $error = $this->deleteOneCategory($catid);
 +                    break;
 +                case 'move':
 +                    $error = $this->moveOneCategory($catid, $destBlogId);
 +                    break;
 +                default:
 +                    $error = _BATCH_UNKNOWN . Entity::hsc($action);
 +            }
 +
 +            echo '<b>',($error ? _ERROR . ': '.$error : _BATCH_SUCCESS),'</b>';
 +            echo '</li>';
 +        }
 +
 +        echo '</ul>';
 +        echo '<b>',_BATCH_DONE,'</b>';
 +
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function batchMoveSelectDestination($type, $ids) {
 +        global $manager;
 +        $this->pagehead();
 +        ?>
 +        <h2><?php echo _MOVE_TITLE ?></h2>
 +        <form method="post" action="index.php"><div>
 +
 +            <input type="hidden" name="action" value="batch<?php echo $type ?>" />
 +            <input type="hidden" name="batchaction" value="move" />
 +            <?php
 +                $manager->addTicketHidden();
 +
 +                // insert selected item numbers
 +                $idx = 0;
 +                foreach ($ids as $id)
 +                    echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
 +
 +                // show blog/category selection list
 +                $this->selectBlogCategory('destcatid');
 +
 +            ?>
 +
 +
 +            <input type="submit" value="<?php echo _MOVE_BTN ?>" onclick="return checkSubmit();" />
 +
 +        </div></form>
 +        <?php       $this->pagefoot();
 +        exit;
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function batchMoveCategorySelectDestination($type, $ids) {
 +        global $manager;
 +        $this->pagehead();
 +        ?>
 +        <h2><?php echo _MOVECAT_TITLE ?></h2>
 +        <form method="post" action="index.php"><div>
 +
 +            <input type="hidden" name="action" value="batch<?php echo $type ?>" />
 +            <input type="hidden" name="batchaction" value="move" />
 +            <?php
 +                $manager->addTicketHidden();
 +
 +                // insert selected item numbers
 +                $idx = 0;
 +                foreach ($ids as $id)
 +                    echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
 +
 +                // show blog/category selection list
 +                $this->selectBlog('destblogid');
 +
 +            ?>
 +
 +
 +            <input type="submit" value="<?php echo _MOVECAT_BTN ?>" onclick="return checkSubmit();" />
 +
 +        </div></form>
 +        <?php       $this->pagefoot();
 +        exit;
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function batchAskDeleteConfirmation($type, $ids) {
 +        global $manager;
 +
 +        $this->pagehead();
 +        ?>
 +        <h2><?php echo _BATCH_DELETE_CONFIRM ?></h2>
 +        <form method="post" action="index.php"><div>
 +
 +            <input type="hidden" name="action" value="batch<?php echo $type ?>" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="batchaction" value="delete" />
 +            <input type="hidden" name="confirmation" value="yes" />
 +            <?php               // insert selected item numbers
 +                $idx = 0;
 +                foreach ($ids as $id)
 +                    echo '<input type="hidden" name="batch[',($idx++),']" value="',intval($id),'" />';
 +
 +                // add hidden vars for team & comment
 +                if ($type == 'team')
 +                {
 +                    echo '<input type="hidden" name="blogid" value="',intRequestVar('blogid'),'" />';
 +                }
 +                if ($type == 'comment')
 +                {
 +                    echo '<input type="hidden" name="itemid" value="',intRequestVar('itemid'),'" />';
 +                }
 +
 +            ?>
 +
 +            <input type="submit" value="<?php echo _BATCH_DELETE_CONFIRM_BTN ?>" onclick="return checkSubmit();" />
 +
 +        </div></form>
 +        <?php       $this->pagefoot();
 +        exit;
 +    }
 +
 +
 +    /**
 +     * Inserts a HTML select element with choices for all categories to which the current
 +     * member has access
 +     * @see function selectBlog
 +     */
 +    function selectBlogCategory($name, $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1) {
 +        Admin::selectBlog($name, 'category', $selected, $tabindex, $showNewCat, $iForcedBlogInclude);
 +    }
 +
 +      /**
 +       * Admin::selectBlog()
 +       * Inserts a HTML select element with choices for all blogs to which the user has access
 +       *  mode = 'blog' => shows blognames and values are blogids
 +       *  mode = 'category' => show category names and values are catids
 +       * 
 +       * @param       string  $name                           name of 
 +       * @param       string  $mode                           blog/category
 +       * @param       integer $selected                       category ID to be selected
 +       * @param       integer $tabindex                       tab index value
 +       * @param       integer $showNewCat                     show category to newly be created
 +       * @param       integer $iForcedBlogInclude     ID of a blog that always needs to be included,
 +       *                                              without checking if the member is on the blog team (-1 = none)
 +       * @return      void
 +       */
 +      public function selectBlog($name, $mode='blog', $selected = 0, $tabindex = 0, $showNewCat = 0, $iForcedBlogInclude = -1)
 +      {
 +              global $member, $CONF;
 +              
 +              // 0. get IDs of blogs to which member can post items (+ forced blog)
 +              $aBlogIds = array();
 +              if ( $iForcedBlogInclude != -1 )
 +              {
 +                      $aBlogIds[] = intval($iForcedBlogInclude);
 +              }
 +              
 +              if ( !$member->isAdmin() || !array_key_exists('ShowAllBlogs', $CONF) || !$CONF['ShowAllBlogs'] )
 +              {
 +                      $query = "SELECT bnumber FROM %s,%s WHERE tblog=bnumber and tmember=%d;";
 +                      $query = sprintf($query, sql_table('blog'), sql_table('team'), (integer) $member->getID());
 +              }
 +              else
 +              {
 +                      $query = "SELECT bnumber FROM %s ORDER BY bname;";
 +                      $query = sprintf($query, sql_table('blog'));
 +              }
 +              
 +              $rblogids = DB::getResult($query);
 +              foreach ( $rblogids as $row )
 +              {
 +                      if ( $row['bnumber'] != $iForcedBlogInclude )
 +                      {
 +                              $aBlogIds[] = (integer) $row['bnumber'];
 +                      }
 +              }
 +              if ( count($aBlogIds) == 0 )
 +              {
 +                      return;
 +              }
 +              
 +              echo "<select name=\"{$name}\" tabindex=\"{$tabindex}\">\n";
 +              
 +              // 1. select blogs (we'll create optiongroups)
 +              // (only select those blogs that have the user on the team)
 +              $query = "SELECT bnumber, bname FROM %s WHERE bnumber in (%s) ORDER BY bname;";
 +              $query = sprintf($query, sql_table('blog'), implode(',',$aBlogIds));
 +              $blogs = DB::getResult($query);
 +              
 +              if ( $mode == 'category' )
 +              {
 +                      $multipleBlogs = ($blogs->rowCount() > 1);
 +                      
 +                      foreach ( $blogs as $row )
 +                      {
 +                              if ( $multipleBlogs )
 +                              {
 +                                      echo '<optgroup label="' . Entity::hsc($row['bname']) . '">' . "\n";
 +                              }
 +                              
 +                              // show selection to create new category when allowed/wanted
 +                              if ( $showNewCat )
 +                              {
 +                                      // check if allowed to do so
 +                                      if ( $member->blogAdminRights($row['bnumber']) )
 +                                      {
 +                                              echo "<option value=\"newcat-{$row['bnumber']}\">" . _ADD_NEWCAT . "</option>\n";
 +                                      }
 +                              }
 +                              
 +                              // 2. for each category in that blog
 +                              $query = "SELECT cname, catid FROM %s WHERE cblog=%d ORDER BY cname ASC;";
 +                              $query = sprintf($query, sql_table('category'), (integer) $row['bnumber']);
 +                              $categories = DB::getResult($query);
 +                              foreach ( $categories as $cat )
 +                              {
 +                                      if ( $cat['catid'] != $selected )
 +                                      {
 +                                      echo "<option value=\"{$cat['catid']}\" {$selectText} >" . Entity::hsc($cat['cname']) . "</option>\n";
 +                                      }
 +                                      else
 +                                      {
 +                                      echo "<option value=\"{$cat['catid']}\" selected=\"selected\" >" . Entity::hsc($cat['cname']) . "</option>\n";
 +                                      }
 +                              }
 +                              
 +                              if ( $multipleBlogs )
 +                              {
 +                                      echo "</optgroup>\n";
 +                              }
 +                      }
 +              }
 +              else
 +              {
 +                      // blog mode
 +                      foreach ( $blogs as $row )
 +                      {
 +                              if ( $row['bnumber'] != $selected )
 +                              {
 +                                      echo "<option value=\"{$row['bnumber']}\">" . Entity::hsc($row['bname']) . "</option>\n";
 +                              }
 +                              else
 +                              {
 +                                      echo "<option value=\"{$row['bnumber']}\" selected=\"selected\">" . Entity::hsc($row['bname']) . "</option>\n";
 +                              }
 +                      }
 +              }
 +              echo "</select>\n";
++=======
+               $member->teamRights($blogid) or $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('itemlist');
                return;
        }
        
                return;
        }
        
-     /**
-      * @todo document this
-      */
-     function action_itemupdate() {
-         global $member, $manager, $CONF;
-         $itemid = intRequestVar('itemid');
-         $catid = postVar('catid');
-         // only allow if user is allowed to alter item
-         $member->canUpdateItem($itemid, $catid) or $this->disallow();
+       /**
+        * Admin::action_itemdelete()
+        * Delete item
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       static private function action_itemdelete()
+       {
+               global $member, $manager;
+               
+               $itemid = intRequestVar('itemid');
+               
+               // only allow if user is allowed to alter item
+               $member->canAlterItem($itemid) or self::disallow();
+               
+               if ( !$manager->existsItem($itemid,1,1) )
+               {
+                       self::error(_ERROR_NOSUCHITEM);
+                       return;
+               }
+               
+               self::$skin->parse('itemdelete');
+               return;
+       }
+       
+       /**
+        * Admin::action_itemdeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_itemdeleteconfirm()
+       {
+               global $member, $manager;
+               
+               $itemid = intRequestVar('itemid');
+               
+               // only allow if user is allowed to alter item
+               $member->canAlterItem($itemid) or self::disallow();
+               
+               // get item first
+               $item =& $manager->getItem($itemid, 1, 1);
+               
+               // delete item (note: some checks will be performed twice)
+               self::deleteOneItem($item['itemid']);
+               
+               self::action_itemlist($item['blogid']);
+               return;
+       }
+       
+       /**
+        * Admin::deleteOneItem()
+        * Deletes one item and returns error if something goes wrong
+        * 
+        * @param       integer $itemid ID for item
+        * @return      void
+        */
+       static public function deleteOneItem($itemid)
+       {
+               global $member, $manager;
+               
+               // only allow if user is allowed to alter item (also checks if itemid exists)
+               if ( !$member->canAlterItem($itemid) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               // need to get blogid before the item is deleted
+               $item =& $manager->getItem($itemid, 1, 1);
+               
+               $manager->loadClass('ITEM');
+               Item::delete($item['itemid']);
+               
+               // update blog's futureposted
+               self::updateFuturePosted($item['itemid']);
+               return;
+       }
+       
+       /**
+        * Admin::updateFuturePosted()
+        * Update a blog's future posted flag
+        * 
+        * @param integer $blogid
+        * @return      void
+        */
+       static private function updateFuturePosted($blogid)
+       {
+               global $manager;
+               
+               $blogid                 =  intval($blogid);
+               $blog                   =& $manager->getBlog($blogid);
+               $currenttime    =  $blog->getCorrectTime(time());
+               
+               $query = "SELECT * FROM %s WHERE iblog=%d AND iposted=0 AND itime>'%s'";
+               $query = sprintf($query, sql_table('item'), (integer) $blogid, i18n::formatted_datetime('mysql', $currenttime));
+               $result = DB::getResult($query);
+               
+               if ( $result->rowCount() > 0 )
+               {
+                               $blog->setFuturePost();
+               }
+               else
+               {
+                               $blog->clearFuturePost();
+               }
+               return;
+       }
+       /**
+        * Admin::action_itemmove()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_itemmove()
+       {
+               global $member, $manager;
+               
+               $itemid = intRequestVar('itemid');
+               
+               $member->canAlterItem($itemid) or self::disallow();
+               
+               self::$skin->parse('itemmove');
+               return;
+       }
+       
+       /**
+        * Admin::action_itemmoveto()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_itemmoveto()
+       {
+               global $member, $manager;
+               
+               $itemid = intRequestVar('itemid');
+               $catid = requestVar('catid');
+               
+               // create new category if needed
+               if ( i18n::strpos($catid,'newcat') === 0 )
+               {
+                       // get blogid
+                       list($blogid) = sscanf($catid,'newcat-%d');
+                       
+                       // create
+                       $blog =& $manager->getBlog($blogid);
+                       $catid = $blog->createNewCategory();
+                       
+                       // show error when sth goes wrong
+                       if ( !$catid )
+                       {
+                               self::doError(_ERROR_CATCREATEFAIL);
+                       }
+               }
+               
+               // only allow if user is allowed to alter item
+               $member->canUpdateItem($itemid, $catid) or self::disallow();
+               
+               $old_blogid = getBlogIDFromItemId($itemid);
+               
+               Item::move($itemid, $catid);
+               
+               // set the futurePosted flag on the blog
+               self::updateFuturePosted(getBlogIDFromItemId($itemid));
+               
+               // reset the futurePosted in case the item is moved from one blog to another
+               self::updateFuturePosted($old_blogid);
+               
+               if ( $catid != intRequestVar('catid') )
+               {
+                       self::action_categoryedit($catid, $blog->getID());
+               }
+               else
+               {
+                       self::action_itemlist(getBlogIDFromCatID($catid));
+               }
+               return;
+       }
+       
+       /**
+        * Admin::moveOneItem()
+        * Moves one item to a given category (category existance should be checked by caller)
+        * errors are returned
+        * 
+        * @param       integer $itemid         ID for item
+        * @param       integer $destCatid      ID for category to which the item will be moved
+        * @return      void
+        */
+       static public function moveOneItem($itemid, $destCatid)
+       {
+               global $member;
+               
+               // only allow if user is allowed to move item
+               if ( !$member->canUpdateItem($itemid, $destCatid) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               Item::move($itemid, $destCatid);
+               return;
+       }
+       
+       /**
+        * Admin::action_additem()
+        * Adds a item to the chosen blog
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_additem()
+       {
+               global $manager, $CONF;
+               
+               $manager->loadClass('ITEM');
+               
+               $result = Item::createFromRequest();
+               
+               if ( $result['status'] == 'error' )
+               {
+                       self::error($result['message']);
+                       return;
+               }
+               
+               $item =& $manager->getItem($result['itemid'], 0, 0);
+               
+               if ( $result['status'] == 'newcategory' )
+               {
+                       $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=itemList&blogid=' . $item['blogid']);
+                       self::action_categoryedit($result['catid'], $item['blogid'], $distURI);
+               }
+               else
+               {
+                       $methodName = 'action_itemlist';
+                       self::action_itemlist($item['blogid']);
+               }
+               return;
+       }
+       
+       /**
+        * Admin::action_commentedit()
+        * Allows to edit previously made comments
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_commentedit()
+       {
+               global $member, $manager;
+               
+               $commentid = intRequestVar('commentid');
+               
+               $member->canAlterComment($commentid) or self::disallow();
+               
+               $comment = Comment::getComment($commentid);
+               $data = array('comment' => &$comment);
+               $manager->notify('PrepareCommentForEdit', $data);
+               
+               self::$contents = $comment;
+               self::$skin->parse('commentedit');
+               return;
+       }
+       
+       /**
+        * Admin::action_commentupdate()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_commentupdate()
+       {
+               global $member, $manager;
+               
+               $commentid = intRequestVar('commentid');
+               
+               $member->canAlterComment($commentid) or self::disallow();
+               
+               $url    = postVar('url');
+               $email  = postVar('email');
+               $body   = postVar('body');
+               
+               // intercept words that are too long
+               if (preg_match('#[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}#', $body) != FALSE)
+               {
+                       self::error(_ERROR_COMMENT_LONGWORD);
+                       return;
+               }
+               
+               // check length
+               if ( i18n::strlen($body) < 3 )
+               {
+                       self::error(_ERROR_COMMENT_NOCOMMENT);
+                       return;
+               }
+               
+               if ( i18n::strlen($body) > 5000 )
+               {
+                       self::error(_ERROR_COMMENT_TOOLONG);
+                       return;
+               }
+               
+               // prepare body
+               $body = Comment::prepareBody($body);
+               
+               // call plugins
+               $data = array(
+                       'body' => &$body
+               );
+               $manager->notify('PreUpdateComment', $data);
+               
+               $query = "UPDATE %s SET cmail=%s, cemail=%s, cbody=%s WHERE cnumber=%d;";
+               $query = sprintf($query, sql_table('comment'), DB::quoteValue($url), DB::quoteValue($email), DB::quoteValue($body), (integer) $commentid);
+               DB::execute($query);
+               
+               // get itemid
+               $query = "SELECT citem FROM %s WHERE cnumber=%d;";
+               $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+               
+               $itemid = DB::getValue($query);
+               
+               if ( $member->canAlterItem($itemid) )
+               {
+                       self::action_itemcommentlist($itemid);
+               }
+               else
+               {
+                       self::action_browseowncomments();
+               }
+               return;
+       }
+       
+       /**
+        * Admin::action_commentdelete()
+        * Update comment
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_commentdelete()
+       {
+               global $member, $manager;
+               
+               $commentid = intRequestVar('commentid');
+               $member->canAlterComment($commentid) or self::disallow();
+               
+               self::$skin->parse('commentdelete');
+               return;
+       }
+       
+       /**
+        * Admin::action_commentdeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_commentdeleteconfirm()
+       {
+               global $member;
+               
+               $commentid = intRequestVar('commentid');
+               
+               // get item id first
+               $query = "SELECT citem FROM %s WHERE cnumber=%d;";
+               $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+               
+               $itemid = DB::getValue($query);
+               
+               $error = self::deleteOneComment($commentid);
+               if ( $error )
+               {
+                       self::doError($error);
+               }
+               
+               if ( $member->canAlterItem($itemid) )
+               {
+                       self::action_itemcommentlist($itemid);
+               }
+               else
+               {
+                       self::action_browseowncomments();
+               }
+               return;
+       }
+       
+       /**
+        * Admin::deleteOneComment()
+        * 
+        * @param       integer $commentid      ID for comment
+        * @return      void
+        */
+       static public function deleteOneComment($commentid)
+       {
+               global $member, $manager;
+               
+               $commentid = (integer) $commentid;
+               
+               if ( !$member->canAlterComment($commentid) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               $data = array(
+                       'commentid' => $commentid
+               );
+               
+               $manager->notify('PreDeleteComment', $data);
+               
+               // delete the comments associated with the item
+               $query = "DELETE FROM %s WHERE cnumber=%d;";
+               $query = sprintf($query, sql_table('comment'), (integer) $commentid);
+               DB::execute($query);
+               
+               $data = array(
+                       'commentid' => $commentid
+               );
+               
+               $manager->notify('PostDeleteComment', $data);
+               
+               return '';
+       }
+       
+       /**
+        * Admin::action_usermanagement()
+        * Usermanagement main
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_usermanagement()
+       {
+               global $member, $manager;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('usermanagement');
+               return;
+       }
+       
+       /**
+        * Admin::action_memberedit()
+        * Edit member settings
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_memberedit()
+       {
+               self::action_editmembersettings(intRequestVar('memberid'));
+               return;
+       }
+       
+       /**
+        * Admin::action_editmembersettings()
+        * 
+        * @param       integer $memberid       ID for member
+        * @return      void
+        * 
+        */
+       static private function action_editmembersettings($memberid = '')
+       {
+               global $member, $manager, $CONF;
+               
+               if ( $memberid == '' )
+               {
+                       $memberid = $member->getID();
+               }
+               
+               /* TODO: we should consider to use the other way insterad of this */
+               $_REQUEST['memberid'] = $memberid;
+               
+               // check if allowed
+               ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+               
+               self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+               
+               self::$skin->parse('editmembersettings');
+               return;
+       }
+       
+       /**
+        * Admin::action_changemembersettings()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_changemembersettings()
+       {
+               global $member, $CONF, $manager;
+               
+               $memberid = intRequestVar('memberid');
+               
+               // check if allowed
+               ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+               
+               $name                   = trim(strip_tags(postVar('name')));
+               $realname               = trim(strip_tags(postVar('realname')));
+               $password               = postVar('password');
+               $repeatpassword = postVar('repeatpassword');
+               $email                  = strip_tags(postVar('email'));
+               $url                    = strip_tags(postVar('url'));
+               $adminskin              = intPostVar('adminskin');
+               $bookmarklet    = intPostVar('bookmarklet');
+               
+               // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.
+               if ( !preg_match('#^https?://#', $url) )
+               {
+                       $url = 'http://' . $url;
+               }
+               
+               $admin          = postVar('admin');
+               $canlogin       = postVar('canlogin');
+               $notes          = strip_tags(postVar('notes'));
+               $locale         = postVar('locale');
+               
+               $mem =& $manager->getMember($memberid);
+               
+               if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
+               {
+                       if ( !isValidDisplayName($name) )
+                       {
+                               self::error(_ERROR_BADNAME);
+                               return;
+                       }
+                       
+                       if ( ($name != $mem->getDisplayName()) && Member::exists($name) )
+                       {
+                               self::error(_ERROR_NICKNAMEINUSE);
+                               return;
+                       }
+                       
+                       if ( $password != $repeatpassword )
+                       {
+                               self::error(_ERROR_PASSWORDMISMATCH);
+                               return;
+                       }
+                       
+                       if ( $password && (i18n::strlen($password) < 6) )
+                       {
+                               self::error(_ERROR_PASSWORDTOOSHORT);
+                               return;
+                       }
+                               
+                       if ( $password )
+                       {
+                               $pwdvalid = true;
+                               $pwderror = '';
+                               
+                               $data = array(
+                                       'password'     => $password,
+                                       'errormessage' => &$pwderror,
+                                       'valid'        => &$pwdvalid
+                               );
+                               $manager->notify('PrePasswordSet', $data);
+                               
+                               if ( !$pwdvalid )
+                               {
+                                       self::error($pwderror);
+                                       return;
+                               }
+                       }
+               }
+               
+               if ( !NOTIFICATION::address_validation($email) )
+               {
+                       self::error(_ERROR_BADMAILADDRESS);
+                       return;
+               }
+               if ( !$realname )
+               {
+                       self::error(_ERROR_REALNAMEMISSING);
+                       return;
+               }
+               if ( ($locale != '') && (!in_array($locale, i18n::get_available_locale_list())) )
+               {
+                       self::error(_ERROR_NOSUCHTRANSLATION);
+                       return;
+               }
+               
+               // check if there will remain at least one site member with both the logon and admin rights
+               // (check occurs when taking away one of these rights from such a member)
+               if (    (!$admin && $mem->isAdmin() && $mem->canLogin())
+                       ||      (!$canlogin && $mem->isAdmin() && $mem->canLogin())
+                       )
+               {
+                       $r = DB::getResult('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
+                       if ( $r->rowCount() < 2 )
+                       {
+                               self::error(_ERROR_ATLEASTONEADMIN);
+                               return;
+                       }
+               }
+               
+               if ( $CONF['AllowLoginEdit'] || $member->isAdmin() )
+               {
+                       $mem->setDisplayName($name);
+                       if ( $password )
+                       {
+                               $mem->setPassword($password);
+                       }
+               }
+               
+               $oldEmail = $mem->getEmail();
+               
+               $mem->setRealName($realname);
+               $mem->setEmail($email);
+               $mem->setURL($url);
+               $mem->setNotes($notes);
+               $mem->setLocale($locale);
+               $mem->setAdminSkin($adminskin);
+               $mem->setBookmarklet($bookmarklet);
+               // only allow super-admins to make changes to the admin status
+               if ( $member->isAdmin() )
+               {
+                       $mem->setAdmin($admin);
+                       $mem->setCanLogin($canlogin);
+               }
+               
+               $autosave = postVar('autosave');
+               $mem->setAutosave($autosave);
+               
+               $mem->write();
+               
+               // store plugin options
+               $aOptions = requestArray('plugoption');
+               NucleusPlugin::apply_plugin_options($aOptions);
+               $data = array(
+                       'context'  => 'member',
+                       'memberid' => $memberid,
+                       'member'   => &$mem
+               );
+               $manager->notify('PostPluginOptionsUpdate', $data);
+               
+               // if email changed, generate new password
+               if ( $oldEmail != $mem->getEmail() )
+               {
+                       $mem->sendActivationLink('addresschange', $oldEmail);
+                       // logout member
+                       $mem->newCookieKey();
+                       
+                       // only log out if the member being edited is the current member.
+                       if ( $member->getID() == $memberid )
+                       {
+                               $member->logout();
+                       }
+                       self::action_login(_MSG_ACTIVATION_SENT, 0);
+                       return;
+               }
+               
+               if ( ($mem->getID() == $member->getID())
+                       && ($mem->getDisplayName() != $member->getDisplayName()) )
+               {
+                       $mem->newCookieKey();
+                       $member->logout();
+                       self::action_login(_MSG_LOGINAGAIN, 0);
+               }
+               else
+               {
+                       self::action_overview(_MSG_SETTINGSCHANGED);
+               }
+               return;
+       }
+       /**
+        * Admin::action_memberadd()
+        * 
+        * @param       void
+        * @return      void
+        * 
+        */
+       static private function action_memberadd()
+       {
+               global $member, $manager;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               if ( postVar('password') != postVar('repeatpassword') )
+               {
+                       self::error(_ERROR_PASSWORDMISMATCH);
+                       return;
+               }
+               
+               if ( i18n::strlen(postVar('password')) < 6 )
+               {
+                       self::error(_ERROR_PASSWORDTOOSHORT);
+                       return;
+               }
+               
+               $res = Member::create(
+                       postVar('name'),
+                       postVar('realname'),
+                       postVar('password'),
+                       postVar('email'),
+                       postVar('url'),
+                       postVar('admin'),
+                       postVar('canlogin'),
+                       postVar('notes')
+               );
+               
+               if ( $res != 1 )
+               {
+                       self::error($res);
+                       return;
+               }
+               
+               // fire PostRegister event
+               $newmem = new Member();
+               $newmem->readFromName(postVar('name'));
+               $data = array(
+                       'member' => &$newmem
+               );
+               $manager->notify('PostRegister', $data);
+               
+               self::action_usermanagement();
+               return;
+       }
+       
+       /**
+        * Admin::action_forgotpassword()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_forgotpassword()
+       {
+               self::$skin->parse('forgotpassword');
+               return;
+       }
+       
+       /**
+        * Admin::action_activate()
+        * Account activation
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_activate()
+       {
+               $key = getVar('key');
+               self::showActivationPage($key);
+               return;
+       }
+       
+       /**
+        * Admin::showActivationPage()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function showActivationPage($key, $message = '')
+       {
+               global $manager;
+               
+               // clean up old activation keys
+               Member::cleanupActivationTable();
+               
+               // get activation info
+               $info = Member::getActivationInfo($key);
+               
+               if ( !$info )
+               {
+                       self::error(_ERROR_ACTIVATE);
+                       return;
+               }
+               
+               $mem =& $manager->getMember($info->vmember);
+               
+               if ( !$mem )
+               {
+                       self::error(_ERROR_ACTIVATE);
+                       return;
+               }
+               
+               /* TODO: we should consider to use the other way insterad of this */
+               $_POST['ackey']                                 = $key;
+               $_POST['bNeedsPasswordChange']  = TRUE;
+               
+               self::$headMess = $message;
+               self::$skin->parse('activate');
+               return;
+       }
+       
+       /**
+        * Admin::action_activatesetpwd()
+        * Account activation - set password part
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_activatesetpwd()
+       {
+               global $manager;
+               $key = postVar('key');
+               
+               // clean up old activation keys
+               Member::cleanupActivationTable();
+               
+               // get activation info
+               $info = Member::getActivationInfo($key);
+               
+               if ( !$info || ($info->type == 'addresschange') )
+               {
+                       return self::showActivationPage($key, _ERROR_ACTIVATE);
+               }
+               
+               $mem =& $manager->getMember($info->vmember);
+               
+               if ( !$mem )
+               {
+                       return self::showActivationPage($key, _ERROR_ACTIVATE);
+               }
+               
+               $password               = postVar('password');
+               $repeatpassword = postVar('repeatpassword');
+               
+               if ( $password != $repeatpassword )
+               {
+                       return self::showActivationPage($key, _ERROR_PASSWORDMISMATCH);
+               }
+               
+               if ( $password && (i18n::strlen($password) < 6) )
+               {
+                       return self::showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
+               }
+                       
+               if ( $password )
+               {
+                       $pwdvalid = true;
+                       $pwderror = '';
+                       
+                       $data = array(
+                               'password'              => $password,
+                               'errormessage'  => &$pwderror,
+                               'valid'                 => &$pwdvalid
+                       );
+                       $manager->notify('PrePasswordSet', $data);
+                       if ( !$pwdvalid )
+                       {
+                               return self::showActivationPage($key,$pwderror);
+                       }
+               }
+               
+               $error = '';
+               
+               $data = array(
+                       'type'   => 'activation',
+                       'member' => $mem,
+                       'error'  => &$error
+               );
+               $manager->notify('ValidateForm', $data);
+               if ( $error != '' )
+               {
+                       return self::showActivationPage($key, $error);
+               }
+               
+               // set password
+               $mem->setPassword($password);
+               $mem->write();
+               
+               // do the activation
+               Member::activate($key);
+               
+               self::$skin->parse('activatesetpwd');
+               return;
+       }
+       
+       /**
+        * Admin::action_manageteam()
+        * Manage team
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_manageteam()
+       {
+               global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               // check if allowed
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               self::$skin->parse('manageteam');
+               return;
+       }
+       
+       /**
+        * Admin::action_teamaddmember()
+        * Add member to team
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_teamaddmember()
+       {
+               global $member, $manager;
+               
+               $memberid       = intPostVar('memberid');
+               $blogid         = intPostVar('blogid');
+               $admin          = intPostVar('admin');
+               
+               // check if allowed
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $blog =& $manager->getBlog($blogid);
+               if ( !$blog->addTeamMember($memberid, $admin) )
+               {
+                       self::error(_ERROR_ALREADYONTEAM);
+                       return;
+               }
+               
+               self::action_manageteam();
+               return;
+       }
+       
+       /**
+        * Admin::action_teamdelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_teamdelete()
+       {
+               global $member, $manager;
+               
+               $memberid       = intRequestVar('memberid');
+               $blogid         = intRequestVar('blogid');
+               
+               // check if allowed
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $teammem =& $manager->getMember($memberid);
+               $blog =& $manager->getBlog($blogid);
+               
+               self::$skin->parse('teamdelete');
+               return;
+       }
+       
+       /**
+        * Admin::action_teamdeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_teamdeleteconfirm()
+       {
+               global $member;
+               
+               $memberid = intRequestVar('memberid');
+               $blogid = intRequestVar('blogid');
+               
+               $error = self::deleteOneTeamMember($blogid, $memberid);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
+               self::action_manageteam();
+               return;
+       }
+       
+       /**
+        * Admin::deleteOneTeamMember()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static public function deleteOneTeamMember($blogid, $memberid)
+       {
+               global $member, $manager;
+               
+               $blogid   = intval($blogid);
+               $memberid = intval($memberid);
+               
+               // check if allowed
+               if ( !$member->blogAdminRights($blogid) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               // check if: - there remains at least one blog admin
+               //           - (there remains at least one team member)
+               $tmem =& $manager->getMember($memberid);
+               
+               
+               $data = array(
+                       'member' => &$tmem,
+                       'blogid' => $blogid
+               );
+               $manager->notify('PreDeleteTeamMember', $data);
+               
+               if ( $tmem->isBlogAdmin($blogid) )
+               {
+                       /* TODO: why we did double check? */
+                       // check if there are more blog members left and at least one admin
+                       // (check for at least two admins before deletion)
+                       $query = "SELECT * FROM %s WHERE tblog=%d and tadmin=1;";
+                       $query = sprintf($query, sql_table('team'), (integer) $blogid);
+                       $r     = DB::getResult($query);
+                       if ( $r->rowCount() < 2 )
+                       {
+                               return _ERROR_ATLEASTONEBLOGADMIN;
+                       }
+               }
+               
+               $query = "DELETE FROM %s WHERE tblog=%d AND tmember=%d;";
+               $query = sprintf($query, sql_table('team'), (integer) $blogid, (integer) $memberid);
+               DB::execute($query);
+               
+               $data = array(
+                       'member' => &$tmem,
+                       'blogid' => $blogid
+               );
+               $manager->notify('PostDeleteTeamMember', $data);
+               
+               return '';
+       }
+       
+       /**
+        * Admin::action_teamchangeadmin()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_teamchangeadmin()
+       {
+               global $manager, $member;
+               
+               $blogid         = intRequestVar('blogid');
+               $memberid       = intRequestVar('memberid');
+               
+               // check if allowed
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $mem =& $manager->getMember($memberid);
+               
+               // don't allow when there is only one admin at this moment
+               if ( $mem->isBlogAdmin($blogid) )
+               {
+                       $query = "SELECT * FROM %s WHERE tblog=%d AND tadmin=1;";
+                       $query = sprintf($query, sql_table('team'), (integer) $blogid);
+                       $r = DB::getResult($query);
+                       if ( $r->rowCount() == 1 )
+                       {
+                               self::error(_ERROR_ATLEASTONEBLOGADMIN);
+                               return;
+                       }
+               }
+               
+               if ( $mem->isBlogAdmin($blogid) )
+               {
+                       $newval = 0;
+               }
+               else
+               {
+                       $newval = 1;
+               }
+               
+               $query = "UPDATE %s SET tadmin=%d WHERE tblog=%d and tmember=%d;";
+               $query = sprintf($query, (integer) $blogid, (integer) $newval, (integer) $blogid, (integer) $memberid);
+               DB::execute($query);
+               
+               // only show manageteam if member did not change its own admin privileges
+               if ( $member->isBlogAdmin($blogid) )
+               {
+                       self::action_manageteam();
+               }
+               else
+               {
+                       self::action_overview(_MSG_ADMINCHANGED);
+               }
+               return;
+       }
+       
+       /**
+        * Admin::action_blogsettings()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_blogsettings()
+       {
+               global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               // check if allowed
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $blog =& $manager->getBlog($blogid);
+               
+               self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+               
+               self::$skin->parse('blogsettings');
+               return;
+       }
+       
+       /**
+        * Admin::action_categorynew()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_categorynew()
+       {
+               global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $cname = postVar('cname');
+               $cdesc = postVar('cdesc');
+               
+               if ( !isValidCategoryName($cname) )
+               {
+                       self::error(_ERROR_BADCATEGORYNAME);
+                       return;
+               }
+               
+               $query = "SELECT * FROM %s WHERE cname=%s AND cblog=%d;";
+               $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid);
+               $res = DB::getResult($query);
+               if ( $res->rowCount() > 0 )
+               {
+                       self::error(_ERROR_DUPCATEGORYNAME);
+                       return;
+               }
+               
+               $blog           =& $manager->getBlog($blogid);
+               $newCatID       =  $blog->createNewCategory($cname, $cdesc);
+               
+               self::action_blogsettings();
+               return;
+       }
+       
+       /**
+        * Admin::action_categoryedit()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_categoryedit($catid = '', $blogid = '', $desturl = '')
+       {
+               global $member, $manager;
+               
+               if ( $blogid == '' )
+               {
+                       $blogid = intGetVar('blogid');
+               }
+               else
+               {
+                       $blogid = intval($blogid);
+               }
+               if ( $catid == '' )
+               {
+                       $catid = intGetVar('catid');
+               }
+               else
+               {
+                       $catid = intval($catid);
+               }
+               
+               /* TODO: we should consider to use the other way insterad of this */
+               $_REQUEST['blogid']             = $blogid;
+               $_REQUEST['catid']              = $catid;
+               $_REQUEST['desturl']    = $desturl;
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
+               
+               self::$skin->parse('categoryedit');
+               return;
+       }
+       
+       /**
+        * Admin::action_categoryupdate()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_categoryupdate()
+       {
+               global $member, $manager;
+               
+               $blogid         = intPostVar('blogid');
+               $catid          = intPostVar('catid');
+               $cname          = postVar('cname');
+               $cdesc          = postVar('cdesc');
+               $desturl        = postVar('desturl');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               if ( !isValidCategoryName($cname) )
+               {
+                       self::error(_ERROR_BADCATEGORYNAME);
+                       return;
+               }
+               
+               $query  = "SELECT * FROM %s WHERE cname=%s AND cblog=%d AND not(catid=%d);";
+               $query  = sprintf($query, sql_table('category'), DB::quoteValue($cname), (integer) $blogid, (integer) $catid);
+               $res    = DB::getResult($query);
+               if ( $res->rowCount() > 0 )
+               {
+                       self::error(_ERROR_DUPCATEGORYNAME);
+                       return;
+               }
+               
+               $query =  "UPDATE %s SET cname=%s, cdesc=%s WHERE catid=%d;";
+               $query = sprintf($query, sql_table('category'), DB::quoteValue($cname), DB::quoteValue($cdesc), (integer) $catid);
+               DB::execute($query);
+               
+               // store plugin options
+               $aOptions = requestArray('plugoption');
+               NucleusPlugin::apply_plugin_options($aOptions);
+               $data = array(
+                       'context'       => 'category',
+                       'catid'         => $catid
+               );
+               $manager->notify('PostPluginOptionsUpdate', $data);
+               
+               if ( $desturl )
+               {
+                       redirect($desturl);
+                       return;
+               }
+               
+               self::action_blogsettings();
+               
+               return;
+       }
+       
+       /**
+        * Admin::action_categorydelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_categorydelete()
+       {
+               global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               $catid  = intRequestVar('catid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $blog =& $manager->getBlog($blogid);
+               
+               // check if the category is valid
+               if ( !$blog->isValidCategory($catid) )
+               {
+                       self::error(_ERROR_NOSUCHCATEGORY);
+                       return;
+               }
+               
+               // don't allow deletion of default category
+               if ( $blog->getDefaultCategory() == $catid )
+               {
+                       self::error(_ERROR_DELETEDEFCATEGORY);
+                       return;
+               }
+               
+               // check if catid is the only category left for blogid
+               $query = "SELECT catid FROM %s WHERE cblog=%d;";
+               $query = sprintf($query, sql_table('category'), $blogid);
+               $res = DB::getResult($query);
+               if ( $res->rowCount() == 1 )
+               {
+                       self::error(_ERROR_DELETELASTCATEGORY);
+                       return;
+               }
+               
+               self::$skin->parse('categorydelete');
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_browseownitems()
++=======
+        * Admin::action_categorydeleteconfirm()
++>>>>>>> skinnable-master
+        * 
+        * @param       void
+        * @return      void
+        */
 -      static private function action_categorydeleteconfirm()
++<<<<<<< HEAD
++      public function action_browseownitems()
+       {
 -              global $member, $manager;
++              global $member, $manager, $CONF;
++              
++              $this->pagehead();
++              
++              echo '<p><a href="index.php?action=overview">(' . _BACKHOME . ")</a></p>\n";
++              echo '<h2>' . _ITEMLIST_YOUR . "</h2>\n";
++              
++              // start index
++              if ( postVar('start') )
++              {
++                      $start = intPostVar('start');
++              }
++              else
++              {
++                      $start = 0;
++              }
++              
++              // amount of items to show
++              if ( postVar('amount') )
++              {
++                      $amount = intPostVar('amount');
++              }
++              else
++              {
++                      $amount = (integer) $CONF['DefaultListSize'];
++                      if ( $amount < 1 )
++                      {
++                              $amount = 10;
++                      }
++              }
++              
++              $search = postVar('search');    // search through items
++              
++              $query = 'SELECT bshortname, cname, mname, ititle, ibody, idraft, inumber, itime'
++                     . ' FROM '.sql_table('item').', '.sql_table('blog') . ', '.sql_table('member') . ', '.sql_table('category')
++                     . ' WHERE iauthor='. $member->getID() .' and iauthor=mnumber and iblog=bnumber and icat=catid';
++              
++              if ( $search )
++              {
++                      $query .= " and ((ititle LIKE " . DB::quoteValue('%'.$search.'%') . ") or (ibody LIKE " . DB::quoteValue('%'.$search.'%') . ") or (imore LIKE " . DB::quoteValue('%'.$search.'%') . "))";
++              }
++              
++              $query .= ' ORDER BY itime DESC'
++                      . " LIMIT $start, $amount";
++              
++              $template['content'] = 'itemlist';
++              $template['now'] = time();
++              
++              $manager->loadClass("ENCAPSULATE");
++              $navList = new NavList('browseownitems', $start, $amount, 0, 1000, /*$blogid*/ 0, $search, 0);
++              $navList->showBatchList('item',$query,'table',$template);
++              
++              $this->pagefoot();
++=======
++      static private function action_categorydeleteconfirm()
++      {
++              global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               $catid  = intRequestVar('catid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $error = self::deleteOneCategory($catid);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
+               
+               self::action_blogsettings();
+               return;
+       }
+       
+       /**
+        * Admin::deleteOneCategory()
+        * Delete a category by its id
+        * 
+        * @param       String  $catid  category id for deleting
+        * @return      Void
+        */
+       static public function deleteOneCategory($catid)
+       {
+               global $manager, $member;
+               
+               $catid  = intval($catid);
+               $blogid = getBlogIDFromCatID($catid);
+               
+               if ( !$member->blogAdminRights($blogid) )
+               {
+                       return ERROR_DISALLOWED;
+               }
+               
+               // get blog
+               $blog =& $manager->getBlog($blogid);
+               
+               // check if the category is valid
+               if ( !$blog || !$blog->isValidCategory($catid) )
+               {
+                       return _ERROR_NOSUCHCATEGORY;
+               }
+               
+               $destcatid = $blog->getDefaultCategory();
+               
+               // don't allow deletion of default category
+               if ( $blog->getDefaultCategory() == $catid )
+               {
+                       return _ERROR_DELETEDEFCATEGORY;
+               }
+               
+               // check if catid is the only category left for blogid
+               $query = "SELECT catid FROM %s WHERE cblog=%d;";
+               $query = sprintf($query, sql_table('category'), (integer) $blogid);
+               
+               $res = DB::getResult($query);
+               if ( $res->rowCount() == 1 )
+               {
+                       return _ERROR_DELETELASTCATEGORY;
+               }
+               
+               $data = array('catid' => $catid);
+               $manager->notify('PreDeleteCategory', $data);
+               
+               // change category for all items to the default category
+               $query = "UPDATE %s SET icat=%d WHERE icat=%d;";
+               $query =sprintf($query, sql_table('item'), (integer) $destcatid, (integer) $catid);
+               DB::execute($query);
+               
+               // delete all associated plugin options
+               NucleusPlugin::delete_option_values('category', (integer) $catid);
+               
+               // delete category
+               $query = "DELETE FROM %s WHERE catid=%d;";
+               $query = sprintf($query, sql_table('category'), (integer) $catid);
+               DB::execute($query);
+               
+               $data = array('catid' => $catid);
+               $manager->notify('PostDeleteCategory', $data);
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_itemcommentlist()
++       * 
++       * Show all the comments for a given item
++       * @param       integer $itemid ID for item
++       * @return      void
++       */
++      public function action_itemcommentlist($itemid = '')
++      {
++              global $member, $manager, $CONF;
++              
++              if ( $itemid == '' )
++              {
++                      $itemid = intRequestVar('itemid');
++              }
++              
++              // only allow if user is allowed to alter item
++              $member->canAlterItem($itemid) or $this->disallow();
++              
++              $blogid = getBlogIdFromItemId($itemid);
++              
++              $this->pagehead();
++              
++              // start index
++              if ( postVar('start') )
++              {
++                      $start = intPostVar('start');
++              }
++              else
++              {
++                      $start = 0;
++              }
++              
++              // amount of items to show
++              if ( postVar('amount') )
++              {
++                      $amount = intPostVar('amount');
++              }
++              else
++              {
++                      $amount = (integer) $CONF['DefaultListSize'];
++                      if ( $amount < 1 )
++                      {
++                              $amount = 10;
++                      }
++              }
++              
++              $search = postVar('search');
++              
++              echo '<p>(<a href="index.php?action=itemlist&amp;blogid=' . $blogid . '">' . _BACKTOOVERVIEW . "</a>)</p>\n";
++              echo '<h2>',_COMMENTS,'</h2>';
++              
++              $query = 'SELECT cbody, cuser, cmail, cemail, mname, ctime, chost, cnumber, cip, citem FROM ' . sql_table('comment') . ' LEFT OUTER JOIN ' . sql_table('member') . ' ON mnumber = cmember WHERE citem = ' . $itemid;
++              
++              if ( $search )
++              {
++                      $query .= " and cbody LIKE " . DB::quoteValue('%'.$search.'%');
++              }
++              
++              $query .= ' ORDER BY ctime ASC'
++                      . " LIMIT $start,$amount";
++              
++              $template['content'] = 'commentlist';
++              $template['canAddBan'] = $member->blogAdminRights(getBlogIDFromItemID($itemid));
++              
++              $manager->loadClass("ENCAPSULATE");
++              $navList = new NavList('itemcommentlist', $start, $amount, 0, 1000, 0, $search, $itemid);
++              $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS);
++              
++              $this->pagefoot();
++=======
+        * Admin::moveOneCategory()
+        * Delete a category by its id
+        * 
+        * @param       int     $catid          category id for move
+        * @param       int     $destblogid     blog id for destination
+        * @return      void
+        */
+       static public function moveOneCategory($catid, $destblogid)
+       {
+               global $manager, $member;
+               $catid      = intval($catid);
+               $destblogid = intval($destblogid);
+               $blogid     = getBlogIDFromCatID($catid);
+               // mover should have admin rights on both blogs
+               if (!$member->blogAdminRights($blogid)) {
+                       return _ERROR_DISALLOWED;
+               }
+               if (!$member->blogAdminRights($destblogid)) {
+                       return _ERROR_DISALLOWED;
+               }
+               // cannot move to self
+               if ($blogid == $destblogid) {
+                       return _ERROR_MOVETOSELF;
+               }
+               // get blogs
+               $blog     =& $manager->getBlog($blogid);
+               $destblog =& $manager->getBlog($destblogid);
+               // check if the category is valid
+               if (!$blog || !$blog->isValidCategory($catid)) {
+                       return _ERROR_NOSUCHCATEGORY;
+               }
+               // don't allow default category to be moved
+               if ($blog->getDefaultCategory() == $catid) {
+                       return _ERROR_MOVEDEFCATEGORY;
+               }
+               $data = array(
+                       'catid'                 => &$catid,
+                       'sourceblog'    => &$blog,
+                       'destblog'              => &$destblog
+               );
+               $manager->notify('PreMoveCategory', $data);
+               // update comments table (cblog)
+               $query = 'SELECT '
+               . '    inumber '
+               . 'FROM '
+               .      sql_table('item') . ' '
+               . 'WHERE '
+               . '    icat = %d';
+               $items = sql_query(sprintf($query, $catid));
+               while ($oItem = sql_fetch_object($items)) {
+                       $query = 'UPDATE '
+                       .      sql_table('comment') . ' '
+                       . 'SET '
+                       . '    cblog = %d' . ' '
+                       . 'WHERE '
+                       . '    citem = %d';
+                       sql_query(sprintf($query, $destblogid, $oItem->inumber));
+               }
+       
+               // update items (iblog)
+               $query = 'UPDATE '
+               .      sql_table('item') . ' '
+               . 'SET '
+               . '    iblog = %d '
+               . 'WHERE '
+               . '    icat = %d';
+               sql_query(sprintf($query, $destblogid, $catid));
+       
+               // move category
+               $query = 'UPDATE '
+               .      sql_table('category') . ' '
+               . 'SET '
+               . '    cblog = %d' . ' '
+               . 'WHERE '
+               . '    catid = %d';
+               sql_query(sprintf($query, $destblogid, $catid));
+               
+               $data = array(
+                       'catid'                 => &$catid,
+                       'sourceblog'    => &$blog,
+                       'destblog'              =>  $destblog
+               );
+               $manager->notify('PostMoveCategory', $data);
+               return;
+       }
+       /**
+        * Admin::action_blogsettingsupdate
+        * Updating blog settings
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       static private function action_blogsettingsupdate()
+       {
+               global $member, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $blog =& $manager->getBlog($blogid);
+               
+               $notify_address = trim(postVar('notify'));
+               $shortname              = trim(postVar('shortname'));
+               $updatefile             = trim(postVar('update'));
+               
+               $notifyComment  = intPostVar('notifyComment');
+               $notifyVote             = intPostVar('notifyVote');
+               $notifyNewItem  = intPostVar('notifyNewItem');
+               
+               if ( $notifyComment == 0 )
+               {
+                       $notifyComment = 1;
+               }
+               if ( $notifyVote == 0 )
+               {
+                       $notifyVote = 1;
+               }
+               if ( $notifyNewItem == 0 )
+               {
+                       $notifyNewItem = 1;
+               }
+               $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
+               
+               if ( $notify_address && !NOTIFICATION::address_validation($notify_address) )
+               {
+                       self::error(_ERROR_BADNOTIFY);
+                       return;
+               }
+               
+               if ( !isValidShortName($shortname) )
+               {
+                       self::error(_ERROR_BADSHORTBLOGNAME);
+                       return;
+               }
+               
+               if ( ($blog->getShortName() != $shortname) && $manager->existsBlog($shortname) )
+               {
+                       self::error(_ERROR_DUPSHORTBLOGNAME);
+                       return;
+               }
+               // check if update file is writable
+               if ( $updatefile && !is_writeable($updatefile) )
+               {
+                       self::error(_ERROR_UPDATEFILE);
+                       return;
+               }
+               
+               $blog->setName(trim(postVar('name')));
+               $blog->setShortName($shortname);
+               $blog->setNotifyAddress($notify_address);
+               $blog->setNotifyType($notifyType);
+               $blog->setMaxComments(postVar('maxcomments'));
+               $blog->setCommentsEnabled(postVar('comments'));
+               $blog->setTimeOffset(postVar('timeoffset'));
+               $blog->setUpdateFile($updatefile);
+               $blog->setURL(trim(postVar('url')));
+               $blog->setDefaultSkin(intPostVar('defskin'));
+               $blog->setDescription(trim(postVar('desc')));
+               $blog->setPublic(postVar('public'));
+               $blog->setConvertBreaks(intPostVar('convertbreaks'));
+               $blog->setAllowPastPosting(intPostVar('allowpastposting'));
+               $blog->setDefaultCategory(intPostVar('defcat'));
+               $blog->setSearchable(intPostVar('searchable'));
+               $blog->setEmailRequired(intPostVar('reqemail'));
+               $blog->writeSettings();
+               
+               // store plugin options
+               $aOptions = requestArray('plugoption');
+               NucleusPlugin::apply_plugin_options($aOptions);
+               
+               $data = array(
+                       'context' => 'blog',
+                       'blogid'  => $blogid,
+                       'blog'    => &$blog
+               );
+               $manager->notify('PostPluginOptionsUpdate', $data);
+               
+               self::action_overview(_MSG_SETTINGSCHANGED);
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_browseowncomments()
++       * Browse own comments
++=======
+        * Admin::action_deleteblog()
++>>>>>>> skinnable-master
+        * 
+        * @param       void
+        * @return      void
+        */
++<<<<<<< HEAD
++      public function action_browseowncomments()
++      {
++              global $member, $manager, $CONF;
++              
++              // start index
++              if ( postVar('start') )
++              {
++                      $start = intPostVar('start');
++              }
++              else
++              {
++                      $start = 0;
++              }
++              
++              // amount of items to show
++              if ( postVar('amount') )
++              {
++                      $amount = intPostVar('amount');
++              }
++              else
++              {
++                      $amount = intval($CONF['DefaultListSize']);
++                      if ( $amount < 1 )
++                      {
++                              $amount = 10;
++                      }
++              }
++              
++              $search = postVar('search');
++              
++              $query =  'SELECT cbody, cuser, cmail, mname, ctime, chost, cnumber, cip, citem FROM '.sql_table('comment').' LEFT OUTER JOIN '.sql_table('member').' ON mnumber=cmember WHERE cmember=' . $member->getID();
++              
++              if ( $search )
++              {
++                      $query .= " and cbody LIKE " . DB::quoteValue('%'.$search.'%');
++              }
++              
++              $query .= ' ORDER BY ctime DESC'
++                      . " LIMIT $start,$amount";
++              
++              $this->pagehead();
++              
++              echo '<p><a href="index.php?action=overview">(' . _BACKHOME . ")</a></p>\n";
++              echo '<h2>' . _COMMENTS_YOUR . "</h2>\n";
++              
++              $template['content'] = 'commentlist';
++              $template['canAddBan'] = 0; // doesn't make sense to allow banning yourself
++              
++              $manager->loadClass("ENCAPSULATE");
++              $navList = new NavList('browseowncomments', $start, $amount, 0, 1000, 0, $search, 0);
++              $navList->showBatchList('comment',$query,'table',$template,_NOCOMMENTS_YOUR);
++              
++              $this->pagefoot();
++=======
+       static private function action_deleteblog()
+       {
+               global $member, $CONF, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               // check if blog is default blog
+               if ( $CONF['DefaultBlog'] == $blogid )
+               {
+                       self::error(_ERROR_DELDEFBLOG);
+                       return;
+               }
+               
+               $blog =& $manager->getBlog($blogid);
+               
+               self::$skin->parse('deleteblog');
+               return;
+       }
+       
+       /**
+        * Admin::action_deleteblogconfirm()
+        * Delete Blog
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       static private function action_deleteblogconfirm()
+       {
+               global $member, $CONF, $manager;
+               
+               $blogid = intRequestVar('blogid');
+               
+               $data = array('blogid' => $blogid);
+               $manager->notify('PreDeleteBlog', $data);
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               // check if blog is default blog
+               if ( $CONF['DefaultBlog'] == $blogid )
+               {
+                       self::error(_ERROR_DELDEFBLOG);
+                       return;
+               }
+               
+               // delete all comments
+               $query = 'DELETE FROM ' . sql_table('comment') . ' WHERE cblog='.$blogid;
+               DB::execute($query);
+               
+               // delete all items
+               $query = 'DELETE FROM ' . sql_table('item') . ' WHERE iblog=' . $blogid;
+               DB::execute($query);
+               
+               // delete all team members
+               $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tblog=' . $blogid;
+               DB::execute($query);
+               
+               // delete all bans
+               $query = 'DELETE FROM ' . sql_table('ban') . ' WHERE blogid=' . $blogid;
+               DB::execute($query);
+               
+               // delete all categories
+               $query = 'DELETE FROM ' . sql_table('category') . ' WHERE cblog=' . $blogid;
+               DB::execute($query);
+               
+               // delete all associated plugin options
+               NucleusPlugin::delete_option_values('blog', $blogid);
+               
+               // delete the blog itself
+               $query = 'DELETE FROM ' . sql_table('blog') . ' WHERE bnumber=' . $blogid;
+               DB::execute($query);
+               
+               $data = array('blogid' => $blogid);
+               $manager->notify('PostDeleteBlog', $data);
+               
+               self::action_overview(_DELETED_BLOG);
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_blogcommentlist()
++       * 
++       * Browse all comments for a weblog
++       * @param       integer $blogid ID for weblog
++       * @return      void
++       */
++      function action_blogcommentlist($blogid = '')
++      {
++              global $member, $manager, $CONF;
++              
++              if ( $blogid == '' )
++              {
++                      $blogid = intRequestVar('blogid');
++              }
++              else
++              {
++                      $blogid = intval($blogid);
++              }
++              
++              $member->teamRights($blogid) or $member->isAdmin() or $this->disallow();
++              
++              // start index
++              if ( postVar('start') )
++              {
++                      $start = intPostVar('start');
++              }
++              else
++              {
++                      $start = 0;
++              }
++              
++              // amount of items to show
++              if ( postVar('amount') )
++              {
++                      $amount = intPostVar('amount');
++              }
++              else
++              {
++                      $amount = intval($CONF['DefaultListSize']);
++                      if ( $amount < 1 )
++                      {
++                              $amount = 10;
++                      }
++              }
++              
++              $search = postVar('search');            // search through comments
++              
++              $query =  'SELECT cbody, cuser, cemail, cmail, mname, ctime, chost, cnumber, cip, citem FROM '.sql_table('comment').' LEFT OUTER JOIN '.sql_table('member').' ON mnumber=cmember WHERE cblog=' . intval($blogid);
++              
++              if ( $search != '' )
++              {
++                      $query .= " and cbody LIKE " . DB::quoteValue('%'.$search.'%');
++              }
++              
++              $query .= ' ORDER BY ctime DESC'
++                      . " LIMIT $start,$amount";
++              
++              $blog =& $manager->getBlog($blogid);
++              
++              $this->pagehead();
++              
++              echo '<p><a href="index.php?action=overview">(' . _BACKHOME . ")</a></p>\n";
++              echo '<h2>', _COMMENTS_BLOG , ' ' , $this->bloglink($blog), '</h2>';
++              
++              $template['content'] = 'commentlist';
++              $template['canAddBan'] = $member->blogAdminRights($blogid);
++              
++              $manager->loadClass("ENCAPSULATE");
++              $navList = new NavList('blogcommentlist', $start, $amount, 0, 1000, $blogid, $search, 0);
++              $navList->showBatchList('comment',$query,'table',$template, _NOCOMMENTS_BLOG);
++              
++              $this->pagefoot();
++=======
+        * Admin::action_memberdelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_memberdelete()
+       {
+               global $member, $manager;
+               
+               $memberid = intRequestVar('memberid');
+               
+               ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+               
+               $mem =& $manager->getMember($memberid);
+               
+               self::$skin->parse('memberdelete');
+               return;
+       }
+       
+       /**
+        * Admin::action_memberdeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_memberdeleteconfirm()
+       {
+               global $member;
+               
+               $memberid = intRequestVar('memberid');
+               
+               ($member->getID() == $memberid) or $member->isAdmin() or self::disallow();
+               
+               $error = self::deleteOneMember($memberid);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
+               
+               if ( $member->isAdmin() )
+               {
+                       self::action_usermanagement();
+                       return;
+               }
+               else
+               {
+                       self::action_overview(_DELETED_MEMBER);
+                       return;
+               }
+               return;
+       }
+       
+       /**
+        * Admin::deleteOneMember()
+        * Delete a member by id
+        * 
+        * @static
+        * @params      Integer $memberid       member id
+        * @return      String  null string or error messages
+        */
+       static public function deleteOneMember($memberid)
+       {
+               global $manager;
+               
+               $memberid = intval($memberid);
+               $mem =& $manager->getMember($memberid);
+               
+               if ( !$mem->canBeDeleted() )
+               {
+                       return _ERROR_DELETEMEMBER;
+               }
+               
+               $data = array('member' => &$mem);
+               $manager->notify('PreDeleteMember', $data);
+               
+               /* unlink comments from memberid */
+               if ( $memberid )
+               {
+                       $query = "UPDATE %s SET cmember=0, cuser=%s WHERE cmember=%d;";
+                       $query = sprintf($query, sql_table('comment'), DB::quoteValue($mem->getDisplayName()), $memberid);
+                       DB::execute($query);
+               }
+               
+               $query = 'DELETE FROM ' . sql_table('member') . ' WHERE mnumber=' . $memberid;
+               DB::execute($query);
+               
+               $query = 'DELETE FROM ' . sql_table('team') . ' WHERE tmember=' . $memberid;
+               DB::execute($query);
+               
+               $query = 'DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . $memberid;
+               DB::execute($query);
+               
+               // delete all associated plugin options
+               NucleusPlugin::delete_option_values('member', $memberid);
+               
+               $data = array('member' => &$mem);
+               $manager->notify('PostDeleteMember', $data);
+               
+               return '';
+       }
+       
+       /**
+        * Admin::action_createnewlog()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_createnewlog()
+       {
+               global $member, $CONF, $manager;
+               
+               // Only Super-Admins can do this
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('createnewlog');
+               return;
+       }
+       
+       /**
+        * Admin::action_addnewlog()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_addnewlog()
+       {
+               global $member, $manager, $CONF;
+               
+               // Only Super-Admins can do this
+               $member->isAdmin() or self::disallow();
+               
+               $bname                  = trim(postVar('name'));
+               $bshortname             = trim(postVar('shortname'));
+               $btimeoffset    = postVar('timeoffset');
+               $bdesc                  = trim(postVar('desc'));
+               $bdefskin               = postVar('defskin');
+               
+               if ( !isValidShortName($bshortname) )
+               {
+                       self::error(_ERROR_BADSHORTBLOGNAME);
+                       return;
+               }
+               
+               if ( $manager->existsBlog($bshortname) )
+               {
+                       self::error(_ERROR_DUPSHORTBLOGNAME);
+                       return;
+               }
+               
+               $data = array(
+                       'name'        => &$bname,
+                       'shortname'   => &$bshortname,
+                       'timeoffset'  => &$btimeoffset,
+                       'description' => &$bdesc,
+                       'defaultskin' => &$bdefskin
+               );
+               $manager->notify('PreAddBlog', $data);
+               
+               // add slashes for sql queries
+               $bname                  = DB::quoteValue($bname);
+               $bshortname             = DB::quoteValue($bshortname);
+               $btimeoffset    = DB::quoteValue($btimeoffset);
+               $bdesc                  = DB::quoteValue($bdesc);
+               $bdefskin               = DB::quoteValue($bdefskin);
+               
+               // create blog
+               $query = "INSERT INTO %s (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES (%s, %s, %s, %s, %s);";
+               $query = sprintf($query, sql_table('blog'), $bname, $bshortname, $bdesc, $btimeoffset, $bdefskin);
+               DB::execute($query);
+               
+               $blogid = DB::getInsertId();
+               $blog   =& $manager->getBlog($blogid);
+               
+               // create new category
+               $catdefname = (!defined('_EBLOGDEFAULTCATEGORY_NAME') ? 'General' : _EBLOGDEFAULTCATEGORY_NAME);
+               $catdefdesc = (!defined('_EBLOGDEFAULTCATEGORY_DESC') ? 'Items that do not fit in other categories' : _EBLOGDEFAULTCATEGORY_DESC);
+               
+               $query = 'INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)';
+               DB::execute(sprintf($query, sql_table('category'), (integer) $blogid, DB::quoteValue($catdefname), DB::quoteValue($catdefdesc)));
+               $catid = DB::getInsertId();
+               
+               // set as default category
+               $blog->setDefaultCategory($catid);
+               $blog->writeSettings();
+               
+               // create team member
+               $query = "INSERT INTO %s (tmember, tblog, tadmin) VALUES (%d, %d, 1);";
+               $query = sprintf($query, sql_table('team'), (integer) $member->getID(), (integer) $blogid);
+               DB::execute($query);
+               
+               $itemdeftitle = (defined('_EBLOG_FIRSTITEM_TITLE') ? _EBLOG_FIRSTITEM_TITLE : 'First Item');
+               $itemdefbody  = (defined('_EBLOG_FIRSTITEM_BODY')  ? _EBLOG_FIRSTITEM_BODY  : 'This is the first item in your weblog. Feel free to delete it.');
+               
+               $blog->additem(
+                       $blog->getDefaultCategory(),
+                       $itemdeftitle,$itemdefbody,
+                       '',
+                       $blogid,
+                       $member->getID(),
+                       $blog->getCorrectTime(),
+                       0,
+                       0,
+                       0
+               );
+               
+               $data = array('blog' => &$blog);
+               $manager->notify('PostAddBlog', $data);
+               
+               $data = array(
+                       'blog'                  => &$blog,
+                       'name'                  => _EBLOGDEFAULTCATEGORY_NAME,
+                       'description'   => _EBLOGDEFAULTCATEGORY_DESC,
+                       'catid'                 => $catid
+               );
+               $manager->notify('PostAddCategory', $data);
+               
+               /* TODO: we should consider to use the other way insterad of this */
+               $_REQUEST['blogid'] = $blogid;
+               $_REQUEST['catid']  = $catid;
+               self::$skin->parse('addnewlog');
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_createitem()
++       * Provide a page to item a new item to the given blog
++=======
+        * Admin::action_addnewlog2()
++>>>>>>> skinnable-master
+        * 
+        * @param       void
+        * @return      void
+        */
++<<<<<<< HEAD
++      public function action_createitem()
++      {
++              global $member, $manager;
++              
++              $blogid = intRequestVar('blogid');
++              
++              // check if allowed
++              $member->teamRights($blogid) or $this->disallow();
++              
++              $memberid = $member->getID();
++              
++              $blog =& $manager->getBlog($blogid);
++              
++              // generate the add-item form
++              $handler = new PageFactory($blog);
++              
++              $contents = $handler->getTemplateFor('admin', 'add');
++              $manager->notify('PreAddItemForm', array('contents' => &$contents, 'blog' => &$blog));
++              
++              $parser = new Parser($handler);
++              
++              $this->pagehead();
++              $parser->parse($contents);
++              $this->pagefoot();
++              
++=======
+       static private function action_addnewlog2()
+       {
+               global $member, $manager;
+               $blogid = intRequestVar('blogid');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               $burl = requestVar('url');
+               
+               $blog =& $manager->getBlog($blogid);
+               $blog->setURL(trim($burl));
+               $blog->writeSettings();
+               
+               self::action_overview(_MSG_NEWBLOG);
+               return;
+       }
+       
+       /**
+        * Admin::action_skinieoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skinieoverview()
+       {
+               global $member, $DIR_LIBS, $manager;
+               
+               $member->isAdmin() or self::disallow();
+               
+               include_once($DIR_LIBS . 'skinie.php');
+               
+               self::$skin->parse('skinieoverview');
++>>>>>>> skinnable-master
+               return;
+       }
+       
+       /**
++<<<<<<< HEAD
++       * Admin::action_itemedit()
++=======
+        * Admin::action_skinieimport()
++>>>>>>> skinnable-master
+        * 
+        * @param       void
+        * @return      void
+        */
++<<<<<<< HEAD
++      public function action_itemedit()
++      {
++              global $member, $manager;
++              
++              $itemid = intRequestVar('itemid');
++              
++              // only allow if user is allowed to alter item
++              $member->canAlterItem($itemid) or $this->disallow();
++              
++              $variables =& $manager->getItem($itemid, 1, 1);
++              $blog =& $manager->getBlog(getBlogIDFromItemID($itemid));
++              
++              $manager->notify('PrepareItemForEdit', array('item' => &$variables));
++              
++              if ( $blog->convertBreaks() )
++              {
++                      $variables['body'] = removeBreaks($variables['body']);
++                      $variables['more'] = removeBreaks($variables['more']);
++              }
++              
++              // form to edit blog items
++              $handler = new PageFactory($blog);
++              $handler->setVariables($variables);
++              
++              $content = $handler->getTemplateFor('admin', 'edit');
++              
++              $parser = new Parser($handler);
++              
++              $this->pagehead();
++              $parser->parse($content);
++              $this->pagefoot();
++              return;
++      }
++      
++    /**
++     * @todo document this
++     */
++    function action_itemupdate() {
++        global $member, $manager, $CONF;
++
++        $itemid = intRequestVar('itemid');
++        $catid = postVar('catid');
++
++        // only allow if user is allowed to alter item
++        $member->canUpdateItem($itemid, $catid) or $this->disallow();
++
 +        $actiontype = postVar('actiontype');
 +
 +        // delete actions are handled by itemdelete (which has confirmation)
 +        if ($actiontype == 'delete') {
 +            $this->action_itemdelete();
 +            return;
 +        }
 +
 +        $body   = postVar('body');
 +        $title  = postVar('title');
 +        $more   = postVar('more');
 +        $closed = intPostVar('closed');
 +        $draftid = intPostVar('draftid');
 +
 +        // default action = add now
 +        if (!$actiontype)
 +            $actiontype='addnow';
 +
 +        // create new category if needed
 +        if ( i18n::strpos($catid,'newcat') === 0 ) {
 +            // get blogid
 +            list($blogid) = sscanf($catid,"newcat-%d");
 +
 +            // create
 +            $blog =& $manager->getBlog($blogid);
 +            $catid = $blog->createNewCategory();
 +
 +            // show error when sth goes wrong
 +            if (!$catid)
 +                $this->doError(_ERROR_CATCREATEFAIL);
 +        }
 +
 +        /*
 +            set some variables based on actiontype
 +
 +            actiontypes:
 +                draft items -> addnow, addfuture, adddraft, delete
 +                non-draft items -> edit, changedate, delete
 +
 +            variables set:
 +                $timestamp: set to a nonzero value for future dates or date changes
 +                $wasdraft: set to 1 when the item used to be a draft item
 +                $publish: set to 1 when the edited item is not a draft
 +        */
 +        $blogid =  getBlogIDFromItemID($itemid);
 +        $blog   =& $manager->getBlog($blogid);
 +
 +        $wasdrafts = array('adddraft', 'addfuture', 'addnow');
 +        $wasdraft  = in_array($actiontype, $wasdrafts) ? 1 : 0;
 +        $publish   = ($actiontype != 'adddraft' && $actiontype != 'backtodrafts') ? 1 : 0;
 +        if ($actiontype == 'addfuture' || $actiontype == 'changedate') {
 +            $timestamp = mktime(intPostVar('hour'), intPostVar('minutes'), 0, intPostVar('month'), intPostVar('day'), intPostVar('year'));
 +        } else {
 +            $timestamp =0;
 +        }
 +
 +        // edit the item for real
 +        Item::update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp);
 +
 +        $this->updateFuturePosted($blogid);
 +
 +        if ($draftid > 0) {
 +            // delete permission is checked inside Item::delete()
 +            Item::delete($draftid);
 +        }
 +
 +        // show category edit window when we created a new category
 +        // ($catid will then be a new category ID, while postVar('catid') will be 'newcat-x')
 +        if ($catid != intPostVar('catid')) {
 +            $this->action_categoryedit(
 +                $catid,
 +                $blog->getID(),
 +                $CONF['AdminURL'] . 'index.php?action=itemlist&blogid=' . getBlogIDFromItemID($itemid)
 +            );
 +        } else {
 +            // TODO: set start item correctly for itemlist
 +            $this->action_itemlist(getBlogIDFromItemID($itemid));
 +        }
 +    }
++=======
+       static private function action_skinieimport()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $skinFileRaw = postVar('skinfile');
+               $mode = postVar('mode');
+               
+               $error = self::skinieimport($mode, $skinFileRaw);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
+               
+               self::$skin->parse('skinieimport');
+               return;
+       }
        
        /**
-        * Admin::action_itemdelete()
-        * Delete item
+        * Admin::action_skiniedoimport()
         * 
-        * @param       Void
-        * @return      Void
+        * @param       void
+        * @return      void
+        */
+       static private function action_skiniedoimport()
+       {
+               global $member, $DIR_LIBS, $DIR_SKINS;
+               
+               $member->isAdmin() or self::disallow();
+               
+               // load skinie class
+               include_once($DIR_LIBS . 'skinie.php');
+               
+               $mode = postVar('mode');
+               $skinFileRaw = postVar('skinfile');
+               $allowOverwrite = intPostVar('overwrite');
+               
+               $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);
+               if ( $error )
+               {
+                       self::error($msg);
+                       return;
+               }
+               
+               self::$skin->parse('skiniedoimport');
+               return;
+       }
+       
+       /**
+        * Admin::action_skinieexport()
+        * 
+        * @param       void
+        * @return      void
         */
-       function action_itemdelete()
+       static private function action_skinieexport()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $aSkins = requestIntArray('skin');
+               $aTemplates = requestIntArray('template');
+               $info = postVar('info');
+               
+               self::skinieexport($aSkins, $aTemplates, $info);
+               
+               return;
+       }
+       
+       /**
+        * Admin::action_templateoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_templateoverview()
        {
                global $member, $manager;
                
                return;
        }
        
-     /**
-      * @todo document this
-      */
-     function action_itemdeleteconfirm() {
-         global $member;
-         $itemid = intRequestVar('itemid');
-         // only allow if user is allowed to alter item
-         $member->canAlterItem($itemid) or $this->disallow();
-         // get blogid first
-         $blogid = getBlogIdFromItemId($itemid);
-         // delete item (note: some checks will be performed twice)
-         $this->deleteOneItem($itemid);
-         $this->action_itemlist($blogid);
-     }
-     /**
-      * Deletes one item and returns error if something goes wrong
-      * @param int $itemid
-      */
-     function deleteOneItem($itemid) {
-         global $member, $manager;
-         // only allow if user is allowed to alter item (also checks if itemid exists)
-         if (!$member->canAlterItem($itemid))
-             return _ERROR_DISALLOWED;
-         // need to get blogid before the item is deleted
-         $blogid = getBlogIDFromItemId($itemid);
-         $manager->loadClass('ITEM');
-         Item::delete($itemid);
-         // update blog's futureposted
-         $this->updateFuturePosted($blogid);
-     }
        /**
-        * Admin::updateFuturePosted()
-        * Update a blog's future posted flag
+        * Admin::addToTemplate()
         * 
-        * @param integer $blogid
+        * @param       Integer $id     ID for template
+        * @param       String  $partname       parts name
+        * @param       String  $content        template contents
+        * @return      Integer record index
+        * 
+        */
+       static private function addToTemplate($id, $partname, $content)
+       {
+               // don't add empty parts:
+               if ( !trim($content) )
+               {
+                       return -1;
+               }
+               
+               $query = "INSERT INTO %s (tdesc, tpartname, tcontent) VALUES (%d, %s, %s);";
+               $query = sprintf($query, sql_table('template'), (integer) $id, DB::quoteValue($partname), DB::quoteValue($content));
+               if ( DB::execute($query) === FALSE )
+               {
+                       $err = DB::getError();
+                       exit(_ADMIN_SQLDIE_QUERYERROR . $err[2]);
+               }
+               return DB::getInsertId();
+       }
+       
+       /**
+        * Admin::action_templatedelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_templatedelete()
+       {
+               global $member, $manager;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $templateid = intRequestVar('templateid');
+               // TODO: check if template can be deleted
+               
+               self::$skin->parse('templatedelete');
+               return;
+       }
++>>>>>>> skinnable-master
+       
+       /**
+        * Admin::action_templatedeleteconfirm()
+        * 
+        * @param       void
         * @return      void
+        */
+       static private function action_templatedeleteconfirm()
+       {
+               global $member, $manager;
+               
+               $templateid = intRequestVar('templateid');
+               
+               $member->isAdmin() or self::disallow();
+               
+               $data = array('templateid' => $templateid);
+               $manager->notify('PreDeleteTemplate', $data);
+               
+               // 1. delete description
+               DB::execute('DELETE FROM ' . sql_table('template_desc') . ' WHERE tdnumber=' . $templateid);
+               
+               // 2. delete parts
+               DB::execute('DELETE FROM ' . sql_table('template') . ' WHERE tdesc=' . $templateid);
+               
+               
+               $data = array('templateid' => $templateid);
+               $manager->notify('PostDeleteTemplate', $data);
+               
+               self::action_templateoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_templatenew()
         * 
+        * @param       void
+        * @return      void
         */
-       function updateFuturePosted($blogid)
+       static private function action_templatenew()
        {
-               global $manager;
+               global $member;
                
-               $blog =& $manager->getBlog($blogid);
-               $currenttime = $blog->getCorrectTime(time());
+               $member->isAdmin() or self::disallow();
                
++<<<<<<< HEAD
 +              $query = "SELECT * FROM %s WHERE iblog=%d AND iposted=0 AND itime>%s";
 +              $query = sprintf($query, sql_table('item'), (integer) $blogid, DB::formatDateTime($currenttime));
 +              $result = DB::getResult($query);
 +              
 +              if ( $result->rowCount() > 0 )
++=======
+               $name = postVar('name');
+               $desc = postVar('desc');
+               
+               if ( !isValidTemplateName($name) )
++>>>>>>> skinnable-master
                {
-                               $blog->setFuturePost();
+                       self::error(_ERROR_BADTEMPLATENAME);
+                       return;
                }
-               else
+               
+               if ( Template::exists($name) )
                {
-                               $blog->clearFuturePost();
+                       self::error(_ERROR_DUPTEMPLATENAME);
+                       return;
                }
+               
+               $newTemplateId = Template::createNew($name, $desc);
+               
+               self::action_templateoverview();
                return;
        }
++<<<<<<< HEAD
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_itemmove() {
 +        global $member, $manager;
 +
 +        $itemid = intRequestVar('itemid');
 +
 +        // only allow if user is allowed to alter item
 +        $member->canAlterItem($itemid) or $this->disallow();
 +
 +        $item =& $manager->getItem($itemid,1,1);
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _MOVE_TITLE ?></h2>
 +            <form method="post" action="index.php"><div>
 +                <input type="hidden" name="action" value="itemmoveto" />
 +                <input type="hidden" name="itemid" value="<?php echo  $itemid; ?>" />
 +
 +                <?php
 +
 +                    $manager->addTicketHidden();
 +                    $this->selectBlogCategory('catid',$item['catid'],10,1);
 +                ?>
 +
 +                <input type="submit" value="<?php echo _MOVE_BTN ?>" tabindex="10000" onclick="return checkSubmit();" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_itemmoveto() {
 +        global $member, $manager;
 +
 +        $itemid = intRequestVar('itemid');
 +        $catid = requestVar('catid');
 +
 +        // create new category if needed
 +        if ( i18n::strpos($catid,'newcat') === 0 ) {
 +            // get blogid
 +            list($blogid) = sscanf($catid,'newcat-%d');
 +
 +            // create
 +            $blog =& $manager->getBlog($blogid);
 +            $catid = $blog->createNewCategory();
 +
 +            // show error when sth goes wrong
 +            if (!$catid)
 +                $this->doError(_ERROR_CATCREATEFAIL);
 +        }
 +
 +        // only allow if user is allowed to alter item
 +        $member->canUpdateItem($itemid, $catid) or $this->disallow();
 +
 +        $old_blogid = getBlogIDFromItemId($itemid);
 +
 +        Item::move($itemid, $catid);
 +
 +        // set the futurePosted flag on the blog
 +        $this->updateFuturePosted(getBlogIDFromItemId($itemid));
 +
 +        // reset the futurePosted in case the item is moved from one blog to another
 +        $this->updateFuturePosted($old_blogid);
 +
 +        if ($catid != intRequestVar('catid'))
 +            $this->action_categoryedit($catid, $blog->getID());
 +        else
 +            $this->action_itemlist(getBlogIDFromCatID($catid));
 +    }
 +
 +    /**
 +     * Moves one item to a given category (category existance should be checked by caller)
 +     * errors are returned
 +     * @param int $itemid
 +     * @param int $destCatid category ID to which the item will be moved
 +     */
 +    function moveOneItem($itemid, $destCatid) {
 +        global $member;
 +
 +        // only allow if user is allowed to move item
 +        if (!$member->canUpdateItem($itemid, $destCatid))
 +            return _ERROR_DISALLOWED;
 +
 +        Item::move($itemid, $destCatid);
 +    }
 +
 +    /**
 +     * Adds a item to the chosen blog
 +     */
 +    function action_additem() {
 +        global $manager, $CONF;
 +
 +        $manager->loadClass('ITEM');
 +
 +        $result = Item::createFromRequest();
 +
 +        if ($result['status'] == 'error')
 +            $this->error($result['message']);
 +
 +        $blogid = getBlogIDFromItemID($result['itemid']);
 +        $blog =& $manager->getBlog($blogid);
 +        $btimestamp = $blog->getCorrectTime();
 +        $item       = $manager->getItem(intval($result['itemid']), 1, 1);
 +
 +        if ($result['status'] == 'newcategory') {
 +            $distURI = $manager->addTicketToUrl($CONF['AdminURL'] . 'index.php?action=itemList&blogid=' . intval($blogid));
 +            $this->action_categoryedit($result['catid'], $blogid, $distURI);
 +        } else {
 +            $methodName = 'action_itemList';
 +            call_user_func(array(&$this, $methodName), $blogid);
 +        }
 +    }
 +
 +      /**
 +       * Allows to edit previously made comments
 +       **/
 +      function action_commentedit() {
 +
 +              global $member, $manager;
 +
 +              $commentid = intRequestVar('commentid');
 +
 +              $member->canAlterComment($commentid) or $this->disallow();
 +
 +              $comment = Comment::getComment($commentid);
 +
 +              $manager->notify('PrepareCommentForEdit', array('comment' => &$comment) );
 +
 +              // change <br /> to \n
 +              $comment['body'] = str_replace('<br />', '', $comment['body']);
 +
 +              // replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0
 +              /* original eregi_replace: eregi_replace("<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\") ?>[^<]*</a>", "\\1", $comment['body']) */
 +
 +        $comment['body'] = preg_replace("#<a href=['\"]([^'\"]+)['\"]( rel=\"nofollow\") ?>[^<]*</a>#i", "\\1", $comment['body']);
 +
 +        $this->pagehead();
 +
 +        ?>
 +        <h2><?php echo _EDITC_TITLE ?></h2>
 +
 +        <form action="index.php" method="post"><div>
 +
 +        <input type="hidden" name="action" value="commentupdate" />
 +        <?php $manager->addTicketHidden(); ?>
 +        <input type="hidden" name="commentid" value="<?php echo  $commentid; ?>" />
 +        <table><tr>
 +            <th colspan="2"><?php echo _EDITC_TITLE ?></th>
 +        </tr><tr>
 +            <td><?php echo _EDITC_WHO ?></td>
 +            <td>
 +            <?php               if ($comment['member'])
 +                    echo $comment['member'] . " (" . _EDITC_MEMBER . ")";
 +                else
 +                    echo $comment['user'] . " (" . _EDITC_NONMEMBER . ")";
 +            ?>
 +            </td>
 +        </tr><tr>
 +            <td><?php echo _EDITC_WHEN ?></td>
 +            <td><?php echo  date("Y-m-d @ H:i",$comment['timestamp']); ?></td>
 +        </tr><tr>
 +            <td><?php echo _EDITC_HOST ?></td>
 +            <td><?php echo  $comment['host']; ?></td>
 +        </tr>
 +        <tr>
 +            <td><?php echo _EDITC_URL; ?></td>
 +            <td><input type="text" name="url" size="30" tabindex="6" value="<?php echo $comment['userid']; ?>" /></td>
 +        </tr>
 +        <tr>
 +            <td><?php echo _EDITC_EMAIL; ?></td>
 +            <td><input type="text" name="email" size="30" tabindex="8" value="<?php echo $comment['email']; ?>" /></td>
 +        </tr>
 +        <tr>
 +            <td><?php echo _EDITC_TEXT ?></td>
 +            <td>
 +                <textarea name="body" tabindex="10" rows="10" cols="50"><?php                   // htmlspecialchars not needed (things should be escaped already)
 +                    echo $comment['body'];
 +                ?></textarea>
 +            </td>
 +        </tr><tr>
 +            <td><?php echo _EDITC_EDIT ?></td>
 +            <td><input type="submit"  tabindex="20" value="<?php echo _EDITC_EDIT ?>" onclick="return checkSubmit();" /></td>
 +        </tr></table>
 +
 +        </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_commentupdate() {
 +        global $member, $manager;
 +
 +        $commentid = intRequestVar('commentid');
 +
 +        $member->canAlterComment($commentid) or $this->disallow();
 +
 +        $url = postVar('url');
 +        $email = postVar('email');
 +        $body = postVar('body');
 +
 +              # replaced eregi() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0
 +              # original eregi: eregi("[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}", $body) != FALSE
 +              # important note that '\' must be matched with '\\\\' in preg* expressions
 +
 +              // intercept words that are too long
 +              if (preg_match('#[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}#', $body) != FALSE)
++=======
+       
+       /**
+        * Admin::action_templateclone()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_templateclone()
+       {
+               global $member;
+               
+               $templateid = intRequestVar('templateid');
+               
+               $member->isAdmin() or self::disallow();
+               
+               // 1. read old template
+               $name = Template::getNameFromId($templateid);
+               $desc = Template::getDesc($templateid);
+               
+               // 2. create desc thing
+               $name = "cloned" . $name;
+               
+               // if a template with that name already exists:
+               if ( Template::exists($name) )
++>>>>>>> skinnable-master
                {
-                       $this->error(_ERROR_COMMENT_LONGWORD);
+                       $i = 1;
+                       while (Template::exists($name . $i))
+                       {
+                               $i++;
+                       }
+                       $name .= $i;
                }
-               // check length
-               if (i18n::strlen($body) < 3)
+               
+               $newid = Template::createNew($name, $desc);
+               
+               // 3. create clone
+               // go through parts of old template and add them to the new one
+               $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";
+               $query = sprintf($query, sql_table('template'), (integer) $templateid);
+               
+               $res = DB::getResult($query);
+               foreach ( $res as $row)
                {
-                       $this->error(_ERROR_COMMENT_NOCOMMENT);
+                       self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);
                }
-               if (i18n::strlen($body) > 5000)
+               
+               self::action_templateoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_admintemplateoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_admintemplateoverview()
+       {
+               global $member;
+               $member->isAdmin() or self::disallow();
+               self::$skin->parse('admntemplateoverview');
+               return;
+       }
+       
+       /**
+        * Admin::action_admintemplateedit()
+        * 
+        * @param       string  $msg    message for pageheader
+        * @return      void
+        */
+       static private function action_admintemplateedit($msg = '')
+       {
+               global $member, $manager;
+               if ( $msg )
                {
-                       $this->error(_ERROR_COMMENT_TOOLONG);
+                       self::$headMess = $msg;
                }
 -              $member->isAdmin() or self::disallow();
 -              
++<<<<<<< HEAD
 +
 +              // prepare body
 +              $body = Comment::prepareBody($body);
 +
 +              // call plugins
 +              $manager->notify('PreUpdateComment',array('body' => &$body));
 +
 +              $query = 'UPDATE ' . sql_table('comment')
 +                      . ' SET cmail = ' . DB::quoteValue($url) . ', cemail = ' . DB::quoteValue($email) . ', cbody = ' . DB::quoteValue($body)
 +                      . ' WHERE cnumber = ' . $commentid;
 +              DB::execute($query);
 +
 +              // get itemid
 +              $res = DB::getValue('SELECT citem FROM '.sql_table('comment').' WHERE cnumber=' . $commentid);
 +              $itemid = $res;
 +
 +              if ($member->canAlterItem($itemid))
 +                      $this->action_itemcommentlist($itemid);
 +              else
 +                      $this->action_browseowncomments();
 +
 +    }
++=======
++              $member->isAdmin() or self::disallow();
++              
+               self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/templateEdit.js)%>\"></script>\n";
+               self::$extrahead .= '<script type="text/javascript">setTemplateEditText("' . Entity::hsc(_EDITTEMPLATE_EMPTY) . '");</script>' . "\n";
+               
+               self::$skin->parse('admintemplateedit');
+               return;
+       }
++>>>>>>> skinnable-master
        
        /**
-        * Admin::action_commentdelete()
-        * Update comment
+        * Admin::action_admintemplateupdate()
         * 
-        * @param       Void
-        * @return      Void
+        * @param       void
+        * @return      void
         */
-       function action_commentdelete()
+       static private function action_admintemplateupdate()
        {
                global $member, $manager;
+               $templateid = intRequestVar('templateid');
+               $member->isAdmin() or self::disallow();
+               $name = postVar('tname');
+               $desc = postVar('tdesc');
                
-               $commentid = intRequestVar('commentid');
-               $member->canAlterComment($commentid) or $this->disallow();
-               $comment = Comment::getComment($commentid);
-               
-               $body = strip_tags($comment['body']);
-               $body = Entity::hsc(Entity::shorten($body, 300, '...'));
-               
-               if ( $comment['member'] )
+               if ( !isValidTemplateName($name) )
                {
-                       $author = $comment['member'];
+                       self::error(_ERROR_BADTEMPLATENAME);
+                       return;
                }
-               else
+               
+               if ( (Template::getNameFromId($templateid) != $name) && Template::exists($name) )
                {
-                       $author = $comment['user'];
+                       self::error(_ERROR_DUPTEMPLATENAME);
+                       return;
                }
                
-               $this->pagehead();
+               // 1. Remove all template parts
+               $query = "DELETE FROM %s WHERE tdesc=%d;";
+               $query = sprintf($query, sql_table('template'), (integer) $templateid);
+               DB::execute($query);
                
-               echo '<h2>' . _DELETE_CONFIRM . "</h2>\n";
-               echo '<p>' . _CONFIRMTXT_COMMENT . "</p>\n";
-               echo "<div class=\"note\">\n";
-               echo '<b>' . _EDITC_WHO . ":</b>{$author}<br />\n";
-               echo '<b>' . _EDITC_TEXT . ":</b>{$body}\n";
-               echo "</div>\n";
-               echo "<form method=\"post\" action=\"index.php\">\n";
-               echo "<div>\n";
-               echo "<input type=\"hidden\" name=\"action\" value=\"commentdeleteconfirm\" />\n";
-               echo $manager->addTicketHidden() . "\n";
-               echo "<input type=\"hidden\" name=\"commentid\" value=\"{$commentid}\" />\n";
-               echo '<input type="submit" tabindex="10" value="'. _DELETE_CONFIRM_BTN . "\" />\n";
-               echo "</div>\n";
-               echo "</form>\n";
-               $this->pagefoot();
+               // 2. Update description
+               $query = "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d;";
+               $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $templateid);
+               DB::execute($query);
+               
+               // 3. Add non-empty template parts
+               self::addToTemplate($templateid, 'NORMALSKINLIST_HEAD',                                         postVar('NORMALSKINLIST_HEAD'));
+               self::addToTemplate($templateid, 'NORMALSKINLIST_BODY',                                         postVar('NORMALSKINLIST_BODY'));
+               self::addToTemplate($templateid, 'NORMALSKINLIST_FOOT',                                         postVar('NORMALSKINLIST_FOOT'));
+               self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ICON',                           postVar('ADMIN_CUSTOMHELPLINK_ICON'));
+               self::addToTemplate($templateid, 'ADMIN_CUSTOMHELPLINK_ANCHOR',                         postVar('ADMIN_CUSTOMHELPLINK_ANCHOR'));
+               self::addToTemplate($templateid, 'ADMIN_BLOGLINK',                                                      postVar('ADMIN_BLOGLINK'));
+               self::addToTemplate($templateid, 'ADMIN_BATCHLIST',                                                     postVar('ADMIN_BATCHLIST'));
+               self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TITLE',                                       postVar('ACTIVATE_FORGOT_TITLE'));
+               self::addToTemplate($templateid, 'ACTIVATE_FORGOT_TEXT',                                        postVar('ACTIVATE_FORGOT_TEXT'));
+               self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TITLE',                                     postVar('ACTIVATE_REGISTER_TITLE'));
+               self::addToTemplate($templateid, 'ACTIVATE_REGISTER_TEXT',                                      postVar('ACTIVATE_REGISTER_TEXT'));
+               self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TITLE',                                       postVar('ACTIVATE_CHANGE_TITLE'));
+               self::addToTemplate($templateid, 'ACTIVATE_CHANGE_TEXT',                                        postVar('ACTIVATE_CHANGE_TEXT'));
+               self::addToTemplate($templateid, 'TEMPLATE_EDIT_EXPLUGNAME',                            postVar('TEMPLATE_EDIT_EXPLUGNAME'));
+               self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_HEAD',                                      postVar('TEMPLATE_EDIT_ROW_HEAD'));
+               self::addToTemplate($templateid, 'TEMPLATE_EDIT_ROW_TAIL',                                      postVar('TEMPLATE_EDIT_ROW_TAIL'));
+               self::addToTemplate($templateid, 'SPECIALSKINLIST_HEAD',                                        postVar('SPECIALSKINLIST_HEAD'));
+               self::addToTemplate($templateid, 'SPECIALSKINLIST_BODY',                                        postVar('SPECIALSKINLIST_BODY'));
+               self::addToTemplate($templateid, 'SPECIALSKINLIST_FOOT',                                        postVar('SPECIALSKINLIST_FOOT'));
+               self::addToTemplate($templateid, 'SYSTEMINFO_GDSETTINGS',                                       postVar('SYSTEMINFO_GDSETTINGS'));
+               self::addToTemplate($templateid, 'BANLIST_DELETED_LIST',                                        postVar('BANLIST_DELETED_LIST'));
+               self::addToTemplate($templateid, 'INSERT_PLUGOPTION_TITLE',                                     postVar('INSERT_PLUGOPTION_TITLE'));
+               self::addToTemplate($templateid, 'INSERT_PLUGOPTION_BODY',                                      postVar('INSERT_PLUGOPTION_BODY'));
+               self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_ADMIN',                           postVar('INPUTYESNO_TEMPLATE_ADMIN'));
+               self::addToTemplate($templateid, 'INPUTYESNO_TEMPLATE_NORMAL',                          postVar('INPUTYESNO_TEMPLATE_NORMAL'));
+               self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_HEAD',                          postVar('ADMIN_SPECIALSKINLIST_HEAD'));
+               self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_BODY',                          postVar('ADMIN_SPECIALSKINLIST_BODY'));
+               self::addToTemplate($templateid, 'ADMIN_SPECIALSKINLIST_FOOT',                          postVar('ADMIN_SPECIALSKINLIST_FOOT'));
+               self::addToTemplate($templateid, 'SKINIE_EXPORT_LIST',                                          postVar('SKINIE_EXPORT_LIST'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_HEAD',                       postVar('SHOWLIST_LISTPLUG_SELECT_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_BODY',                       postVar('SHOWLIST_LISTPLUG_SELECT_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_SELECT_FOOT',                       postVar('SHOWLIST_LISTPLUG_SELECT_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_HEAD',                        postVar('SHOWLIST_LISTPLUG_TABLE_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BODY',                        postVar('SHOWLIST_LISTPLUG_TABLE_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_FOOT',                        postVar('SHOWLIST_LISTPLUG_TABLE_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT',       postVar('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN',       postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',       postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',       postVar('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_DRFTLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_ACTNLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD',       postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_HEAD'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY',       postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_BODY'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT',       postVar('SHOWLIST_LISTPLUG_TABLE_IBANLIST_FOOT'));
+               self::addToTemplate($templateid, 'SHOWLIST_LISTPLUG_TABLE_NAVILIST',            postVar('SHOWLIST_LISTPLUG_TABLE_NAVILIST'));
+               self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_TITLE',                                      postVar('PLUGIN_QUICKMENU_TITLE'));
+               self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_HEAD',                                       postVar('PLUGIN_QUICKMENU_HEAD'));
+               self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_BODY',                                       postVar('PLUGIN_QUICKMENU_BODY'));
+               self::addToTemplate($templateid, 'PLUGIN_QUICKMENU_FOOT',                                       postVar('PLUGIN_QUICKMENU_FOOT'));
+               
+               $data = array('fields' => array());
+               $manager->notify('AdminTemplateExtraFields', $data);
+               foreach ( $data['fields'] as $pfkey => $pfvalue )
+               {
+                       foreach ( $pfvalue as $pffield => $pfdesc )
+                       {
+                               self::addToTemplate($templateid, $pffield, postVar($pffield));
+                       }
+               }
+               
+               // jump back to template edit
+               self::action_admintemplateedit(_TEMPLATE_UPDATED);
+               return;
+       }
+       
+       /**
+        * Admin::action_admintemplatedelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_admintemplatedelete()
+       {
+               global $member, $manager;
+               $member->isAdmin() or self::disallow();
+               
+               // TODO: check if template can be deleted
+               self::$skin->parse('admintemplatedelete');
                return;
        }
        
++<<<<<<< HEAD
 +    /**
 +     * @todo document this
 +     */
 +    function action_commentdeleteconfirm() {
 +        global $member;
 +
 +        $commentid = intRequestVar('commentid');
 +
 +        // get item id first
 +        $res = DB::getValue('SELECT citem FROM '.sql_table('comment') .' WHERE cnumber=' . $commentid);
 +        $itemid = $res;
 +
 +        $error = $this->deleteOneComment($commentid);
 +        if ($error)
 +            $this->doError($error);
 +
 +        if ($member->canAlterItem($itemid))
 +            $this->action_itemcommentlist($itemid);
 +        else
 +            $this->action_browseowncomments();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function deleteOneComment($commentid) {
 +        global $member, $manager;
 +
 +        $commentid = intval($commentid);
 +
 +        if (!$member->canAlterComment($commentid))
 +            return _ERROR_DISALLOWED;
 +
 +        $manager->notify('PreDeleteComment', array('commentid' => $commentid));
 +
 +        // delete the comments associated with the item
 +        $query = 'DELETE FROM '.sql_table('comment').' WHERE cnumber=' . $commentid;
 +        DB::execute($query);
 +
 +        $manager->notify('PostDeleteComment', array('commentid' => $commentid));
 +
 +        return '';
 +    }
 +
 +      /**
 +       * Admin::action_usermanagement()
 +       * 
 +       * Usermanagement main
 +       * @param       void
 +       * @return      void
 +       */
 +      public function action_usermanagement()
 +      {
 +              global $member, $manager;
 +              
 +              // check if allowed
 +              $member->isAdmin() or $this->disallow();
 +              
 +              $this->pagehead();
 +              
 +              echo '<p><a href="index.php?action=manage">(' . _BACKTOMANAGE . ")</a></p>\n";
 +              
 +              echo '<h2>' . _MEMBERS_TITLE . "</h2>\n";
 +              
 +              echo '<h3>' . _MEMBERS_CURRENT . "</h3>\n";
 +              
 +              // show list of members with actions
 +              $query =  'SELECT * FROM '.sql_table('member');
 +              $template['content'] = 'memberlist';
 +              $template['tabindex'] = 10;
 +              
 +              $manager->loadClass("ENCAPSULATE");
 +              $batch = new Batch('member');
 +              $batch->showlist($query,'table',$template);
 +              
 +              echo '<h3>' . _MEMBERS_NEW .'</h3>';
 +              echo "<form method=\"post\" action=\"index.php\" name=\"memberedit\">\n";
 +              echo "<div>\n";
 +              echo "<input type=\"hidden\" name=\"action\" value=\"memberadd\" />\n";
 +              $manager->addTicketHidden();
 +              
 +              echo '<table frame="box" rules="rules" summary="' . _MEMBERS_NEW . '">' ."\n";
 +              echo "<tr>\n";
 +              echo '<th colspan="2">' . _MEMBERS_NEW . "</th>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_DISPLAY;
 +              help('shortnames');
 +              echo '<br />';
 +              echo '<small>' . _MEMBERS_DISPLAY_INFO . '</small>';
 +              echo "</td>\n";
 +              echo "<td><input tabindex=\"10010\" name=\"name\" size=\"32\" maxlength=\"32\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_REALNAME . "</td>\n";
 +              echo "<td><input name=\"realname\" tabindex=\"10020\" size=\"40\" maxlength=\"60\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_PWD . "</td>\n";
 +              echo "<td><input name=\"password\" tabindex=\"10030\" size=\"16\" maxlength=\"40\" type=\"password\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_REPPWD . "</td>\n";
 +              echo "<td><input name=\"repeatpassword\" tabindex=\"10035\" size=\"16\" maxlength=\"40\" type=\"password\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_EMAIL . "</td>\n";
 +              echo "<td><input name=\"email\" tabindex=\"10040\" size=\"40\" maxlength=\"60\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_URL . "</td>\n";
 +              echo "<td><input name=\"url\" tabindex=\"10050\" size=\"40\" maxlength=\"100\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_SUPERADMIN;
 +              help('superadmin');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('admin',0,10060);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_CANLOGIN;
 +              help('canlogin');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('canlogin',1,10070);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_NOTES . "</td>\n";
 +              echo "<td><input name=\"notes\" maxlength=\"100\" size=\"40\" tabindex=\"10080\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _MEMBERS_NEW . "</td>\n";
 +              echo '<td><input type="submit" value="' . _MEMBERS_NEW_BTN . '" tabindex="10090" onclick="return checkSubmit();" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "</table>\n";
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              $this->pagefoot();
 +              return;
 +      }
 +      
 +    /**
 +     * Edit member settings
 +     */
 +    function action_memberedit() {
 +        $this->action_editmembersettings(intRequestVar('memberid'));
 +    }
 +
++=======
++>>>>>>> skinnable-master
        /**
-        * @todo document this
+        * Admin::action_admintemplatedeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
         */
-       function action_editmembersettings($memberid = '') {
-               global $member, $manager, $CONF;
+       static private function action_admintemplatedeleteconfirm()
+       {
+               global $member, $manager;
                
-               if ($memberid == '')
-               {
-                       $memberid = $member->getID();
-               }
+               $templateid = intRequestVar('templateid');
+               $member->isAdmin() or self::disallow();
                
-               // check if allowed
-               ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
+               $data = array('templateid' => $templateid);
+               $manager->notify('PreDeleteAdminTemplate', $data);
                
-               $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
-               $this->pagehead($extrahead);
+               // 1. delete description
+               $query = "DELETE FROM %s WHERE tdnumber=%s;";
+               $query = sprintf($query, sql_table('template_desc'), (integer) $templateid);
+               DB::execute($query);
                
++<<<<<<< HEAD
 +              // show message to go back to member overview (only for admins)
 +              if ($member->isAdmin())
 +              {
 +                      echo '<a href="index.php?action=usermanagement">(' ._MEMBERS_BACKTOOVERVIEW. ')</a>';
 +              }
 +              else
 +              {
 +                      echo '<a href="index.php?action=overview">(' ._BACKHOME. ')</a>';
 +              }
 +              echo '<h2>' . _MEMBERS_EDIT . '</h2>';
 +              
 +              $mem =& $manager->getMember($memberid);
 +              ?>
 +              <form method="post" action="index.php" name="memberedit"><div>
 +              
 +              <input type="hidden" name="action" value="changemembersettings" />
 +              <input type="hidden" name="memberid" value="<?php echo  $memberid; ?>" />
 +              <?php $manager->addTicketHidden() ?>
 +              
 +              <table><tr>
 +                      <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_DISPLAY ?> <?php help('shortnames'); ?>
 +                              <br /><small><?php echo _MEMBERS_DISPLAY_INFO ?></small>
 +                      </td>
 +                      <td>
 +                      <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
 +                              <input name="name" tabindex="10" maxlength="32" size="32" value="<?php echo  Entity::hsc($mem->getDisplayName()); ?>" />
 +                      <?php } else {
 +                              echo Entity::hsc($member->getDisplayName());
 +                         }
 +                      ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_REALNAME ?></td>
 +                      <td><input name="realname" tabindex="20" maxlength="60" size="40" value="<?php echo  Entity::hsc($mem->getRealName()); ?>" /></td>
 +              </tr><tr>
 +              <?php if ($CONF['AllowLoginEdit'] || $member->isAdmin()) { ?>
 +                      <td><?php echo _MEMBERS_PWD ?></td>
 +                      <td><input type="password" tabindex="30" maxlength="40" size="16" name="password" /></td>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_REPPWD ?></td>
 +                      <td><input type="password" tabindex="35" maxlength="40" size="16" name="repeatpassword" /></td>
 +              <?php } ?>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_EMAIL ?>
 +                              <br /><small><?php echo _MEMBERS_EMAIL_EDIT ?></small>
 +                      </td>
 +                      <td><input name="email" tabindex="40" size="40" maxlength="60" value="<?php echo  Entity::hsc($mem->getEmail()); ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_URL ?></td>
 +                      <td><input name="url" tabindex="50" size="40" maxlength="100" value="<?php echo  Entity::hsc($mem->getURL()); ?>" /></td>
 +              <?php // only allow to change this by super-admins
 +                 // we don't want normal users to 'upgrade' themselves to super-admins, do we? ;-)
 +                 if ($member->isAdmin()) {
 +              ?>
 +                      </tr><tr>
 +                              <td><?php echo _MEMBERS_SUPERADMIN ?> <?php help('superadmin'); ?></td>
 +                              <td><?php $this->input_yesno('admin',$mem->isAdmin(),60); ?></td>
 +                      </tr><tr>
 +                              <td><?php echo _MEMBERS_CANLOGIN ?> <?php help('canlogin'); ?></td>
 +                              <td><?php $this->input_yesno('canlogin',$mem->canLogin(),70,1,0,_YES,_NO,$mem->isAdmin()); ?></td>
 +              <?php } ?>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_NOTES ?></td>
 +                      <td><input name="notes" tabindex="80" size="40" maxlength="100" value="<?php echo  Entity::hsc($mem->getNotes()); ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_LOCALE ?> <?php help('locale'); ?>
 +                      </td>
 +                      <td>
 +                      
 +                              <select name="locale" tabindex="85">
 +                              <?php
 +                              $locales = i18n::get_available_locale_list();
 +                              if ( !$mem->getLocale() || !in_array($mem->getLocale(), $locales) )
 +                              {
 +                                      echo "<option value=\"\" selected=\"selected\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
 +                              }
 +                              else
 +                              {
 +                                      echo "<option value=\"\">" . Entity::hsc(_MEMBERS_USESITELANG) . "</option>\n";
 +                              }
 +                              
 +                              foreach( $locales as $locale )
 +                              {
 +                                      if( $locale == $mem->getLocale() )
 +                                      {
 +                                              echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
 +                                      }
 +                                      else
 +                                      {
 +                                              echo "<option value=\"{$locale}\">{$locale}</option>\n";
 +                                      }
 +                              }
 +                              ?>
 +                              </select>
 +                              
 +                      </td>
 +              </tr>
 +              <tr>
 +                      <td><?php echo _MEMBERS_USEAUTOSAVE ?> <?php help('autosave'); ?></td>
 +                      <td><?php $this->input_yesno('autosave', $mem->getAutosave(), 87); ?></td>
 +              </tr>
 +              <?php
 +                      // plugin options
 +                      $this->_insertPluginOptions('member',$memberid);
 +              ?>
 +              <tr>
 +                      <th colspan="2"><?php echo _MEMBERS_EDIT ?></th>
 +              </tr><tr>
 +                      <td><?php echo _MEMBERS_EDIT ?></td>
 +                      <td><input type="submit" tabindex="90" value="<?php echo _MEMBERS_EDIT_BTN ?>" onclick="return checkSubmit();" /></td>
 +              </tr></table>
 +              
 +              </div></form>
 +              
 +              <?php
 +                      echo '<h3>',_PLUGINS_EXTRA,'</h3>';
 +                      
 +                      $manager->notify(
 +                              'MemberSettingsFormExtras',
 +                              array(
 +                                      'member' => &$mem
 +                              )
 +                      );
 +              $this->pagefoot();
++=======
+               // 2. delete parts
+               $query = "DELETE FROM %s WHERE tdesc=%d;";
+               $query = sprintf($query, sql_table('template'), (integer) $templateid);
+               DB::execute($query);
+               
+               $data = array('templateid' => $templateid);
+               $manager->notify('PostDeleteAdminTemplate', $data);
+               
+               self::action_admintemplateoverview();
+               return;
++>>>>>>> skinnable-master
        }
        
-     /**
-      * @todo document this
-      */
-     function action_changemembersettings() {
-         global $member, $CONF, $manager;
-         $memberid = intRequestVar('memberid');
-         // check if allowed
-         ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
-         $name           = trim(strip_tags(postVar('name')));
-         $realname       = trim(strip_tags(postVar('realname')));
-         $password       = postVar('password');
-         $repeatpassword = postVar('repeatpassword');
-         $email          = strip_tags(postVar('email'));
-         $url            = strip_tags(postVar('url'));
-               # replaced eregi() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0
-               # original eregi: !eregi("^https?://", $url)
-               // begin if: sometimes user didn't prefix the URL with http:// or https://, this cause a malformed URL. Let's fix it.
-               if (!preg_match('#^https?://#', $url) )
+       /**
+        * Admin::action_admintemplatenew()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_admintemplatenew()
+       {
+               global $member;
+               $member->isAdmin() or self::disallow();
+               $name = postVar('name');
+               $desc = postVar('desc');
+               
+               if ( !isValidTemplateName($name) )
                {
++<<<<<<< HEAD
 +                      $url = 'http://' . $url;
 +              }
 +
 +        $admin          = postVar('admin');
 +        $canlogin       = postVar('canlogin');
 +        $notes          = strip_tags(postVar('notes'));
 +        $locale        = postVar('locale');
 +
 +        $mem =& $manager->getMember($memberid);
 +
 +        if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
 +
 +            if (!isValidDisplayName($name))
 +                $this->error(_ERROR_BADNAME);
 +
 +            if (($name != $mem->getDisplayName()) && Member::exists($name))
 +                $this->error(_ERROR_NICKNAMEINUSE);
 +
 +            if ($password != $repeatpassword)
 +                $this->error(_ERROR_PASSWORDMISMATCH);
 +
 +            if ($password && (i18n::strlen($password) < 6))
 +                $this->error(_ERROR_PASSWORDTOOSHORT);
 +                
 +            if ($password) {
 +                              $pwdvalid = true;
 +                              $pwderror = '';
 +                              $manager->notify('PrePasswordSet',array('password' => $password, 'errormessage' => &$pwderror, 'valid' => &$pwdvalid));
 +                              if (!$pwdvalid) {
 +                                      $this->error($pwderror);
 +                              }
 +                      }
++=======
+                       self::error(_ERROR_BADTEMPLATENAME);
+                       return;
++>>>>>>> skinnable-master
                }
-               
-               if ( !NOTIFICATION::address_validation($email) )
+               else if ( !preg_match('#^admin/#', $name) )
                {
-                       $this->error(_ERROR_BADMAILADDRESS);
+                       self::error(_ERROR_BADADMINTEMPLATENAME);
+                       return;
                }
-               if ( !$realname )
+               else if ( Template::exists($name) )
                {
-                       $this->error(_ERROR_REALNAMEMISSING);
+                       self::error(_ERROR_DUPTEMPLATENAME);
+                       return;
                }
++<<<<<<< HEAD
 +        if ( ($locale != '') && (!in_array($locale, i18n::get_available_locale_list())) )
 +            $this->error(_ERROR_NOSUCHTRANSLATION);
 +
 +        // check if there will remain at least one site member with both the logon and admin rights
 +        // (check occurs when taking away one of these rights from such a member)
 +        if (    (!$admin && $mem->isAdmin() && $mem->canLogin())
 +             || (!$canlogin && $mem->isAdmin() && $mem->canLogin())
 +           )
 +        {
 +            $r = DB::getResult('SELECT * FROM '.sql_table('member').' WHERE madmin=1 and mcanlogin=1');
 +            if ($r->rowCount() < 2)
 +                $this->error(_ERROR_ATLEASTONEADMIN);
 +        }
 +
 +        if ($CONF['AllowLoginEdit'] || $member->isAdmin()) {
 +            $mem->setDisplayName($name);
 +            if ($password)
 +                $mem->setPassword($password);
 +        }
 +
 +        $oldEmail = $mem->getEmail();
 +
 +        $mem->setRealName($realname);
 +        $mem->setEmail($email);
 +        $mem->setURL($url);
 +        $mem->setNotes($notes);
 +        $mem->setLocale($locale);
 +
 +
 +        // only allow super-admins to make changes to the admin status
 +        if ($member->isAdmin()) {
 +            $mem->setAdmin($admin);
 +            $mem->setCanLogin($canlogin);
 +        }
 +
 +        $autosave = postVar ('autosave');
 +        $mem->setAutosave($autosave);
 +
 +        $mem->write();
 +
 +        // store plugin options
 +        $aOptions = requestArray('plugoption');
 +        NucleusPlugin::apply_plugin_options($aOptions);
 +        $manager->notify('PostPluginOptionsUpdate',array('context' => 'member', 'memberid' => $memberid, 'member' => &$mem));
 +
 +        // if email changed, generate new password
 +        if ($oldEmail != $mem->getEmail())
 +        {
 +            $mem->sendActivationLink('addresschange', $oldEmail);
 +            // logout member
 +            $mem->newCookieKey();
 +
 +            // only log out if the member being edited is the current member.
 +            if ($member->getID() == $memberid)
 +                $member->logout();
 +            $this->action_login(_MSG_ACTIVATION_SENT, 0);
 +            return;
 +        }
 +
 +
 +        if (  ( $mem->getID() == $member->getID() )
 +           && ( $mem->getDisplayName() != $member->getDisplayName() )
 +           ) {
 +            $mem->newCookieKey();
 +            $member->logout();
 +            $this->action_login(_MSG_LOGINAGAIN, 0);
 +        } else {
 +            $this->action_overview(_MSG_SETTINGSCHANGED);
 +        }
 +    }
 +
++=======
+               
+               $newTemplateId = Template::createNew($name, $desc);
+               self::action_admintemplateoverview();
+               return;
+       }
+       
++>>>>>>> skinnable-master
        /**
-        * Admin::action_memberadd()
+        * Admin::action_admintemplateclone()
         * 
         * @param       void
         * @return      void
-        * 
-       */
-       function action_memberadd()
+        */
+       static private function action_admintemplateclone()
        {
-               global $member, $manager;
+               global $member;
+               $templateid = intRequestVar('templateid');
+               $member->isAdmin() or self::disallow();
                
-               // check if allowed
-               $member->isAdmin() or $this->disallow();
+               // 1. read old template
+               $name = Template::getNameFromId($templateid);
+               $desc = Template::getDesc($templateid);
                
-               if ( postVar('password') != postVar('repeatpassword') )
+               // 2. create desc thing
+               $name = $name . "cloned";
+               
+               // if a template with that name already exists:
+               if ( Template::exists($name) )
                {
-                       $this->error(_ERROR_PASSWORDMISMATCH);
+                       $i = 1;
+                       while ( Template::exists($name . $i) )
+                       {
+                               $i++;
+                       }
+                       $name .= $i;
                }
                
-               if ( i18n::strlen(postVar('password')) < 6 )
+               $newid = Template::createNew($name, $desc);
+               
+               // 3. create clone
+               // go through parts of old template and add them to the new one
+               $query = "SELECT tpartname, tcontent FROM %s WHERE tdesc=%d;";
+               $query = sprintf($query, sql_table('template'), (integer) $templateid);
+               
+               $res = DB::getResult($query);
+               foreach ( $res as $row )
                {
-                       $this->error(_ERROR_PASSWORDTOOSHORT);
+                       self::addToTemplate($newid, $row['tpartname'], $row['tcontent']);
                }
                
-               $res = Member::create(postVar('name'), postVar('realname'), postVar('password'), postVar('email'), postVar('url'), postVar('admin'), postVar('canlogin'), postVar('notes'));
-               if ( $res != 1 )
+               self::action_admintemplateoverview();
+               return;
+       }
+       /**
+        * Admin::action_skinoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skinoverview()
+       {
+               global $member, $manager;
+               
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('skinoverview');
+               return;
+       }
+       
+       /**
+        * Admin::action_skinnew()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skinnew()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $name = trim(postVar('name'));
+               $desc = trim(postVar('desc'));
+               
+               if ( !isValidSkinName($name) )
+               {
+                       self::error(_ERROR_BADSKINNAME);
+                       return;
+               }
+               else if ( SKIN::exists($name) )
                {
-                       $this->error($res);
+                       self::error(_ERROR_DUPSKINNAME);
+                       return;
                }
                
-               // fire PostRegister event
-               $newmem = new Member();
-               $newmem->readFromName(postVar('name'));
-               $manager->notify('PostRegister',array('member' => &$newmem));
+               SKIN::createNew($name, $desc);
                
-               $this->action_usermanagement();
+               self::action_skinoverview();
                return;
        }
 -      
++<<<<<<< HEAD
 +
 +    /**
 +     * Account activation
 +     *
 +     * @author dekarma
 +     */
 +    function action_activate() {
 +
 +        $key = getVar('key');
 +        $this->_showActivationPage($key);
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function _showActivationPage($key, $message = '')
 +    {
 +        global $manager;
 +
 +        // clean up old activation keys
 +        Member::cleanupActivationTable();
 +
 +        // get activation info
 +        $info = Member::getActivationInfo($key);
 +
 +        if (!$info)
 +            $this->error(_ERROR_ACTIVATE);
 +
 +        $mem =& $manager->getMember($info['vmember']);
 +
 +        if (!$mem)
 +            $this->error(_ERROR_ACTIVATE);
 +
 +        $text = '';
 +        $title = '';
 +        $bNeedsPasswordChange = true;
 +
 +        switch ($info['vtype'])
 +        {
 +            case 'forgot':
 +                $title = _ACTIVATE_FORGOT_TITLE;
 +                $text = _ACTIVATE_FORGOT_TEXT;
 +                break;
 +            case 'register':
 +                $title = _ACTIVATE_REGISTER_TITLE;
 +                $text = _ACTIVATE_REGISTER_TEXT;
 +                break;
 +            case 'addresschange':
 +                $title = _ACTIVATE_CHANGE_TITLE;
 +                $text = _ACTIVATE_CHANGE_TEXT;
 +                $bNeedsPasswordChange = false;
 +                Member::activate($key);
 +                break;
 +        }
 +
 +        $aVars = array(
 +            'memberName' => Entity::hsc($mem->getDisplayName())
 +        );
 +        $title = Template::fill($title, $aVars);
 +        $text = Template::fill($text, $aVars);
 +
 +        $this->pagehead();
 +
 +            echo '<h2>' , $title, '</h2>';
 +            echo '<p>' , $text, '</p>';
 +
 +            if ($message != '')
 +            {
 +                echo '<p class="error">',$message,'</p>';
 +            }
 +
 +            if ($bNeedsPasswordChange)
 +            {
 +                ?>
 +                    <div><form action="index.php" method="post">
 +
 +                        <input type="hidden" name="action" value="activatesetpwd" />
 +                        <?php $manager->addTicketHidden() ?>
 +                        <input type="hidden" name="key" value="<?php echo Entity::hsc($key) ?>" />
 +
 +                        <table><tr>
 +                            <td><?php echo _MEMBERS_PWD ?></td>
 +                            <td><input type="password" maxlength="40" size="16" name="password" /></td>
 +                        </tr><tr>
 +                            <td><?php echo _MEMBERS_REPPWD ?></td>
 +                            <td><input type="password" maxlength="40" size="16" name="repeatpassword" /></td>
 +                        <?php
 +
 +                            global $manager;
 +                            $manager->notify('FormExtra', array('type' => 'activation', 'member' => $mem));
 +
 +                        ?>
 +                        </tr><tr>
 +                            <td><?php echo _MEMBERS_SETPWD ?></td>
 +                            <td><input type='submit' value='<?php echo _MEMBERS_SETPWD_BTN ?>' /></td>
 +                        </tr></table>
 +
 +
 +                    </form></div>
 +
 +                <?php
 +
 +            }
 +
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * Account activation - set password part
 +     *
 +     * @author dekarma
 +     */
 +    function action_activatesetpwd()
 +    {
 +              global $manager;
 +        $key = postVar('key');
 +
 +        // clean up old activation keys
 +        Member::cleanupActivationTable();
 +
 +        // get activation info
 +        $info = Member::getActivationInfo($key);
 +
 +        if (!$info || ($info['type'] == 'addresschange'))
 +            return $this->_showActivationPage($key, _ERROR_ACTIVATE);
 +
 +        $mem =& $manager->getMember($info['vmember']);
 +
 +        if (!$mem)
 +            return $this->_showActivationPage($key, _ERROR_ACTIVATE);
 +
 +        $password       = postVar('password');
 +        $repeatpassword = postVar('repeatpassword');
 +
 +        if ($password != $repeatpassword)
 +            return $this->_showActivationPage($key, _ERROR_PASSWORDMISMATCH);
 +
 +        if ($password && (i18n::strlen($password) < 6))
 +            return $this->_showActivationPage($key, _ERROR_PASSWORDTOOSHORT);
 +            
 +        if ($password) {
 +                      $pwdvalid = true;
 +                      $pwderror = '';
 +                      global $manager;
 +                      $manager->notify('PrePasswordSet',array('password' => $password, 'errormessage' => &$pwderror, 'valid' => &$pwdvalid));
 +                      if (!$pwdvalid) {
 +                              return $this->_showActivationPage($key,$pwderror);
 +                      }
 +              }
 +
 +        $error = '';
 +        
 +        $manager->notify('ValidateForm', array('type' => 'activation', 'member' => $mem, 'error' => &$error));
 +        if ($error != '')
 +            return $this->_showActivationPage($key, $error);
 +
 +
 +        // set password
 +        $mem->setPassword($password);
 +        $mem->write();
 +
 +        // do the activation
 +        Member::activate($key);
 +
 +        $this->pagehead();
 +            echo '<h2>',_ACTIVATE_SUCCESS_TITLE,'</h2>';
 +            echo '<p>',_ACTIVATE_SUCCESS_TEXT,'</p>';
 +        $this->pagefoot();
 +    }
 +
        /**
 -       * Admin::action_skinedit()
 +       * Admin::action_manageteam()
         * 
 +       * Manage team
         * @param       void
         * @return      void
         */
         * @param       void
         * @return      void
         */
 -      static private function action_skinupdate()
 +      public function action_blogsettings()
        {
 -              global $manager, $member;
 +              global $member, $manager;
                
 -              $skinid = intRequestVar('skinid');
 -              $content = trim(postVar('content'));
 -              $type = postVar('type');
 +              $blogid = intRequestVar('blogid');
                
 -              $member->isAdmin() or self::disallow();
 +              // check if allowed
 +              $member->blogAdminRights($blogid) or $this->disallow();
                
 -              $skin =& $manager->getSKIN($skinid);
 -              $skin->update($type, $content);
 +              $blog =& $manager->getBlog($blogid);
                
 -              self::action_skinedittype(_SKIN_UPDATED);
 -              return;
 -      }
 -      
 -      /**
 -       * Admin::action_skindelete()
 -       * 
 -       * @param       void
 -       * @return      void
 -       */
 -      static private function action_skindelete()
 -      {
 -              global $CONF, $member;
 +              $extrahead = "<script type=\"text/javascript\" src=\"javascript/numbercheck.js\"></script>\n";
 +              $this->pagehead($extrahead);
                
 -              $member->isAdmin() or self::disallow();
 +              echo '<p><a href="index.php?action=overview">(' . _BACKHOME . ")</a></p>\n";
 +              echo '<h2>' . _EBLOG_TITLE . ": '{$this->bloglink($blog)}'</h2>\n";
                
 -              $skinid = intRequestVar('skinid');
 +              echo '<h3>' . _EBLOG_TEAM_TITLE . "</h3>\n";
                
 -              // don't allow default skin to be deleted
 -              if ( $skinid == $CONF['BaseSkin'] )
 -              {
 -                      self::error(_ERROR_DEFAULTSKIN);
 +              echo '<p>' . _EBLOG_CURRENT_TEAM_MEMBER;
 +              
 +              $query = "SELECT mname, mrealname FROM %s, %s WHERE mnumber=tmember AND tblog=%d;";
 +              $query = sprintf($query, sql_table('member'), sql_table('team'), (integer) $blogid);
 +              $res = DB::getResult($query);
 +              $aMemberNames = array();
 +              foreach ( $res as $row )
 +              {
 +                      $aMemberNames[] = Entity::hsc($row['mname']) . ' (' . Entity::hsc($row['mrealname']). ')';
 +              }
 +              echo implode(',', $aMemberNames);
 +                      
 +              echo "</p>\n";
 +              echo '<p>';
 +              echo '<a href="index.php?action=manageteam&amp;blogid=' . $blogid . '">' . _EBLOG_TEAM_TEXT . '</a>';
 +              echo "</p>\n";
 +              
 +              echo '<h3>' . _EBLOG_SETTINGS_TITLE . "</h3>\n";
 +              
 +              echo "<form method=\"post\" action=\"index.php\">\n";
 +              echo "<div>\n";
 +              
 +              echo "<input type=\"hidden\" name=\"action\" value=\"blogsettingsupdate\" />\n";
 +              $manager->addTicketHidden() . "\n";
 +              echo "<input type=\"hidden\" name=\"blogid\" value=\"{$blogid}\" />\n";
 +              
 +              echo '<table frame="box" rules="all" summary="' . _EBLOG_SETTINGS_TITLE . '">' . "\n";
 +              echo "<tfoot>\n";
 +              echo "<tr>\n";
 +              echo '<th colspan="2">' . _EBLOG_CHANGE . "</th>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_CHANGE . "</td>\n";
 +              echo '<td><input type="submit" tabindex="130" value="' . _EBLOG_CHANGE_BTN . '" onclick="return checkSubmit();" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "</tfoot>\n";
 +              echo "<tbody>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_NAME . "</td>\n";
 +              echo '<td><input name="name" tabindex="10" size="40" maxlength="60" value="' . Entity::hsc($blog->getName()) . '" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_SHORTNAME;
 +              help('shortblogname');
 +              echo _EBLOG_SHORTNAME_EXTRA;
 +              echo "</td>\n";
 +              echo '<td><input name="shortname" tabindex="20" maxlength="15" size="15" value="' . Entity::hsc($blog->getShortName()) .'" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_DESC . "</td>\n";
 +              echo '<td><input name="desc" tabindex="30" maxlength="200" size="40" value="' . Entity::hsc($blog->getDescription()) . '" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_URL . "</td>\n";
 +              echo '<td><input name="url" tabindex="40" size="40" maxlength="100" value="' . Entity::hsc($blog->getURL()) . '" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_DEFSKIN;
 +              help('blogdefaultskin');
 +              echo "</td>\n";
 +              echo "<td>\n";
 +              
 +              $query = 'SELECT sdname as text, sdnumber as value FROM ' . sql_table('skin_desc');
 +              $template['name'] = 'defskin';
 +              $template['selected'] = $blog->getDefaultSkin();
 +              $template['tabindex'] = 50;
 +              showlist($query, 'select', $template);
 +              
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_LINEBREAKS;
 +              help('convertbreaks');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('convertbreaks',$blog->convertBreaks(),55);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_ALLOWPASTPOSTING;
 +              help('allowpastposting');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('allowpastposting',$blog->allowPastPosting(),57);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_DISABLECOMMENTS;
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('comments', $blog->commentsEnabled(), 60);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_ANONYMOUS . "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('public',$blog->isPublic(),70);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_REQUIREDEMAIL . "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('reqemail', $blog->emailRequired(),72);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_NOTIFY;
 +              help('blognotify');
 +              echo "</td>\n";
 +              echo '<td><input name="notify" tabindex="80" maxlength="128" size="40" value="' . Entity::hsc($blog->getNotifyAddress()) . '" />' . "</td>\n";
 +              echo "</tr>\n";
 +              
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_NOTIFY_ON . "</td>\n";
 +              echo "<td>\n";
 +              
 +              if ( !$blog->notifyOnComment() )
 +              {
 +                      echo "<input name=\"notifyComment\" value=\"3\" type=\"checkbox\" tabindex=\"81\" id=\"notifyComment\" />\n";
 +              }
 +              else
 +              {
 +                      echo "<input name=\"notifyComment\" value=\"3\" type=\"checkbox\" tabindex=\"81\" id=\"notifyComment\" checked=\"checked\"/>\n";
 +              }
 +              echo '<label for="notifyComment">' . _EBLOG_NOTIFY_COMMENT . "</label><br />\n";
 +              
 +              if ( !$blog->notifyOnVote() )
 +              {
 +                      echo "<input name=\"notifyVote\" value=\"5\" type=\"checkbox\" tabindex=\"82\" id=\"notifyVote\" />\n";
 +              }
 +              else
 +              {
 +                      echo "<input name=\"notifyVote\" value=\"5\" type=\"checkbox\" tabindex=\"82\" id=\"notifyVote\" checked=\"checked\" />\n";
 +              }
 +              
 +              echo '<label for="notifyVote">' . _EBLOG_NOTIFY_KARMA . "</label><br />\n";
 +              
 +              if ( !$blog->notifyOnNewItem() )
 +              {
 +                      echo "<input name=\"notifyNewItem\" value=\"7\" type=\"checkbox\" tabindex=\"83\" id=\"notifyNewItem\" />\n";
 +              
 +              }
 +              else
 +              {
 +                      echo "<input name=\"notifyNewItem\" value=\"7\" type=\"checkbox\" tabindex=\"83\" id=\"notifyNewItem\" checked=\"checked\" />\n";
 +              }
 +              
 +              echo '<label for="notifyNewItem">' . _EBLOG_NOTIFY_ITEM . "</label>\n";
 +              
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_MAXCOMMENTS;
 +              help('blogmaxcomments');
 +              echo "</td>\n";
 +              echo '<td><input name="maxcomments" tabindex="90" size="3" value="' . Entity::hsc($blog->getMaxComments()) . '" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_UPDATE;
 +              help('blogupdatefile');
 +              echo "</td>\n";
 +              echo '<td><input name="update" tabindex="100" size="40" maxlength="60" value="' . Entity::hsc($blog->getUpdateFile()) .'" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_DEFCAT . "</td>\n";
 +              echo "<td>\n";
 +              $query =  "SELECT cname as text, catid as value FROM %s WHERE cblog=%d;";
 +              $query = sprintf($query, sql_table('category'), (integer) $blog->getID());
 +              $template['name'] = 'defcat';
 +              $template['selected'] = $blog->getDefaultCategory();
 +              $template['tabindex'] = 110;
 +              showlist($query, 'select', $template);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_OFFSET;
 +              help('blogtimeoffset');
 +              echo "<br />\n";
 +              echo _EBLOG_STIME;
 +              echo ' <b>' . i18n::formatted_datetime('%H:%M', time()) . '</b><br />';
 +              echo _EBLOG_BTIME;
 +              echo '<b>' . i18n::formatted_datetime('%H:%M', $blog->getCorrectTime()) . '</b>';
 +              echo "</td>\n";
 +              echo '<td><input name="timeoffset" tabindex="120" size="3" value="' . Entity::hsc($blog->getTimeOffset()) .'" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_SEARCH;
 +              help('blogsearchable');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('searchable', $blog->getSearchable(), 122);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              
 +              // plugin options
 +              $this->_insertPluginOptions('blog', $blogid);
 +              
 +              echo "</tbody>\n";
 +              echo "</table>\n";
 +              
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              
 +              echo '<h3>' . _EBLOG_CAT_TITLE . "</h3>\n";
 +              
 +              $query = 'SELECT * FROM '.sql_table('category').' WHERE cblog='.$blog->getID().' ORDER BY cname';
 +              $template['content'] = 'categorylist';
 +              $template['tabindex'] = 200;
 +              
 +              $manager->loadClass("ENCAPSULATE");
 +              $batch = new Batch('category');
 +              $batch->showlist($query,'table',$template);
 +              
 +              echo "<form action=\"index.php\" method=\"post\">\n";
 +              echo "<div>\n";
 +              echo "<input name=\"action\" value=\"categorynew\" type=\"hidden\" />\n";
 +              $manager->addTicketHidden() . "\n";
 +              echo "<input name=\"blogid\" value=\"{$blog->getID()}\" type=\"hidden\" />\n";
 +              
 +              echo '<table frame="box" rules="all" summary="' . _EBLOG_CAT_CREATE . '">' . "\n";
 +              echo "<thead>\n";
 +              echo "<tr>\n";
 +              echo '<th colspan="2">' . _EBLOG_CAT_CREATE . "</th>\n";
 +              echo "</tr>\n";
 +              echo "</thead>\n";
 +              echo "<tbody>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_CAT_NAME . "</td>\n";
 +              echo "<td><input name=\"cname\" size=\"40\" maxlength=\"40\" tabindex=\"300\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_CAT_DESC . "</td>\n";
 +              echo "<td><input name=\"cdesc\" size=\"40\" maxlength=\"200\" tabindex=\"310\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _EBLOG_CAT_CREATE . "</td>\n";
 +              echo '<td><input type="submit" value="' . _EBLOG_CAT_CREATE . '" tabindex="320" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "</tbody>\n";
 +              echo "</table>\n";
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              
 +              echo '<h3>' . _PLUGINS_EXTRA . "</h3>\n";
 +              $manager->notify('BlogSettingsFormExtras', array('blog' => &$blog));
 +              
 +              $this->pagefoot();
 +              return;
 +      }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_categorynew() {
 +        global $member, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $cname = postVar('cname');
 +        $cdesc = postVar('cdesc');
 +
 +        if (!isValidCategoryName($cname))
 +            $this->error(_ERROR_BADCATEGORYNAME);
 +
 +        $query = 'SELECT * FROM '.sql_table('category') . ' WHERE cname=' . DB::quoteValue($cname).' and cblog=' . intval($blogid);
 +        $res = DB::getResult($query);
 +        if ($res->rowCount() > 0)
 +            $this->error(_ERROR_DUPCATEGORYNAME);
 +
 +        $blog       =& $manager->getBlog($blogid);
 +        $newCatID   =  $blog->createNewCategory($cname, $cdesc);
 +
 +        $this->action_blogsettings();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_categoryedit($catid = '', $blogid = '', $desturl = '') {
 +        global $member, $manager;
 +
 +        if ($blogid == '')
 +            $blogid = intGetVar('blogid');
 +        else
 +            $blogid = intval($blogid);
 +        if ($catid == '')
 +            $catid = intGetVar('catid');
 +        else
 +            $catid = intval($catid);
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $res = DB::getRow('SELECT * FROM '.sql_table('category')." WHERE cblog=$blogid AND catid=$catid");
 +
 +        $cname = $res['cname'];
 +        $cdesc = $res['cdesc'];
 +
 +        $extrahead = '<script type="text/javascript" src="javascript/numbercheck.js"></script>';
 +        $this->pagehead($extrahead);
 +
 +        echo "<p><a href='index.php?action=blogsettings&amp;blogid=$blogid'>(",_BACK_TO_BLOGSETTINGS,")</a></p>";
 +
 +        ?>
 +        <h2><?php echo _EBLOG_CAT_UPDATE ?> '<?php echo Entity::hsc($cname) ?>'</h2>
 +        <form method='post' action='index.php'><div>
 +        <input name="blogid" type="hidden" value="<?php echo $blogid ?>" />
 +        <input name="catid" type="hidden" value="<?php echo $catid ?>" />
 +        <input name="desturl" type="hidden" value="<?php echo Entity::hsc($desturl) ?>" />
 +        <input name="action" type="hidden" value="categoryupdate" />
 +        <?php $manager->addTicketHidden(); ?>
 +
 +        <table><tr>
 +            <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_CAT_NAME ?></td>
 +            <td><input type="text" name="cname" value="<?php echo Entity::hsc($cname) ?>" size="40" maxlength="40" /></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_CAT_DESC ?></td>
 +            <td><input type="text" name="cdesc" value="<?php echo Entity::hsc($cdesc) ?>" size="40" maxlength="200" /></td>
 +        </tr>
 +        <?php
 +            // insert plugin options
 +            $this->_insertPluginOptions('category',$catid);
 +        ?>
 +        <tr>
 +            <th colspan="2"><?php echo _EBLOG_CAT_UPDATE ?></th>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_CAT_UPDATE ?></td>
 +            <td><input type="submit" value="<?php echo _EBLOG_CAT_UPDATE_BTN ?>" /></td>
 +        </tr></table>
 +
 +        </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_categoryupdate() {
 +        global $member, $manager;
 +
 +        $blogid = intPostVar('blogid');
 +        $catid = intPostVar('catid');
 +        $cname = postVar('cname');
 +        $cdesc = postVar('cdesc');
 +        $desturl = postVar('desturl');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        if (!isValidCategoryName($cname))
 +            $this->error(_ERROR_BADCATEGORYNAME);
 +
 +        $query = 'SELECT * FROM '.sql_table('category').' WHERE cname=' . DB::quoteValue($cname).' and cblog=' . intval($blogid) . " and not(catid=$catid)";
 +        $res = DB::getResult($query);
 +        if ($res->rowCount() > 0)
 +            $this->error(_ERROR_DUPCATEGORYNAME);
 +
 +        $query =  'UPDATE '.sql_table('category').' SET'
 +               . ' cname=' . DB::quoteValue($cname) . ','
 +               . ' cdesc=' . DB::quoteValue($cdesc)
 +               . ' WHERE catid=' . $catid;
 +
 +        DB::execute($query);
 +
 +        // store plugin options
 +        $aOptions = requestArray('plugoption');
 +        NucleusPlugin::apply_plugin_options($aOptions);
 +        $manager->notify('PostPluginOptionsUpdate',array('context' => 'category', 'catid' => $catid));
 +
 +
 +        if ($desturl) {
 +            redirect($desturl);
 +            exit;
 +        } else {
 +            $this->action_blogsettings();
 +        }
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_categorydelete() {
 +        global $member, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +        $catid = intRequestVar('catid');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $blog =& $manager->getBlog($blogid);
 +
 +        // check if the category is valid
 +        if (!$blog->isValidCategory($catid))
 +            $this->error(_ERROR_NOSUCHCATEGORY);
 +
 +        // don't allow deletion of default category
 +        if ($blog->getDefaultCategory() == $catid)
 +            $this->error(_ERROR_DELETEDEFCATEGORY);
 +
 +        // check if catid is the only category left for blogid
 +        $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
 +        $res = DB::getResult($query);
 +        if ($res->rowCount() == 1)
 +            $this->error(_ERROR_DELETELASTCATEGORY);
 +
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <div>
 +            <?php echo _CONFIRMTXT_CATEGORY ?><b><?php echo  Entity::hsc($blog->getCategoryName($catid)) ?></b>
 +            </div>
 +
 +            <form method="post" action="index.php"><div>
 +            <input type="hidden" name="action" value="categorydeleteconfirm" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="blogid" value="<?php echo $blogid ?>" />
 +            <input type="hidden" name="catid" value="<?php echo $catid ?>" />
 +            <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_categorydeleteconfirm() {
 +        global $member, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +        $catid = intRequestVar('catid');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $error = $this->deleteOneCategory($catid);
 +        if ($error)
 +            $this->error($error);
 +
 +        $this->action_blogsettings();
 +    }
++=======
 +      
 +      /**
-        * Admin::deleteOneCategory()
-        * Delete a category by its id
++       * Admin::action_skinedit()
 +       * 
-        * @param       String  $catid  category id for deleting
-        * @return      Void
++       * @param       void
++       * @return      void
 +       */
-       function deleteOneCategory($catid)
++      static private function action_skinedit()
++      {
++              global $member;
++              
++              $member->isAdmin() or self::disallow();
++              
++              self::$skin->parse('skinedit');
++              return;
++      }
++      
++      /**
++       * Admin::action_skineditgeneral()
++       * 
++       * @param       void
++       * @return      void
++       */
++      static private function action_skineditgeneral()
++      {
++              global $member;
++              
++              $skinid = intRequestVar('skinid');
++              
++              $member->isAdmin() or self::disallow();
++              
++              $error = self::skineditgeneral($skinid);
++              if ( $error )
++              {
++                      self::error($error);
++                      return;
++              }
++              
++              self::action_skinedit();
++              return;
++      }
++      
++      static private function action_skinedittype($msg = '')
++      {
++              global $member;
++              
++              $member->isAdmin() or self::disallow();
++              
++              if ( $msg )
++              {
++                      self::$headMess = $msg;
++              }
++              
++              $type = requestVar('type');
++              $type = trim($type);
++              $type = strtolower($type);
++              
++              if ( !isValidShortName($type) )
++              {
++                      self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
++                      return;
++              }
++              
++              self::$skin->parse('skinedittype');
++              return;
++      }
++>>>>>>> skinnable-master
++      
++      /**
++       * Admin::action_skinupdate()
++       * 
++       * @param       void
++       * @return      void
++       */
++      static private function action_skinupdate()
 +      {
 +              global $manager, $member;
 +              
-               $catid = intval($catid);
-               $blogid = getBlogIDFromCatID($catid);
++              $skinid = intRequestVar('skinid');
++              $content = trim(postVar('content'));
++              $type = postVar('type');
 +              
-               if ( !$member->blogAdminRights($blogid) )
++              $member->isAdmin() or self::disallow();
++              
++              $skin =& $manager->getSKIN($skinid);
++              $skin->update($type, $content);
++              
++              self::action_skinedittype(_SKIN_UPDATED);
++              return;
++      }
++      
++      /**
++       * Admin::action_skindelete()
++       * 
++       * @param       void
++       * @return      void
++       */
++      static private function action_skindelete()
++      {
++              global $CONF, $member;
++              
++              $member->isAdmin() or self::disallow();
++              
++              $skinid = intRequestVar('skinid');
++              
++              // don't allow default skin to be deleted
++              if ( $skinid == $CONF['BaseSkin'] )
 +              {
-                       return ERROR_DISALLOWED;
++                      self::error(_ERROR_DEFAULTSKIN);
+                       return;
                }
                
-               // get blog
-               $blog =& $manager->getBlog($blogid);
+               // don't allow deletion of default skins for blogs
+               $query = "SELECT bname FROM %s WHERE bdefskin=%d";
+               $query = sprintf($query, sql_table('blog'), (integer) $skinid);
                
-               // check if the category is valid
-               if ( !$blog || !$blog->isValidCategory($catid) )
+               $name = DB::getValue($query);
+               if ( $name )
                {
-                       return _ERROR_NOSUCHCATEGORY;
+                       self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));
+                       return;
                }
                
-               $destcatid = $blog->getDefaultCategory();
+               self::$skin->parse('skindelete');
+               return;
+       }
+       
+       /**
+        * Admin::action_skindeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skindeleteconfirm()
+       {
+               global $member, $CONF;
                
-               // don't allow deletion of default category
-               if ( $blog->getDefaultCategory() == $catid )
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
+               
+               // don't allow default skin to be deleted
+               if ( $skinid == $CONF['BaseSkin'] )
                {
-                       return _ERROR_DELETEDEFCATEGORY;
+                       self::error(_ERROR_DEFAULTSKIN);
+                       return;
                }
                
++<<<<<<< HEAD
 +              // check if catid is the only category left for blogid
 +              $query = 'SELECT catid FROM '.sql_table('category').' WHERE cblog=' . $blogid;
 +              $res = DB::getResult($query);
 +              if ( $res->rowCount() == 1 )
++=======
+               // don't allow deletion of default skins for blogs
+               $query = "SELECT bname FROM %s WHERE bdefskin=%d;";
+               $query = sprintf($query, sql_table('blog'), (integer) $skinid);
+               
+               $name = DB::getValue($query);
+               if ( $name )
+                               {
+                       self::error(_ERROR_SKINDEFDELETE . Entity::hsc($name));
+                       return;
+               }
+               
+               self::skindeleteconfirm($skinid);
+               
+               self::action_skinoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_skinremovetype()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skinremovetype()
+       {
+               global $member, $CONF;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
+               $skintype = requestVar('type');
+               
+               if ( !isValidShortName($skintype) )
++>>>>>>> skinnable-master
                {
-                       return _ERROR_DELETELASTCATEGORY;
+                       self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
+                       return;
                }
                
-               $manager->notify('PreDeleteCategory', array('catid' => $catid));
+               self::$skin->parse('skinremovetype');
+               return;
+       }
+       
+       /**
+        * Admin::action_skinremovetypeconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_skinremovetypeconfirm()
+       {
+               global $member;
                
++<<<<<<< HEAD
 +              // change category for all items to the default category
 +              $query = 'UPDATE '.sql_table('item')." SET icat=$destcatid WHERE icat=$catid";
 +              DB::execute($query);
++=======
+               $member->isAdmin() or self::disallow();
++>>>>>>> skinnable-master
                
-               // delete all associated plugin options
-               NucleusPlugin::delete_option_values('category', $catid);
+               $skinid = intRequestVar('skinid');
+               $skintype = requestVar('type');
                
++<<<<<<< HEAD
 +              // delete category
 +              $query = 'DELETE FROM '.sql_table('category').' WHERE catid=' .$catid;
 +              DB::execute($query);
++=======
+               $error = self::skinremovetypeconfirm($skinid, $skintype);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
++>>>>>>> skinnable-master
                
-               $manager->notify('PostDeleteCategory', array('catid' => $catid));
+               self::action_skinedit();
                return;
        }
        
        /**
-        * Admin::action_blogsettingsupdate
-        * Updating blog settings
+        * Admin::action_skinclone()
         * 
-        * @param       Void
-        * @return      Void
+        * @param       void
+        * @return      void
         */
-       function action_blogsettingsupdate()
+       static private function action_skinclone()
        {
-               global $member, $manager;
+               global $member;
                
-               $blogid = intRequestVar('blogid');
+               $member->isAdmin() or self::disallow();
                
-               $member->blogAdminRights($blogid) or $this->disallow();
+               $skinid = intRequestVar('skinid');
                
-               $blog =& $manager->getBlog($blogid);
+               self::skinclone($skinid);
                
-               $notify_address = trim(postVar('notify'));
-               $shortname              = trim(postVar('shortname'));
-               $updatefile     = trim(postVar('update'));
+               self::action_skinoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinoverview()
+       {
+               global $member;
                
-               $notifyComment  = intPostVar('notifyComment');
-               $notifyVote             = intPostVar('notifyVote');
-               $notifyNewItem  = intPostVar('notifyNewItem');
+               $member->isAdmin() or self::disallow();
                
-               if ( $notifyComment == 0 )
+               self::$skin->parse('adminskinoverview');
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinnew()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinnew()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $name = trim(postVar('name'));
+               $desc = trim(postVar('desc'));
+               
+               if ( !isValidSkinName($name) )
                {
-                       $notifyComment = 1;
+                       self::error(_ERROR_BADSKINNAME);
+                       return;
                }
-               if ( $notifyVote == 0 )
+               else if ( !preg_match('#^admin/#', $name) )
                {
-                       $notifyVote = 1;
+                       self::error(_ERROR_BADADMINSKINNAME);
+                       return;
                }
-               if ( $notifyNewItem == 0 )
+               else if ( Skin::exists($name) )
                {
-                       $notifyNewItem = 1;
+                       self::error(_ERROR_DUPSKINNAME);
+                       return;
                }
-               $notifyType = $notifyComment * $notifyVote * $notifyNewItem;
                
-               if ( $notify_address && !NOTIFICATION::address_validation($notify_address) )
+               Skin::createNew($name, $desc);
+               
+               self::action_adminskinoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinedit()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinedit()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('adminskinedit');
+               
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskineditgeneral()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskineditgeneral()
+       {
+               global $member;
+               
+               $skinid = intRequestVar('skinid');
+               
+               $member->isAdmin() or self::disallow();
+               
+               $error = self::skineditgeneral($skinid, 'AdminActions');
+               if ( $error )
                {
-                       $this->error(_ERROR_BADNOTIFY);
+                       self::error($error);
+                       return;
                }
                
-               if ( !isValidShortName($shortname) )
+               self::action_adminskinedit();
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinedittype()
+        * 
+        * @param       string  $msg    message for pageheader
+        * @return      void
+        */
+       static private function action_adminskinedittype($msg = '')
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               if ( $msg )
                {
-                       $this->error(_ERROR_BADSHORTBLOGNAME);
+                       self::$headMess = $msg;
                }
+               $type = requestVar('type');
+               $type = trim($type);
+               $type = strtolower($type);
                
-               if ( ($blog->getShortName() != $shortname) && $manager->existsBlog($shortname) )
+               if ( !isValidShortName($type) )
                {
-                       $this->error(_ERROR_DUPSHORTBLOGNAME);
+                       self::error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
+                       return;
                }
-               // check if update file is writable
-               if ( $updatefile && !is_writeable($updatefile) )
+               
+               self::$skin->parse('adminskinedittype');
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinupdate()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinupdate()
+       {
+               global $manager, $member;
+               
+               $skinid = intRequestVar('skinid');
+               $content = trim(postVar('content'));
+               $type = postVar('type');
+               
+               $member->isAdmin() or self::disallow();
+               
+               $skin =& $manager->getSkin($skinid, 'AdminActions', 'AdminSkin');
+               $skin->update($type, $content);
+               
+               self::action_adminskinedittype(_SKIN_UPDATED);
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskindelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskindelete()
+       {
+               global $CONF, $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
+               
+               // don't allow default skin to be deleted
+               if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )
                {
-                       $this->error(_ERROR_UPDATEFILE);
+                       self::error(_ERROR_DEFAULTSKIN);
+                       return;
                }
                
-               $blog->setName(trim(postVar('name')));
-               $blog->setShortName($shortname);
-               $blog->setNotifyAddress($notify_address);
-               $blog->setNotifyType($notifyType);
-               $blog->setMaxComments(postVar('maxcomments'));
-               $blog->setCommentsEnabled(postVar('comments'));
-               $blog->setTimeOffset(postVar('timeoffset'));
-               $blog->setUpdateFile($updatefile);
-               $blog->setURL(trim(postVar('url')));
-               $blog->setDefaultSkin(intPostVar('defskin'));
-               $blog->setDescription(trim(postVar('desc')));
-               $blog->setPublic(postVar('public'));
-               $blog->setConvertBreaks(intPostVar('convertbreaks'));
-               $blog->setAllowPastPosting(intPostVar('allowpastposting'));
-               $blog->setDefaultCategory(intPostVar('defcat'));
-               $blog->setSearchable(intPostVar('searchable'));
-               $blog->setEmailRequired(intPostVar('reqemail'));
-               $blog->writeSettings();
+               /* don't allow if someone use it as a default*/
+               $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';
+               $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));
                
-               // store plugin options
-               $aOptions = requestArray('plugoption');
-               NucleusPlugin::apply_plugin_options($aOptions);
-               $manager->notify('PostPluginOptionsUpdate',array('context' => 'blog', 'blogid' => $blogid, 'blog' => &$blog));
+               $members = array();
+               while ( $row = $res->fetch() ) {
+                       $members[] = $row['mrealname'];
+               }
+               if ( count($members) )
+               {
+                       self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));
+                       return;
+               }
+               
+               self::$skin->parse('adminskindelete');
+               return;
+       }
+       /**
+        * Admin::action_adminskindeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskindeleteconfirm()
+       {
+               global $member, $CONF;
+               
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
+               
+               // don't allow default skin to be deleted
+               if ( $skinid == $CONF['AdminSkin'] || $skinid == $CONF['BookmarkletSkin'] )
+               {
+                       self::error(_ERROR_DEFAULTSKIN);
+                       return;
+               }
+               
+               /* don't allow if someone use it as a default*/
+               $query = 'SELECT * FROM %s WHERE madminskin = %d or mbkmklt = %d;';
+               $res = DB::getResult(sprintf($query, sql_table('member'), $skinid, $skinid));
+               
+               $members = array();
+               while ( $row = $res->fetch() ) {
+                       $members[] = $row['mrealname'];
+               }
+               if ( count($members) )
+               {
+                       self::error(_ERROR_SKINDEFDELETE . implode(' ' . _AND . ' ', $members));
+                       return;
+               }
+               
+               self::skindeleteconfirm($skinid);
+               
+               self::action_adminskinoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinremovetype()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinremovetype()
+       {
+               global $member, $CONF;
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
+               $skintype = requestVar('type');
                
-               $this->action_overview(_MSG_SETTINGSCHANGED);
+               if ( !isValidShortName($skintype) )
+               {
+                       self::error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
+                       return;
+               }
+               
+               self::$skin->parse('adminskinremovetype');
                return;
        }
++<<<<<<< HEAD
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_deleteblog() {
 +        global $member, $CONF, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        // check if blog is default blog
 +        if ($CONF['DefaultBlog'] == $blogid)
 +            $this->error(_ERROR_DELDEFBLOG);
 +
 +        $blog =& $manager->getBlog($blogid);
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <p><?php echo _WARNINGTXT_BLOGDEL ?>
 +            </p>
 +
 +            <div>
 +            <?php echo _CONFIRMTXT_BLOG ?><b><?php echo  Entity::hsc($blog->getName()) ?></b>
 +            </div>
 +
 +            <form method="post" action="index.php"><div>
 +            <input type="hidden" name="action" value="deleteblogconfirm" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="blogid" value="<?php echo  $blogid; ?>" />
 +            <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
++=======
++>>>>>>> skinnable-master
        
        /**
-        * Admin::action_deleteblogconfirm()
-        * Delete Blog
+        * Admin::action_adminskinremovetypeconfirm()
         * 
-        * @param       Void
-        * @return      Void
+        * @param       void
+        * @return      void
         */
-       function action_deleteblogconfirm()
+       static private function action_adminskinremovetypeconfirm()
        {
-               global $member, $CONF, $manager;
+               global $member;
                
-               $blogid = intRequestVar('blogid');
-               $manager->notify('PreDeleteBlog', array('blogid' => $blogid));
-               $member->blogAdminRights($blogid) or $this->disallow();
+               $member->isAdmin() or self::disallow();
                
-               // check if blog is default blog
-               if ( $CONF['DefaultBlog'] == $blogid )
+               $skinid = intRequestVar('skinid');
+               $skintype = requestVar('type');
+               
+               $error = self::skinremovetypeconfirm($skinid, $skintype);
+               if ( $error )
                {
-                       $this->error(_ERROR_DELDEFBLOG);
+                       self::error($error);
+                       return;
                }
                
++<<<<<<< HEAD
 +              // delete all comments
 +              $query = 'DELETE FROM '.sql_table('comment').' WHERE cblog='.$blogid;
 +              DB::execute($query);
 +              
 +              // delete all items
 +              $query = 'DELETE FROM '.sql_table('item').' WHERE iblog='.$blogid;
 +              DB::execute($query);
 +              
 +              // delete all team members
 +              $query = 'DELETE FROM '.sql_table('team').' WHERE tblog='.$blogid;
 +              DB::execute($query);
 +              
 +              // delete all bans
 +              $query = 'DELETE FROM '.sql_table('ban').' WHERE blogid='.$blogid;
 +              DB::execute($query);
 +              
 +              // delete all categories
 +              $query = 'DELETE FROM '.sql_table('category').' WHERE cblog='.$blogid;
 +              DB::execute($query);
++=======
+               self::action_adminskinedit();
+               return;
+       }
+       /**
+        * Admin::action_adminskinclone()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinclone()
+       {
+               global $member;
                
-               // delete all associated plugin options
-               NucleusPlugin::delete_option_values('blog', $blogid);
+               $member->isAdmin() or self::disallow();
+               
+               $skinid = intRequestVar('skinid');
++>>>>>>> skinnable-master
+               
+               self::skinclone($skinid, 'AdminActions');
                
++<<<<<<< HEAD
 +              // delete the blog itself
 +              $query = 'DELETE FROM '.sql_table('blog').' WHERE bnumber='.$blogid;
 +              DB::execute($query);
++=======
+               self::action_adminskinoverview();
+               return;
+       }
+       
+       /**
+        * Admin::action_adminskinieoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_adminskinieoverview()
+       {
+               global $member;
++>>>>>>> skinnable-master
                
-               $manager->notify('PostDeleteBlog', array('blogid' => $blogid));
+               $member->isAdmin() or self::disallow();
                
-               $this->action_overview(_DELETED_BLOG);
+               self::$skin->parse('adminskinieoverview');
                return;
        }
++<<<<<<< HEAD
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_memberdelete() {
 +        global $member, $manager;
 +
 +        $memberid = intRequestVar('memberid');
 +
 +        ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
 +
 +        $mem =& $manager->getMember($memberid);
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <p><?php echo _CONFIRMTXT_MEMBER ?><b><?php echo Entity::hsc($mem->getDisplayName()) ?></b>
 +            </p>
 +
 +            <p>
 +            <?php echo _WARNINGTXT_NOTDELMEDIAFILES ?>
 +            </p>
 +
 +            <form method="post" action="index.php"><div>
 +            <input type="hidden" name="action" value="memberdeleteconfirm" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="memberid" value="<?php echo  $memberid; ?>" />
 +            <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_memberdeleteconfirm() {
 +        global $member;
++=======
++>>>>>>> skinnable-master
  
-         $memberid = intRequestVar('memberid');
-         ($member->getID() == $memberid) or $member->isAdmin() or $this->disallow();
-         $error = $this->deleteOneMember($memberid);
-         if ($error)
-             $this->error($error);
-         if ($member->isAdmin())
-             $this->action_usermanagement();
-         else
-             $this->action_overview(_DELETED_MEMBER);
-     }
-       
        /**
-        * Admin::deleteOneMember()
-        * Delete a member by id
+        * Admin::action_adminskinieimport()
         * 
-        * @static
-        * @params      Integer $memberid       member id
-        * @return      String  null string or error messages
+        * @param       void
+        * @return      void
         */
-       function deleteOneMember($memberid)
+       static private function action_adminskinieimport()
        {
-               global $manager;
+               global $member;
                
++<<<<<<< HEAD
 +              $memberid = intval($memberid);
 +              $mem =& $manager->getMember($memberid);
 +              
 +              if ( !$mem->canBeDeleted() )
 +              {
 +                      return _ERROR_DELETEMEMBER;
 +              }
++=======
+               $member->isAdmin() or self::disallow();
++>>>>>>> skinnable-master
                
-               $manager->notify('PreDeleteMember', array('member' => &$mem));
+               $skinFileRaw = postVar('skinfile');
+               $mode = postVar('mode');
                
-               /* unlink comments from memberid */
-               if ( $memberid )
+               $error = self::skinieimport($mode, $skinFileRaw);
+               if ( $error )
                {
 -                      self::error($error);
 -                      return;
++<<<<<<< HEAD
 +                      $query = "UPDATE %s SET cmember=0, cuser=%s WHERE cmember=%d";
 +                      $query = sprintf($query, sql_table('comment'), DB::quoteValue($mem->getDisplayName()), $memberid);
 +                      DB::execute($query);
                }
                
 -              if ( !is_object(self::$skin) )
 -              {
 -                      self::action_adminskiniedoimport();
 -              }
 -              else
 -              {
 -                      self::$skin->parse('adminskinieimport');
 -              }
 -              return;
 -      }
 -      
 -      /**
 -       * Admin::action_adminskiniedoimport()
 -       * 
 -       * @param       void
 -       * @return      void
 -       */
 -      static private function action_adminskiniedoimport()
 -      {
 -              global $DIR_SKINS, $member, $CONF;
 +              $query = 'DELETE FROM '.sql_table('member').' WHERE mnumber='.$memberid;
 +              DB::execute($query);
                
 -              $member->isAdmin() or self::disallow();
 +              $query = 'DELETE FROM '.sql_table('team').' WHERE tmember='.$memberid;
 +              DB::execute($query);
                
 -              $mode = postVar('mode');
 -              $skinFileRaw = postVar('skinfile');
 -              $allowOverwrite = intPostVar('overwrite');
 +              $query = 'DELETE FROM '.sql_table('activation').' WHERE vmember='.$memberid;
 +              DB::execute($query);
 +              
 +              // delete all associated plugin options
 +              NucleusPlugin::delete_option_values('member', $memberid);
 +              
 +              $manager->notify('PostDeleteMember', array('member' => &$mem));
 +              
 +              return '';
 +      }
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_createnewlog() {
 +        global $member, $CONF, $manager;
 +
 +        // Only Super-Admins can do this
 +        $member->isAdmin() or $this->disallow();
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +        ?>
 +        <h2><?php echo _EBLOG_CREATE_TITLE ?></h2>
 +
 +        <h3><?php echo _ADMIN_NOTABILIA ?></h3>
 +
 +        <p><?php echo _ADMIN_PLEASE_READ ?></p>
 +
 +        <p><?php echo _ADMIN_HOW_TO_ACCESS ?></p>
 +
 +        <ol>
 +            <li><?php echo _ADMIN_SIMPLE_WAY ?></li>
 +            <li><?php echo _ADMIN_ADVANCED_WAY ?></li>
 +        </ol>
 +
 +        <h3><?php echo _ADMIN_HOW_TO_CREATE ?></h3>
 +
 +        <p>
 +        <?php echo _EBLOG_CREATE_TEXT ?>
 +        </p>
 +
 +        <form method="post" action="index.php"><div>
 +
 +        <input type="hidden" name="action" value="addnewlog" />
 +        <?php $manager->addTicketHidden() ?>
 +
 +
 +        <table><tr>
 +            <td><?php echo _EBLOG_NAME ?></td>
 +            <td><input name="name" tabindex="10" size="40" maxlength="60" /></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_SHORTNAME ?>
 +                <?php help('shortblogname'); ?>
 +            </td>
 +            <td><input name="shortname" tabindex="20" maxlength="15" size="15" /></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_DESC ?></td>
 +            <td><input name="desc" tabindex="30" maxlength="200" size="40" /></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_DEFSKIN ?>
 +                <?php help('blogdefaultskin'); ?>
 +            </td>
 +            <td>
 +                <?php
 +                    $query =  'SELECT sdname as text, sdnumber as value'
 +                           . ' FROM '.sql_table('skin_desc');
 +                    $template['name'] = 'defskin';
 +                    $template['tabindex'] = 50;
 +                    $template['selected'] = $CONF['BaseSkin'];  // set default selected skin to be globally defined base skin
 +                    showlist($query,'select',$template);
 +                ?>
 +            </td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_OFFSET ?>
 +                <?php help('blogtimeoffset'); ?>
 +                <br /><?php echo _EBLOG_STIME ?> <b><?php echo i18n::formatted_datetime('%H:%M',time()); ?></b>
 +            </td>
 +            <td><input name="timeoffset" tabindex="110" size="3" value="0" /></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_ADMIN ?>
 +                <?php help('teamadmin'); ?>
 +            </td>
 +            <td><?php echo _EBLOG_ADMIN_MSG ?></td>
 +        </tr><tr>
 +            <td><?php echo _EBLOG_CREATE ?></td>
 +            <td><input type="submit" tabindex="120" value="<?php echo _EBLOG_CREATE_BTN ?>" onclick="return checkSubmit();" /></td>
 +        </tr></table>
 +
 +        </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_addnewlog() {
 +        global $member, $manager, $CONF;
 +
 +        // Only Super-Admins can do this
 +        $member->isAdmin() or $this->disallow();
 +
 +        $bname          = trim(postVar('name'));
 +        $bshortname     = trim(postVar('shortname'));
 +        $btimeoffset    = postVar('timeoffset');
 +        $bdesc          = trim(postVar('desc'));
 +        $bdefskin       = postVar('defskin');
 +
 +        if (!isValidShortName($bshortname))
 +            $this->error(_ERROR_BADSHORTBLOGNAME);
 +
 +        if ($manager->existsBlog($bshortname))
 +            $this->error(_ERROR_DUPSHORTBLOGNAME);
 +
 +        $manager->notify(
 +            'PreAddBlog',
 +            array(
 +                'name' => &$bname,
 +                'shortname' => &$bshortname,
 +                'timeoffset' => &$btimeoffset,
 +                'description' => &$bdesc,
 +                'defaultskin' => &$bdefskin
 +            )
 +        );
 +
 +
 +        // create blog
 +              $query = sprintf('INSERT INTO %s (bname, bshortname, bdesc, btimeoffset, bdefskin) VALUES (%s, %s, %s, %s, %s)',
 +                      sql_table('blog'),
 +                      DB::quoteValue($bname),
 +                      DB::quoteValue($bshortname),
 +                      DB::quoteValue($bdesc),
 +                      DB::quoteValue($btimeoffset),
 +                      DB::quoteValue($bdefskin)
 +              );
 +        DB::execute($query);
 +        $blogid = DB::getInsertId();
 +        $blog   =& $manager->getBlog($blogid);
 +
 +        // create new category
 +        $catdefname = (defined('_EBLOGDEFAULTCATEGORY_NAME') ? _EBLOGDEFAULTCATEGORY_NAME : 'General');
 +        $catdefdesc = (defined('_EBLOGDEFAULTCATEGORY_DESC') ? _EBLOGDEFAULTCATEGORY_DESC : 'Items that do not fit in other categories');
 +              $query = sprintf('INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)',
 +                      sql_table('category'),
 +                      $blogid,
 +                      DB::quoteValue($catdefname),
 +                      DB::quoteValue($catdefdesc)
 +              );
 +        DB::execute($query);
 +        $catid = DB::getInsertId();
 +
 +        // set as default category
 +        $blog->setDefaultCategory($catid);
 +        $blog->writeSettings();
 +
 +        // create team member
 +        $memberid = $member->getID();
 +        $query = sprintf('INSERT INTO %s (tmember, tblog, tadmin) VALUES (%d, %d, 1)', sql_table('team'), $memberid, $blogid);
 +        DB::execute($query);
 +
 +        $itemdeftitle = (defined('_EBLOG_FIRSTITEM_TITLE') ? _EBLOG_FIRSTITEM_TITLE : 'First Item');
 +        $itemdefbody = (defined('_EBLOG_FIRSTITEM_BODY') ? _EBLOG_FIRSTITEM_BODY : 'This is the first item in your weblog. Feel free to delete it.');
 +
 +        $blog->additem($blog->getDefaultCategory(),$itemdeftitle,$itemdefbody,'',$blogid, $memberid,$blog->getCorrectTime(),0,0,0);
 +
 +        
 +        $manager->notify(
 +            'PostAddBlog',
 +            array(
 +                'blog' => &$blog
 +            )
 +        );
 +
 +        $manager->notify(
 +            'PostAddCategory',
 +            array(
 +                'blog' => &$blog,
 +                'name' => _EBLOGDEFAULTCATEGORY_NAME,
 +                'description' => _EBLOGDEFAULTCATEGORY_DESC,
 +                'catid' => $catid
 +            )
 +        );
 +
 +        $this->pagehead();
 +        ?>
 +        <h2><?php echo _BLOGCREATED_TITLE ?></h2>
 +
 +        <p><?php echo sprintf(_BLOGCREATED_ADDEDTXT, Entity::hsc($bname)) ?></p>
 +
 +        <ol>
 +            <li><a href="#index_php"><?php echo sprintf(_BLOGCREATED_SIMPLEWAY, Entity::hsc($bshortname)) ?></a></li>
 +            <li><a href="#skins"><?php echo _BLOGCREATED_ADVANCEDWAY ?></a></li>
 +        </ol>
 +
 +        <h3><a id="index_php"><?php echo sprintf(_BLOGCREATED_SIMPLEDESC1, Entity::hsc($bshortname)) ?></a></h3>
 +
 +        <p><?php echo sprintf(_BLOGCREATED_SIMPLEDESC2, Entity::hsc($bshortname)) ?></p>
 +<pre><code>&lt;?php
 +
 +$CONF['Self'] = '<b><?php echo Entity::hsc($bshortname) ?>.php</b>';
 +
 +include('<i>./config.php</i>');
 +
 +selectBlog('<b><?php echo Entity::hsc($bshortname) ?></b>');
 +selector();
 +
 +?&gt;</code></pre>
 +
 +        <p><?php echo _BLOGCREATED_SIMPLEDESC3 ?></p>
 +
 +        <p><?php echo _BLOGCREATED_SIMPLEDESC4 ?></p>
 +
 +        <form action="index.php" method="post"><div>
 +            <input type="hidden" name="action" value="addnewlog2" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="blogid" value="<?php echo intval($blogid) ?>" />
 +            <table><tr>
 +                <td><?php echo _EBLOG_URL ?></td>
 +                <td><input name="url" maxlength="100" size="40" value="<?php echo Entity::hsc($CONF['IndexURL'].$bshortname.'.php') ?>" /></td>
 +            </tr><tr>
 +                <td><?php echo _EBLOG_CREATE ?></td>
 +                <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN ?>" onclick="return checkSubmit();" /></td>
 +            </tr></table>
 +        </div></form>
 +
 +        <h3><a id="skins"><?php echo _BLOGCREATED_ADVANCEDWAY2 ?></a></h3>
 +
 +        <p><?php echo _BLOGCREATED_ADVANCEDWAY3 ?></p>
 +
 +        <form action="index.php" method="post"><div>
 +            <input type="hidden" name="action" value="addnewlog2" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="blogid" value="<?php echo intval($blogid) ?>" />
 +            <table><tr>
 +                <td><?php echo _EBLOG_URL ?></td>
 +                <td><input name="url" maxlength="100" size="40" /></td>
 +            </tr><tr>
 +                <td><?php echo _EBLOG_CREATE ?></td>
 +                <td><input type="submit" value="<?php echo _EBLOG_CREATE_BTN ?>" onclick="return checkSubmit();" /></td>
 +            </tr></table>
 +        </div></form>
 +
 +        <?php       $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_addnewlog2() {
 +        global $member, $manager;
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $burl   = requestVar('url');
 +        $blogid = intRequestVar('blogid');
 +
 +        $blog =& $manager->getBlog($blogid);
 +        $blog->setURL(trim($burl));
 +        $blog->writeSettings();
 +
 +        $this->action_overview(_MSG_NEWBLOG);
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinieoverview() {
 +        global $member, $DIR_LIBS, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // load skinie class
 +        include_once($DIR_LIBS . 'skinie.php');
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +
 +    ?>
 +        <h2><?php echo _SKINIE_TITLE_IMPORT ?></h2>
 +
 +                <p><label for="skinie_import_local"><?php echo _SKINIE_LOCAL ?></label>
 +                <?php                   global $DIR_SKINS;
 +
 +                    $candidates = SkinImport::searchForCandidates($DIR_SKINS);
 +
 +                    if (sizeof($candidates) > 0) {
 +                        ?>
 +                            <form method="post" action="index.php"><div>
 +                                <input type="hidden" name="action" value="skinieimport" />
 +                                <?php $manager->addTicketHidden() ?>
 +                                <input type="hidden" name="mode" value="file" />
 +                                <select name="skinfile" id="skinie_import_local">
 +                                <?php                                   foreach ($candidates as $skinname => $skinfile) {
 +                                        $html = Entity::hsc($skinfile);
 +                                        echo '<option value="',$html,'">',$skinname,'</option>';
 +                                    }
 +                                ?>
 +                                </select>
 +                                <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT ?>" />
 +                            </div></form>
 +                        <?php                   } else {
 +                        echo _SKINIE_NOCANDIDATES;
 +                    }
 +                ?>
 +                </p>
 +
 +                <p><em><?php echo _OR ?></em></p>
 +
 +                <form method="post" action="index.php"><p>
 +                    <?php $manager->addTicketHidden() ?>
 +                    <input type="hidden" name="action" value="skinieimport" />
 +                    <input type="hidden" name="mode" value="url" />
 +                    <label for="skinie_import_url"><?php echo _SKINIE_FROMURL ?></label>
 +                    <input type="text" name="skinfile" id="skinie_import_url" size="60" value="http://" />
 +                    <input type="submit" value="<?php echo _SKINIE_BTN_IMPORT ?>" />
 +                </p></form>
 +
 +
 +        <h2><?php echo _SKINIE_TITLE_EXPORT ?></h2>
 +        <form method="post" action="index.php"><div>
 +            <input type="hidden" name="action" value="skinieexport" />
 +            <?php $manager->addTicketHidden() ?>
 +
 +            <p><?php echo _SKINIE_EXPORT_INTRO ?></p>
 +
 +            <table><tr>
 +                <th colspan="2"><?php echo _SKINIE_EXPORT_SKINS ?></th>
 +            </tr><tr>
 +    <?php       // show list of skins
 +        $res = DB::getResult('SELECT * FROM '.sql_table('skin_desc'));
 +        foreach ( $res as $row) {
 +            $id = 'skinexp' . $row['sdnumber'];
 +            echo '<td><input type="checkbox" name="skin[',$row['sdnumber'],']"  id="',$id,'" />';
 +            echo '<label for="',$id,'">',Entity::hsc($row['sdname']),'</label></td>';
 +            echo '<td>',Entity::hsc($row['sddesc']),'</td>';
 +            echo '</tr><tr>';
 +        }
 +
 +        echo '<th colspan="2">',_SKINIE_EXPORT_TEMPLATES,'</th></tr><tr>';
 +
 +        // show list of templates
 +        $res = DB::getResult('SELECT * FROM '.sql_table('template_desc'));
 +        foreach ( $res as $row ) {
 +            $id = 'templateexp' . $row['tdnumber'];
 +            echo '<td><input type="checkbox" name="template[',$row['tdnumber'],']" id="',$id,'" />';
 +            echo '<label for="',$id,'">',Entity::hsc($row['tdname']),'</label></td>';
 +            echo '<td>',Entity::hsc($row['tddesc']),'</td>';
 +            echo '</tr><tr>';
 +        }
 +
 +    ?>
 +                <th colspan="2"><?php echo _SKINIE_EXPORT_EXTRA ?></th>
 +            </tr><tr>
 +                <td colspan="2"><textarea cols="40" rows="5" name="info"></textarea></td>
 +            </tr><tr>
 +                <th colspan="2"><?php echo _SKINIE_TITLE_EXPORT ?></th>
 +            </tr><tr>
 +                <td colspan="2"><input type="submit" value="<?php echo _SKINIE_BTN_EXPORT ?>" /></td>
 +            </tr></table>
 +        </div></form>
 +
 +    <?php
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinieimport() {
 +        global $member, $DIR_LIBS, $DIR_SKINS, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // load skinie class
 +        include_once($DIR_LIBS . 'skinie.php');
 +
 +        $skinFileRaw= postVar('skinfile');
 +        $mode       = postVar('mode');
 +
 +        $importer = new SkinImport();
 +
 +        // get full filename
 +        if ($mode == 'file')
 +        {
 +            $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
 +
 +            // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
 +            if (!file_exists($skinFile))
 +                $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
 +        } else {
 +            $skinFile = $skinFileRaw;
 +        }
 +
 +        // read only metadata
 +        $error = $importer->readFile($skinFile, 1);
 +
 +        // clashes
 +        $skinNameClashes = $importer->checkSkinNameClashes();
 +        $templateNameClashes = $importer->checkTemplateNameClashes();
 +        $hasNameClashes = (count($skinNameClashes) > 0) || (count($templateNameClashes) > 0);
 +
 +        if ($error) $this->error($error);
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=skinieoverview">(',_BACK,')</a></p>';
 +        ?>
 +        <h2><?php echo _SKINIE_CONFIRM_TITLE ?></h2>
 +
 +        <ul>
 +            <li><p><strong><?php echo _SKINIE_INFO_GENERAL ?></strong> <?php echo Entity::hsc($importer->getInfo()) ?></p></li>
 +            <li><p><strong><?php echo _SKINIE_INFO_SKINS ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames()) ?></p></li>
 +            <li><p><strong><?php echo _SKINIE_INFO_TEMPLATES ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames()) ?></p></li>
 +            <?php
 +                if ($hasNameClashes)
 +                {
 +            ?>
 +            <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_SKINCLASH ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$skinNameClashes) ?></p></li>
 +            <li><p><strong style="color: red;"><?php echo _SKINIE_INFO_TEMPLCLASH ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$templateNameClashes) ?></p></li>
 +            <?php
 +                } // if (hasNameClashes)
 +            ?>
 +        </ul>
 +
 +        <form method="post" action="index.php"><div>
 +            <input type="hidden" name="action" value="skiniedoimport" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="skinfile" value="<?php echo Entity::hsc(postVar('skinfile')) ?>" />
 +            <input type="hidden" name="mode" value="<?php echo Entity::hsc($mode) ?>" />
 +            <input type="submit" value="<?php echo _SKINIE_CONFIRM_IMPORT ?>" />
 +            <?php
 +                if ($hasNameClashes)
 +                {
 +            ?>
 +            <br />
 +            <input type="checkbox" name="overwrite" value="1" id="cb_overwrite" /><label for="cb_overwrite"><?php echo _SKINIE_CONFIRM_OVERWRITE ?></label>
 +            <?php
 +                } // if (hasNameClashes)
 +            ?>
 +        </div></form>
 +
 +
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skiniedoimport() {
 +        global $member, $DIR_LIBS, $DIR_SKINS;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // load skinie class
 +        include_once($DIR_LIBS . 'skinie.php');
 +
 +        $skinFileRaw= postVar('skinfile');
 +        $mode       = postVar('mode');
 +
 +        $allowOverwrite = intPostVar('overwrite');
 +
 +        // get full filename
 +        if ($mode == 'file')
 +        {
 +            $skinFile = $DIR_SKINS . $skinFileRaw . '/skinbackup.xml';
 +
 +            // backwards compatibilty (in v2.0, exports were saved as skindata.xml)
 +            if (!file_exists($skinFile))
 +                $skinFile = $DIR_SKINS . $skinFileRaw . '/skindata.xml';
 +
 +        } else {
 +            $skinFile = $skinFileRaw;
 +        }
 +
 +        $importer = new SkinImport();
 +
 +        $error = $importer->readFile($skinFile);
 +
 +        if ($error)
 +            $this->error($error);
 +
 +        $error = $importer->writeToDatabase($allowOverwrite);
 +
 +        if ($error)
 +            $this->error($error);
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +    ?>
 +        <h2><?php echo _SKINIE_DONE ?></h2>
 +
 +        <ul>
 +            <li><p><strong><?php echo _SKINIE_INFO_GENERAL ?></strong> <?php echo Entity::hsc($importer->getInfo()) ?></p></li>
 +            <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDSKINS ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getSkinNames()) ?></p></li>
 +            <li><p><strong><?php echo _SKINIE_INFO_IMPORTEDTEMPLS ?></strong> <?php echo implode(' <em>'._AND.'</em> ',$importer->getTemplateNames()) ?></p></li>
 +        </ul>
 +
 +    <?php       $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinieexport() {
 +        global $member, $DIR_LIBS;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // load skinie class
 +        include_once($DIR_LIBS . 'skinie.php');
 +
 +        $aSkins = requestIntArray('skin');
 +        $aTemplates = requestIntArray('template');
 +
 +        if (!is_array($aTemplates)) $aTemplates = array();
 +        if (!is_array($aSkins)) $aSkins = array();
 +
 +        $skinList = array_keys($aSkins);
 +        $templateList = array_keys($aTemplates);
 +
 +        $info = postVar('info');
 +
 +        $exporter = new SkinExport();
 +        foreach ($skinList as $skinId) {
 +            $exporter->addSkin($skinId);
 +        }
 +        foreach ($templateList as $templateId) {
 +            $exporter->addTemplate($templateId);
 +        }
 +        $exporter->setInfo($info);
 +
 +        $exporter->export();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templateoverview() {
 +        global $member, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +
 +        echo '<h2>' . _TEMPLATE_TITLE . '</h2>';
 +        echo '<h3>' . _TEMPLATE_AVAILABLE_TITLE . '</h3>';
 +
 +        $query = 'SELECT * FROM '.sql_table('template_desc').' ORDER BY tdname';
 +        $template['content'] = 'templatelist';
 +        $template['tabindex'] = 10;
 +        showlist($query,'table',$template);
 +
 +        echo '<h3>' . _TEMPLATE_NEW_TITLE . '</h3>';
 +
 +        ?>
 +        <form method="post" action="index.php"><div>
 +
 +        <input name="action" value="templatenew" type="hidden" />
 +        <?php $manager->addTicketHidden() ?>
 +        <table><tr>
 +            <td><?php echo _TEMPLATE_NAME ?> <?php help('shortnames'); ?></td>
 +            <td><input name="name" tabindex="10010" maxlength="20" size="20" /></td>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_DESC ?></td>
 +            <td><input name="desc" tabindex="10020" maxlength="200" size="50" /></td>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_CREATE ?></td>
 +            <td><input type="submit" tabindex="10030" value="<?php echo _TEMPLATE_CREATE_BTN ?>" onclick="return checkSubmit();" /></td>
 +        </tr></table>
 +
 +        </div></form>
 +
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templateedit($msg = '') {
 +        global $member, $manager;
 +
 +        $templateid = intRequestVar('templateid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $extrahead = '<script type="text/javascript" src="javascript/templateEdit.js"></script>';
 +        $extrahead .= '<script type="text/javascript">setTemplateEditText('.DB::quoteValue(_EDITTEMPLATE_EMPTY).');</script>';
 +
 +        $this->pagehead($extrahead);
 +
 +        $templatename = Template::getNameFromId($templateid);
 +        $templatedescription = Template::getDesc($templateid);
 +        $template =& $manager->getTemplate($templatename);
 +
 +        ?>
 +        <p>
 +        <a href="index.php?action=templateoverview">(<?php echo _TEMPLATE_BACK ?>)</a>
 +        </p>
 +
 +        <h2><?php echo _TEMPLATE_EDIT_TITLE ?> '<?php echo  Entity::hsc($templatename); ?>'</h2>
 +
 +        <?php                   if ($msg) echo "<p>"._MESSAGE.": $msg</p>";
 +        ?>
 +
 +        <p><?php echo _TEMPLATE_EDIT_MSG ?></p>
 +
 +        <form method="post" action="index.php">
 +        <div>
 +
 +        <input type="hidden" name="action" value="templateupdate" />
 +        <?php $manager->addTicketHidden() ?>
 +        <input type="hidden" name="templateid" value="<?php echo  $templateid; ?>" />
 +
 +        <table><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_SETTINGS ?></th>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_NAME ?> <?php help('shortnames'); ?></td>
 +            <td><input name="tname" tabindex="4" size="20" maxlength="20" value="<?php echo  Entity::hsc($templatename) ?>" /></td>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_DESC ?></td>
 +            <td><input name="tdesc" tabindex="5" size="50" maxlength="200" value="<?php echo  Entity::hsc($templatedescription) ?>" /></td>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_UPDATE ?></th>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_UPDATE ?></td>
 +            <td>
 +                <input type="submit" tabindex="6" value="<?php echo _TEMPLATE_UPDATE_BTN ?>" onclick="return checkSubmit();" />
 +                <input type="reset" tabindex="7" value="<?php echo _TEMPLATE_RESET_BTN ?>" />
 +            </td>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_ITEMS ?> <?php help('templateitems'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_ITEMHEADER, 'ITEM_HEADER', '', 8);
 +    $this->_templateEditRow($template, _TEMPLATE_ITEMBODY, 'ITEM', '', 9, 1);
 +    $this->_templateEditRow($template, _TEMPLATE_ITEMFOOTER, 'ITEM_FOOTER', '', 10);
 +    $this->_templateEditRow($template, _TEMPLATE_MORELINK, 'MORELINK', 'morelink', 20);
 +    $this->_templateEditRow($template, _TEMPLATE_EDITLINK, 'EDITLINK', 'editlink', 25);
 +    $this->_templateEditRow($template, _TEMPLATE_NEW, 'NEW', 'new', 30);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_COMMENTS_ANY ?> <?php help('templatecomments'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_CHEADER, 'COMMENTS_HEADER', 'commentheaders', 40);
 +    $this->_templateEditRow($template, _TEMPLATE_CBODY, 'COMMENTS_BODY', 'commentbody', 50, 1);
 +    $this->_templateEditRow($template, _TEMPLATE_CFOOTER, 'COMMENTS_FOOTER', 'commentheaders', 60);
 +    $this->_templateEditRow($template, _TEMPLATE_CONE, 'COMMENTS_ONE', 'commentwords', 70);
 +    $this->_templateEditRow($template, _TEMPLATE_CMANY, 'COMMENTS_MANY', 'commentwords', 80);
 +    $this->_templateEditRow($template, _TEMPLATE_CMORE, 'COMMENTS_CONTINUED', 'commentcontinued', 90);
 +    $this->_templateEditRow($template, _TEMPLATE_CMEXTRA, 'COMMENTS_AUTH', 'memberextra', 100);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_COMMENTS_NONE ?> <?php help('templatecomments'); ?></th>
 +<?php
 +    $this->_templateEditRow($template, _TEMPLATE_CNONE, 'COMMENTS_NONE', '', 110);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_COMMENTS_TOOMUCH ?> <?php help('templatecomments'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_CTOOMUCH, 'COMMENTS_TOOMUCH', '', 120);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_ARCHIVELIST ?> <?php help('templatearchivelists'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_AHEADER, 'ARCHIVELIST_HEADER', '', 130);
 +    $this->_templateEditRow($template, _TEMPLATE_AITEM, 'ARCHIVELIST_LISTITEM', '', 140);
 +    $this->_templateEditRow($template, _TEMPLATE_AFOOTER, 'ARCHIVELIST_FOOTER', '', 150);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_BLOGLIST ?> <?php help('templatebloglists'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_BLOGHEADER, 'BLOGLIST_HEADER', '', 160);
 +    $this->_templateEditRow($template, _TEMPLATE_BLOGITEM, 'BLOGLIST_LISTITEM', '', 170);
 +    $this->_templateEditRow($template, _TEMPLATE_BLOGFOOTER, 'BLOGLIST_FOOTER', '', 180);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_CATEGORYLIST ?> <?php help('templatecategorylists'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_CATHEADER, 'CATLIST_HEADER', '', 190);
 +    $this->_templateEditRow($template, _TEMPLATE_CATITEM, 'CATLIST_LISTITEM', '', 200);
 +    $this->_templateEditRow($template, _TEMPLATE_CATFOOTER, 'CATLIST_FOOTER', '', 210);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_DATETIME ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_DHEADER, 'DATE_HEADER', 'dateheads', 220);
 +    $this->_templateEditRow($template, _TEMPLATE_DFOOTER, 'DATE_FOOTER', 'dateheads', 230);
 +    $this->_templateEditRow($template, _TEMPLATE_DFORMAT, 'FORMAT_DATE', 'datetime', 240);
 +    $this->_templateEditRow($template, _TEMPLATE_TFORMAT, 'FORMAT_TIME', 'datetime', 250);
 +    $this->_templateEditRow($template, _TEMPLATE_LOCALE, 'LOCALE', 'locale', 260);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_IMAGE ?> <?php help('templatepopups'); ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_PCODE, 'POPUP_CODE', '', 270);
 +    $this->_templateEditRow($template, _TEMPLATE_ICODE, 'IMAGE_CODE', '', 280);
 +    $this->_templateEditRow($template, _TEMPLATE_MCODE, 'MEDIA_CODE', '', 290);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_SEARCH ?></th>
 +<?php $this->_templateEditRow($template, _TEMPLATE_SHIGHLIGHT, 'SEARCH_HIGHLIGHT', 'highlight',300);
 +    $this->_templateEditRow($template, _TEMPLATE_SNOTFOUND, 'SEARCH_NOTHINGFOUND', 'nothingfound',310);
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_PLUGIN_FIELDS ?></th>
 +<?php
 +        $tab = 600;
 +        $pluginfields = array();
 +        $manager->notify('TemplateExtraFields',array('fields'=>&$pluginfields));
 +
 +        foreach ($pluginfields as $pfkey=>$pfvalue) {
 +            echo "</tr><tr>\n";
 +            echo '<th colspan="2">' . Entity::hen($pfkey) . "</th>\n";
 +            foreach ($pfvalue as $pffield=>$pfdesc) {
 +                $this->_templateEditRow($template, $pfdesc, $pffield, '',++$tab,0);
 +            }
 +        }
 +?>
 +        </tr><tr>
 +            <th colspan="2"><?php echo _TEMPLATE_UPDATE ?></th>
 +        </tr><tr>
 +            <td><?php echo _TEMPLATE_UPDATE ?></td>
 +            <td>
 +                <input type="submit" tabindex="800" value="<?php echo _TEMPLATE_UPDATE_BTN ?>" onclick="return checkSubmit();" />
 +                <input type="reset" tabindex="810" value="<?php echo _TEMPLATE_RESET_BTN ?>" />
 +            </td>
 +        </tr></table>
 +
 +        </div>
 +        </form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function _templateEditRow(&$template, $description, $name, $help = '', $tabindex = 0, $big = 0) {
 +        static $count = 1;
 +        if (!isset($template[$name])) $template[$name] = '';
 +    ?>
 +        </tr><tr>
 +            <td><?php echo $description ?> <?php if ($help) help('template'.$help); ?></td>
 +            <td id="td<?php echo $count ?>"><textarea class="templateedit" name="<?php echo $name ?>" tabindex="<?php echo $tabindex ?>" cols="50" rows="<?php echo $big?10:5 ?>" id="textarea<?php echo $count ?>"><?php echo  Entity::hsc($template[$name]); ?></textarea></td>
 +    <?php       $count++;
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templateupdate() {
 +        global $member,$manager;
 +
 +        $templateid = intRequestVar('templateid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $name = postVar('tname');
 +        $desc = postVar('tdesc');
 +
 +        if (!isValidTemplateName($name))
 +            $this->error(_ERROR_BADTEMPLATENAME);
 +
 +        if ((Template::getNameFromId($templateid) != $name) && Template::exists($name))
 +            $this->error(_ERROR_DUPTEMPLATENAME);
 +
 +
 +        $name = DB::quoteValue($name);
 +        $desc = DB::quoteValue($desc);
 +
 +        // 1. Remove all template parts
 +        $query = 'DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid;
 +        DB::execute($query);
 +
 +        // 2. Update description
 +        $query =  'UPDATE '.sql_table('template_desc').' SET'
 +               . ' tdname=' . $name . ','
 +               . ' tddesc=' . $desc
 +               . ' WHERE tdnumber=' . $templateid;
 +        DB::execute($query);
 +
 +        // 3. Add non-empty template parts
 +        $this->addToTemplate($templateid, 'ITEM_HEADER', postVar('ITEM_HEADER'));
 +        $this->addToTemplate($templateid, 'ITEM', postVar('ITEM'));
 +        $this->addToTemplate($templateid, 'ITEM_FOOTER', postVar('ITEM_FOOTER'));
 +        $this->addToTemplate($templateid, 'MORELINK', postVar('MORELINK'));
 +        $this->addToTemplate($templateid, 'EDITLINK', postVar('EDITLINK'));
 +        $this->addToTemplate($templateid, 'NEW', postVar('NEW'));
 +        $this->addToTemplate($templateid, 'COMMENTS_HEADER', postVar('COMMENTS_HEADER'));
 +        $this->addToTemplate($templateid, 'COMMENTS_BODY', postVar('COMMENTS_BODY'));
 +        $this->addToTemplate($templateid, 'COMMENTS_FOOTER', postVar('COMMENTS_FOOTER'));
 +        $this->addToTemplate($templateid, 'COMMENTS_CONTINUED', postVar('COMMENTS_CONTINUED'));
 +        $this->addToTemplate($templateid, 'COMMENTS_TOOMUCH', postVar('COMMENTS_TOOMUCH'));
 +        $this->addToTemplate($templateid, 'COMMENTS_AUTH', postVar('COMMENTS_AUTH'));
 +        $this->addToTemplate($templateid, 'COMMENTS_ONE', postVar('COMMENTS_ONE'));
 +        $this->addToTemplate($templateid, 'COMMENTS_MANY', postVar('COMMENTS_MANY'));
 +        $this->addToTemplate($templateid, 'COMMENTS_NONE', postVar('COMMENTS_NONE'));
 +        $this->addToTemplate($templateid, 'ARCHIVELIST_HEADER', postVar('ARCHIVELIST_HEADER'));
 +        $this->addToTemplate($templateid, 'ARCHIVELIST_LISTITEM', postVar('ARCHIVELIST_LISTITEM'));
 +        $this->addToTemplate($templateid, 'ARCHIVELIST_FOOTER', postVar('ARCHIVELIST_FOOTER'));
 +        $this->addToTemplate($templateid, 'BLOGLIST_HEADER', postVar('BLOGLIST_HEADER'));
 +        $this->addToTemplate($templateid, 'BLOGLIST_LISTITEM', postVar('BLOGLIST_LISTITEM'));
 +        $this->addToTemplate($templateid, 'BLOGLIST_FOOTER', postVar('BLOGLIST_FOOTER'));
 +        $this->addToTemplate($templateid, 'CATLIST_HEADER', postVar('CATLIST_HEADER'));
 +        $this->addToTemplate($templateid, 'CATLIST_LISTITEM', postVar('CATLIST_LISTITEM'));
 +        $this->addToTemplate($templateid, 'CATLIST_FOOTER', postVar('CATLIST_FOOTER'));
 +        $this->addToTemplate($templateid, 'DATE_HEADER', postVar('DATE_HEADER'));
 +        $this->addToTemplate($templateid, 'DATE_FOOTER', postVar('DATE_FOOTER'));
 +        $this->addToTemplate($templateid, 'FORMAT_DATE', postVar('FORMAT_DATE'));
 +        $this->addToTemplate($templateid, 'FORMAT_TIME', postVar('FORMAT_TIME'));
 +        $this->addToTemplate($templateid, 'LOCALE', postVar('LOCALE'));
 +        $this->addToTemplate($templateid, 'SEARCH_HIGHLIGHT', postVar('SEARCH_HIGHLIGHT'));
 +        $this->addToTemplate($templateid, 'SEARCH_NOTHINGFOUND', postVar('SEARCH_NOTHINGFOUND'));
 +        $this->addToTemplate($templateid, 'POPUP_CODE', postVar('POPUP_CODE'));
 +        $this->addToTemplate($templateid, 'MEDIA_CODE', postVar('MEDIA_CODE'));
 +        $this->addToTemplate($templateid, 'IMAGE_CODE', postVar('IMAGE_CODE'));
 +
 +        $pluginfields = array();
 +        $manager->notify('TemplateExtraFields',array('fields'=>&$pluginfields));
 +        foreach ($pluginfields as $pfkey=>$pfvalue) {
 +            foreach ($pfvalue as $pffield=>$pfdesc) {
 +                $this->addToTemplate($templateid, $pffield, postVar($pffield));
 +            }
 +        }
 +
 +        // jump back to template edit
 +        $this->action_templateedit(_TEMPLATE_UPDATED);
 +
 +    }
 +
++=======
++                      self::error($error);
++                      return;
++              }
++              
++              if ( !is_object(self::$skin) )
++              {
++                      self::action_adminskiniedoimport();
++              }
++              else
++              {
++                      self::$skin->parse('adminskinieimport');
++              }
++              return;
++      }
++      
++>>>>>>> skinnable-master
 +      /**
-        * Admin::addToTemplate()
-        * 
-        * @param       Integer $id     ID for template
-        * @param       String  $partname       parts name
-        * @param       String  $content        template contents
-        * @return      Integer record index
++       * Admin::action_adminskiniedoimport()
 +       * 
++       * @param       void
++       * @return      void
 +       */
-       function addToTemplate($id, $partname, $content)
++      static private function action_adminskiniedoimport()
 +      {
-               // don't add empty parts:
-               if ( !trim($content) )
++              global $DIR_SKINS, $member, $CONF;
++              
++              $member->isAdmin() or self::disallow();
++              
++              $mode = postVar('mode');
++              $skinFileRaw = postVar('skinfile');
++              $allowOverwrite = intPostVar('overwrite');
+               
+               $error = self::skiniedoimport($mode, $skinFileRaw, $allowOverwrite);
+               if ( $error )
                {
-                       return -1;
 -                      self::error($error);
 -                      return;
++                      self::error($error);
++                      return;
 +              }
 +              
++<<<<<<< HEAD
 +              $partname = DB::quoteValue($partname);
 +              $content = DB::quoteValue($content);
 +              
 +              $query = "INSERT INTO %s (tdesc, tpartname, tcontent) VALUES (%d, %s, %s)";
 +              $query = sprintf($query, sql_table('template'), (integer) $id, $partname, $content);
 +              if ( DB::execute($query) === FALSE )
 +              {
 +                      $err = DB::getError();
 +                      exit(_ADMIN_SQLDIE_QUERYERROR . $err[2]);
 +              }
 +              return DB::getInsertId();
 +      }
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_templatedelete() {
 +        global $member, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $templateid = intRequestVar('templateid');
 +        // TODO: check if template can be deleted
 +
 +        $this->pagehead();
 +
 +        $name = Template::getNameFromId($templateid);
 +        $desc = Template::getDesc($templateid);
 +
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <p>
 +            <?php echo _CONFIRMTXT_TEMPLATE ?><b><?php echo Entity::hsc($name) ?></b> (<?php echo  Entity::hsc($desc) ?>)
 +            </p>
 +
 +            <form method="post" action="index.php"><div>
 +                <input type="hidden" name="action" value="templatedeleteconfirm" />
 +                <?php $manager->addTicketHidden() ?>
 +                <input type="hidden" name="templateid" value="<?php echo  $templateid ?>" />
 +                <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templatedeleteconfirm() {
 +        global $member, $manager;
 +
 +        $templateid = intRequestVar('templateid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $manager->notify('PreDeleteTemplate', array('templateid' => $templateid));
 +
 +        // 1. delete description
 +        DB::execute('DELETE FROM '.sql_table('template_desc').' WHERE tdnumber=' . $templateid);
 +
 +        // 2. delete parts
 +        DB::execute('DELETE FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
 +
 +        $manager->notify('PostDeleteTemplate', array('templateid' => $templateid));
 +
 +        $this->action_templateoverview();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templatenew() {
 +        global $member;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $name = postVar('name');
 +        $desc = postVar('desc');
 +
 +        if (!isValidTemplateName($name))
 +            $this->error(_ERROR_BADTEMPLATENAME);
 +
 +        if (Template::exists($name))
 +            $this->error(_ERROR_DUPTEMPLATENAME);
 +
 +        $newTemplateId = Template::createNew($name, $desc);
 +
 +        $this->action_templateoverview();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_templateclone() {
 +        global $member;
 +
 +        $templateid = intRequestVar('templateid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // 1. read old template
 +        $name = Template::getNameFromId($templateid);
 +        $desc = Template::getDesc($templateid);
 +
 +        // 2. create desc thing
 +        $name = "cloned" . $name;
 +
 +        // if a template with that name already exists:
 +        if (Template::exists($name)) {
 +            $i = 1;
 +            while (Template::exists($name . $i))
 +                $i++;
 +            $name .= $i;
 +        }
 +
 +        $newid = Template::createNew($name, $desc);
 +
 +        // 3. create clone
 +        // go through parts of old template and add them to the new one
 +        $res = DB::getResult('SELECT tpartname, tcontent FROM '.sql_table('template').' WHERE tdesc=' . $templateid);
 +        foreach ( $res as $row ) {
 +            $this->addToTemplate($newid, $row['tpartname'], $row['tcontent']);
 +        }
 +
 +        $this->action_templateoverview();
 +    }
 +      
 +      /**
 +       * Admin::action_skinoverview()
 +       * 
 +       * @param       void
 +       * @return      void
 +       */
 +      public function action_skinoverview()
 +      {
 +              global $member, $manager;
 +              
 +              $member->isAdmin() or $this->disallow();
 +              
 +              $this->pagehead();
 +              
 +              echo '<p><a href="index.php?action=manage">(' . _BACKTOMANAGE . ")</a></p>\n";
 +              echo '<h2>' . _SKIN_EDIT_TITLE . "</h2>\n";
 +              echo '<h3>' . _SKIN_AVAILABLE_TITLE . "</h3>\n";
 +              
 +              $query = 'SELECT * FROM '.sql_table('skin_desc').' ORDER BY sdname;';
 +              $template['content'] = 'skinlist';
 +              $template['tabindex'] = 10;
 +              
 +              showlist($query,'table',$template);
 +              
 +              echo '<h3>' . _SKIN_NEW_TITLE . "</h3>\n";
 +              echo "<form method=\"post\" action=\"index.php\">\n";
 +              echo "<div>\n";
 +              echo "<input name=\"action\" value=\"skinnew\" type=\"hidden\" />\n";
 +              
 +              $manager->addTicketHidden() . "\n";
 +              
 +              echo "<table frame=\"box\" rules=\"all\" summary=\"skinoverview\">\n";
 +              echo "<tr>\n";
 +              echo "<td>" . _SKIN_NAME;
 +              echo help('shortnames');
 +              echo "</td>\n";
 +              echo "<td><input name=\"name\" tabindex=\"10010\" maxlength=\"20\" size=\"20\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo "<td>" . _SKIN_DESC . "</td>\n";
 +              echo "<td><input name=\"desc\" tabindex=\"10020\" maxlength=\"200\" size=\"50\" /></td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _SKIN_CREATE . "</td>\n";
 +              echo '<td><input type="submit" tabindex="10030" value="' . _SKIN_CREATE_BTN . '" onclick="return checkSubmit();" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "</table>\n";
 +              
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              
 +              $this->pagefoot();
 +              return;
 +      }
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinnew() {
 +        global $member;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $name = trim(postVar('name'));
 +        $desc = trim(postVar('desc'));
 +
 +        if (!isValidSkinName($name))
 +            $this->error(_ERROR_BADSKINNAME);
 +
 +        if (Skin::exists($name))
 +            $this->error(_ERROR_DUPSKINNAME);
 +
 +        $newId = Skin::createNew($name, $desc);
 +
 +        $this->action_skinoverview();
 +    }
 +
 +      /**
 +       * Admin::action_skinedit()
 +       * @param       void
 +       * @return      void
 +       */
 +      public function action_skinedit()
 +      {
 +              global $member, $manager;
 +              
 +              $skinid = intRequestVar('skinid');
 +              
 +              $member->isAdmin() or $this->disallow();
 +              
 +              $skin = new SKIN($skinid);
 +              $default_skin_types = $skin->getDefaultTypes();
 +              $available_skin_types = $skin->getAvailableTypes();
 +              
 +              $this->pagehead();
 +              
 +              echo "<p>";
 +              echo '( <a href="index.php?action=skinoverview">' . _SKIN_BACK . "</a> )";
 +              echo "</p>\n";
 +              echo '<h2>' . _SKIN_EDITONE_TITLE . $skin->getName() . "</h2>\n";
 +              
 +              echo '<h3>' . _SKIN_PARTS_TITLE . "</h3>\n";
 +              echo _SKIN_PARTS_MSG . "\n";
 +              echo "<ul>\n";
 +              
 +              $tabindex = 10;
 +              foreach ( $default_skin_types as $type => $friendly_name )
 +              {
 +                      echo "<li>\n";
 +                      echo "<a tabindex=\"{$tabindex}\" href=\"index.php?action=skinedittype&amp;skinid={$skinid}&amp;type={$type}\">";
 +                      echo $friendly_name;
 +                      echo "</a>\n";
 +                      help("skinpart{$type}");
 +                      echo "</li>\n";
 +                      $tabindex++;
 +              }
 +              echo "</ul>\n";
 +              
 +              echo '<h3>' . _SKIN_PARTS_SPECIAL . '</h3>';
 +              echo "<form method=\"get\" action=\"index.php\">\n";
 +              echo "<input type=\"hidden\" name=\"action\" value=\"skinedittype\" />\n";
 +              echo "<input type=\"hidden\" name=\"skinid\" value=\"{$skinid}\" />\n";
 +              echo "<input type=\"text\" name=\"type\" tabindex=\"89\" size=\"20\" maxlength=\"20\" />\n";
 +              echo '<input type="submit" tabindex="140" value="' . _SKIN_CREATE . "\" onclick=\"return checkSubmit();\" />\n";
 +              echo "</form>\n";
 +              
 +              /* NOTE: special skin parts has FALSE in its value */
 +              if ( in_array(FALSE, array_values($available_skin_types)) )
 +              {
 +                      $tabstart = 75;
 +                      
 +                      echo '<ul>';
 +                      foreach ( $available_skin_types as $type => $friendly_name )
 +                      {
 +                              if ( !$friendly_name )
 +                              {
 +                                      $tabstart++;
 +                                      echo "<li>\n";
 +                                      echo "<a tabindex=\"{$tabstart}\" href=\"index.php?action=skinedittype&amp;skinid={$skinid}&amp;type=" . Entity::hsc(strtolower($type)) . '">';
 +                                      echo Entity::hsc(ucfirst($type));
 +                                      echo "</a>\n";
 +                                      $tabstart++;
 +                                      echo "(<a tabindex=\"{$tabstart}\" href=\"index.php?action=skinremovetype&amp;skinid={$skinid}&amp;type=" . Entity::hsc(strtolower($type)) . '">';
 +                                      echo _LISTS_DELETE;
 +                                      echo "</a>)\n";
 +                                      echo "</li>\n";
 +                              }
 +                      }
 +                      echo '</ul>';
 +              }
 +              
 +              echo '<h3>' . _SKIN_GENSETTINGS_TITLE . "</h3>\n";
 +              echo "<form method=\"post\" action=\"index.php\">\n";
 +              echo "<div>\n";
 +              echo "<input type=\"hidden\" name=\"action\" value=\"skineditgeneral\" />\n";
 +              $manager->addTicketHidden() . "\n";
 +              echo "<input type=\"hidden\" name=\"skinid\" value=\"{$skinid}\" />\n";
 +              
 +              echo '<table frame="box" rules="all" summary="' . _SKIN_GENSETTINGS_TITLE . '">' . "\n";
 +              echo "<tr>\n";
 +              echo '<td>';
 +              echo _SKIN_NAME;
 +              help('shortnames');
 +              echo "</td>\n";
 +              echo '<td><input type="text" name="name" tabindex="90" value="' . Entity::hsc($skin->getName()) . '" maxlength="20" size="20" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _SKIN_DESC . "</td>\n";
 +              echo '<td><input type="text" name="desc" tabindex="100" value="' . Entity::hsc($skin->getDescription()) . '" maxlength="200" size="50" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _SKIN_TYPE . "</td>\n";
 +              echo '<td><input type="text" name="type" tabindex="110" value="' . Entity::hsc($skin->getContentType()) . '" maxlength="40" size="20" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>';
 +              echo _SKIN_INCLUDE_MODE;
 +              help('includemode');
 +              echo "</td>\n";
 +              echo '<td>';
 +              $this->input_yesno('inc_mode', $skin->getIncludeMode(), 120, 'skindir', 'normal', _PARSER_INCMODE_SKINDIR, _PARSER_INCMODE_NORMAL);
 +              echo "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>';
 +              echo _SKIN_INCLUDE_PREFIX;
 +              help('includeprefix');
 +              echo "</td>\n";
 +              echo '<td><input type="text" name="inc_prefix" tabindex="130" value="' . Entity::hsc($skin->getIncludePrefix()) . '" maxlength="40" size="20" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "<tr>\n";
 +              echo '<td>' . _SKIN_CHANGE . "</td>\n";
 +              echo '<td><input type="submit" tabindex="140" value="' . _SKIN_CHANGE_BTN . '" onclick="return checkSubmit();" />' . "</td>\n";
 +              echo "</tr>\n";
 +              echo "</table>\n";
 +              
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              $this->pagefoot();
 +              return;
 +      }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skineditgeneral() {
 +        global $member;
 +
 +        $skinid = intRequestVar('skinid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $name = postVar('name');
 +        $desc = postVar('desc');
 +        $type = postVar('type');
 +        $inc_mode = postVar('inc_mode');
 +        $inc_prefix = postVar('inc_prefix');
 +
 +        $skin = new SKIN($skinid);
 +
 +        // 1. Some checks
 +        if (!isValidSkinName($name))
 +            $this->error(_ERROR_BADSKINNAME);
 +
 +        if (($skin->getName() != $name) && Skin::exists($name))
 +            $this->error(_ERROR_DUPSKINNAME);
 +
 +        if (!$type) $type = 'text/html';
 +        if (!$inc_mode) $inc_mode = 'normal';
 +
 +        // 2. Update description
 +        $skin->updateGeneralInfo($name, $desc, $type, $inc_mode, $inc_prefix);
 +
 +        $this->action_skinedit();
 +
 +    }
 +
 +      /**
 +       * Admin::action_skinedittype()
 +       * 
 +       * @param       string  $msg    message for pageheader
 +       * @return      void
 +       */
 +      public function action_skinedittype($msg = '')
 +      {
 +              global $member, $manager;
 +              
 +              $skinid = intRequestVar('skinid');
 +              $type = requestVar('type');
 +              
 +              $member->isAdmin() or $this->disallow();
 +              
 +              $type = trim($type);
 +              $type = strtolower($type);
 +              
 +              if ( !isValidShortName($type) )
 +              {
 +                      $this->error(_ERROR_SKIN_PARTS_SPECIAL_FORMAT);
 +              }
 +              
 +              $skin = new SKIN($skinid);
 +              $skin_types = $skin->getAvailableTypes();
 +              if ( !array_key_exists($type, $skin_types) || !$skin_types[$type] )
 +              {
 +                      $friendlyName = ucfirst($type);
 +              }
 +              else
 +              {
 +                      $friendlyName = $skin_types[$type];
 +              }
 +              
 +              $this->pagehead();
 +              
 +              echo '<p>(<a href="index.php?action=skinoverview">' . _SKIN_GOBACK . "</a>)</p>\n";
 +              
 +              echo '<h2>' . _SKIN_EDITPART_TITLE . " '" . Entity::hsc($skin->getName()) . "': " . Entity::hsc($friendlyName) . "</h2>\n";
 +              
 +              if ( $msg != '')
 +              {
 +                      echo "<p>" . _MESSAGE . ": $msg</p>\n";
 +              }
 +              
 +              echo "<form method=\"post\" action=\"index.php\">\n";
 +              echo "<div>\n";
 +              
 +              echo "<input type=\"hidden\" name=\"action\" value=\"skinupdate\" />\n";
 +              $manager->addTicketHidden() . "\n";
 +              echo "<input type=\"hidden\" name=\"skinid\" value=\"{$skinid}\" />\n";
 +              echo "<input type=\"hidden\" name=\"type\" value=\"{$type}\" />\n";
 +              
 +              echo '<input type="submit" value="' . _SKIN_UPDATE_BTN . '" onclick="return checkSubmit();" />' . "\n";
 +              echo '<input type="reset" value="' . _SKIN_RESET_BTN . '" />' . "\n";
 +              echo '(skin type: ' . Entity::hsc($friendlyName) . ")\n";
 +              
 +              if ( !array_key_exists($type, $skin_types) || !$skin_types[$type] )
 +              {
 +                      help('skinpartspecial');
 +              }
 +              else
 +              {
 +                      help('skinpart' . $type);
 +              }
 +              echo "<br />\n";
 +              
 +              echo "<textarea class=\"skinedit\" tabindex=\"10\" rows=\"20\" cols=\"80\" name=\"content\">\n";
 +              echo Entity::hsc($skin->getContentFromDB($type)) . "\n";
 +              echo "</textarea>\n";
 +              
 +              echo "<br />\n";
 +              echo '<input type="submit" tabindex="20" value="' . _SKIN_UPDATE_BTN . '" onclick="return checkSubmit();" />' . "\n";
 +              echo '<input type="reset" value="' . _SKIN_RESET_BTN . '" />' . "\n";
 +              echo '(skin type: ' . Entity::hsc($friendlyName) . ")\n";
 +              
 +              echo "<br />\n";
 +              echo "<br />\n";
 +              echo _SKIN_ALLOWEDVARS;
 +              
 +              $actions = $skin->getAllowedActionsForType($type);
 +              
 +              sort($actions);
 +              
 +              while ( $current = array_shift($actions) )
 +              {
 +                      // skip deprecated vars
 +                      if ( in_array($current, array('ifcat', 'imagetext', 'vars')) )
 +                      {
 +                              continue;
 +                      }
 +                      
 +                      echo helplink("skinvar-{$current}") . "{$current}</a>\n";
 +                      
 +                      if ( count($actions) != 0 )
 +                      {
 +                              echo ", ";
 +                      }
 +              }
 +              
 +              echo "<br />\n";
 +              echo "<br />\n";
 +              echo _SKINEDIT_ALLOWEDBLOGS;
 +              
 +              $query = 'SELECT bshortname, bname FROM '.sql_table('blog');
 +              showlist($query, 'table', array('content'=>'shortblognames'));
 +              
 +              echo "<br />\n";
 +              echo _SKINEDIT_ALLOWEDTEMPLATESS;
 +              
 +              $query = 'SELECT tdname as name, tddesc as description FROM '.sql_table('template_desc');
 +              showlist($query, 'table', array('content'=>'shortnames'));
 +              
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              
 +              $this->pagefoot();
 +              
 +              return;
 +      }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinupdate() {
 +        global $member;
 +
 +        $skinid = intRequestVar('skinid');
 +        $content = trim(postVar('content'));
 +        $type = postVar('type');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $skin = new SKIN($skinid);
 +        $skin->update($type, $content);
 +
 +        $this->action_skinedittype(_SKIN_UPDATED);
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skindelete() {
 +        global $member, $manager, $CONF;
 +
 +        $skinid = intRequestVar('skinid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // don't allow default skin to be deleted
 +        if ($skinid == $CONF['BaseSkin'])
 +            $this->error(_ERROR_DEFAULTSKIN);
 +
 +        // don't allow deletion of default skins for blogs
 +        $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
 +        $r = DB::getValue($query);
 +        if ( $r )
 +            $this->error(_ERROR_SKINDEFDELETE . Entity::hsc($r));
 +
 +        $this->pagehead();
 +
 +        $skin = new SKIN($skinid);
 +        $name = $skin->getName();
 +        $desc = $skin->getDescription();
 +
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <p>
 +                <?php echo _CONFIRMTXT_SKIN ?><b><?php echo Entity::hsc($name) ?></b> (<?php echo  Entity::hsc($desc) ?>)
 +            </p>
 +
 +            <form method="post" action="index.php"><div>
 +                <input type="hidden" name="action" value="skindeleteconfirm" />
 +                <?php $manager->addTicketHidden() ?>
 +                <input type="hidden" name="skinid" value="<?php echo  $skinid ?>" />
 +                <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_skindeleteconfirm() {
 +        global $member, $CONF, $manager;
 +
 +        $skinid = intRequestVar('skinid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // don't allow default skin to be deleted
 +        if ($skinid == $CONF['BaseSkin'])
 +            $this->error(_ERROR_DEFAULTSKIN);
 +
 +        // don't allow deletion of default skins for blogs
 +        $query = 'SELECT bname FROM '.sql_table('blog').' WHERE bdefskin=' . $skinid;
 +        $r = DB::getValue($query);
 +        if ($r)
 +            $this->error(_ERROR_SKINDEFDELETE .$r);
 +
 +        $manager->notify('PreDeleteSkin', array('skinid' => $skinid));
 +
 +        // 1. delete description
 +        DB::execute('DELETE FROM '.sql_table('skin_desc').' WHERE sdnumber=' . $skinid);
 +
 +        // 2. delete parts
 +        DB::execute('DELETE FROM '.sql_table('skin').' WHERE sdesc=' . $skinid);
 +
 +        $manager->notify('PostDeleteSkin', array('skinid' => $skinid));
 +
 +        $this->action_skinoverview();
 +    }
 +      
 +      /**
 +       * Admin::action_skinremovetype()
 +       *
 +       * @param       void
 +       * @return      void
 +       */
 +      public function action_skinremovetype()
 +      {
 +              global $member, $manager, $CONF;
 +              
 +              $skinid = intRequestVar('skinid');
 +              $skintype = requestVar('type');
 +              
 +              if ( !isValidShortName($skintype) )
 +              {
 +                      $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
 +              }
 +              
 +              $member->isAdmin() or $this->disallow();
 +              
 +              // don't allow default skinparts to be deleted
 +              $skin = new Skin($skinid);
 +              $default_skin_types = $skin->getDefaultTypes();
 +              if ( array_key_exists($skintype, $default_skin_types) )
 +              {
 +                      $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
 +              }
 +              
 +              $name = $skin->getName();
 +              $desc = $skin->getDescription();
 +              
 +              $this->pagehead();
 +              
 +              echo '<h2>' . _DELETE_CONFIRM . "</h2>\n";
 +              echo "<p>\n";
 +              echo _CONFIRMTXT_SKIN_PARTS_SPECIAL;
 +              echo Entity::hsc($skintype);
 +              echo  '(' . Entity::hsc($name) . ')</b>';
 +              echo ' (' . Entity::hsc($desc) . ')';
 +              echo "</p>\n";
 +              
 +              echo "<form method=\"post\" action=\"index.php\">\n";
 +              echo "<div>\n";
 +              echo "<input type=\"hidden\" name=\"action\" value=\"skinremovetypeconfirm\" />\n";
 +              $manager->addTicketHidden();
 +              echo "<input type=\"hidden\" name=\"skinid\" value=\"{$skinid}\" />\n";
 +              echo '<input type="hidden" name="type" value="' . Entity::hsc($skintype) . '" />' . "\n";
 +              echo '<input type="submit" tabindex="10" value="' . _DELETE_CONFIRM_BTN . '" />' . "\n";
 +              echo "</div>\n";
 +              echo "</form>\n";
 +              $this->pagefoot();
 +              return;
 +      }
 +      
 +      /**
 +       * Admin::action_skinremovetypeconfirm()
 +       * 
 +       * @param       void
 +       * @return      void
 +       */
 +      public function action_skinremovetypeconfirm()
 +      {
 +              global $member, $CONF, $manager;
 +              
 +              $skinid = intRequestVar('skinid');
 +              $skintype = requestVar('type');
 +              
 +              if ( !isValidShortName($skintype) )
 +              {
 +                      $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
 +              }
 +              
 +              $member->isAdmin() or $this->disallow();
 +              
 +              // don't allow default skinparts to be deleted
 +              $skin = new Skin($skinid);
 +              $default_skin_types = $skin->getDefaultTypes();
 +              if ( array_key_exists($skintype, $default_skin_types) )
 +              {
 +                      $this->error(_ERROR_SKIN_PARTS_SPECIAL_DELETE);
                }
                
 +              $data = array(
 +                      'skinid'        => $skinid,
 +                      'skintype'      => $skintype
 +              );
 +              $manager->notify('PreDeleteSkinPart', $data);
 +              
 +              // delete part
 +              $query = "DELETE FROM %s WHERE sdesc=%d AND stype='%s';";
 +              $query = sprintf($query, sql_table('skin'), (integer) $skinid, $skintype);
 +              DB::execute($query);
 +              
 +              $data = array(
 +                      'skinid'        => $skinid,
 +                      'skintype'      => $skintype
 +              );
 +              $manager->notify('PostDeleteSkinPart', $data);
 +              
 +              $this->action_skinedit();
 +              return;
 +      }
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_skinclone() {
 +        global $member;
 +
 +        $skinid = intRequestVar('skinid');
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        // 1. read skin to clone
 +        $skin = new SKIN($skinid);
 +
 +        $name = "clone_" . $skin->getName();
 +
 +        // if a skin with that name already exists:
 +        if (Skin::exists($name)) {
 +            $i = 1;
 +            while (Skin::exists($name . $i))
 +                $i++;
 +            $name .= $i;
 +        }
 +
 +        // 2. create skin desc
 +        $newid = Skin::createNew(
 +            $name,
 +            $skin->getDescription(),
 +            $skin->getContentType(),
 +            $skin->getIncludeMode(),
 +            $skin->getIncludePrefix()
 +        );
 +        
 +        $query = "SELECT stype FROM " . sql_table('skin') . " WHERE sdesc = " . $skinid;
 +        $res = DB::getResult($query);
 +        foreach ( $res as $row) {
 +            $this->skinclonetype($skin, $newid, $row['stype']);
 +        }
 +
 +        $this->action_skinoverview();
 +
 +    }
++=======
+               if ( !is_object(self::$skin) )
+               {
+                       global $DIR_SKINS;
+                       $query  = "SELECT min(sdnumber) FROM %s WHERE sdname != 'admin/bookmarklet' AND sdname LIKE 'admin/%%'";
+                       $query  = sprintf($query, sql_table('skin_desc'));
+                       $res    = intval(DB::getValue($query));
+                       $query  = "UPDATE %s SET value = %d WHERE name = 'AdminSkin'";
+                       $query  = sprintf($query, sql_table('config'), $res);
+                       DB::execute($query);
+                       if ( $res )
+                       {
+                               redirect($CONF['AdminURL']);
+                               exit;
+                       }
+                       $skin   = new Skin(0, 'AdminActions', 'AdminSkin');
+                       $skin->parse('importAdmin', $DIR_SKINS . 'admin/defaultimporter.skn');
+               }
+               else
+               {
+                       self::$skin->parse('adminskiniedoimport');
+               }
+               return;
+       }
++>>>>>>> skinnable-master
  
        /**
-        * Admin::skinclonetype()
+        * Admin::action_adminskinieexport()
         * 
-        * @param       String  $skin   Skin object
-        * @param       Integer $newid  ID for this clone
-        * @param       String  $type   type of skin
-        * @return      Void
+        * @param       void
+        * @return      void
         */
-       function skinclonetype($skin, $newid, $type)
+       static private function action_adminskinieexport()
        {
++<<<<<<< HEAD
 +              $newid = intval($newid);
 +              $content = $skin->getContentFromDB($type);
 +              
 +              if ( $content )
 +              {
 +                      $query = "INSERT INTO %s (sdesc, scontent, stype) VALUES (%d, '%s', '%s')";
 +                      $query = sprintf($query, sql_table('skin'), (integer) $newid, $content, $type);
 +                      DB::execute($query);
 +              }
++=======
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               // load skinie class
+               $aSkins = requestIntArray('skin');
+               $aTemplates = requestIntArray('template');
+               $info = postVar('info');
+               
+               self::skinieexport($aSkins, $aTemplates, $info);
+               
++>>>>>>> skinnable-master
                return;
        }
        
         * @param       Void
         * @return      Void
         */
-       function action_settingsedit() {
+       static private function action_settingsedit()
+       {
                global $member, $manager, $CONF, $DIR_NUCLEUS, $DIR_MEDIA;
++<<<<<<< HEAD
 +
 +              $member->isAdmin() or $this->disallow();
 +
 +              $this->pagehead();
 +
 +              echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +              ?>
 +
 +              <h2><?php echo _SETTINGS_TITLE ?></h2>
 +
 +              <form action="index.php" method="post">
 +              <div>
 +
 +              <input type="hidden" name="action" value="settingsupdate" />
 +              <?php $manager->addTicketHidden() ?>
 +
 +              <table><tr>
 +                      <th colspan="2"><?php echo _SETTINGS_SUB_GENERAL ?></th>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DEFBLOG ?> <?php help('defaultblog'); ?></td>
 +                      <td>
 +                              <?php
 +                                      $query =  'SELECT bname as text, bnumber as value'
 +                                                 . ' FROM '.sql_table('blog');
 +                                      $template['name'] = 'DefaultBlog';
 +                                      $template['selected'] = $CONF['DefaultBlog'];
 +                                      $template['tabindex'] = 10;
 +                                      showlist($query,'select',$template);
 +                              ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_BASESKIN ?> <?php help('baseskin'); ?></td>
 +                      <td>
 +                              <?php
 +                                      $query =  'SELECT sdname as text, sdnumber as value'
 +                                                 . ' FROM '.sql_table('skin_desc');
 +                                      $template['name'] = 'BaseSkin';
 +                                      $template['selected'] = $CONF['BaseSkin'];
 +                                      $template['tabindex'] = 1;
 +                                      showlist($query,'select',$template);
 +                              ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ADMINMAIL ?></td>
 +                      <td><input name="AdminEmail" tabindex="10010" size="40" value="<?php echo  Entity::hsc($CONF['AdminEmail']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_SITENAME ?></td>
 +                      <td><input name="SiteName" tabindex="10020" size="40" value="<?php echo  Entity::hsc($CONF['SiteName']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_SITEURL ?></td>
 +                      <td><input name="IndexURL" tabindex="10030" size="40" value="<?php echo  Entity::hsc($CONF['IndexURL']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ADMINURL ?></td>
 +                      <td><input name="AdminURL" tabindex="10040" size="40" value="<?php echo  Entity::hsc($CONF['AdminURL']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_PLUGINURL ?> <?php help('pluginurl'); ?></td>
 +                      <td><input name="PluginURL" tabindex="10045" size="40" value="<?php echo  Entity::hsc($CONF['PluginURL']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_SKINSURL ?> <?php help('skinsurl'); ?></td>
 +                      <td><input name="SkinsURL" tabindex="10046" size="40" value="<?php echo  Entity::hsc($CONF['SkinsURL']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ACTIONSURL ?> <?php help('actionurl'); ?></td>
 +                      <td><input name="ActionURL" tabindex="10047" size="40" value="<?php echo  Entity::hsc($CONF['ActionURL']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_LOCALE ?> <?php help('locale'); ?>
 +                      </td>
 +                      <td>
 +                              <select name="Locale" tabindex="10050">
 +                      <?php
 +                              $locales = i18n::get_available_locale_list();
 +                              if ( !i18n::get_current_locale() || !in_array(i18n::get_current_locale(), $locales) )
 +                              {
 +                                      echo "<option value=\"\" selected=\"selected\">en_Latn_US</option>\n";
 +                              }
 +                              else
 +                              {
 +                                      echo "<option value=\"\">en_Latn_US</option>\n";
 +                              }
 +                              
 +                              foreach ( $locales as $locale )
 +                              {
 +                                      if ( $locale == 'en_Latn_US' )
 +                                      {
 +                                              continue;
 +                                      }
 +                                      if ( $locale == i18n::get_current_locale() )
 +                                      {
 +                                              echo "<option value=\"{$locale}\" selected=\"selected\">{$locale}</option>\n";
 +                                      }
 +                                      else
 +                                      {
 +                                              echo "<option value=\"{$locale}\">{$locale}</option>\n";
 +                                      }
 +                              }
 +                      ?>
 +                      </select>
 +
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DISABLESITE ?> <?php help('disablesite'); ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('DisableSite',$CONF['DisableSite'],10060); ?>
 +                                      <br />
 +                              <?php echo _SETTINGS_DISABLESITEURL ?> <input name="DisableSiteURL" tabindex="10070" size="40" value="<?php echo  Entity::hsc($CONF['DisableSiteURL']) ?>" />
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DIRS ?></td>
 +                      <td><?php echo  Entity::hsc($DIR_NUCLEUS) ?>
 +                              <i><?php echo _SETTINGS_SEECONFIGPHP ?></i></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DBLOGIN ?></td>
 +                      <td><i><?php echo _SETTINGS_SEECONFIGPHP ?></i></td>
 +              </tr><tr>
 +                      <td>
 +                      <?php
 +                              echo _SETTINGS_JSTOOLBAR
 +                              /* =_SETTINGS_DISABLEJS
 +
 +                                      I temporary changed the meaning of DisableJsTools, until I can find a good
 +                                      way to select the javascript version to use
 +
 +                                      now, its:
 +                                              0 : IE
 +                                              1 : all javascript disabled
 +                                              2 : 'simpler' javascript (for mozilla/opera/mac)
 +                              */
 +                         ?>
 +                      </td>
 +                      <td><?php /* $this->input_yesno('DisableJsTools',$CONF['DisableJsTools'],10075); */ ?>
 +                              <select name="DisableJsTools" tabindex="10075">
 +                      <?php                              $extra = ($CONF['DisableJsTools'] == 1) ? 'selected="selected"' : '';
 +                                      echo "<option $extra value='1'>",_SETTINGS_JSTOOLBAR_NONE,"</option>";
 +                                      $extra = ($CONF['DisableJsTools'] == 2) ? 'selected="selected"' : '';
 +                                      echo "<option $extra value='2'>",_SETTINGS_JSTOOLBAR_SIMPLE,"</option>";
 +                                      $extra = ($CONF['DisableJsTools'] == 0) ? 'selected="selected"' : '';
 +                                      echo "<option $extra value='0'>",_SETTINGS_JSTOOLBAR_FULL,"</option>";
 +                      ?>
 +                              </select>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_URLMODE ?> <?php help('urlmode'); ?></td>
 +                                         <td><?php
 +
 +                                         $this->input_yesno('URLMode',$CONF['URLMode'],10077,
 +                                                        'normal','pathinfo',_SETTINGS_URLMODE_NORMAL,_SETTINGS_URLMODE_PATHINFO);
 +
 +                                         echo ' ', _SETTINGS_URLMODE_HELP;
 +
 +                                                       ?>
 +
 +                                         </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DEBUGVARS ?> <?php help('debugvars'); ?></td>
 +                                         <td><?php
 +
 +                                              $this->input_yesno('DebugVars',$CONF['DebugVars'],10078);
 +
 +                                                       ?>
 +
 +                                         </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_DEFAULTLISTSIZE ?> <?php help('defaultlistsize'); ?></td>
 +                      <td>
 +                      <?php
 +                              if (!array_key_exists('DefaultListSize',$CONF)) {
 +                                      DB::execute("INSERT INTO ".sql_table('config')." VALUES ('DefaultListSize', '10')");
 +                                      $CONF['DefaultListSize'] = 10;
 +                              }
 +                      ?>
 +                              <input name="DefaultListSize" tabindex="10079" size="40" value="<?php echo  Entity::hsc((intval($CONF['DefaultListSize']) < 1 ? '10' : $CONF['DefaultListSize'])) ?>" />
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ADMINCSS ?> 
 +                      </td>
 +                      <td>
 +
 +                              <select name="AdminCSS" tabindex="10080">
 +                              <?php                      // show a dropdown list of all available admin css files
 +                              global $DIR_NUCLEUS;
 +                              
 +                              $dirhandle = opendir($DIR_NUCLEUS."styles/");
 +
 +                              while ($filename = readdir($dirhandle) )
 +                              {
 +
 +                                      # replaced ereg() below with preg_match(). ereg* functions are deprecated in PHP 5.3.0
 +                                      # original ereg: ereg("^(.*)\.php$",$filename,$matches)
 +
 +                                      if (preg_match('#^admin_(.*)\.css$#', $filename, $matches) )
 +                                      {
 +
 +                                              $name = $matches[1];
 +                                              echo "<option value=\"$name\"";
 +
 +                                              if ($name == $CONF['AdminCSS'])
 +                                              {
 +                                                      echo " selected=\"selected\"";
 +                                              }
 +
 +                                              echo ">$name</option>";
 +
 +                                      }
 +
 +                              }
 +
 +                              closedir($dirhandle);
 +
 +                              ?>
 +                              </select>
 +
 +                      </td>
 +              </tr><tr>
 +                      <th colspan="2"><?php echo _SETTINGS_MEDIA ?> <?php help('media'); ?></th>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_MEDIADIR ?></td>
 +                      <td><?php echo  Entity::hsc($DIR_MEDIA) ?>
 +                              <i><?php echo _SETTINGS_SEECONFIGPHP ?></i>
 +                              <?php                              if (!is_dir($DIR_MEDIA))
 +                                              echo "<br /><b>" . _WARNING_NOTADIR . "</b>";
 +                                      if (!is_readable($DIR_MEDIA))
 +                                              echo "<br /><b>" . _WARNING_NOTREADABLE . "</b>";
 +                                      if (!is_writeable($DIR_MEDIA))
 +                                              echo "<br /><b>" . _WARNING_NOTWRITABLE . "</b>";
 +                              ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_MEDIAURL ?></td>
 +                      <td>
 +                              <input name="MediaURL" tabindex="10090" size="40" value="<?php echo  Entity::hsc($CONF['MediaURL']) ?>" />
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ALLOWUPLOAD ?></td>
 +                      <td><?php $this->input_yesno('AllowUpload',$CONF['AllowUpload'],10090); ?></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ALLOWUPLOADTYPES ?></td>
 +                      <td>
 +                              <input name="AllowedTypes" tabindex="10100" size="40" value="<?php echo  Entity::hsc($CONF['AllowedTypes']) ?>" />
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_MAXUPLOADSIZE ?></td>
 +                      <td>
 +                              <input name="MaxUploadSize" tabindex="10105" size="40" value="<?php echo  Entity::hsc($CONF['MaxUploadSize']) ?>" />
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_MEDIAPREFIX ?></td>
 +                      <td><?php $this->input_yesno('MediaPrefix',$CONF['MediaPrefix'],10110); ?></td>
 +
 +              </tr><tr>
 +                      <th colspan="2"><?php echo _SETTINGS_MEMBERS ?></th>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_CHANGELOGIN ?></td>
 +                      <td><?php $this->input_yesno('AllowLoginEdit',$CONF['AllowLoginEdit'],10120); ?></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_ALLOWCREATE ?>
 +                              <?php help('allowaccountcreation'); ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('AllowMemberCreate',$CONF['AllowMemberCreate'],10130); ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_NEWLOGIN ?> <?php help('allownewmemberlogin'); ?>
 +                              <br /><?php echo _SETTINGS_NEWLOGIN2 ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('NewMemberCanLogon',$CONF['NewMemberCanLogon'],10140); ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_MEMBERMSGS ?>
 +                              <?php help('messageservice'); ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('AllowMemberMail',$CONF['AllowMemberMail'],10150); ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_NONMEMBERMSGS ?>
 +                              <?php help('messageservice'); ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('NonmemberMail',$CONF['NonmemberMail'],10155); ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_PROTECTMEMNAMES ?>
 +                              <?php help('protectmemnames'); ?>
 +                      </td>
 +                      <td><?php $this->input_yesno('ProtectMemNames',$CONF['ProtectMemNames'],10156); ?>
 +                      </td>
 +
 +
 +
 +              </tr><tr>
 +                      <th colspan="2"><?php echo _SETTINGS_COOKIES_TITLE ?> <?php help('cookies'); ?></th>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_COOKIEPREFIX ?></td>
 +                      <td><input name="CookiePrefix" tabindex="10159" size="40" value="<?php echo  Entity::hsc($CONF['CookiePrefix']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_COOKIEDOMAIN ?></td>
 +                      <td><input name="CookieDomain" tabindex="10160" size="40" value="<?php echo  Entity::hsc($CONF['CookieDomain']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_COOKIEPATH ?></td>
 +                      <td><input name="CookiePath" tabindex="10170" size="40" value="<?php echo  Entity::hsc($CONF['CookiePath']) ?>" /></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_COOKIESECURE ?></td>
 +                      <td><?php $this->input_yesno('CookieSecure',$CONF['CookieSecure'],10180); ?></td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_COOKIELIFE ?></td>
 +                      <td><?php $this->input_yesno('SessionCookie',$CONF['SessionCookie'],10190,
 +                                                        1,0,_SETTINGS_COOKIESESSION,_SETTINGS_COOKIEMONTH); ?>
 +                      </td>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_LASTVISIT ?></td>
 +                      <td><?php $this->input_yesno('LastVisit',$CONF['LastVisit'],10200); ?></td>
 +
 +
 +
 +              </tr><tr>
 +                      <th colspan="2"><?php echo _SETTINGS_UPDATE ?></th>
 +              </tr><tr>
 +                      <td><?php echo _SETTINGS_UPDATE ?></td>
 +                      <td><input type="submit" tabindex="10210" value="<?php echo _SETTINGS_UPDATE_BTN ?>" onclick="return checkSubmit();" /></td>
 +              </tr></table>
 +
 +              </div>
 +              </form>
 +
 +              <?php
 +                      echo '<h2>',_PLUGINS_EXTRA,'</h2>';
 +
 +                      $manager->notify(
 +                              'GeneralSettingsFormExtras',
 +                              array()
 +                      );
 +
 +              $this->pagefoot();
++=======
+               
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('settingsedit');
+               return;
++>>>>>>> skinnable-master
        }
        
        /**
         * @param       void
         * @return      void
         */
-       function action_systemoverview()
+       static private function action_systemoverview()
        {
++<<<<<<< HEAD
 +              global $member, $nucleus, $CONF;
 +              
 +              $this->pagehead();
 +              
 +              echo '<h2>' . _ADMIN_SYSTEMOVERVIEW_HEADING . "</h2>\n";
 +              
 +              if ( $member->isLoggedIn() && $member->isAdmin() )
 +              {
 +                      // Information about the used PHP and MySQL installation
 +                      echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_PHPANDMYSQL . "</h3>\n\n";
 +                      
 +                      // Version of PHP MySQL
 +                      echo '<table frame="box" rules="all" summary="' . _ADMIN_SYSTEMOVERVIEW_VERSIONS . "\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_VERSIONS . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . _ADMIN_SYSTEMOVERVIEW_PHPVERSION . "</td>\n";
 +                      echo '<td>' . phpversion() . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . _ADMIN_SYSTEMOVERVIEW_MYSQLVERSION . "</td>\n";
 +                      echo '<td>' . DB::getAttribute(PDO::ATTR_SERVER_VERSION) . ' (' . DB::getAttribute(PDO::ATTR_CLIENT_VERSION) . ')' . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +                      
 +                      // Important PHP settings
 +                      echo '<table frame="box" rules="all" summary="' . _ADMIN_SYSTEMOVERVIEW_SETTINGS . "\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_SETTINGS . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>magic_quotes_gpc' . "</td>\n";
 +                      $mqg = get_magic_quotes_gpc() ? 'On' : 'Off';
 +                      echo '<td>' . $mqg . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>magic_quotes_runtime' . "</td>\n";
 +                      $mqr = get_magic_quotes_runtime() ? 'On' : 'Off';
 +                      echo '<td>' . $mqr . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>register_globals' . "</td>\n";
 +                      $rg = ini_get('register_globals') ? 'On' : 'Off';
 +                      echo '<td>' . $rg . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +                      
 +                      // Information about GD library
 +                      $gdinfo = gd_info();
 +                      echo '<table frame="box" rules="all" summary="' . _ADMIN_SYSTEMOVERVIEW_GDLIBRALY . "\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_GDLIBRALY . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      foreach ( $gdinfo as $key=>$value )
 +                      {
 +                              if ( is_bool($value) )
 +                              {
 +                                      $value = $value ? _ADMIN_SYSTEMOVERVIEW_ENABLE : _ADMIN_SYSTEMOVERVIEW_DISABLE;
 +                              }
 +                              else
 +                              {
 +                                      $value = Entity::hsc($value);
 +                              }
 +                              echo "<tr>\n";
 +                              echo '<td>' . $key . "</td>\n";
 +                              echo '<td>' . $value . "</td>\n";
 +                              echo "</tr>\n";
 +                      }
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +
 +                      // Check if special modules are loaded
 +                      ob_start();
 +                      phpinfo(INFO_MODULES);
 +                      $im = ob_get_contents();
 +                      ob_clean();
 +                      echo '<table frame="box" rules="all" summary="' . _ADMIN_SYSTEMOVERVIEW_MODULES . "\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>";
 +                      echo '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_MODULES . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "<tbody>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>mod_rewrite' . "</td>\n";
 +                      $modrewrite = (i18n::strpos($im, 'mod_rewrite') !== FALSE) ?
 +                                              _ADMIN_SYSTEMOVERVIEW_ENABLE :
 +                                              _ADMIN_SYSTEMOVERVIEW_DISABLE;
 +                      echo '<td>' . $modrewrite . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +
 +                      // Information about the used Nucleus CMS
 +                      echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSYSTEM . "</h3>\n";
 +                      global $nucleus;
 +                      $nv = getNucleusVersion() / 100 . '(' . $nucleus['version'] . ')';
 +                      $np = getNucleusPatchLevel();
 +                      echo "<table frame=\"box\" rules=\"all\" summary=\"Nucleus CMS\" class=\"systemoverview\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">Nucleus CMS' . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSVERSION . "</td>\n";
 +                      echo '<td>' . $nv . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSPATCHLEVEL . "</td>\n";
 +                      echo '<td>' . $np . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +
 +                      // Important settings of the installation
 +                      echo '<table frame="box" rules="all" summary="' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS . "\" class=\"systemoverview\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">' . _ADMIN_SYSTEMOVERVIEW_NUCLEUSSETTINGS . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . '$CONF[' . "'Self']</td>\n";
 +                      echo '<td>' . $CONF['Self'] . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . '$CONF[' . "'ItemURL']</td>\n";
 +                      echo '<td>' . $CONF['ItemURL'] . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo '<td>' . '$CONF[' . "'alertOnHeadersSent']</td>\n";
 +                      $ohs = $CONF['alertOnHeadersSent'] ?
 +                                              _ADMIN_SYSTEMOVERVIEW_ENABLE :
 +                                              _ADMIN_SYSTEMOVERVIEW_DISABLE;
 +                      echo '<td>' . $ohs . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo "<td>i18n::get_current_charset()</td>\n";
 +                      echo '<td>' . i18n::get_current_charset() . "</td>\n";
 +                      echo "</tr>\n";
 +                      echo "</tbody>\n";
 +                      echo "</table>\n\n";
 +
 +                      // Link to the online version test at the Nucleus CMS website
 +                      echo '<h3>' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK . "</h3>\n";
 +                      if ( $nucleus['codename'] != '')
 +                      {
 +                              $codenamestring = ' &quot;' . $nucleus['codename'] . '&quot;';
 +                      }
 +                      else
 +                      {
 +                              $codenamestring = '';
 +                      }
 +                      echo _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TXT;
 +                      $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
 +                      echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">';
 +                      echo 'Nucleus CMS ' . $nv . $codenamestring;
 +                      echo '</a>';
 +              }
 +              else
 +              {
 +                      echo _ADMIN_SYSTEMOVERVIEW_NOT_ADMIN;
 +              }
 +              $this->pagefoot();
++=======
+               self::$skin->parse('systemoverview');
+               return;
++>>>>>>> skinnable-master
        }
+       
        /**
         * Admin::updateConfig()
         * 
         * @param       string  $val    
         * @return      integer return the ID in which the latest query posted
         */
-       function updateConfig($name, $val)
+       static private function updateConfig($name, $val)
        {
++<<<<<<< HEAD
 +              $name = DB::quoteValue($name);
 +              $val = DB::quoteValue(trim($val));
 +              
 +              $query = "UPDATE %s SET value=%s WHERE name=%s";
 +              $query = sprintf($query, sql_table('config'), $val, $name);
 +              if ( DB::execute($query) === FALSE )
 +              {
 +                      $err = DB::getError();
 +                      die("Query error: " . $err[2]);
++=======
+               $query = "UPDATE %s SET value=%s WHERE name=%s";
+               $query = sprintf($query, sql_table('config'), DB::quoteValue($val), DB::quoteValue($name));
+               if ( DB::execute($query) === FALSE )
+               {
+                       $err = DB::getError();
+                       die(_ADMIN_SQLDIE_QUERYERROR . $err[2]);
++>>>>>>> skinnable-master
                }
                return DB::getInsertId();
        }
         * @param       void
         * @return      void
         */
++<<<<<<< HEAD
 +      function pagehead($extrahead = '')
 +      {
 +              global $member, $nucleus, $CONF, $manager;
 +              
 +              $manager->notify(
 +                      'AdminPrePageHead',
 +                      array(
 +                              'extrahead' => &$extrahead,
 +                              'action' => $this->action));
 +              
 +              $baseUrl = Entity::hsc($CONF['AdminURL']);
 +              if ( !array_key_exists('AdminCSS',$CONF) )
 +              {
 +                      DB::execute("INSERT INTO ".sql_table('config')." VALUES ('AdminCSS', 'original')");
 +                      $CONF['AdminCSS'] = 'original';
 +              }
 +              
 +              /* HTTP 1.1 application for no caching */
 +              header("Cache-Control: no-cache, must-revalidate");
 +              header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
 +              
 +              $root_element = 'html';
 +              $charset = i18n::get_current_charset();
 +              $locale = preg_replace('#_#', '-', i18n::get_current_locale());
 +              
 +              echo "<?xml version=\"{$this->xml_version_info}\" encoding=\"{$charset}\" ?>\n";
 +              echo "<!DOCTYPE {$root_element} PUBLIC \"{$this->formal_public_identifier}\" \"{$this->system_identifier}\">\n";
 +              echo "<{$root_element} xmlns=\"{$this->xhtml_namespace}\" xml:lang=\"{$locale}\" lang=\"{$locale}\">\n";
 +              echo "<head>\n";
 +              echo '<title>' . Entity::hsc($CONF['SiteName']) . " - Admin</title>\n";
 +              echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}styles/admin_{$CONF["AdminCSS"]}.css\" />\n";
 +              echo "<link rel=\"stylesheet\" title=\"Nucleus Admin Default\" type=\"text/css\" href=\"{$baseUrl}styles/addedit.css\" />\n";
 +              echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascript/edit.js\"></script>\n";
 +              echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascript/admin.js\"></script>\n";
 +              echo "<script type=\"text/javascript\" src=\"{$baseUrl}javascript/compatibility.js\"></script>\n";
 +              echo "{$extrahead}\n";
 +              echo "</head>\n\n";
 +              echo "<body>\n";
 +              echo "<div id=\"adminwrapper\">\n";
 +              echo "<div class=\"header\">\n";
 +              echo '<h1>' . Entity::hsc($CONF['SiteName']) . "</h1>\n";
 +              echo "</div>\n";
 +              echo "<div id=\"container\">\n";
 +              echo "<div id=\"content\">\n";
 +              echo "<div class=\"loginname\">\n";
 +              if ( $member->isLoggedIn() )
 +              {
 +                      echo _LOGGEDINAS . ' ' . $member->getDisplayName() ." - <a href='index.php?action=logout'>" . _LOGOUT. "</a><br />\n";
 +                      echo "<a href='index.php?action=overview'>" . _ADMINHOME . "</a> - ";
 +              }
 +              else
 +              {
 +                      echo '<a href="index.php?action=showlogin" title="Log in">' . _NOTLOGGEDIN . "</a><br />\n";
 +              }
 +              echo "<a href='".$CONF['IndexURL']."'>"._YOURSITE."</a><br />\n";
 +              echo '(';
++=======
+       static private function action_bookmarklet()
+       {
+               global $member, $manager;
++>>>>>>> skinnable-master
                
-               if (array_key_exists('codename', $nucleus) && $nucleus['codename'] != '' )
-               {
-                       $codenamestring = ' &quot;' . $nucleus['codename'].'&quot;';
-               }
-               else
-               {
-                       $codenamestring = '';
-               }
+               $blogid = intRequestVar('blogid');
+               $member->teamRights($blogid) or self::disallow();
                
-               if ( $member->isLoggedIn() && $member->isAdmin() )
-               {
-                       $checkURL = sprintf(_ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_URL, getNucleusVersion(), getNucleusPatchLevel());
-                       echo '<a href="' . $checkURL . '" title="' . _ADMIN_SYSTEMOVERVIEW_VERSIONCHECK_TITLE . '">Nucleus CMS ' . $nucleus['version'] . $codenamestring . '</a>';
-                       
-                       $newestVersion = getLatestVersion();
-                       $newestCompare = str_replace('/','.',$newestVersion);
-                       $currentVersion = str_replace(array('/','v'),array('.',''),$nucleus['version']);
-                       if ( $newestVersion && version_compare($newestCompare, $currentVersion) > 0 )
-                       {
-                               echo "<br />\n";
-                               echo '<a style="color:red" href="http://nucleuscms.org/upgrade.php" title="' . _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TITLE . '">';
-                               echo _ADMIN_SYSTEMOVERVIEW_LATESTVERSION_TEXT . $newestVersion;
-                               echo "</a>";
-                       }
-               }
-               else
-               {
-                       echo 'Nucleus CMS ' . $nucleus['version'] . $codenamestring;
-               }
-               echo ')';
-               echo '</div>';
+               self::$skin->parse('bookmarklet');
+               return;
+       }
+       
+       /**
+        * Admin::action_actionlog()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_actionlog()
+       {
+               global $member, $manager;
+               
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('actionlog');
                return;
        }
        
        }
        
        /**
++<<<<<<< HEAD
 +       * Admin::action_bookmarklet()
++=======
+        * Admin::action_banlistnewfromitem()
++>>>>>>> skinnable-master
         * 
         * @param       void
         * @return      void
         */
++<<<<<<< HEAD
 +      public function action_bookmarklet()
 +      {
 +              global $member, $manager;
 +              
 +              $blogid = intRequestVar('blogid');
 +              $member->teamRights($blogid) or $this->disallow();
 +              $blog =& $manager->getBlog($blogid);
 +              
 +              $this->pagehead();
 +              
 +              echo '<p><a href="index.php?action=overview">(' . _BACKHOME . ")</a></p>\n";
 +              
 +              echo '<h2>' . _BOOKMARKLET_TITLE . "</h2>\n";
 +              echo '<p>';
 +              echo _BOOKMARKLET_DESC1 . _BOOKMARKLET_DESC2 . _BOOKMARKLET_DESC3 . _BOOKMARKLET_DESC4 . _BOOKMARKLET_DESC5;
 +              echo "</p>\n";
 +              
 +              echo '<h3>' . _BOOKMARKLET_BOOKARKLET . "</h3>\n";
 +              echo '<p>';
 +              echo _BOOKMARKLET_BMARKTEXT . '<small>' . _BOOKMARKLET_BMARKTEST . '</small>';
 +              echo "</p>\n";
 +              echo '<p>';
 +              echo '<a href="javascript:' . rawurlencode(getBookmarklet($blogid)) . '">' . sprintf(_BOOKMARKLET_ANCHOR, Entity::hsc($blog->getName())) . '</a>';
 +              echo _BOOKMARKLET_BMARKFOLLOW;
 +              echo "</p>\n";
 +              
 +              $this->pagefoot();
 +              return;
 +      }
 +      
 +    /**
 +     * @todo document this
 +     */
 +    function action_actionlog() {
 +        global $member, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +
 +        $url = $manager->addTicketToUrl('index.php?action=clearactionlog');
 +
 +        ?>
 +            <h2><?php echo _ACTIONLOG_CLEAR_TITLE ?></h2>
 +            <p><a href="<?php echo Entity::hsc($url) ?>"><?php echo _ACTIONLOG_CLEAR_TEXT ?></a></p>
 +        <?php
 +        echo '<h2>' . _ACTIONLOG_TITLE . '</h2>';
 +
 +        $query =  'SELECT * FROM '.sql_table('actionlog').' ORDER BY timestamp DESC';
 +        $template['content'] = 'actionlist';
 +        $amount = showlist($query,'table',$template);
 +
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlist() {
 +        global $member, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $blog =& $manager->getBlog($blogid);
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=overview">(',_BACKHOME,')</a></p>';
 +
 +        echo '<h2>' . _BAN_TITLE . " '". $this->bloglink($blog) ."'</h2>";
 +
 +        $query =  'SELECT * FROM '.sql_table('ban').' WHERE blogid='.$blogid.' ORDER BY iprange';
 +        $template['content'] = 'banlist';
 +        $amount = showlist($query,'table',$template);
 +
 +        if ($amount == 0)
 +            echo _BAN_NONE;
 +
 +        echo '<h2>'._BAN_NEW_TITLE.'</h2>';
 +        echo "<p><a href='index.php?action=banlistnew&amp;blogid=$blogid'>"._BAN_NEW_TEXT."</a></p>";
 +
 +
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlistdelete() {
 +        global $member, $manager;
 +
 +        $blogid = intRequestVar('blogid');
 +        $iprange = requestVar('iprange');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $blog =& $manager->getBlog($blogid);
 +        $banBlogName =  Entity::hsc($blog->getName());
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _BAN_REMOVE_TITLE ?></h2>
 +
 +            <form method="post" action="index.php">
 +
 +            <h3><?php echo _BAN_IPRANGE ?></h3>
 +
 +            <p>
 +                <?php echo _CONFIRMTXT_BAN ?> <?php echo Entity::hsc($iprange) ?>
 +                <input name="iprange" type="hidden" value="<?php echo Entity::hsc($iprange) ?>" />
 +            </p>
 +
 +            <h3><?php echo _BAN_BLOGS ?></h3>
 +
 +            <div>
 +                <input type="hidden" name="blogid" value="<?php echo $blogid ?>" />
 +                <input name="allblogs" type="radio" value="0" id="allblogs_one" />
 +                <label for="allblogs_one"><?php echo sprintf(_BAN_BANBLOGNAME, $banBlogName) ?></label>
 +                <br />
 +                <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS ?></label>
 +            </div>
 +
 +            <h3><?php echo _BAN_DELETE_TITLE ?></h3>
 +
 +            <div>
 +                <?php $manager->addTicketHidden() ?>
 +                <input type="hidden" name="action" value="banlistdeleteconfirm" />
 +                <input type="submit" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div>
 +
 +            </form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlistdeleteconfirm() {
 +        global $member, $manager;
 +
 +        $blogid = intPostVar('blogid');
 +        $allblogs = postVar('allblogs');
 +        $iprange = postVar('iprange');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $deleted = array();
 +
 +        if (!$allblogs) {
 +            if (Ban::removeBan($blogid, $iprange))
 +                array_push($deleted, $blogid);
 +        } else {
 +            // get blogs fot which member has admin rights
 +            $adminblogs = $member->getAdminBlogs();
 +            foreach ($adminblogs as $blogje) {
 +                if (Ban::removeBan($blogje, $iprange))
 +                    array_push($deleted, $blogje);
 +            }
 +        }
 +
 +        if (sizeof($deleted) == 0)
 +            $this->error(_ERROR_DELETEBAN);
 +
 +        $this->pagehead();
 +
 +        echo '<a href="index.php?action=banlist&amp;blogid=',$blogid,'">(',_BACK,')</a>';
 +        echo '<h2>'._BAN_REMOVED_TITLE.'</h2>';
 +        echo "<p>"._BAN_REMOVED_TEXT."</p>";
 +
 +        echo "<ul>";
 +        foreach ($deleted as $delblog) {
 +            $b =& $manager->getBlog($delblog);
 +            echo "<li>" . Entity::hsc($b->getName()). "</li>";
 +        }
 +        echo "</ul>";
 +
 +        $this->pagefoot();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlistnewfromitem() {
 +        $this->action_banlistnew(getBlogIDFromItemID(intRequestVar('itemid')));
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlistnew($blogid = '') {
 +        global $member, $manager;
 +
 +        if ($blogid == '')
 +            $blogid = intRequestVar('blogid');
 +
 +        $ip = requestVar('ip');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        $blog =& $manager->getBlog($blogid);
 +
 +        $this->pagehead();
 +        ?>
 +        <h2><?php echo _BAN_ADD_TITLE ?></h2>
 +
 +
 +        <form method="post" action="index.php">
 +
 +        <h3><?php echo _BAN_IPRANGE ?></h3>
 +
 +        <p><?php echo _BAN_IPRANGE_TEXT ?></p>
 +
 +        <div class="note">
 +            <strong><?php echo _BAN_EXAMPLE_TITLE ?></strong>
 +            <?php echo _BAN_EXAMPLE_TEXT ?>
 +        </div>
 +
 +        <div>
 +        <?php
 +        if ($ip) {
 +            $iprangeVal = Entity::hsc($ip);
 +        ?>
 +            <input name="iprange" type="radio" value="<?php echo $iprangeVal ?>" checked="checked" id="ip_fixed" />
 +            <label for="ip_fixed"><?php echo $iprangeVal ?></label>
 +            <br />
 +            <input name="iprange" type="radio" value="custom" id="ip_custom" />
 +            <label for="ip_custom"><?php echo _BAN_IP_CUSTOM ?></label>
 +            <input name='customiprange' value='<?php echo $iprangeVal ?>' maxlength='15' size='15' />
 +        <?php
 +        } else {
 +            echo "<input name='iprange' value='custom' type='hidden' />";
 +            echo "<input name='customiprange' value='' maxlength='15' size='15' />";
 +        }
 +        ?>
 +        </div>
 +
 +        <h3><?php echo _BAN_BLOGS ?></h3>
 +
 +        <p><?php echo _BAN_BLOGS_TEXT ?></p>
 +
 +        <div>
 +            <input type="hidden" name="blogid" value="<?php echo $blogid ?>" />
 +            <input name="allblogs" type="radio" value="0" id="allblogs_one" /><label for="allblogs_one">'<?php echo Entity::hsc($blog->getName()) ?>'</label>
 +            <br />
 +            <input name="allblogs" type="radio" value="1" checked="checked" id="allblogs_all" /><label for="allblogs_all"><?php echo _BAN_ALLBLOGS ?></label>
 +        </div>
 +
 +        <h3><?php echo _BAN_REASON_TITLE ?></h3>
 +
 +        <p><?php echo _BAN_REASON_TEXT ?></p>
 +
 +        <div><textarea name="reason" cols="40" rows="5"></textarea></div>
 +
 +        <h3><?php echo _BAN_ADD_TITLE ?></h3>
 +
 +        <div>
 +            <input name="action" type="hidden" value="banlistadd" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="submit" value="<?php echo _BAN_ADD_BTN ?>" />
 +        </div>
 +
 +        </form>
 +
 +        <?php       $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_banlistadd() {
 +        global $member;
 +
 +        $blogid =       intPostVar('blogid');
 +        $allblogs =     postVar('allblogs');
 +        $iprange =      postVar('iprange');
 +        if ($iprange == "custom")
 +            $iprange = postVar('customiprange');
 +        $reason =       postVar('reason');
 +
 +        $member->blogAdminRights($blogid) or $this->disallow();
 +
 +        // TODO: check IP range validity
 +
 +        if (!$allblogs) {
 +            if (!Ban::addBan($blogid, $iprange, $reason))
 +                $this->error(_ERROR_ADDBAN);
 +        } else {
 +            // get blogs fot which member has admin rights
 +            $adminblogs = $member->getAdminBlogs();
 +            $failed = 0;
 +            foreach ($adminblogs as $blogje) {
 +                if (!Ban::addBan($blogje, $iprange, $reason))
 +                    $failed = 1;
 +            }
 +            if ($failed)
 +                $this->error(_ERROR_ADDBAN);
 +        }
 +
 +        $this->action_banlist();
 +
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_clearactionlog() {
 +        global $member;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        ActionLog::clear();
 +
 +        $this->action_manage(_MSG_ACTIONLOGCLEARED);
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_backupoverview() {
 +        global $member, $manager;
 +
 +        $member->isAdmin() or $this->disallow();
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
 +        ?>
 +        <h2><?php echo _BACKUPS_TITLE ?></h2>
 +
 +        <h3><?php echo _BACKUP_TITLE ?></h3>
 +
 +        <p><?php echo _BACKUP_INTRO ?></p>
 +
 +        <form method="post" action="index.php"><p>
 +        <input type="hidden" name="action" value="backupcreate" />
 +        <?php $manager->addTicketHidden() ?>
 +
 +        <input type="radio" name="gzip" value="1" checked="checked" id="gzip_yes" tabindex="10" /><label for="gzip_yes"><?php echo _BACKUP_ZIP_YES ?></label>
 +        <br />
 +        <input type="radio" name="gzip" value="0" id="gzip_no" tabindex="10" /><label for="gzip_no" ><?php echo _BACKUP_ZIP_NO ?></label>
 +        <br /><br />
 +        <input type="submit" value="<?php echo _BACKUP_BTN ?>" tabindex="20" />
 +
 +        </p></form>
 +
 +        <div class="note"><?php echo _BACKUP_NOTE ?></div>
 +
 +
 +        <h3><?php echo _RESTORE_TITLE ?></h3>
 +
 +        <div class="note"><?php echo _RESTORE_NOTE ?></div>
 +
 +        <p><?php echo _RESTORE_INTRO ?></p>
 +
 +        <form method="post" action="index.php" enctype="multipart/form-data"><p>
 +            <input type="hidden" name="action" value="backuprestore" />
 +            <?php $manager->addTicketHidden() ?>
 +            <input name="backup_file" type="file" tabindex="30" />
 +            <br /><br />
 +            <input type="submit" value="<?php echo _RESTORE_BTN ?>" tabindex="40" />
 +            <br /><input type="checkbox" name="letsgo" value="1" id="letsgo" tabindex="50" /><label for="letsgo"><?php echo _RESTORE_IMSURE ?></label>
 +            <br /><?php echo _RESTORE_WARNING ?>
 +        </p></form>
++=======
+       static private function action_banlistnewfromitem()
+       {
+               global $manager;
+               
+               $itemid = intRequestVar('itemid');
+               $item =& $manager->getItem($itemid, 1, 1);
+               self::action_banlistnew($item['blogid']);
+               return;
+       }
+       
+       /**
+        * Admin::action_banlistnew()
+        * 
+        * @param       integer $blogid ID for weblog
+        * @return      void
+        */
+       static private function action_banlistnew($blogid = '')
+       {
+               global $member, $manager;
+               
+               if ( $blogid == '' )
+               {
+                       $blogid = intRequestVar('blogid');
+               }
+               
+               $ip = requestVar('ip');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               /* TODO: we should consider to use the other way instead of this */
+               $_REQUEST['blogid'] = $blogid;          
+               
+               self::$skin->parse('banlistnew');
+               
+               return;
+       }
++>>>>>>> skinnable-master
  
-         <?php       $this->pagefoot();
-     }
+       /**
+        * Admin::action_banlistadd()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_banlistadd()
+       {
+               global $member;
+               
+               $blogid         = intPostVar('blogid');
+               $allblogs       = postVar('allblogs');
+               $iprange        = postVar('iprange');
+               
+               if ( $iprange == "custom" )
+               {
+                       $iprange = postVar('customiprange');
+               }
+               $reason   = postVar('reason');
+               
+               $member->blogAdminRights($blogid) or self::disallow();
+               
+               // TODO: check IP range validity
+               
+               if ( !$allblogs )
+               {
+                       if ( !Ban::addBan($blogid, $iprange, $reason) )
+                       {
+                               self::error(_ERROR_ADDBAN);
+                               return;
+                       }
+               }
+               else
+               {
+                       // get blogs fot which member has admin rights
+                       $adminblogs = $member->getAdminBlogs();
+                       $failed = 0;
+                       foreach ($adminblogs as $blogje)
+                       {
+                               if ( !Ban::addBan($blogje, $iprange, $reason) )
+                               {
+                                       $failed = 1;
+                               }
+                       }
+                       if ( $failed )
+                       {
+                               self::error(_ERROR_ADDBAN);
+                               return;
+                       }
+               }
+               self::action_banlist();
+               return;
+       }
+       
+       /**
+        * Admin::action_clearactionlog()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_clearactionlog()
+       {
+               global $member;
+               
+               $member->isAdmin() or self::disallow();
+               
+               ActionLog::clear();
+               
+               self::action_manage(_MSG_ACTIONLOGCLEARED);
+               return;
+       }
+       
+       /**
+        * Admin::action_backupoverview()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_backupoverview()
+       {
+               global $member, $manager;
+               
+               $member->isAdmin() or self::disallow();
+               
+               self::$skin->parse('backupoverview');
+               return;
+       }
  
        /**
         * Admin::action_backupcreate()
                global $DIR_PLUGINS, $member, $manager;
                
                // check if allowed
-               $member->isAdmin() or $this->disallow();
+               $member->isAdmin() or self::disallow();
                
-               $this->pagehead();
-               
-               echo '<p><a href="index.php?action=manage">(',_BACKTOMANAGE,')</a></p>';
-               
-               echo '<h2>' , _PLUGS_TITLE_MANAGE , ' ', help('plugins'), '</h2>';
-               
-               echo '<h3>' , _PLUGS_TITLE_INSTALLED , ' &nbsp;&nbsp;<span style="font-size:smaller">', helplink('getplugins'), _PLUGS_TITLE_GETPLUGINS, '</a></span></h3>';
-               
-               $query =  'SELECT * FROM '.sql_table('plugin').' ORDER BY porder ASC';
-               
-               $template['content'] = 'pluginlist';
-               $template['tabindex'] = 10;
-               showlist($query, 'table', $template);
-               
-               echo '<h3>' . _PLUGS_TITLE_UPDATE . "</h3>\n";
-               echo '<p>' . _PLUGS_TEXT_UPDATE . "</p>\n";
-               echo '<form method="post" action="index.php">' . "\n";
-               echo "<div>\n";
-               echo '<input type="hidden" name="action" value="pluginupdate" />' . "\n";
-               $manager->addTicketHidden();
-               echo '<input type="submit" value="' . _PLUGS_BTN_UPDATE . '" tabindex="20" />' . "\n";
-               echo "</div>\n";
-               echo "</form>\n";
-               
-               echo '<h3>' . _PLUGS_TITLE_NEW . "</h3>\n";
-               
-               // find a list of possibly non-installed plugins
-               $candidates = array();
-               $dirhandle = opendir($DIR_PLUGINS);
+               self::$skin->parse('pluginlist');
+               return;
+       }
+       
+       /**
+        * Admin::action_pluginhelp()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_pluginhelp()
+       {
+               global $member, $manager, $DIR_PLUGINS, $CONF;
                
++<<<<<<< HEAD
 +              while ( $filename = readdir($dirhandle) )
 +              {
 +                      if ( preg_match('#^NP_(.*)\.php$#', $filename, $matches) )
 +                      {
 +                              $name = $matches[1];
 +                              
 +                              // only show in list when not yet installed
 +                              $query = 'SELECT * FROM %s WHERE pfile = %s';
 +                              $query = sprintf($query, sql_table('plugin'), DB::quoteValue('NP_'.$name));
 +                              $res = DB::getResult($query);
 +                              
 +                              if ( $res->rowCount() == 0 )
 +                              {
 +                                      array_push($candidates, $name);
 +                              }
 +                      }
 +              }
++=======
+               // check if allowed
+               $member->isAdmin() or self::disallow();
++>>>>>>> skinnable-master
                
-               closedir($dirhandle);
+               $plugid = intGetVar('plugid');
                
-               if ( sizeof($candidates) > 0 )
-               {
-                       echo '<p>' . _PLUGS_ADD_TEXT . "</p>\n";
-                       
-                       echo '<form method="post" action="index.php">' . "\n";
-                       echo "<div>\n";
-                       echo '<input type="hidden" name="action" value="pluginadd" />' . "\n";
-                       $manager->addTicketHidden();
-                       echo '<select name="filename" tabindex="30">' . "\n";
-                       
-                       foreach ( $candidates as $name )
-                       {
-                               echo '<option value="NP_',$name,'">',Entity::hsc($name),'</option>';
-                       }
-                       
-                       echo "</select>\n";
-                       echo '<input type="submit" tabindex="40" value="' . _PLUGS_BTN_INSTALL ."\" />\n";
-                       echo "</div>\n";
-                       echo "</form>\n";
-               }
-               else
+               if ( !$manager->pidInstalled($plugid) )
                {
-                       echo '<p>', _PLUGS_NOCANDIDATES, '</p>';
+                       self::error(_ERROR_NOSUCHPLUGIN);
+                       return;
                }
                
-               $this->pagefoot();
+               self::$skin->parse('pluginhelp');
                return;
        }
        
++<<<<<<< HEAD
 +    /**
 +     * @todo document this
 +     */
 +    function action_pluginhelp() {
 +        global $member, $manager, $DIR_PLUGINS, $CONF;
 +
 +        // check if allowed
 +        $member->isAdmin() or $this->disallow();
 +
 +        $plugid = intGetVar('plugid');
 +
 +        if (!$manager->pidInstalled($plugid))
 +            $this->error(_ERROR_NOSUCHPLUGIN);
 +
 +        $plugName = $manager->getPluginNameFromPid($plugid);
 +
 +        $this->pagehead();
 +
 +        echo '<p><a href="index.php?action=pluginlist">(',_PLUGS_BACK,')</a></p>';
 +
 +        echo '<h2>',_PLUGS_HELP_TITLE,': ',Entity::hsc($plugName),'</h2>';
 +
 +        $plug =& $manager->getPlugin($plugName);
 +        $helpFile = $DIR_PLUGINS.$plug->getShortName().'/help.html';
 +
 +        if (($plug->supportsFeature('HelpPage') > 0) && (@file_exists($helpFile))) {
 +            @readfile($helpFile);
 +        } else {
 +            echo '<p>Error: ', _ERROR_PLUGNOHELPFILE,'</p>';
 +            echo '<p><a href="index.php?action=pluginlist">(',_BACK,')</a></p>';
 +        }
 +
 +
 +        $this->pagefoot();
 +    }
 +
++=======
++>>>>>>> skinnable-master
        /**
         * Admin::action_pluginadd()
         * 
                global $member, $manager, $DIR_PLUGINS;
                
                // check if allowed
-               $member->isAdmin() or $this->disallow();
+               $member->isAdmin() or self::disallow();
+               
+               $name = postVar('filename');
+               
+               if ( $manager->pluginInstalled($name) )
+               {
+                       self::error(_ERROR_DUPPLUGIN);
+                       return;
+               }
+               
+               if ( !checkPlugin($name) )
+               {
+                       self::error(_ERROR_PLUGFILEERROR . ' (' . Entity::hsc($name) . ')');
+                       return;
+               }
+               
+               // get number of currently installed plugins
++<<<<<<< HEAD
++              $res = DB::getResult('SELECT * FROM '.sql_table('plugin'));
++=======
+               $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));
++>>>>>>> skinnable-master
+               $numCurrent = $res->rowCount();
+               
+               // plugin will be added as last one in the list
+               $newOrder = $numCurrent + 1;
+               
+               $data = array('file' => &$name);
+               $manager->notify('PreAddPlugin', $data);
+               
+               // do this before calling getPlugin (in case the plugin id is used there)
++<<<<<<< HEAD
++              $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.','.DB::quoteValue($name).')';
++=======
+               $query = "INSERT INTO %s (porder, pfile) VALUES (%d, %s);";
+               $query = sprintf($query, sql_table('plugin'), (integer) $newOrder, DB::quoteValue($name));
++>>>>>>> skinnable-master
+               DB::execute($query);
+               $iPid = DB::getInsertId();
+               
+               $manager->clearCachedInfo('installedPlugins');
+               
+               // Load the plugin for condition checking and instalation
+               $plugin =& $manager->getPlugin($name);
+               
+               // check if it got loaded (could have failed)
+               if ( !$plugin )
+               {
++<<<<<<< HEAD
++                      DB::execute('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
++=======
+                       $query = "DELETE FROM %s WHERE pid=%d;";
+                       $query = sprintf($query, sql_table('plugin'), (integer) $iPid);
+                       
+                       DB::execute($query);
+                       
++>>>>>>> skinnable-master
+                       $manager->clearCachedInfo('installedPlugins');
+                       self::error(_ERROR_PLUGIN_LOAD);
+                       return;
+               }
+               
+               // check if plugin needs a newer Nucleus version
+               if ( getNucleusVersion() < $plugin->getMinNucleusVersion() )
+               {
+                       // uninstall plugin again...
+                       self::deleteOnePlugin($plugin->getID());
+                       
+                       // ...and show error
+                       self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc($plugin->getMinNucleusVersion()));
+                       return;
+               }
+               
+               // check if plugin needs a newer Nucleus version
+               if ( (getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()) )
+               {
+                       // uninstall plugin again...
+                       self::deleteOnePlugin($plugin->getID());
+                       
+                       // ...and show error
+                       self::error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
+                       return;
+               }
+               
+               $pluginList = $plugin->getPluginDep();
+               foreach ( $pluginList as $pluginName )
+               {
+                       $res = DB::getResult('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile=' . DB::quoteValue($pluginName));
+                       if ($res->rowCount() == 0)
+                       {
+                               // uninstall plugin again...
+                               self::deleteOnePlugin($plugin->getID());
+                               self::error(sprintf(_ERROR_INSREQPLUGIN, Entity::hsc($pluginName)));
+                               return;
+                       }
+               }
+               
+               // call the install method of the plugin
+               $plugin->install();
+               
+               $data = array('plugin' => &$plugin);
+               $manager->notify('PostAddPlugin', $data);
+               
+               // update all events
+               self::action_pluginupdate();
+               return;
+       }
+       
+       /**
+        * ADMIN:action_pluginupdate():
+        * 
+        * @param       Void
+        * @return      Void
+        * 
+        */
+       static private function action_pluginupdate()
+       {
+               global $member, $manager, $CONF;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               // delete everything from plugin_events
+               DB::execute('DELETE FROM '.sql_table('plugin_event'));
+               
+               // loop over all installed plugins
+               $res = DB::getResult('SELECT pid, pfile FROM '.sql_table('plugin'));
+               foreach ( $res as $row )
+               {
+                       $pid  =  $row['pid'];
+                       $plug =& $manager->getPlugin($row['pfile']);
+                       if ( $plug )
+                       {
+                               $eventList = $plug->getEventList();
+                               foreach ( $eventList as $eventName )
+                               {
+                                       $query = "INSERT INTO %s (pid, event) VALUES (%d, %s)";
+                                       $query = sprintf($query, sql_table('plugin_event'), (integer) $pid, DB::quoteValue($eventName));
+                                       DB::execute($query);
+                               }
+                       }
+               }
+               redirect($CONF['AdminURL'] . '?action=pluginlist');
+               return;
+       }
+       
+       /**
+        * Admin::action_plugindelete()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_plugindelete()
+       {
+               global $member, $manager;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               $pid = intGetVar('plugid');
+               
+               if ( !$manager->pidInstalled($pid) )
+               {
+                       self::error(_ERROR_NOSUCHPLUGIN);
+                       return;
+               }
+               
+               self::$skin->parse('plugindelete');
+               return;
+       }
+       /**
+        * Admin::action_plugindeleteconfirm()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_plugindeleteconfirm()
+       {
+               global $member, $manager, $CONF;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               $pid = intPostVar('plugid');
+               
+               $error = self::deleteOnePlugin($pid, 1);
+               if ( $error )
+               {
+                       self::error($error);
+                       return;
+               }
+               
+               redirect($CONF['AdminURL'] . '?action=pluginlist');
+               return;
+       }
+       
+       /**
+        * Admin::deleteOnePlugin()
+        * 
+        * @param       integer $pid
+        * @param       boolean $callUninstall
+        * @return      string  empty or message if failed
+        */
+       static public function deleteOnePlugin($pid, $callUninstall = 0)
+       {
+               global $manager;
                
-               $name = postVar('filename');
+               $pid = intval($pid);
                
-               if ( $manager->pluginInstalled($name) )
+               if ( !$manager->pidInstalled($pid) )
                {
-                       $this->error(_ERROR_DUPPLUGIN);
+                       return _ERROR_NOSUCHPLUGIN;
                }
                
-               if ( !checkPlugin($name) )
+               $query = "SELECT pfile as result FROM %s WHERE pid=%d;";
+               $query = sprintf($query, sql_table('plugin'), (integer) $pid);
+               $name = DB::getValue($query);
+               
+               // check dependency before delete
+               $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
+               foreach ( $res as $row )
                {
-                       $this->error(_ERROR_PLUGFILEERROR . ' (' . Entity::hsc($name) . ')');
+                       $plug =& $manager->getPlugin($row['pfile']);
+                       if ( $plug )
+                       {
+                               $depList = $plug->getPluginDep();
+                               foreach ( $depList as $depName )
+                               {
+                                       if ( $name == $depName )
+                                       {
+                                               return sprintf(_ERROR_DELREQPLUGIN, $row['pfile']);
+                                       }
+                               }
+                       }
                }
                
-               // get number of currently installed plugins
-               $res = DB::getResult('SELECT * FROM '.sql_table('plugin'));
-               $numCurrent = $res->rowCount();
-               
-               // plugin will be added as last one in the list
-               $newOrder = $numCurrent + 1;
-               
-               $manager->notify(
-                       'PreAddPlugin',
-                       array(
-                               'file' => &$name
-                       )
-               );
-               
-               // do this before calling getPlugin (in case the plugin id is used there)
-               $query = 'INSERT INTO '.sql_table('plugin').' (porder, pfile) VALUES ('.$newOrder.','.DB::quoteValue($name).')';
-               DB::execute($query);
-               $iPid = DB::getInsertId();
-               
-               $manager->clearCachedInfo('installedPlugins');
-               
-               // Load the plugin for condition checking and instalation
-               $plugin =& $manager->getPlugin($name);
+               $data = array('plugid' => $pid);
+               $manager->notify('PreDeletePlugin', $data);
                
-               // check if it got loaded (could have failed)
-               if ( !$plugin )
+               // call the unInstall method of the plugin
+               if ( $callUninstall )
                {
-                       DB::execute('DELETE FROM ' . sql_table('plugin') . ' WHERE pid='. intval($iPid));
-                       $manager->clearCachedInfo('installedPlugins');
-                       $this->error(_ERROR_PLUGIN_LOAD);
+                       $plugin =& $manager->getPlugin($name);
+                       if ( $plugin )
+                       {
+                               $plugin->unInstall();
+                       }
                }
                
-               // check if plugin needs a newer Nucleus version
-               if ( getNucleusVersion() < $plugin->getMinNucleusVersion() )
+               // delete all subscriptions
+               DB::execute('DELETE FROM ' . sql_table('plugin_event') . ' WHERE pid=' . $pid);
+               
+               // delete all options
+               // get OIDs from plugin_option_desc
+               $res = DB::getResult('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
+               $aOIDs = array();
+               foreach ( $res as $row )
                {
-                       // uninstall plugin again...
-                       $this->deleteOnePlugin($plugin->getID());
-                       
-                       // ...and show error
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc($plugin->getMinNucleusVersion()));
+                       array_push($aOIDs, $row['oid']);
                }
                
-               // check if plugin needs a newer Nucleus version
-               if ( (getNucleusVersion() == $plugin->getMinNucleusVersion()) && (getNucleusPatchLevel() < $plugin->getMinNucleusPatchLevel()) )
+               // delete from plugin_option and plugin_option_desc
+               DB::execute('DELETE FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
+               if (count($aOIDs) > 0)
                {
-                       // uninstall plugin again...
-                       $this->deleteOnePlugin($plugin->getID());
-                       
-                       // ...and show error
-                       $this->error(_ERROR_NUCLEUSVERSIONREQ . Entity::hsc( $plugin->getMinNucleusVersion() . ' patch ' . $plugin->getMinNucleusPatchLevel() ) );
+                       DB::execute('DELETE FROM ' . sql_table('plugin_option') . ' WHERE oid in (' . implode(',', $aOIDs) . ')');
                }
                
-               $pluginList = $plugin->getPluginDep();
-               foreach ( $pluginList as $pluginName )
+               // update order numbers
+               $res = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);
+               DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=(porder - 1) WHERE porder>' . $res);
+               
+               // delete row
+               DB::execute('DELETE FROM ' . sql_table('plugin') . ' WHERE pid=' . $pid);
+               
+               $manager->clearCachedInfo('installedPlugins');
+               $data = array('plugid' => $pid);
+               $manager->notify('PostDeletePlugin', $data);
+               
+               return '';
+       }
+       
+       /**
+        * Admin::action_pluginup()
+        * 
+        * @param       void
+        * @return      void
+        */
+       static private function action_pluginup()
+       {
+               global $member, $manager, $CONF;
+               
+               // check if allowed
+               $member->isAdmin() or self::disallow();
+               
+               $plugid = intGetVar('plugid');
+               
+               if ( !$manager->pidInstalled($plugid) )
                {
++<<<<<<< HEAD
 +                      $res = DB::getResult('SELECT * FROM '.sql_table('plugin') . ' WHERE pfile=' . DB::quoteValue($pluginName));
 +                      if ($res->rowCount() == 0)
 +                      {
 +                              // uninstall plugin again...
 +                              $this->deleteOnePlugin($plugin->getID());
 +                              $this->error(sprintf(_ERROR_INSREQPLUGIN, Entity::hsc($pluginName)));
 +                      }
++=======
+                       self::error(_ERROR_NOSUCHPLUGIN);
+                       return;
++>>>>>>> skinnable-master
                }
                
-               // call the install method of the plugin
-               $plugin->install();
+               // 1. get old order number
+               $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);
                
-               $manager->notify(
-                       'PostAddPlugin',
-                       array(
-                               'plugin' => &$plugin
-                       )
-               );
+               // 2. calculate new order number
+               $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
                
-               // update all events
-               $this->action_pluginupdate();
+               // 3. update plug numbers
+               DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);
+               DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);
+               
+               //self::action_pluginlist();
+               // To avoid showing ticket in the URL, redirect to pluginlist, instead.
+               redirect($CONF['AdminURL'] . '?action=pluginlist');
                return;
        }
        
                global $member, $manager, $CONF;
                
                // check if allowed
++<<<<<<< HEAD
 +              $member->isAdmin() or $this->disallow();
 +              
 +              // delete everything from plugin_events
 +              DB::execute('DELETE FROM '.sql_table('plugin_event'));
 +              
 +              // loop over all installed plugins
 +              $res = DB::getResult('SELECT pid, pfile FROM '.sql_table('plugin'));
 +              foreach ( $res as $row )
 +              {
 +                      $pid = $row['pid'];
 +                      $plug =& $manager->getPlugin($row['pfile']);
 +                      if ( $plug )
 +                      {
 +                              $eventList = $plug->getEventList();
 +                              foreach ( $eventList as $eventName )
 +                              {
 +                                      $query = "INSERT INTO %s (pid, event) VALUES (%d, %s)";
 +                                      $query = sprintf($query, sql_table('plugin_event'), (integer) $pid, DB::quoteValue($eventName));
 +                                      DB::execute($query);
 +                              }
 +                      }
++=======
+               $member->isAdmin() or self::disallow();
+               
+               $plugid = intGetVar('plugid');
+               if ( !$manager->pidInstalled($plugid) )
+               {
+                       self::error(_ERROR_NOSUCHPLUGIN);
+                       return;
++>>>>>>> skinnable-master
                }
+               
+               // 1. get old order number
+               $oldOrder = DB::getValue('SELECT porder FROM ' . sql_table('plugin') . ' WHERE pid=' . $plugid);
+               
+               $res = DB::getResult('SELECT * FROM ' . sql_table('plugin'));
+               $maxOrder = $res->rowCount();
+               
+               // 2. calculate new order number
+               $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
+               
+               // 3. update plug numbers
+               DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $oldOrder . ' WHERE porder=' . $newOrder);
+               DB::execute('UPDATE ' . sql_table('plugin') . ' SET porder=' . $newOrder . ' WHERE pid=' . $plugid);
+               
+               //self::action_pluginlist();
+               // To avoid showing ticket in the URL, redirect to pluginlist, instead.
                redirect($CONF['AdminURL'] . '?action=pluginlist');
                return;
        }
        
++<<<<<<< HEAD
 +    /**
 +     * @todo document this
 +     */
 +    function action_plugindelete() {
 +        global $member, $manager;
 +
 +        // check if allowed
 +        $member->isAdmin() or $this->disallow();
 +
 +        $pid = intGetVar('plugid');
 +
 +        if (!$manager->pidInstalled($pid))
 +            $this->error(_ERROR_NOSUCHPLUGIN);
 +
 +        $this->pagehead();
 +        ?>
 +            <h2><?php echo _DELETE_CONFIRM ?></h2>
 +
 +            <p><?php echo _CONFIRMTXT_PLUGIN ?> <strong><?php echo $manager->getPluginNameFromPid($pid) ?></strong>?</p>
 +
 +            <form method="post" action="index.php"><div>
 +            <?php $manager->addTicketHidden() ?>
 +            <input type="hidden" name="action" value="plugindeleteconfirm" />
 +            <input type="hidden" name="plugid" value="<?php echo $pid; ?>" />
 +            <input type="submit" tabindex="10" value="<?php echo _DELETE_CONFIRM_BTN ?>" />
 +            </div></form>
 +        <?php
 +        $this->pagefoot();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_plugindeleteconfirm() {
 +        global $member, $manager, $CONF;
 +
 +        // check if allowed
 +        $member->isAdmin() or $this->disallow();
 +
 +        $pid = intPostVar('plugid');
 +
 +        $error = $this->deleteOnePlugin($pid, 1);
 +        if ($error) {
 +            $this->error($error);
 +        }
 +
 +        redirect($CONF['AdminURL'] . '?action=pluginlist');
 +//            $this->action_pluginlist();
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function deleteOnePlugin($pid, $callUninstall = 0) {
 +        global $manager;
 +
 +        $pid = intval($pid);
 +
 +        if (!$manager->pidInstalled($pid))
 +            return _ERROR_NOSUCHPLUGIN;
 +
 +        $name = DB::getValue('SELECT pfile as result FROM '.sql_table('plugin').' WHERE pid='.$pid);
 +
 +/*            // call the unInstall method of the plugin
 +        if ($callUninstall) {
 +            $plugin =& $manager->getPlugin($name);
 +            if ($plugin) $plugin->unInstall();
 +        }*/
 +
 +        // check dependency before delete
 +        $res = DB::getResult('SELECT pfile FROM '.sql_table('plugin'));
 +        foreach ( $res as $row ) {
 +            $plug =& $manager->getPlugin($row['pfile']);
 +            if ($plug)
 +            {
 +                $depList = $plug->getPluginDep();
 +                foreach ($depList as $depName)
 +                {
 +                    if ($name == $depName)
 +                    {
 +                        return sprintf(_ERROR_DELREQPLUGIN, $row['pfile']);
 +                    }
 +                }
 +            }
 +        }
 +
 +        $manager->notify('PreDeletePlugin', array('plugid' => $pid));
 +
 +        // call the unInstall method of the plugin
 +        if ($callUninstall) {
 +            $plugin =& $manager->getPlugin($name);
 +            if ($plugin) $plugin->unInstall();
 +        }
 +
 +        // delete all subscriptions
 +        DB::execute('DELETE FROM '.sql_table('plugin_event').' WHERE pid=' . $pid);
 +
 +        // delete all options
 +        // get OIDs from plugin_option_desc
 +        $res = DB::getResult('SELECT oid FROM ' . sql_table('plugin_option_desc') . ' WHERE opid=' . $pid);
 +        $aOIDs = array();
 +        foreach ( $res as $row ) {
 +            array_push($aOIDs, $row['oid']);
 +        }
 +
 +        // delete from plugin_option and plugin_option_desc
 +        DB::execute('DELETE FROM '.sql_table('plugin_option_desc').' WHERE opid=' . $pid);
 +        if (count($aOIDs) > 0)
 +            DB::execute('DELETE FROM '.sql_table('plugin_option').' WHERE oid in ('.implode(',',$aOIDs).')');
 +
 +        // update order numbers
 +        $res = DB::getValue('SELECT porder FROM '.sql_table('plugin').' WHERE pid=' . $pid);
 +        DB::execute('UPDATE '.sql_table('plugin').' SET porder=(porder - 1) WHERE porder>'.$res);
 +
 +        // delete row
 +        DB::execute('DELETE FROM '.sql_table('plugin').' WHERE pid='.$pid);
 +
 +        $manager->clearCachedInfo('installedPlugins');
 +        $manager->notify('PostDeletePlugin', array('plugid' => $pid));
 +
 +        return '';
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_pluginup() {
 +        global $member, $manager, $CONF;
 +
 +        // check if allowed
 +        $member->isAdmin() or $this->disallow();
 +
 +        $plugid = intGetVar('plugid');
 +
 +        if (!$manager->pidInstalled($plugid))
 +            $this->error(_ERROR_NOSUCHPLUGIN);
 +
 +        // 1. get old order number
 +        $oldOrder = DB::getValue('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid);
 +
 +        // 2. calculate new order number
 +        $newOrder = ($oldOrder > 1) ? ($oldOrder - 1) : 1;
 +
 +        // 3. update plug numbers
 +        DB::execute('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
 +        DB::execute('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
 +
 +        //$this->action_pluginlist();
 +        // To avoid showing ticket in the URL, redirect to pluginlist, instead.
 +        redirect($CONF['AdminURL'] . '?action=pluginlist');
 +    }
 +
 +    /**
 +     * @todo document this
 +     */
 +    function action_plugindown() {
 +        global $member, $manager, $CONF;
 +
 +        // check if allowed
 +        $member->isAdmin() or $this->disallow();
 +
 +        $plugid = intGetVar('plugid');
 +        if (!$manager->pidInstalled($plugid))
 +            $this->error(_ERROR_NOSUCHPLUGIN);
 +
 +        // 1. get old order number
 +        $oldOrder = DB::getValue('SELECT porder FROM '.sql_table('plugin').' WHERE pid='.$plugid);
 +
 +        $res = DB::getResult('SELECT * FROM '.sql_table('plugin'));
 +        $maxOrder = $res->rowCount();
 +
 +        // 2. calculate new order number
 +        $newOrder = ($oldOrder < $maxOrder) ? ($oldOrder + 1) : $maxOrder;
 +
 +        // 3. update plug numbers
 +        DB::execute('UPDATE '.sql_table('plugin').' SET porder='.$oldOrder.' WHERE porder='.$newOrder);
 +        DB::execute('UPDATE '.sql_table('plugin').' SET porder='.$newOrder.' WHERE pid='.$plugid);
 +
 +        //$this->action_pluginlist();
 +        // To avoid showing ticket in the URL, redirect to pluginlist, instead.
 +        redirect($CONF['AdminURL'] . '?action=pluginlist');
 +    }
 +      
++=======
++>>>>>>> skinnable-master
        /**
         * Admin::action_pluginoptions()
         * 
                global $member, $manager;
                
                // check if allowed
-               $member->isAdmin() or $this->disallow();
+               $member->isAdmin() or self::disallow();
                
-               $pid = (integer) requestVar('plugid');
+               $pid = intRequestVar('plugid');
                if ( !$manager->pidInstalled($pid) )
                {
-                       $this->error(_ERROR_NOSUCHPLUGIN);
+                       self::error(_ERROR_NOSUCHPLUGIN);
+                       return;
                }
                
++<<<<<<< HEAD
 +              $pname = $manager->getPluginNameFromPid($pid);
 +              
 +              /* NOTE: to include translation file */
 +              $manager->getPlugin($pname);
 +              
 +              $extrahead = "<script type=\"text/javascript\" src=\"javascript/numbercheck.js\"></script>\n";
 +              $this->pagehead($extrahead);
 +              echo '<p><a href="index.php?action=pluginlist">(' . _PLUGS_BACK . ")</a></p>\n";
 +              echo '<h2>' . sprintf(_PLUGIN_OPTIONS_TITLE, Entity::hsc($pname)) . "</h2>\n";
 +              
 +              if ( isset($message) )
 +              {
 +                      echo $message;
 +              }
 +              
 +              echo "<form action=\"index.php\" method=\"post\">\n";
 +              echo "<div>\n";
 +              echo "<input type=\"hidden\" name=\"action\" value=\"pluginoptionsupdate\" />\n";
 +              echo "<input type=\"hidden\" name=\"plugid\" value=\"{$pid}\" />\n";
 +              $manager->addTicketHidden();
 +              
 +              $options = array();
 +              $query = "SELECT * FROM %s WHERE ocontext='global' and opid=%d ORDER BY oid ASC";
 +              $query = sprintf($query, sql_table('plugin_option_desc'), $pid);
 +              $result = DB::getResult($query);
 +              foreach ( $result as $row )
 +              {
 +                      $options[$row['oid']] = array(
 +                              'oid'           => $row['oid'],
 +                              'value'         => $row['odef'],
 +                              'name'          => $row['oname'],
 +                              'description' => $row['odesc'],
 +                              'type'          => $row['otype'],
 +                              'typeinfo'      => $row['oextra'],
 +                              'contextid'     => 0
 +                      );
 +              }
 +              // fill out actual values
 +              if ( count($options) > 0 )
 +              {
 +                      $query = "SELECT oid, ovalue FROM %s WHERE oid in (%s)";
 +                      $query = sprintf($query, sql_table('plugin_option'), implode(',',array_keys($options)));
 +                      $result = DB::getResult($query);
 +                      foreach ( $result as $row )
 +                      {
 +                              $options[$row['oid']]['value'] = $row['ovalue'];
 +                      }
 +              }
 +              
 +              // call plugins
 +              $data = array('context' => 'global', 'plugid' => $pid, 'options'=>&$options);
 +              $manager->notify('PrePluginOptionsEdit',$data);
 +              
 +              $template['content'] = 'plugoptionlist';
 +              $amount = showlist($options,'table', $template);
 +              if ( $amount == 0 )
 +              {
 +                      echo '<p>',_ERROR_NOPLUGOPTIONS,'</p>';
++=======
+               if ( isset($message) )
+               {
+                       self::$headMess = $message;
++>>>>>>> skinnable-master
                }
-               echo "</div>\n";
-               echo "</form>\n";
-               $this->pagefoot();
+               $plugname       = $manager->getPluginNameFromPid($pid);
+               $plugin         = $manager->getPlugin($plugname);
+               self::$extrahead .= "<script type=\"text/javascript\" src=\"<%skinfile(/javascripts/numbercheck.js)%>\"></script>\n";
                
+               self::$skin->parse('pluginoptions');
                return;
        }
        
        {
                global $manager;
                
++<<<<<<< HEAD
 +              /* get current registered plugin option list in this context even if it's not used */
 +              $query = 'SELECT * FROM %s AS plugins, %s AS options LEFT OUTER JOIN %s AS added '
 +                     . 'ON ( options.oid=added.oid ) '
 +                     . 'WHERE plugins.pid=options.opid AND options.ocontext=%s AND added.ocontextid=%d '
 +                     . 'ORDER BY options.oid ASC';
 +              $query = sprintf($query, sql_table('plugin'), sql_table('plugin_option_desc'), sql_table('plugin_option'), DB::quoteValue($context), intval($contextid));
 +              
 +              $res = DB::getResult($query);
 +              
 +              $options = array();
 +              foreach ( $res as $row )
 +              {
 +                      /* NOTE: to include translation file */
 +                      $manager->getPlugin($row['pfile']);
 +                      
 +                      $options[] = array(
 +                              'pid'           => $row['pid'],
 +                              'pfile'         => $row['pfile'],
 +                              'oid'           => $row['oid'],
 +                              'value'         => ( !$row['ovalue'] ) ? $row['odef'] : $row['ovalue'],
 +                              'name'          => $row['oname'],
 +                              'description' => $row['odesc'],
 +                              'type'          => $row['otype'],
 +                              'typeinfo'      => $row['oextra'],
 +                              'contextid'     => $contextid,
 +                              'extra'         => ''
 +                      );
 +              }
 +              
 +              $manager->notify('PrePluginOptionsEdit',array('context' => $context, 'contextid' => $contextid, 'options'=>&$options));
 +              
 +              $iPrevPid = -1;
 +              foreach ( $options as $option)
 +              {
 +                      // new plugin?
 +                      if ( $iPrevPid != $option['pid'] )
 +                      {
 +                              $iPrevPid = $option['pid'];
 +                              if ( !defined('_PLUGIN_OPTIONS_TITLE') )
 +                              {
 +                                      define('_PLUGIN_OPTIONS_TITLE', 'Options for %s');
 +                              }
 +                              echo "<tr>\n";
 +                              echo '<th colspan="2">' . sprintf(_PLUGIN_OPTIONS_TITLE, Entity::hsc($option['pfile'])) . "</th>\n";
 +                              echo "</tr>\n";
 +                      }
 +                      
 +                      $meta = NucleusPlugin::getOptionMeta($option['typeinfo']);
 +                      if ( @$meta['access'] != 'hidden' )
 +                      {
 +                              echo '<tr>';
 +                              listplug_plugOptionRow($option);
 +                              echo '</tr>';
++=======
+               if ( !in_array(self::$action, self::$adminskin_actions) )
+               {
+                       $event_identifier = 'Skin';
+               }
+               else
+               {
+                       $event_identifier = 'AdminSkin';
+               }
+               
+               if ( !isValidShortName($skintype) )
+               {
+                       return _ERROR_SKIN_PARTS_SPECIAL_DELETE;
+               }
+               
+               $data = array(
+                       'skinid'        => $skinid,
+                       'skintype'      => $skintype
+               );
+               $manager->notify("PreDelete{$event_identifier}Part", $data);
+               
+               // delete part
+               $query = 'DELETE FROM %s WHERE sdesc = %d AND stype = %s;';
+               $query = sprintf($query, sql_table('skin'), (integer) $skinid, DB::quoteValue($skintype) );
+               DB::execute($query);
+               
+               $data = array(
+                       'skinid'        => $skinid,
+                       'skintype'      => $skintype
+               );
+               $manager->notify("PostDelete{$event_identifier}Part", $data);
+               
+               return '';
+       }
+       
+       /**
+        * Admin::skinclone()
+        * 
+        * @param       integer $skinid
+        * @param       string  $handler
+        * @return      void
+        */
+       static private function skinclone($skinid, $handler='')
+       {
+               global $manager;
+               
+               // 1. read skin to clone
+               $skin =& $manager->getSkin($skinid, $handler);
+               $name = "{$skin->getName()}_clone";
+               
+               // if a skin with that name already exists:
+               if ( Skin::exists($name) )
+               {
+                       $i = 1;
+                       while ( Skin::exists($name . $i) )
+                       {
+                               $i++;
+                       }
+                       $name .= $i;
+               }
+               
+               // 2. create skin desc
+               $newid = Skin::createNew(
+                       $name,
+                       $skin->getDescription(),
+                       $skin->getContentType(),
+                       $skin->getIncludeMode(),
+                       $skin->getIncludePrefix()
+               );
+               
+               // 3. clone
+               $query = "SELECT stype FROM %s WHERE sdesc=%d;";
+               $query = sprintf($query, sql_table('skin'), (integer) $skinid);
+               
+               $res = DB::getResult($query);
+               foreach ( $res as $row )
+               {
+                       $content = $skin->getContentFromDB($row['stype']);
+                       if ( $content )
+                       {
+                               $query = "INSERT INTO %s (sdesc, scontent, stype) VALUES (%d, %s, %s)";
+                               $query = sprintf($query, sql_table('skin'), (integer) $newid, DB::quoteValue($content), DB::quoteValue($row['stype']));
+                               DB::execute($query);
++>>>>>>> skinnable-master
                        }
                }
                return;
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * PHP class responsible for ban-management.\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: BAN.php 1525 2011-06-21 10:20:19Z sakamocchi $\r
 + */\r
 +\r
 +class Ban\r
 +{\r
 +      /**\r
 +       * Checks if a given IP is banned from commenting/voting\r
 +       *\r
 +       * Returns 0 when not banned, or a BanInfo object containing the\r
 +       * message and other information of the ban\r
 +       */\r
 +      public function isBanned($blogid, $ip)\r
 +      {\r
 +              $blogid = intval($blogid);\r
 +              $query = sprintf('SELECT * FROM %s WHERE blogid=%d', sql_table('ban'), intval($blogid));\r
 +              $res = DB::getResult($query);\r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      $found = i18n::strpos ($ip, $row['iprange']);\r
 +                      if ( $found !== false )\r
 +                      {\r
 +                              // found a match!\r
 +                              return new BanInfo($row['iprange'], $row['reason']);\r
 +                      }\r
 +              }\r
 +              return 0;\r
 +      }\r
 +\r
 +      /**\r
 +       * Ban::addBan()\r
 +       * Adds a new ban to the banlist. Returns 1 on success, 0 on error\r
 +       * \r
 +       * @param       Integer $blogid ID for weblog\r
 +       * @param       String  $iprange        IP range\r
 +       * @param       String  $reason reason for banning\r
 +       * @return      Boolean\r
 +       * \r
 +       */\r
 +      public function addBan($blogid, $iprange, $reason)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $manager->notify(\r
 +                      'PreAddBan',\r
 +                      array(\r
 +                              'blogid' => $blogid,\r
 +                              'iprange' => &$iprange,\r
 +                              'reason' => &$reason\r
 +                      )\r
 +              );\r
 +              \r
 +              $query = 'INSERT INTO %s (blogid, iprange, reason) VALUES (%d, %s, %s)';\r
 +              $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange), DB::quoteValue($reason));\r
 +              $res = DB::execute($query);\r
 +              \r
 +              $manager->notify(\r
 +                      'PostAddBan',\r
 +                      array(\r
 +                              'blogid' => $blogid,\r
 +                              'iprange' => $iprange,\r
 +                              'reason' => $reason\r
 +                      )\r
 +              );\r
 +              \r
 +              return $res !== FALSE ? 1 : 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Removes a ban from the banlist (correct iprange is needed as argument)\r
 +       * Returns 1 on success, 0 on error\r
 +       */\r
 +      public function removeBan($blogid, $iprange)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $manager->notify(\r
 +                      'PreDeleteBan',\r
 +                      array(\r
 +                              'blogid' => $blogid,\r
 +                              'range' => $iprange\r
 +                      )\r
 +              );\r
 +              \r
 +              $query = 'DELETE FROM %s WHERE blogid=%d and iprange=%s';\r
 +              $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange));\r
 +              $res = DB::execute($query);\r
 +              \r
 +              $manager->notify(\r
 +                      'PostDeleteBan',\r
 +                      array(\r
 +                              'blogid' => $blogid,\r
 +                              'range' => $iprange\r
 +                      )\r
 +              );\r
 +              \r
 +              return $res !== FALSE ? 1 : 0;\r
 +      }\r
 +}\r
 +\r
 +class BanInfo\r
 +{\r
 +      public $iprange;\r
 +      public $message;\r
 +      \r
 +      public function __construct($iprange, $message)\r
 +      {\r
 +              $this->iprange = $iprange;\r
 +              $this->message = $message;\r
 +              return;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * PHP class responsible for ban-management.
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: BAN.php 1812 2012-05-01 14:59:07Z sakamocchi $
+  */
+ class Ban
+ {
+       /**
+        * Checks if a given IP is banned from commenting/voting
+        *
+        * Returns 0 when not banned, or a BanInfo object containing the
+        * message and other information of the ban
+        */
+       public function isBanned($blogid, $ip)
+       {
+               $blogid = intval($blogid);
+               $query = sprintf('SELECT * FROM %s WHERE blogid=%d', sql_table('ban'), intval($blogid));
+               $res = DB::getResult($query);
+               foreach ( $res as $row )
+               {
+                       $found = i18n::strpos ($ip, $row['iprange']);
+                       if ( $found !== false )
+                       {
+                               // found a match!
+                               return new BanInfo($row['iprange'], $row['reason']);
+                       }
+               }
+               return 0;
+       }
+       /**
+        * Ban::addBan()
+        * Adds a new ban to the banlist. Returns 1 on success, 0 on error
+        * 
+        * @param       Integer $blogid ID for weblog
+        * @param       String  $iprange        IP range
+        * @param       String  $reason reason for banning
+        * @return      Boolean
+        * 
+        */
+       public function addBan($blogid, $iprange, $reason)
+       {
+               global $manager;
+               $data = array(
+                               'blogid'        => $blogid,
+                               'iprange'       => &$iprange,
+                               'reason'        => &$reason
+                       );
+               $manager->notify('PreAddBan', $data);
+               
+               $query = 'INSERT INTO %s (blogid, iprange, reason) VALUES (%d, %s, %s)';
+               $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange), DB::quoteValue($reason));
+               $res = DB::execute($query);
+               
+               $manager->notify('PostAddBan', $data);
+               
+               return $res !== FALSE ? 1 : 0;
+       }
+       
+       /**
+        * Removes a ban from the banlist (correct iprange is needed as argument)
+        * Returns 1 on success, 0 on error
+        */
+       public function removeBan($blogid, $iprange)
+       {
+               global $manager;
+               
+               $data = array(
+                       'blogid'        => $blogid,
+                       'range'         => $iprange
+               );
+               $manager->notify('PreDeleteBan', $data);
+               
+               $query = 'DELETE FROM %s WHERE blogid=%d and iprange=%s';
+               $query = sprintf($query, sql_table('ban'), intval($blogid), DB::quoteValue($iprange));
+               $res = DB::execute($query);
+               
+               $manager->notify('PostDeleteBan', $data);
+               
+               return $res !== FALSE ? 1 : 0;
+       }
+ }
+ class BanInfo
+ {
+       public $iprange;
+       public $message;
+       
+       public function __construct($iprange, $message)
+       {
+               $this->iprange = $iprange;
+               $this->message = $message;
+               return;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * A class representing a blog and containing functions to get that blog shown\r
 + * on the screen\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: BLOG.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
 + */\r
 +\r
 +if ( !function_exists('requestVar') ) exit;\r
 +require_once dirname(__FILE__) . '/ITEMACTIONS.php';\r
 +\r
 +class Blog\r
 +{\r
 +      // blog id\r
 +      public $blogid;\r
 +      \r
 +      // After creating an object of the blog class, contains true if the BLOG object is\r
 +      // valid (the blog exists)\r
 +      public $isValid;\r
 +      \r
 +      // associative array, containing all blogsettings (use the get/set functions instead)\r
 +      private $settings;\r
 +      \r
 +      // ID of currently selected category\r
 +      private $selectedcatid;\r
 +      \r
 +      /**\r
 +       * Blog::_\construct()\r
 +       * Creates a new BLOG object for the given blog\r
 +       *\r
 +       * @param       integer $id     blogid\r
 +       * @return      void\r
 +       */\r
 +      public function __construct($id)\r
 +      {\r
 +              global $catid;\r
 +              \r
 +              $this->blogid = (integer) $id;\r
 +              $this->readSettings();\r
 +              $this->setSelectedCategory($catid);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::readLog()\r
 +       * Shows the given amount of items for this blog\r
 +       *\r
 +       * @param       string  $template       String representing the template _NAME_ (!)\r
 +       * @param       integer $amountEntries  amount of entries to show\r
 +       * @param       integer $startpos       offset from where items should be shown (e.g. 5 = start at fifth item)\r
 +       * @return      integer amount of items shown\r
 +       */\r
 +      public function readLog($template, $amountEntries, $offset = 0, $startpos = 0)\r
 +      {\r
 +              return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showArchive()\r
 +       * Shows an archive for a given month\r
 +       *\r
 +       * @param       integer $year           year\r
 +       * @param       integer $month          month\r
 +       * @param       string  $template       String representing the template name to be used\r
 +       * @return      void\r
 +       */\r
 +      public function showArchive($templatename, $year, $month=0, $day=0)\r
 +      {\r
 +              // create extra where clause for select query\r
 +              if ( $day == 0 && $month != 0 )\r
 +              {\r
 +                      $timestamp_start = mktime(0,0,0,$month,1,$year);\r
 +                      // also works when $month==12\r
 +                      $timestamp_end = mktime(0,0,0,$month+1,1,$year);\r
 +              }\r
 +              elseif ( $month == 0 )\r
 +              {\r
 +                      $timestamp_start = mktime(0,0,0,1,1,$year);\r
 +                      // also works when $month==12\r
 +                      $timestamp_end = mktime(0,0,0,12,31,$year);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $timestamp_start = mktime(0,0,0,$month,$day,$year);\r
 +                      $timestamp_end = mktime(0,0,0,$month,$day+1,$year);\r
 +              }\r
 +              $extra_query = " and i.itime>=%s and i.itime<%s";\r
 +              $extra_query = sprintf($extra_query, DB::formatDateTime($timestamp_start), DB::formatDateTime($timestamp_end));\r
 +              \r
 +              $this->readLogAmount($templatename,0,$extra_query,'',1,1);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setSelectedCategory()\r
 +       * Sets the selected category by id (only when category exists)\r
 +       * \r
 +       * @param       integer $catid  ID for category\r
 +       * @return      void\r
 +       */\r
 +      public function setSelectedCategory($catid)\r
 +      {\r
 +              if ( $this->isValidCategory($catid) || (intval($catid) == 0) )\r
 +              {\r
 +                      $this->selectedcatid = intval($catid);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setSelectedCategoryByName()\r
 +       * Sets the selected category by name\r
 +       * \r
 +       * @param       string  $catname        name of category\r
 +       * @return      void\r
 +       */\r
 +      public function setSelectedCategoryByName($catname)\r
 +      {\r
 +              $this->setSelectedCategory($this->getCategoryIdFromName($catname));\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSelectedCategory()\r
 +       * Returns the selected category\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer\r
 +       */\r
 +      public function getSelectedCategory()\r
 +      {\r
 +              return $this->selectedcatid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Shows the given amount of items for this blog\r
 +       *\r
 +       * @param       string  $template               string representing the template _NAME_ (!)\r
 +       * @param       integer $amountEntries  amount of entries to show (0 = no limit)\r
 +       * @param       string  $extraQuery             extra conditions to be added to the query\r
 +       * @param       string  $highlight              contains a query that should be highlighted\r
 +       * @param       integer $comments               1=show comments 0=don't show comments\r
 +       * @param       integer $dateheads              1=show dateheads 0=don't show dateheads\r
 +       * @param       integer $offset                 offset\r
 +       * @return      integer amount of items shown\r
 +       */\r
 +      private function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0)\r
 +      {\r
 +              $query = $this->getSqlBlog($extraQuery);\r
 +              \r
 +              if ( $amountEntries > 0 )\r
 +              {\r
 +                      // $offset zou moeten worden:\r
 +                      // (($startpos / $amountentries) + 1) * $offset ... later testen ...\r
 +                      $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);\r
 +              }\r
 +              return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showUsingQuery()\r
 +       * Do the job for readLogAmmount\r
 +       * \r
 +       * @param       string  $templateName   template name\r
 +       * @param       string  $query                  string for query\r
 +       * @param       string  $highlight              string to be highlighted\r
 +       * @param       integer $comments               the number of comments\r
 +       * @param       boolean $dateheads              date header is needed or not\r
 +       * @return      integer the number of rows as a result of mysql query\r
 +       */\r
 +      private function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1)\r
 +      {\r
 +              global $CONF, $manager, $currentTemplateName;\r
 +              \r
 +              $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');\r
 +              if ( $lastVisit != 0 )\r
 +              {\r
 +                      $lastVisit = $this->getCorrectTime($lastVisit);\r
 +              }\r
 +              \r
 +              // set templatename as global variable (so plugins can access it)\r
 +              $currentTemplateName = $templateName;\r
 +              $template =& $manager->getTemplate($templateName);\r
 +              \r
 +              // create parser object & action handler\r
 +              $handler = new ItemActions($this);\r
 +              $handler->setTemplate($template);\r
 +              $handler->setHighlight($highlight);\r
 +              $handler->setLastVisit($lastVisit);\r
 +              $handler->setShowComments($comments);\r
 +              \r
 +              $parser = new Parser($handler);\r
 +              \r
 +              // execute query\r
 +              $items = DB::getResult($query);\r
 +              \r
 +              // loop over all items\r
 +              $old_date = 0;\r
 +              foreach ( $items as $item )\r
 +              {\r
 +                      // string timestamp -> unix timestamp\r
 +                      $item['timestamp'] = strtotime($item['itime']);\r
 +                      \r
 +                      // action handler needs to know the item we're handling\r
 +                      $handler->setCurrentItem($item);\r
 +                      \r
 +                      // add date header if needed\r
 +                      if ( $dateheads )\r
 +                      {\r
 +                              $new_date = date('dFY', $item['timestamp']);\r
 +                              if ( $new_date != $old_date )\r
 +                              {\r
 +                                      // unless this is the first time, write date footer\r
 +                                      $timestamp = $item['timestamp'];\r
 +                                      if ( $old_date != 0 )\r
 +                                      {\r
 +                                              $oldTS = strtotime($old_date);\r
 +                                              $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
 +                                              \r
 +                                              if ( !in_array('DATE_FOOTER', $template) || empty($template['DATE_FOOTER']) )\r
 +                                              {\r
 +                                                      $tmp_footer = '';\r
 +                                              }\r
 +                                              else\r
 +                                              {\r
 +                                                      $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS);\r
 +                                              }\r
 +                                              $parser->parse($tmp_footer);\r
 +                                              $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => $oldTS));\r
 +                                      }\r
 +                                      \r
 +                                      $manager->notify('PreDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
 +                                      \r
 +                                      // note, to use templatvars in the dateheader, the %-characters need to be doubled in\r
 +                                      // order to be preserved by strftime\r
 +                                      if ( !in_array('DATE_HEADER', $template) || empty($template['DATE_HEADER']) )\r
 +                                      {\r
 +                                              $tmp_header = '';\r
 +                                      }\r
 +                                      else\r
 +                                      {\r
 +                                              $tmp_header = i18n::formatted_datetime($template['DATE_HEADER'], $timestamp);\r
 +                                      }\r
 +                                      $parser->parse($tmp_header);\r
 +                                      $manager->notify('PostDateHead',array('blog' => &$this, 'timestamp' => $timestamp));\r
 +                              }\r
 +                              $old_date = $new_date;\r
 +                      }\r
 +                      \r
 +                      // parse item\r
 +                      $parser->parse($template['ITEM_HEADER']);\r
 +                      $manager->notify('PreItem', array('blog' => &$this, 'item' => &$item));\r
 +                      $parser->parse($template['ITEM']);\r
 +                      $manager->notify('PostItem', array('blog' => &$this, 'item' => &$item));\r
 +                      $parser->parse($template['ITEM_FOOTER']);\r
 +              }\r
 +              \r
 +              $numrows = $items->rowCount();\r
 +              \r
 +              // add another date footer if there was at least one item\r
 +              if ( ($numrows > 0) && $dateheads )\r
 +              {\r
 +                      $manager->notify('PreDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));\r
 +                      $parser->parse($template['DATE_FOOTER']);\r
 +                      $manager->notify('PostDateFoot',array('blog' => &$this, 'timestamp' => strtotime($old_date)));\r
 +              }\r
 +              \r
 +              $items->closeCursor();\r
 +              return $numrows;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showOneitem()\r
 +       * Simplified function for showing only one item\r
 +       * \r
 +       * @param       integer $itemid         ID for item\r
 +       * @param       array   $template       template for item\r
 +       * @param       string  $highlight      string for highlight\r
 +       * @return      integer 1\r
 +       */\r
 +      public function showOneitem($itemid, $template, $highlight)\r
 +      {\r
 +              $extraQuery = ' and inumber=' . intval($itemid);\r
 +              \r
 +              return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::addItem()\r
 +       * Adds an item to this blog\r
 +       * \r
 +       * @param       integer         $catid  ID for category\r
 +       * @param       string          $title  ID for \r
 +       * @param       string          $body   text for body\r
 +       * @param       string          $more   text for more\r
 +       * @param       integer         $blogid ID for blog\r
 +       * @param       integer         $authorid       ID for author\r
 +       * @param       timestamp       $timestamp      UNIX timestamp for post\r
 +       * @param       boolean         $closed opened or closed\r
 +       * @param       boolean         $draft  draft or not\r
 +       * @param       boolean         $posted posted or not\r
 +       * @return      integer ID for added item\r
 +       */\r
 +      function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1')\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $blogid         = (integer) $blogid;\r
 +              $authorid       = (integer) $authorid;\r
 +              $title          = $title;\r
 +              $body           = $body;\r
 +              $more           = $more;\r
 +              $catid          = intval($catid);\r
 +              \r
 +              // convert newlines to <br />\r
 +              if ( $this->convertBreaks() )\r
 +              {\r
 +                      $body = addBreaks($body);\r
 +                      $more = addBreaks($more);\r
 +              }\r
 +\r
 +              if ( $closed != '1' )\r
 +              {\r
 +                      $closed = '0';\r
 +              }\r
 +              if ( $draft != '0' )\r
 +              {\r
 +                      $draft = '1';\r
 +              }\r
 +              \r
 +              if ( !$this->isValidCategory($catid) )\r
 +              {\r
 +                      $catid = $this->getDefaultCategory();\r
 +              }\r
 +              \r
 +              $isFuture = 0;\r
 +              if ( $timestamp > $this->getCorrectTime() )\r
 +              {\r
 +                      $isFuture = 1;\r
 +              }\r
 +              \r
 +              $timestamp = date('Y-m-d H:i:s',$timestamp);\r
 +              \r
 +              $manager->notify('PreAddItem',array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid));\r
 +              \r
 +              $ititle = DB::quoteValue($title);\r
 +              $ibody = DB::quoteValue($body);\r
 +              $imore = DB::quoteValue($more);\r
 +              $timestamp = DB::formatDateTime(strtotime($timestamp));\r
 +              \r
 +              $query = "INSERT INTO %s (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) VALUES (%s, %s, %s, %d, %d, %s, %s, %s, %s, %s)";\r
 +              $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted);\r
 +              DB::execute($query);\r
 +              $itemid = DB::getInsertId();\r
 +              \r
 +              $manager->notify('PostAddItem',array('itemid' => $itemid));\r
 +              \r
 +              if ( !$draft )\r
 +              {\r
 +                      $this->updateUpdateFile();\r
 +              }\r
 +              // send notification mail\r
 +              if ( !$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem() )\r
 +              {\r
 +                      $this->sendNewItemNotification($itemid, $title, $body);\r
 +              }\r
 +              return $itemid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::sendNewItemNotification()\r
 +       * Send a new item notification to the notification list\r
 +       * \r
 +       * @param       string  $itemid ID of the item\r
 +       * @param       string  $title  title of the item\r
 +       * @param       string  $body   body of the item\r
 +       * @return      void\r
 +       */\r
 +      public function sendNewItemNotification($itemid, $title, $body)\r
 +      {\r
 +              global $CONF, $member;\r
 +              \r
 +              $ascii = Entity::anchor_footnoting($body);\r
 +              \r
 +              $message = _NOTIFY_NI_MSG . " \n";\r
 +              $temp = parse_url($CONF['Self']);\r
 +              if ( $temp['scheme'] )\r
 +              {\r
 +                      $message .= Link::create_item_link($itemid) . "\n\n";\r
 +              }\r
 +              else\r
 +              {\r
 +                      $tempurl = $this->getURL();\r
 +                      if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )\r
 +                      {\r
 +                              $message .= $tempurl . '?itemid=' . $itemid . "\n\n";\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $message .= $tempurl . '/?itemid=' . $itemid . "\n\n";\r
 +                      }\r
 +              }\r
 +              $message .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";\r
 +              $message .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";\r
 +              $message .= NOTIFICATION::get_mail_footer();\r
 +              \r
 +              $subject = $this->getName() . ': ' . _NOTIFY_NI_TITLE;\r
 +              \r
 +              $from = $member->getNotifyFromMailAddress();\r
 +              \r
 +              NOTIFICATION::mail($this->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::createNewCategory()\r
 +       * Creates a new category for this blog\r
 +       *\r
 +       * @param       string  $catName                name of the new category. When empty, a name is generated automatically (starting with newcat)\r
 +       * @param       string  $catDescription description of the new category. Defaults to 'New Category'\r
 +       * @return      integer ID for new category on success. 0 on failure\r
 +       */\r
 +      public function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC)\r
 +      {\r
 +              global $member, $manager;\r
 +              \r
 +              if ( !$member->blogAdminRights($this->blogid) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // generate\r
 +              if ( $catName == '' )\r
 +              {\r
 +                      $catName = _CREATED_NEW_CATEGORY_NAME;\r
 +                      $i = 1;\r
 +                      \r
 +                      $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);\r
 +                      while ( $res->rowCount() > 0 )\r
 +                      {\r
 +                              $i++;\r
 +                              $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);\r
 +                      }\r
 +                      \r
 +                      $catName = $catName . $i;\r
 +              }\r
 +              \r
 +              $data = array(\r
 +                      'blog'                  => &$this,\r
 +                      'name'                  => &$catName,\r
 +                      'description'   => $catDescription\r
 +              );\r
 +              $manager->notify('PreAddCategory', $data);\r
 +              \r
 +              $query = "INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)";\r
 +              $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($catName), DB::quoteValue($catDescription));\r
 +              DB::execute($query);\r
 +              $catid = DB::getInsertId();\r
 +              \r
 +              $data = array(\r
 +                      'blog'                  => &$this,\r
 +                      'name'                  => $catName,\r
 +                      'description'   => $catDescription,\r
 +                      'catid'                 => $catid\r
 +              );\r
 +              $manager->notify('PostAddCategory', $data);\r
 +              \r
 +              return $catid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::search()\r
 +       * Searches all months of this blog for the given query\r
 +       *\r
 +       * @param       string  $query                  search query\r
 +       * @param       array   $template               template to be used (__NAME__ of the template)\r
 +       * @param       integer $amountMonths   max amount of months to be search (0 = all)\r
 +       * @param       integer $maxresults             max number of results to show\r
 +       * @param       integer $startpos               offset\r
 +       * @return      amount of hits found\r
 +       */\r
 +      public function search($query, $template, $amountMonths, $maxresults, $startpos) {\r
 +              global $CONF, $manager;\r
 +              \r
 +              $highlight      = '';\r
 +              $sqlquery       = $this->getSqlSearch($query, $amountMonths, $highlight);\r
 +              \r
 +              if ( $sqlquery == '' )\r
 +              {\r
 +                      // no query -> show everything\r
 +                      $extraquery = '';\r
 +                      $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);\r
 +              }\r
 +              else\r
 +              {\r
 +                      // add LIMIT to query (to split search results into pages)\r
 +                      if ( intval($maxresults > 0) )\r
 +                      {\r
 +                              $sqlquery .= ' LIMIT ' . intval($startpos) . ',' . intval($maxresults);\r
 +                      }\r
 +                      \r
 +                      // show results\r
 +                      $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);\r
 +                      \r
 +                      // when no results were found, show a message\r
 +                      if ( $amountfound == 0 )\r
 +                      {\r
 +                              $template =& $manager->getTemplate($template);\r
 +                              $vars = array(\r
 +                                      'query'         => Entity::hsc($query),\r
 +                                      'blogid'        => $this->blogid\r
 +                              );\r
 +                              echo Template::fill($template['SEARCH_NOTHINGFOUND'], $vars);\r
 +                      }\r
 +              }\r
 +              return $amountfound;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSqlSearch()\r
 +       * Returns an SQL query to use for a search query\r
 +       * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
 +       *\r
 +       * @param       string  $query                  search query\r
 +       * @param       integer $amountMonths   amount of months to search back. Default = 0 = unlimited\r
 +       * @param       string  $mode                   either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
 +       * @return      string  $highlight              words to highlight (out parameter)\r
 +       * @return      string  either a full SQL query, or an empty string (if querystring empty)\r
 +       */\r
 +      public function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')\r
 +      {\r
 +              $searchclass = new Search($query);\r
 +              \r
 +              $highlight       = $searchclass->inclusive;\r
 +              \r
 +              // if querystring is empty, return empty string\r
 +              if ( $searchclass->inclusive == '' )\r
 +              {\r
 +                      return '';\r
 +              }\r
 +              \r
 +              $where  = $searchclass->boolean_sql_where('ititle,ibody,imore');\r
 +              $select = $searchclass->boolean_sql_select('ititle,ibody,imore');\r
 +              \r
 +              // get list of blogs to search\r
 +              $blogs          = $searchclass->blogs;  // array containing blogs that always need to be included\r
 +              $blogs[]        = $this->blogid;                // also search current blog (duh)\r
 +              $blogs          = array_unique($blogs); // remove duplicates\r
 +              $selectblogs = '';\r
 +              if ( count($blogs) > 0 )\r
 +              {\r
 +                      $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';\r
 +              }\r
 +              \r
 +              if ( $mode == '' )\r
 +              {\r
 +                      $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, i.itime, i.imore as more, i.icat as catid, i.iclosed as closed,\r
 +                              m.mname as author, m.mrealname as authorname, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl,\r
 +                              c.cname as category';\r
 +                      \r
 +                      if ( $select )\r
 +                      {\r
 +                              $query .= ', '.$select. ' as score ';\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = 'SELECT COUNT(*) as result ';\r
 +              }\r
 +              \r
 +              $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
 +                              . ' WHERE i.iauthor=m.mnumber'\r
 +                              . ' and i.icat=c.catid'\r
 +                              // exclude drafts\r
 +                              . ' and i.idraft=0'\r
 +                              . $selectblogs\r
 +                                      // don't show future items\r
 +                              . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime())\r
 +                              . ' and '.$where;\r
 +              \r
 +              // take into account amount of months to search\r
 +              if ( $amountMonths > 0 )\r
 +              {\r
 +                      $localtime = getdate($this->getCorrectTime());\r
 +                      $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);\r
 +                      $query .= ' and i.itime>' . DB::formatDateTime($timestamp_start);\r
 +              }\r
 +              \r
 +              if ( $mode == '' )\r
 +              {\r
 +                      if ( $select )\r
 +                      {\r
 +                              $query .= ' ORDER BY score DESC';\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $query .= ' ORDER BY i.itime DESC ';\r
 +                      }\r
 +              }\r
 +              \r
 +              return $query;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSqlBlog()\r
 +       * Returns the SQL query that's normally used to display the blog items on the index type skins\r
 +       * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
 +       *\r
 +       * @param       string  $extraQuery     extra query string\r
 +       * @param       string  $mode           either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query\r
 +       * @return      string  either a full SQL query, or an empty string\r
 +       */\r
 +      public function getSqlBlog($extraQuery, $mode = '')\r
 +      {\r
 +              if ( $mode == '' )\r
 +              {\r
 +                      $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,\r
 +                              m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail,\r
 +                              m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = 'SELECT COUNT(*) as result ';\r
 +              }\r
 +              \r
 +              $query  .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'\r
 +                              . ' WHERE i.iblog='.$this->blogid\r
 +                              . ' and i.iauthor=m.mnumber'\r
 +                              . ' and i.icat=c.catid'\r
 +                              . ' and i.idraft=0' // exclude drafts\r
 +                              . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime()); // don't show future items\r
 +              \r
 +              if ( $this->selectedcatid )\r
 +              {\r
 +                      $query .= ' and i.icat=' . $this->selectedcatid . ' ';\r
 +              }\r
 +              \r
 +              $query .= $extraQuery;\r
 +              \r
 +              if ( $mode == '' )\r
 +              {\r
 +                      $query .= ' ORDER BY i.itime DESC';\r
 +              }\r
 +              return $query;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showArchiveList()\r
 +       * Shows the archivelist using the given template\r
 +       * \r
 +       * @param       string  $template       template name\r
 +       * @param       string  $mode   year/month/day\r
 +       * @param       integer $limit  limit of record count\r
 +       * @return      void\r
 +       */\r
 +      public function showArchiveList($template, $mode = 'month', $limit = 0)\r
 +      {\r
 +              global $CONF, $catid, $manager;\r
 +              \r
 +              if ( !isset ($linkparams) )\r
 +              {\r
 +                      $linkparams = array();\r
 +              }\r
 +              \r
 +              if ( $catid )\r
 +              {\r
 +                      $linkparams = array('catid' => $catid);\r
 +              }\r
 +              \r
 +              $template =& $manager->getTemplate($template);\r
 +              $data['blogid'] = $this->blogid;\r
 +              \r
 +              if ( !array_key_exists('ARCHIVELIST_HEADER', $template) || !$template['ARCHIVELIST_HEADER'] )\r
 +              {\r
 +                      $tplt = '';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $tplt = $template['ARCHIVELIST_HEADER'];\r
 +              }\r
 +              \r
 +              echo Template::fill($tplt, $data);\r
 +              \r
 +              $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) AS Day'\r
 +                              . ' FROM '.sql_table('item')\r
 +                              . ' WHERE iblog=' . $this->blogid\r
 +                              . ' AND itime <=' . DB::formatDateTime($this->getCorrectTime()) // don't show future items!\r
 +                              . ' AND idraft=0'; // don't show draft items\r
 +              \r
 +              if ( $catid )\r
 +              {\r
 +                      $query .= ' and icat=' . intval($catid);\r
 +              }\r
 +              \r
 +              $query .= ' GROUP BY Year';\r
 +              if ( $mode == 'month' || $mode == 'day' )\r
 +              {\r
 +                      $query .= ', Month';\r
 +              }\r
 +              if ( $mode == 'day' )\r
 +              {\r
 +                      $query .= ', Day';\r
 +              }\r
 +              \r
 +              $query .= ' ORDER BY itime DESC';\r
 +              \r
 +              if ( $limit > 0 )\r
 +              {\r
 +                      $query .= ' LIMIT ' . intval($limit);\r
 +              }\r
 +              \r
 +              $res = DB::getResult($query);\r
 +              foreach ( $res as $current )\r
 +              {\r
 +                      /* string time -> unix timestamp */\r
 +                      $current['itime'] = strtotime($current['itime']);\r
 +                      \r
 +                      if ( $mode == 'day' )\r
 +                      {\r
 +                              $archivedate = date('Y-m-d',$current['itime']);\r
 +                              $archive['day'] = date('d',$current['itime']);\r
 +                              $data['day'] = date('d',$current['itime']);\r
 +                              $data['month'] = date('m',$current['itime']);\r
 +                              $archive['month'] = $data['month'];\r
 +                      }\r
 +                      elseif ( $mode == 'year' )\r
 +                      {\r
 +                              $archivedate = date('Y',$current['itime']);\r
 +                              $data['day'] = '';\r
 +                              $data['month'] = '';\r
 +                              $archive['day'] = '';\r
 +                              $archive['month'] = '';\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archivedate = date('Y-m',$current['itime']);\r
 +                              $data['month'] = date('m',$current['itime']);\r
 +                              $archive['month'] = $data['month'];\r
 +                              $data['day'] = '';\r
 +                              $archive['day'] = '';\r
 +                      }\r
 +                      \r
 +                      $data['year'] = date('Y',$current['itime']);\r
 +                      $archive['year'] = $data['year'];\r
 +                      $data['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams);\r
 +                      \r
 +                      $manager->notify('PreArchiveListItem', array('listitem' => &$data));\r
 +                      \r
 +                      $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$data);\r
 +                      echo i18n::formatted_datetime($temp, $current['itime']);\r
 +                      return;\r
 +              }\r
 +              \r
 +              $res->closeCursor();\r
 +              \r
 +              if ( !array_key_exists('ARCHIVELIST_FOOTER', $template) || !$template['ARCHIVELIST_FOOTER'] )\r
 +              {\r
 +                      $tplt = '';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $tplt = $template['ARCHIVELIST_FOOTER'];\r
 +              }\r
 +              \r
 +              echo Template::fill($tplt, $data);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showCategoryList()\r
 +       * Shows the list of categories using a given template\r
 +       * \r
 +       * @param       string  $template       Template Name\r
 +       * @return      void\r
 +       */\r
 +      public function showCategoryList($template)\r
 +      {\r
 +              global $CONF, $archive, $archivelist, $manager;\r
 +              \r
 +              /*\r
 +               * determine arguments next to catids\r
 +               * I guess this can be done in a better way, but it works\r
 +               */\r
 +              $linkparams = array();\r
 +              if ( $archive )\r
 +              {\r
 +                      $blogurl = Link::create_archive_link($this->blogid, $archive, '');\r
 +                      $linkparams['blogid'] = $this->blogid;\r
 +                      $linkparams['archive'] = $archive;\r
 +              }\r
 +              else if ( $archivelist )\r
 +              {\r
 +                      $blogurl = Link::create_archivelist_link($this->blogid, '');\r
 +                      $linkparams['archivelist'] = $archivelist;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $blogurl = Link::create_blogid_link($this->blogid, '');\r
 +                      $linkparams['blogid'] = $this->blogid;\r
 +              }\r
 +              \r
 +              $template =& $manager->getTemplate($template);\r
 +              \r
 +              //: Change: Set nocatselected variable\r
 +              if ( $this->selectedcatid )\r
 +              {\r
 +                      $nocatselected = 'no';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $nocatselected = 'yes';\r
 +              } \r
 +              \r
 +              $args = array(\r
 +                      'blogid'        => $this->blogid,\r
 +                      'blogurl'       => $blogurl,\r
 +                      'self'          => $CONF['Self'],\r
 +                      'catiscurrent'  => $nocatselected, // Change: Set catiscurrent template variable for header\r
 +                      'currentcat'    => $nocatselected \r
 +              );\r
 +              \r
 +              /* output header of category list item */\r
 +              if ( !array_key_exists('CATLIST_HEADER', $template) || empty($template['CATLIST_HEADER']) )\r
 +              {\r
 +                      echo Template::fill(NULL, $args);\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo Template::fill($template['CATLIST_HEADER'], $args);\r
 +              }\r
 +              \r
 +              $query = "SELECT catid, cdesc as catdesc, cname as catname FROM %s WHERE cblog=%d ORDER BY cname ASC;";\r
 +              $query = sprintf($query, sql_table('category'), (integer) $this->blogid);\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              foreach ( $res as $data )\r
 +              {\r
 +                      $args = array(\r
 +                              'catid' => $data['catid'],\r
 +                              'name'  => $data['catname'],\r
 +                              'extra' => $linkparams\r
 +                      );\r
 +                      \r
 +                      $data['blogid']         = $this->blogid;\r
 +                      $data['blogurl']        = $blogurl;\r
 +                      $data['catlink']        = Link::create_link('category', $args);\r
 +                      $data['self']           = $CONF['Self'];\r
 +                      \r
 +                      // this gives catiscurrent = no when no category is selected.\r
 +                      $data['catiscurrent'] = 'no';\r
 +                      $data['currentcat'] = 'no';\r
 +                      \r
 +                      if ( $this->selectedcatid )\r
 +                      {\r
 +                              if ( $this->selectedcatid == $data['catid'] )\r
 +                              {\r
 +                                      $data['catiscurrent']   = 'yes';\r
 +                                      $data['currentcat']             = 'yes';\r
 +                              }\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              global $itemid;\r
 +                              if ( intval($itemid) && $manager->existsItem(intval($itemid), 0, 0) )\r
 +                              {\r
 +                                      $iobj   =& $manager->getItem(intval($itemid), 0, 0);\r
 +                                      $cid    = $iobj['catid'];\r
 +                                      \r
 +                                      if ( $cid == $data['catid'] )\r
 +                                      {\r
 +                                              $data['catiscurrent']   = 'yes';\r
 +                                              $data['currentcat']             = 'yes';\r
 +                                      }\r
 +                              }\r
 +                      }\r
 +                      \r
 +                      $manager->notify('PreCategoryListItem', array('listitem' => &$data));\r
 +                      \r
 +                      if ( !array_key_exists('CATLIST_LISTITEM', $template) || empty($template['CATLIST_LISTITEM']))\r
 +                      {\r
 +                              echo Template::fill(NULL, $data);\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              echo Template::fill($template['CATLIST_LISTITEM'], $data);\r
 +                      }\r
 +              }\r
 +              \r
 +              $res->closeCursor();\r
 +              \r
 +              $args = array(\r
 +                      'blogid'                => $this->blogid,\r
 +                      'blogurl'               => $blogurl,\r
 +                      'self'                  => $CONF['Self'],\r
 +                      'catiscurrent'  => $nocatselected, //: Change: Set catiscurrent template variable for footer\r
 +                      'currentcat'    => $nocatselected\r
 +              );\r
 +              \r
 +              if ( !array_key_exists('CATLIST_FOOTER', $template) || empty($template['CATLIST_FOOTER']))\r
 +              {\r
 +                      echo Template::fill(NULL, $args);\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo Template::fill($template['CATLIST_FOOTER'], $args);\r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::showBlogList()\r
 +       * Shows a list of all blogs in the system using a given template\r
 +       * ordered by number, name, shortname or description\r
 +       * in ascending or descending order\r
 +       * \r
 +       * @param       string  $template       tempalte name\r
 +       * @param       string  $bnametype      bname/bshortname\r
 +       * @param       string  $orderby        string for 'ORDER BY' SQL\r
 +       * @param       string  $direction      ASC/DESC\r
 +       * @return      void\r
 +       */\r
 +      public function showBlogList($template, $bnametype, $orderby, $direction)\r
 +      {\r
 +              global $CONF, $manager;\r
 +              \r
 +              switch ( $orderby )\r
 +              {\r
 +                      case 'number':\r
 +                              $orderby='bnumber';\r
 +                              break;\r
 +                      case 'name':\r
 +                              $orderby='bname';\r
 +                              break;\r
 +                      case 'shortname':\r
 +                              $orderby='bshortname';\r
 +                              break;\r
 +                      case 'description':\r
 +                              $orderby='bdesc';\r
 +                              break;\r
 +                      default:\r
 +                              $orderby='bnumber';\r
 +                              break;\r
 +              }\r
 +              \r
 +              $direction=strtolower($direction);\r
 +              switch ( $direction )\r
 +              {\r
 +                      case 'asc':\r
 +                              $direction='ASC';\r
 +                              break;\r
 +                      case 'desc':\r
 +                              $direction='DESC';\r
 +                              break;\r
 +                      default:\r
 +                              $direction='ASC';\r
 +                              break;\r
 +              }\r
 +              \r
 +              $template =& $manager->getTemplate($template);\r
 +              \r
 +              if ( array_key_exists('BLOGLIST_HEADER', $template) && !empty($template['BLOGLIST_HEADER']) )\r
 +              {\r
 +                      $vars = array(\r
 +                              'sitename'      => $CONF['SiteName'],\r
 +                              'siteurl'       => $CONF['IndexURL']\r
 +                      );\r
 +                      \r
 +                      echo Template::fill($template['BLOGLIST_HEADER'], $vars);\r
 +              }\r
 +              \r
 +              if ( array_key_exists('BLOGLIST_LISTITEM', $template) && !empty($template['BLOGLIST_LISTITEM']) )\r
 +              {\r
 +                      $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction;\r
 +                      $res = DB::getResult($query);\r
 +                      \r
 +                      foreach ( $res as $data )\r
 +                      {\r
 +                              $list = array();\r
 +                              $list['bloglink'] = Link::create_blogid_link($data['bnumber']);\r
 +                              $list['blogdesc'] = $data['bdesc'];\r
 +                              $list['blogurl'] = $data['burl'];\r
 +                              \r
 +                              if ( $bnametype == 'shortname' )\r
 +                              {\r
 +                                      $list['blogname'] = $data['bshortname'];\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      /* all other cases */\r
 +                                      $list['blogname'] = $data['bname'];\r
 +                              }\r
 +                              \r
 +                              $manager->notify('PreBlogListItem',array('listitem' => &$list));\r
 +                              \r
 +                              echo Template::fill($template['BLOGLIST_LISTITEM'], $list);\r
 +                      }\r
 +                      \r
 +                      $res->closeCursor();\r
 +              }\r
 +              \r
 +              \r
 +              if ( array_key_exists('BLOGLIST_FOOTER', $template) && !empty($template['BLOGLIST_FOOTER']) )\r
 +              {\r
 +                      $vars = array(\r
 +                              'sitename' => $CONF['SiteName'],\r
 +                              'siteurl' => $CONF['IndexURL']\r
 +                      );\r
 +                      echo Template::fill($template['BLOGLIST_FOOTER']);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::readSettings()\r
 +       * Read the blog settings\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function readSettings()\r
 +      {\r
 +              $query =  'SELECT * FROM %s WHERE bnumber=%d;';\r
 +              $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              $this->isValid = ($res->rowCount() > 0);\r
 +              if ( $this->isValid )\r
 +              {\r
 +                      $this->settings = $res->fetch(PDO::FETCH_ASSOC);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::writeSettings()\r
 +       * Write the blog settings\r
 +       */\r
 +      public function writeSettings()\r
 +      {\r
 +              // (can't use floatval since not available prior to PHP 4.2)\r
 +              $offset = $this->getTimeOffset();\r
 +              if ( !is_float($offset) )\r
 +              {\r
 +                      $offset = (integer) $offset;\r
 +              }\r
 +              \r
 +              $query =  'UPDATE '.sql_table('blog')\r
 +                         . ' SET bname=' . DB::quoteValue($this->getName()) . ','\r
 +                         . '     bshortname='. DB::quoteValue($this->getShortName()) . ','\r
 +                         . '     bcomments='. intval($this->commentsEnabled()) . ','\r
 +                         . '     bmaxcomments=' . intval($this->getMaxComments()) . ','\r
 +                         . '     btimeoffset=' . $offset . ','\r
 +                         . '     bpublic=' . intval($this->isPublic()) . ','\r
 +                         . '     breqemail=' . intval($this->emailRequired()) . ','\r
 +                         . '     bconvertbreaks=' . intval($this->convertBreaks()) . ','\r
 +                         . '     ballowpast=' . intval($this->allowPastPosting()) . ','\r
 +                         . '     bnotify=' . DB::quoteValue($this->getNotifyAddress()) . ','\r
 +                         . '     bnotifytype=' . intval($this->getNotifyType()) . ','\r
 +                         . '     burl=' . DB::quoteValue($this->getURL()) . ','\r
 +                         . '     bupdate=' . DB::quoteValue($this->getUpdateFile()) . ','\r
 +                         . '     bdesc=' . DB::quoteValue($this->getDescription()) . ','\r
 +                         . '     bdefcat=' . intval($this->getDefaultCategory()) . ','\r
 +                         . '     bdefskin=' . intval($this->getDefaultSkin()) . ','\r
 +                         . '     bincludesearch=' . intval($this->getSearchable())\r
 +                         . ' WHERE bnumber=' . intval($this->blogid);\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::updateUpdatefile()\r
 +       * Update the update file if requested\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function updateUpdatefile()\r
 +      {\r
 +              if ( $this->getUpdateFile() )\r
 +              {\r
 +                      $f_update = fopen($this->getUpdateFile(), 'w');\r
 +                      fputs($f_update,$this->getCorrectTime());\r
 +                      fclose($f_update);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::isValidCategory()\r
 +       * Check if a category with a given catid is valid\r
 +       * \r
 +       * @param       integer $catid  ID for category\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      public function isValidCategory($catid)\r
 +      {\r
 +              $query = 'SELECT * FROM %s WHERE cblog=%d and catid=%d;';\r
 +              $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
 +              $res = DB::getResult($query);\r
 +              return ($res->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getCategoryName()\r
 +       * Get the category name for a given catid\r
 +       * \r
 +       * @param       integer $catid  ID for category\r
 +       * @return      string  name of category\r
 +       */\r
 +      public function getCategoryName($catid)\r
 +      {\r
 +              $query = 'SELECT cname FROM %s WHERE cblog=%d and catid=%d;';\r
 +              $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
 +              $res = DB::getValue($query);\r
 +              return $res;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getCategoryDesc()\r
 +       * Get the category description for a given catid\r
 +       * \r
 +       * @param $catid\r
 +       *      category id\r
 +       */\r
 +      public function getCategoryDesc($catid)\r
 +      {\r
 +              $query = 'SELECT cdesc FROM %s WHERE cblog=%d and catid=%d;';\r
 +              $query = sprintf($querym, sql_table('category'), (integer) $this->blogid, (integer) $catid);\r
 +              $res = DB::getValue();\r
 +              return $res;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getCategoryIdFromName\r
 +       * Get the category id for a given category name\r
 +       * \r
 +       * @param       string  $name   category name\r
 +       * @return      ID for category\r
 +       */\r
 +      public function getCategoryIdFromName($name)\r
 +      {\r
 +              $query = 'SELECT catid FROM %s WHERE cblog=%d and cname=%s;';\r
 +              $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($name));\r
 +              \r
 +              $res = DB::getValue();\r
 +              if ( !$res )\r
 +              {\r
 +                      return $this->getDefaultCategory();\r
 +              }\r
 +              return $res;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::insertJavaScriptInfo()\r
 +       * Insert a javascript that includes information about the settings\r
 +       * of an author:  ConvertBreaks, MediaUrl and AuthorId\r
 +       * \r
 +       * @param       $authorid       id of the author\r
 +       */\r
 +      public function insertJavaScriptInfo($authorid = '')\r
 +      {\r
 +              global $member, $CONF;\r
 +              \r
 +              if ( $authorid == '' )\r
 +              {\r
 +                      $authorid = $member->getID();\r
 +              }\r
 +              \r
 +              echo "<script type=\"text/javascript\">\n";\r
 +              \r
 +              if ( !$this->convertBreaks() )\r
 +              {\r
 +                      echo "setConvertBreaks(false);\n";\r
 +              }\r
 +              else\r
 +              {\r
 +                      echo "setConvertBreaks(true);\n";\r
 +              }\r
 +              echo "setMediaUrl('{$CONF['MediaURL']}');\n";\r
 +              echo "setAuthorId('{$authorid}');\n";\r
 +              echo "</script>\n";\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setAllowPastPosting()\r
 +       * Set the the setting for allowing to publish postings in the past\r
 +       * \r
 +       * @param       boolean $val    new value for ballowpast\r
 +       * @return      void\r
 +       */\r
 +      public function setAllowPastPosting($val)\r
 +      {\r
 +              $this->setSetting('ballowpast', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::allowPastPosting()\r
 +       * Get the the setting if it is allowed to publish postings in the past\r
 +       * [should be named as getAllowPastPosting()]\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean\r
 +       */\r
 +      public function allowPastPosting()\r
 +      {\r
 +              return $this->getSetting('ballowpast');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getCorrectTime()\r
 +       * \r
 +       * @param       integer $t\r
 +       * @return      integer\r
 +       */\r
 +      public function getCorrectTime($t=0)\r
 +      {\r
 +              if ( $t == 0 )\r
 +              {\r
 +                      $t = time();\r
 +              }\r
 +              return ($t + 3600 * $this->getTimeOffset());\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getName()\r
 +       * \r
 +       * @param       void\r
 +       * @return      string name of this weblog\r
 +       */\r
 +      public function getName()\r
 +      {\r
 +              return $this->getSetting('bname');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getShortName()\r
 +       * \r
 +       * @param       void\r
 +       * @return      string  short name of this weblog\r
 +       */\r
 +      public function getShortName()\r
 +      {\r
 +              return $this->getSetting('bshortname');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getMaxComments()\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer maximum number of comments\r
 +       */\r
 +      public function getMaxComments()\r
 +      {\r
 +              return $this->getSetting('bmaxcomments');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getNotifyAddress()\r
 +       * \r
 +       * @param       void\r
 +       * @return      string  mail address for notifying\r
 +       */\r
 +      public function getNotifyAddress()\r
 +      {\r
 +              return $this->getSetting('bnotify');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getNotifyType()\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer notifycation type\r
 +       */\r
 +      public function getNotifyType()\r
 +      {\r
 +              return $this->getSetting('bnotifytype');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::notifyOnComment()\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean\r
 +       */\r
 +      public function notifyOnComment()\r
 +      {\r
 +              $n = $this->getNotifyType();\r
 +              return (($n != 0) && (($n % 3) == 0));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::notifyOnVote()\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean\r
 +       */\r
 +      public function notifyOnVote()\r
 +      {\r
 +              $n = $this->getNotifyType();\r
 +              return (($n != 0) && (($n % 5) == 0));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::notifyOnNewItem()\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean\r
 +       */\r
 +      public function notifyOnNewItem()\r
 +      {\r
 +              $n = $this->getNotifyType();\r
 +              return (($n != 0) && (($n % 7) == 0));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setNotifyType()\r
 +       * \r
 +       * @param       integer $val\r
 +       * @return      void\r
 +       */\r
 +      public function setNotifyType($val)\r
 +      {\r
 +              $this->setSetting('bnotifytype',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getTimeOffset()\r
 +       * @param       void\r
 +       * @return      \r
 +       */\r
 +      public function getTimeOffset()\r
 +      {\r
 +              return $this->getSetting('btimeoffset');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::commentsEnabled()\r
 +       * @param       void\r
 +       * @return      integer enabled or not\r
 +       */\r
 +      public function commentsEnabled()\r
 +      {\r
 +              return $this->getSetting('bcomments');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getURL()\r
 +       * @param       void\r
 +       * @return      string  URI for this weblog\r
 +       */\r
 +      public function getURL()\r
 +      {\r
 +              return $this->getSetting('burl');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getDefaultSkin()\r
 +       * @param       void\r
 +       * @return      name of skin as default for this weblog\r
 +       */\r
 +      public function getDefaultSkin()\r
 +      {\r
 +              return $this->getSetting('bdefskin');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getUpdateFile()\r
 +       * @param       void\r
 +       * @return      string  name of file to be updated when weblog is updated\r
 +       */\r
 +      public function getUpdateFile()\r
 +      {\r
 +              return $this->getSetting('bupdate');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getDescription()\r
 +       * @param       void\r
 +       * @return      string  description for this weblog\r
 +       */\r
 +      public function getDescription()\r
 +      {\r
 +              return $this->getSetting('bdesc');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::isPublic()\r
 +       * @param       void\r
 +       * @return      integer publlic or not\r
 +       */\r
 +      public function isPublic()\r
 +      {\r
 +              return $this->getSetting('bpublic');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::emailRequired()\r
 +       * @param       void\r
 +       * @return      integer email is required when posting comment or not\r
 +       */\r
 +      public function emailRequired()\r
 +      {\r
 +              return $this->getSetting('breqemail');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSearchable()\r
 +       * @param       void\r
 +       * @return      integer searchable or not\r
 +       */\r
 +      public function getSearchable()\r
 +      {\r
 +              return $this->getSetting('bincludesearch');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getDefaultCategory()\r
 +       * @param       void\r
 +       * @return      ID for category as a default\r
 +       */\r
 +      public function getDefaultCategory()\r
 +      {\r
 +              return $this->getSetting('bdefcat');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setPublic()\r
 +       * @param       integer $val    allow comments by non-registered members or not\r
 +       * @return      void\r
 +       */\r
 +      public function setPublic($val)\r
 +      {\r
 +              $this->setSetting('bpublic', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setSearchable()\r
 +       * @param       integer $val    searchable from the other blogs or not\r
 +       * @return      void\r
 +       */\r
 +      public function setSearchable($val)\r
 +      {\r
 +              $this->setSetting('bincludesearch', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setDescription\r
 +       * @param       string  $val    description for this weblog\r
 +       * @return      void\r
 +       */\r
 +      public function setDescription($val)\r
 +      {\r
 +              $this->setSetting('bdesc',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setUpdateFile()\r
 +       * @param       string  $val    name of file to beupdated when weblog is updated\r
 +       * @return      \r
 +       */\r
 +      public function setUpdateFile($val)\r
 +      {\r
 +              $this->setSetting('bupdate',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setDefaultSkin()\r
 +       * @param       integer $val    ID for default skin to use when displaying this weblog\r
 +       * @return      void\r
 +       */\r
 +      public function setDefaultSkin($val)\r
 +      {\r
 +              $this->setSetting('bdefskin', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setURL()\r
 +       * @param       string  $val    URI for this weblog\r
 +       * @return      \r
 +       */\r
 +      public function setURL($val)\r
 +      {\r
 +              $this->setSetting('burl', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setName()\r
 +       * @param       string  $val    name of this weblog\r
 +       * @return      void\r
 +       */\r
 +      public function setName($val)\r
 +      {\r
 +              $this->setSetting('bname', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setShortName()\r
 +       * @param       string  $val    short name for this weblog\r
 +       * @return      void\r
 +       */\r
 +      public function setShortName($val)\r
 +      {\r
 +              $this->setSetting('bshortname', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setCommentsEnabled()\r
 +       * @param       integer $val    enabling posting comment or not\r
 +       * @return      void\r
 +       */\r
 +      public function setCommentsEnabled($val)\r
 +      {\r
 +              $this->setSetting('bcomments',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setMaxComments()\r
 +       * @param       integer $val    maximum number of comments for this weblog\r
 +       * @return      void\r
 +       */\r
 +      public function setMaxComments($val)\r
 +      {\r
 +              $this->setSetting('bmaxcomments', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setNotifyAddress()\r
 +       * @param       string  $val    email to be notified if weblog updated\r
 +       * @return      void\r
 +       */\r
 +      public function setNotifyAddress($val)\r
 +      {\r
 +              $this->setSetting('bnotify', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setEmailRequired()\r
 +       * @param       string  requiring comments with email or not from non member\r
 +       * @return      void\r
 +       */\r
 +      public function setEmailRequired($val)\r
 +      {\r
 +              $this->setSetting('breqemail', $val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setTimeOffset()\r
 +       * @param       integer $val    time offset\r
 +       * @return      void\r
 +       */\r
 +      public function setTimeOffset($val)\r
 +      {\r
 +              // check validity of value\r
 +              // 1. replace , by . (common mistake)\r
 +              $val = str_replace(',','.',$val);\r
 +              \r
 +              // 2. cast to float or int\r
 +              if ( is_numeric($val) && (i18n::strpos($val, '.5') === (i18n::strlen($val) - 2)) )\r
 +              {\r
 +                      $val = (float) $val;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $val = (integer) $val;\r
 +              }\r
 +              \r
 +              $this->setSetting('btimeoffset',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setDefaultCategory()\r
 +       * @param       integer $val    ID for default category for this weblog\r
 +       * @return      \r
 +       */\r
 +      public function setDefaultCategory($val)\r
 +      {\r
 +              $this->setSetting('bdefcat',$val);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSetting()\r
 +       * @param       string  $key    key for setting of this weblog\r
 +       * @return      mixed   value for the setting\r
 +       */\r
 +      public function getSetting($key)\r
 +      {\r
 +              return $this->settings[$key];\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setSetting()\r
 +       * @param       string  $key    key for setting of this weblog\r
 +       * @param       mixed   $value  value for the key\r
 +       * @return      \r
 +       */\r
 +      public function setSetting($key, $value)\r
 +      {\r
 +              $this->settings[$key] = $value;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::addTeamMember()\r
 +       * Tries to add a member to the team. \r
 +       * Returns false if the member was already on the team\r
 +       * \r
 +       * @param       integer $memberid       id for member\r
 +       * @param       boolean $admin  super-admin or not\r
 +       * @return      boolean Success/Fail\r
 +       */\r
 +      public function addTeamMember($memberid, $admin)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $memberid = intval($memberid);\r
 +              $admin = intval($admin);\r
 +              \r
 +              // check if member is already a member\r
 +              $tmem =& $manager->getMember($memberid);\r
 +              \r
 +              if ( $tmem->isTeamMember($this->blogid) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              $data = array(\r
 +                      'blog'          => &$this,\r
 +                      'member'        => &$tmem,\r
 +                      'admin'         => &$admin\r
 +              );\r
 +              $manager->notify('PreAddTeamMember', $data);\r
 +              \r
 +              // add to team\r
 +              $query = "INSERT INTO %s (TMEMBER, TBLOG, TADMIN) VALUES (%d, %d, %d);";\r
 +              $query = sprintf($query, sql_table('team'), (integer) $memberid, (integer) $this->blogid, (integer) $admin);\r
 +              DB::execute($query);\r
 +              \r
 +              $data = array(\r
 +                      'blog'          => &$this,\r
 +                      'member'        => &$tmem,\r
 +                      'admin'         =>  $admin\r
 +              );\r
 +              $manager->notify('PostAddTeamMember', $data);\r
 +              \r
 +              $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());\r
 +              ActionLog::add(INFO, $logMsg);\r
 +              \r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getID()\r
 +       * @param       void\r
 +       * @return      integer ID for this weblog\r
 +       */\r
 +      public function getID()\r
 +      {\r
 +              return (integer) $this->blogid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a blog with a given shortname exists \r
 +       * Returns true if there is a blog with the given shortname (static)\r
 +       * \r
 +       * @param       string  $name           blog shortname\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      public function exists($name)\r
 +      {\r
 +              $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bshortname='. DB::quoteValue($name));\r
 +              return ($r->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a blog with a given id exists \r
 +       * Returns true if there is a blog with the given ID (static)\r
 +       * \r
 +       * @param       integer $id     ID for searched weblog\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      public function existsID($id)\r
 +      {\r
 +              $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));\r
 +              return ($r->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::setFuturePost()\r
 +       * flag there is a future post pending\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function setFuturePost()\r
 +      {\r
 +              $query =  "UPDATE %s SET bfuturepost='1' WHERE bnumber=%d;";\r
 +              $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::clearFuturePost()\r
 +       * clear there is a future post pending\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function clearFuturePost()\r
 +      {\r
 +              $query =  "UPDATE %s SET bfuturepost='0' WHERE bnumber=%d;";\r
 +              $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::checkJustPosted()\r
 +       * check if we should throw justPosted event \r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function checkJustPosted()\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              if ( $this->settings['bfuturepost'] == 1 )\r
 +              {\r
 +                      $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d AND itime < NOW();";\r
 +                      $query = sprintf($query, sql_table('item'), (integer) $this->blogid);\r
 +                      \r
 +                      $result = DB::getResult($query);\r
 +                      if ( $result->rowCount() > 0 )\r
 +                      {\r
 +                              // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already\r
 +                              // Note that the plugins's calling order is subject to thri order in the plugin list\r
 +                              $pinged = FALSE;\r
 +                              $manager->notify('JustPosted', array('blogid' => $this->blogid, 'pinged' => &$pinged));\r
 +                              \r
 +                              // clear all expired future posts\r
 +                              $query = "UPDATE %s SET iposted='1' WHERE iblog=%d AND itime < NOW();";\r
 +                              $query = spriintf($query, sql_table('item'), (integer) $this->blogid);\r
 +                              DB::execute($query);\r
 +                              \r
 +                              // check to see any pending future post, clear the flag is none\r
 +                              $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d;";\r
 +                              $query = sprintf($query, sql_table('item'), (integer) $this->blogid);\r
 +                              \r
 +                              $result = DB::getResult($query);\r
 +                              if ( $result->rowCount() == 0 )\r
 +                              {\r
 +                                      $this->clearFuturePost();\r
 +                              }\r
 +                      }\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::readLogFromList()\r
 +       * Shows the given list of items for this blog\r
 +       *\r
 +       * @param       array   $itemarray      array of item numbers to be displayed\r
 +       * @param       string  $template       string representing the template _NAME_ (!)\r
 +       * @param       string  $highlight      contains a query that should be highlighted\r
 +       * @param       boolean $comments       1=show comments 0=don't show comments\r
 +       * @param       boolean $dateheads      1=show dateheads 0=don't show dateheads\r
 +       * @param       boolean $showDrafts     0=do not show drafts 1=show drafts\r
 +       * @param       boolean $showFuture     0=do not show future posts 1=show future posts\r
 +       * @return      integer amount of items shown\r
 +       */\r
 +      public function readLogFromList($itemarray, $template, $highlight = '', $comments = 1, $dateheads = 1,$showDrafts = 0, $showFuture = 0)\r
 +      {\r
 +              $query = $this->getSqlItemList($itemarray,$showDrafts,$showFuture);\r
 +              return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::getSqlItemList()\r
 +       * Returns the SQL query used to fill out templates for a list of items\r
 +       * No LIMIT clause is added. (caller should add this if multiple pages are requested)\r
 +       *\r
 +       * @param       array   $itemarray      an array holding the item numbers of the items to be displayed\r
 +       * @param       integer $showDrafts     0=do not show drafts 1=show drafts\r
 +       * @param       integer $showFuture     0=do not show future posts 1=show future posts\r
 +       * @return      string  either a full SQL query, or an empty string\r
 +       */\r
 +      public function getSqlItemList($itemarray,$showDrafts = 0,$showFuture = 0)\r
 +      {\r
 +              if ( !is_array($itemarray) )\r
 +              {\r
 +                      return '';\r
 +              }\r
 +              \r
 +              $showDrafts = intval($showDrafts);\r
 +              $showFuture = intval($showFuture);\r
 +              $items = array();\r
 +              \r
 +              foreach ( $itemarray as $value )\r
 +              {\r
 +                      if ( intval($value) )\r
 +                      {\r
 +                              $items[] = intval($value);\r
 +                      }\r
 +              }\r
 +              if ( !count($items) )\r
 +              {\r
 +                      return '';\r
 +              }\r
 +              \r
 +              $i = count($items);\r
 +              $query = '';\r
 +              foreach ( $items as $value )\r
 +              {\r
 +                      $query .= '('\r
 +                                      .       'SELECT'\r
 +                                      .       ' i.inumber as itemid,'\r
 +                                      .       ' i.ititle as title,'\r
 +                                      .       ' i.ibody as body,'\r
 +                                      .       ' m.mname as author,'\r
 +                                      .       ' m.mrealname as authorname,'\r
 +                                      .       ' i.itime,'\r
 +                                      .       ' i.imore as more,'\r
 +                                      .       ' m.mnumber as authorid,'\r
 +                                      .       ' m.memail as authormail,'\r
 +                                      .       ' m.murl as authorurl,'\r
 +                                      .       ' c.cname as category,'\r
 +                                      .       ' i.icat as catid,'\r
 +                                      .       ' i.iclosed as closed';\r
 +                      \r
 +                      $query .= ' FROM '\r
 +                                      . sql_table('item') . ' as i, '\r
 +                                      . sql_table('member') . ' as m, '\r
 +                                      . sql_table('category') . ' as c'\r
 +                                      . ' WHERE'\r
 +                                  .    ' i.iblog='.$this->blogid\r
 +                                 . ' and i.iauthor=m.mnumber'\r
 +                                 . ' and i.icat=c.catid';\r
 +                      \r
 +                      // exclude drafts       \r
 +                      if ( !$showDrafts )\r
 +                      {\r
 +                              $query .= ' and i.idraft=0';\r
 +                      }\r
 +                      if ( !$showFuture )\r
 +                      {\r
 +                              // don't show future items\r
 +                              $query .= ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime());\r
 +                      }\r
 +                      \r
 +                      $query .= ' and i.inumber='.intval($value);\r
 +                      $query .= ')';\r
 +                      $i--;\r
 +                      if ($i) $query .= ' UNION ';\r
 +              }\r
 +              \r
 +              return $query;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Blog::convertBreaks()\r
 +       * Get the the setting for the line break handling\r
 +       * [should be named as getConvertBreaks()]\r
 +       * \r
 +       * @deprecated\r
 +       * @param       void\r
 +       * @return      \r
 +       */\r
 +      public function convertBreaks()\r
 +      {\r
 +              return $this->getSetting('bconvertbreaks');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Set the the setting for the line break handling\r
 +       * \r
 +       * @deprecated\r
 +       * @param       boolean $val    new value for bconvertbreaks\r
 +       * @return      void\r
 +       */\r
 +      public function setConvertBreaks($val)\r
 +      {\r
 +              $this->setSetting('bconvertbreaks', $val);\r
 +              return;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * A class representing a blog and containing functions to get that blog shown
+  * on the screen
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: BLOG.php 1624 2012-01-09 11:36:20Z sakamocchi $
+  */
+ if ( !function_exists('requestVar') ) exit;
+ require_once dirname(__FILE__) . '/ITEMACTIONS.php';
+ class Blog
+ {
+       // blog id
+       public $blogid;
+       // After creating an object of the blog class, contains true if the BLOG object is
+       // valid (the blog exists)
+       public $isValid;
+       // associative array, containing all blogsettings (use the get/set functions instead)
+       private $settings;
+       
+       // ID of currently selected category
+       private $selectedcatid;
+       /**
+        * Blog::_\construct()
+        * Creates a new BLOG object for the given blog
+        *
+        * @param       integer $id     blogid
+        * @return      void
+        */
+       public function __construct($id)
+       {
+               global $catid;
+               
+               $this->blogid = (integer) $id;
+               $this->readSettings();
+               $this->setSelectedCategory($catid);
+               return;
+       }
+       
+       /**
+        * Blog::readLog()
+        * Shows the given amount of items for this blog
+        *
+        * @param       string  $template       String representing the template _NAME_ (!)
+        * @param       integer $amountEntries  amount of entries to show
+        * @param       integer $startpos       offset from where items should be shown (e.g. 5 = start at fifth item)
+        * @return      integer amount of items shown
+        */
+       public function readLog($template, $amountEntries, $offset = 0, $startpos = 0)
+       {
+               return $this->readLogAmount($template,$amountEntries,'','',1,1,$offset, $startpos);
+       }
+       
+       /**
+        * Blog::showArchive()
+        * Shows an archive for a given month
+        *
+        * @param       integer $year           year
+        * @param       integer $month          month
+        * @param       string  $template       String representing the template name to be used
+        * @return      void
+        */
+       public function showArchive($templatename, $year, $month=0, $day=0)
+       {
+               // create extra where clause for select query
+               if ( $day == 0 && $month != 0 )
+               {
+                       $timestamp_start = mktime(0,0,0,$month,1,$year);
+                       // also works when $month==12
+                       $timestamp_end = mktime(0,0,0,$month+1,1,$year);
+               }
+               elseif ( $month == 0 )
+               {
+                       $timestamp_start = mktime(0,0,0,1,1,$year);
+                       // also works when $month==12
+                       $timestamp_end = mktime(0,0,0,12,31,$year);
+               }
+               else
+               {
+                       $timestamp_start = mktime(0,0,0,$month,$day,$year);
+                       $timestamp_end = mktime(0,0,0,$month,$day+1,$year);
+               }
+               $extra_query = " and i.itime>=%s and i.itime<%s";
+               $extra_query = sprintf($extra_query, DB::formatDateTime($timestamp_start), DB::formatDateTime($timestamp_end));
+               
+               $this->readLogAmount($templatename,0,$extra_query,'',1,1);
+               return;
+       }
+       
+       /**
+        * Blog::setSelectedCategory()
+        * Sets the selected category by id (only when category exists)
+        * 
+        * @param       integer $catid  ID for category
+        * @return      void
+        */
+       public function setSelectedCategory($catid)
+       {
+               if ( $this->isValidCategory($catid) || (intval($catid) == 0) )
+               {
+                       $this->selectedcatid = intval($catid);
+               }
+               return;
+       }
+       
+       /**
+        * Blog::setSelectedCategoryByName()
+        * Sets the selected category by name
+        * 
+        * @param       string  $catname        name of category
+        * @return      void
+        */
+       public function setSelectedCategoryByName($catname)
+       {
+               $this->setSelectedCategory($this->getCategoryIdFromName($catname));
+               return;
+       }
+       
+       /**
+        * Blog::getSelectedCategory()
+        * Returns the selected category
+        * 
+        * @param       void
+        * @return      integer
+        */
+       public function getSelectedCategory()
+       {
+               return $this->selectedcatid;
+       }
+       
+       /**
+        * Shows the given amount of items for this blog
+        *
+        * @param       string  $template               string representing the template _NAME_ (!)
+        * @param       integer $amountEntries  amount of entries to show (0 = no limit)
+        * @param       string  $extraQuery             extra conditions to be added to the query
+        * @param       string  $highlight              contains a query that should be highlighted
+        * @param       integer $comments               1=show comments 0=don't show comments
+        * @param       integer $dateheads              1=show dateheads 0=don't show dateheads
+        * @param       integer $offset                 offset
+        * @return      integer amount of items shown
+        */
+       private function readLogAmount($template, $amountEntries, $extraQuery, $highlight, $comments, $dateheads, $offset = 0, $startpos = 0)
+       {
+               $query = $this->getSqlBlog($extraQuery);
+               
+               if ( $amountEntries > 0 )
+               {
+                       // $offset zou moeten worden:
+                       // (($startpos / $amountentries) + 1) * $offset ... later testen ...
+                       $query .= ' LIMIT ' . intval($startpos + $offset).',' . intval($amountEntries);
+               }
+               return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);
+       }
+       
+       /**
+        * Blog::showUsingQuery()
+        * Do the job for readLogAmmount
+        * 
+        * @param       string  $templateName   template name
+        * @param       string  $query                  string for query
+        * @param       string  $highlight              string to be highlighted
+        * @param       integer $comments               the number of comments
+        * @param       boolean $dateheads              date header is needed or not
+        * @return      integer the number of rows as a result of mysql query
+        */
+       private function showUsingQuery($templateName, $query, $highlight = '', $comments = 0, $dateheads = 1)
+       {
+               global $CONF, $manager, $currentTemplateName;
+               
+               $lastVisit = cookieVar($CONF['CookiePrefix'] .'lastVisit');
+               if ( $lastVisit != 0 )
+               {
+                       $lastVisit = $this->getCorrectTime($lastVisit);
+               }
+               
+               // set templatename as global variable (so plugins can access it)
+               $currentTemplateName = $templateName;
+               $template =& $manager->getTemplate($templateName);
+               
+               // create parser object & action handler
+               $handler = new ItemActions($this);
+               $handler->setTemplate($template);
+               $handler->setHighlight($highlight);
+               $handler->setLastVisit($lastVisit);
+               $handler->setShowComments($comments);
+               
+               $parser = new Parser($handler);
+               
+               // execute query
+               $items = DB::getResult($query);
+               
+               // loop over all items
+               $old_date = 0;
+               foreach ( $items as $item )
+               {
+                       // string timestamp -> unix timestamp
+                       $item['timestamp'] = strtotime($item['itime']);
+                       
+                       // action handler needs to know the item we're handling
+                       $handler->setCurrentItem($item);
+                       
+                       // add date header if needed
+                       if ( $dateheads )
+                       {
+                               $new_date = date('dFY', $item['timestamp']);
+                               if ( $new_date != $old_date )
+                               {
+                                       // unless this is the first time, write date footer
+                                       $timestamp = $item['timestamp'];
+                                       if ( $old_date != 0 )
+                                       {
+                                               $oldTS = strtotime($old_date);
+                                               $data = array('blog' => &$this, 'timestamp' => $oldTS);
+                                               $manager->notify('PreDateFoot', $data);
+                                               
+                                               if ( !in_array('DATE_FOOTER', $template) || empty($template['DATE_FOOTER']) )
+                                               {
+                                                       $tmp_footer = '';
+                                               }
+                                               else
+                                               {
+                                                       $tmp_footer = i18n::formatted_datetime($template['DATE_FOOTER'], $oldTS);
+                                               }
+                                               $parser->parse($tmp_footer);
+                                               $manager->notify('PostDateFoot', $data);
+                                       }
+                                       
+                                       $data = array('blog' => &$this, 'timestamp' => $timestamp);
+                                       $manager->notify('PreDateHead', $data);
+                                       
+                                       // note, to use templatvars in the dateheader, the %-characters need to be doubled in
+                                       // order to be preserved by strftime
+                                       if ( !in_array('DATE_HEADER', $template) || empty($template['DATE_HEADER']) )
+                                       {
+                                               $tmp_header = '';
+                                       }
+                                       else
+                                       {
+                                               $tmp_header = i18n::formatted_datetime($template['DATE_HEADER'], $timestamp);
+                                       }
+                                       $parser->parse($tmp_header);
+                                       $manager->notify('PostDateHead', $data);
+                               }
+                               $old_date = $new_date;
+                       }
+                       
+                       // parse item
+                       $parser->parse($template['ITEM_HEADER']);
+                       $data = array('blog' => &$this, 'item' => &$item);
+                       $manager->notify('PreItem', $data);
+                       $parser->parse($template['ITEM']);
+                       $manager->notify('PostItem', $data);
+                       $parser->parse($template['ITEM_FOOTER']);
+               }
+               
+               $numrows = $items->rowCount();
+               
+               // add another date footer if there was at least one item
+               if ( ($numrows > 0) && $dateheads )
+               {
+                       $data = array('blog' => &$this, 'timestamp' => strtotime($old_date));
+                       $manager->notify('PreDateFoot', $data);
+                       $parser->parse($template['DATE_FOOTER']);
+                       $manager->notify('PostDateFoot', $data);
+               }
+               
+               $items->closeCursor();
+               return $numrows;
+       }
+       
+       /**
+        * Blog::showOneitem()
+        * Simplified function for showing only one item
+        * 
+        * @param       integer $itemid         ID for item
+        * @param       array   $template       template for item
+        * @param       string  $highlight      string for highlight
+        * @return      integer 1
+        */
+       public function showOneitem($itemid, $template, $highlight)
+       {
+               $extraQuery = ' and inumber=' . intval($itemid);
+               
+               return $this->readLogAmount($template, 1, $extraQuery, $highlight, 0, 0);
+       }
+       
+       /**
+        * Blog::addItem()
+        * Adds an item to this blog
+        * 
+        * @param       integer         $catid  ID for category
+        * @param       string          $title  ID for 
+        * @param       string          $body   text for body
+        * @param       string          $more   text for more
+        * @param       integer         $blogid ID for blog
+        * @param       integer         $authorid       ID for author
+        * @param       timestamp       $timestamp      UNIX timestamp for post
+        * @param       boolean         $closed opened or closed
+        * @param       boolean         $draft  draft or not
+        * @param       boolean         $posted posted or not
+        * @return      integer ID for added item
+        */
+       function additem($catid, $title, $body, $more, $blogid, $authorid, $timestamp, $closed, $draft, $posted='1')
+       {
+               global $manager;
+               
+               $blogid         = (integer) $blogid;
+               $authorid       = (integer) $authorid;
+               $title          = $title;
+               $body           = $body;
+               $more           = $more;
+               $catid          = intval($catid);
+               
+               // convert newlines to <br />
+               if ( $this->convertBreaks() )
+               {
+                       $body = addBreaks($body);
+                       $more = addBreaks($more);
+               }
+               if ( $closed != '1' )
+               {
+                       $closed = '0';
+               }
+               if ( $draft != '0' )
+               {
+                       $draft = '1';
+               }
+               
+               if ( !$this->isValidCategory($catid) )
+               {
+                       $catid = $this->getDefaultCategory();
+               }
+               
+               $isFuture = 0;
+               if ( $timestamp > $this->getCorrectTime() )
+               {
+                       $isFuture = 1;
+               }
+               
+               $timestamp = date('Y-m-d H:i:s',$timestamp);
+               $data = array('title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => $this, 'authorid' => &$authorid, 'timestamp' => &$timestamp, 'closed' => &$closed, 'draft' => &$draft, 'catid' => &$catid);
+               $manager->notify('PreAddItem', $data);
+               
+               $ititle = DB::quoteValue($title);
+               $ibody = DB::quoteValue($body);
+               $imore = DB::quoteValue($more);
+               $timestamp = DB::formatDateTime(strtotime($timestamp));
+               
+               $query = "INSERT INTO %s (ITITLE, IBODY, IMORE, IBLOG, IAUTHOR, ITIME, ICLOSED, IDRAFT, ICAT, IPOSTED) VALUES (%s, %s, %s, %d, %d, %s, %s, %s, %s, %s)";
+               $query = sprintf($query, sql_table('item'), $ititle, $ibody, $imore, $blogid, $authorid, $timestamp, $closed, $draft, $catid, $posted);
+               DB::execute($query);
+               $itemid = DB::getInsertId();
+               $data = array('itemid' => $itemid);
+               $manager->notify('PostAddItem', $data);
+               
+               if ( !$draft )
+               {
+                       $this->updateUpdateFile();
+               }
+               // send notification mail
+               if ( !$draft && !$isFuture && $this->getNotifyAddress() && $this->notifyOnNewItem() )
+               {
+                       $this->sendNewItemNotification($itemid, $title, $body);
+               }
+               return $itemid;
+       }
+       
+       /**
+        * Blog::sendNewItemNotification()
+        * Send a new item notification to the notification list
+        * 
+        * @param       string  $itemid ID of the item
+        * @param       string  $title  title of the item
+        * @param       string  $body   body of the item
+        * @return      void
+        */
+       public function sendNewItemNotification($itemid, $title, $body)
+       {
+               global $CONF, $member;
+               
+               $ascii = Entity::anchor_footnoting($body);
+               
+               $message = _NOTIFY_NI_MSG . " \n";
+               $temp = parse_url($CONF['Self']);
+               if ( $temp['scheme'] )
+               {
+                       $message .= Link::create_item_link($itemid) . "\n\n";
+               }
+               else
+               {
+                       $tempurl = $this->getURL();
+                       if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )
+                       {
+                               $message .= $tempurl . '?itemid=' . $itemid . "\n\n";
+                       }
+                       else
+                       {
+                               $message .= $tempurl . '/?itemid=' . $itemid . "\n\n";
+                       }
+               }
+               $message .= _NOTIFY_TITLE . ' ' . strip_tags($title) . "\n";
+               $message .= _NOTIFY_CONTENTS . "\n " . $ascii . "\n";
+               $message .= NOTIFICATION::get_mail_footer();
+               
+               $subject = $this->getName() . ': ' . _NOTIFY_NI_TITLE;
+               
+               $from = $member->getNotifyFromMailAddress();
+               
+               NOTIFICATION::mail($this->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+               return;
+       }
+       
+       /**
+        * Blog::createNewCategory()
+        * Creates a new category for this blog
+        *
+        * @param       string  $catName                name of the new category. When empty, a name is generated automatically (starting with newcat)
+        * @param       string  $catDescription description of the new category. Defaults to 'New Category'
+        * @return      integer ID for new category on success. 0 on failure
+        */
+       public function createNewCategory($catName = '', $catDescription = _CREATED_NEW_CATEGORY_DESC)
+       {
+               global $member, $manager;
+               
+               if ( !$member->blogAdminRights($this->blogid) )
+               {
+                       return 0;
+               }
+               
+               // generate
+               if ( $catName == '' )
+               {
+                       $catName = _CREATED_NEW_CATEGORY_NAME;
+                       $i = 1;
+                       
+                       $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);
+                       while ( $res->rowCount() > 0 )
+                       {
+                               $i++;
+                               $res = DB::getResult('SELECT * FROM '.sql_table('category')." WHERE cname='".$catName.$i."' and cblog=".$this->blogid);
+                       }
+                       
+                       $catName = $catName . $i;
+               }
+               
+               $data = array(
+                       'blog'                  => &$this,
+                       'name'                  => &$catName,
+                       'description'   => $catDescription
+               );
+               $manager->notify('PreAddCategory', $data);
+               
+               $query = "INSERT INTO %s (cblog, cname, cdesc) VALUES (%d, %s, %s)";
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($catName), DB::quoteValue($catDescription));
+               DB::execute($query);
+               $catid = DB::getInsertId();
+               
+               $data = array(
+                       'blog'                  => &$this,
+                       'name'                  => $catName,
+                       'description'   => $catDescription,
+                       'catid'                 => $catid
+               );
+               $manager->notify('PostAddCategory', $data);
+               
+               return $catid;
+       }
+       
+       /**
+        * Blog::search()
+        * Searches all months of this blog for the given query
+        *
+        * @param       string  $query                  search query
+        * @param       array   $template               template to be used (__NAME__ of the template)
+        * @param       integer $amountMonths   max amount of months to be search (0 = all)
+        * @param       integer $maxresults             max number of results to show
+        * @param       integer $startpos               offset
+        * @return      amount of hits found
+        */
+       public function search($query, $template, $amountMonths, $maxresults, $startpos) {
+               global $CONF, $manager;
+               
+               $highlight      = '';
+               $sqlquery       = $this->getSqlSearch($query, $amountMonths, $highlight);
+               
+               if ( $sqlquery == '' )
+               {
+                       // no query -> show everything
+                       $extraquery = '';
+                       $amountfound = $this->readLogAmount($template, $maxresults, $extraQuery, $query, 1, 1);
+               }
+               else
+               {
+                       // add LIMIT to query (to split search results into pages)
+                       if ( intval($maxresults > 0) )
+                       {
+                               $sqlquery .= ' LIMIT ' . intval($startpos) . ',' . intval($maxresults);
+                       }
+                       
+                       // show results
+                       $amountfound = $this->showUsingQuery($template, $sqlquery, $highlight, 1, 1);
+                       
+                       // when no results were found, show a message
+                       if ( $amountfound == 0 )
+                       {
+                               $template =& $manager->getTemplate($template);
+                               $vars = array(
+                                       'query'         => Entity::hsc($query),
+                                       'blogid'        => $this->blogid
+                               );
+                               echo Template::fill($template['SEARCH_NOTHINGFOUND'], $vars);
+                       }
+               }
+               return $amountfound;
+       }
+       
+       /**
+        * Blog::getSqlSearch()
+        * Returns an SQL query to use for a search query
+        * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        *
+        * @param       string  $query                  search query
+        * @param       integer $amountMonths   amount of months to search back. Default = 0 = unlimited
+        * @param       string  $mode                   either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @return      string  $highlight              words to highlight (out parameter)
+        * @return      string  either a full SQL query, or an empty string (if querystring empty)
+        */
+       public function getSqlSearch($query, $amountMonths = 0, &$highlight, $mode = '')
+       {
+               $searchclass = new Search($query);
+               
+               $highlight       = $searchclass->inclusive;
+               
+               // if querystring is empty, return empty string
+               if ( $searchclass->inclusive == '' )
+               {
+                       return '';
+               }
+               
+               $where  = $searchclass->boolean_sql_where('ititle,ibody,imore');
+               $select = $searchclass->boolean_sql_select('ititle,ibody,imore');
+               
+               // get list of blogs to search
+               $blogs          = $searchclass->blogs;  // array containing blogs that always need to be included
+               $blogs[]        = $this->blogid;                // also search current blog (duh)
+               $blogs          = array_unique($blogs); // remove duplicates
+               $selectblogs = '';
+               if ( count($blogs) > 0 )
+               {
+                       $selectblogs = ' and i.iblog in (' . implode(',', $blogs) . ')';
+               }
+               
+               if ( $mode == '' )
+               {
+                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, i.itime, i.imore as more, i.icat as catid, i.iclosed as closed,
+                               m.mname as author, m.mrealname as authorname, m.mnumber as authorid, m.memail as authormail, m.murl as authorurl,
+                               c.cname as category';
+                       
+                       if ( $select )
+                       {
+                               $query .= ', '.$select. ' as score ';
+                       }
+               }
+               else
+               {
+                       $query = 'SELECT COUNT(*) as result ';
+               }
+               
+               $query .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+                               . ' WHERE i.iauthor=m.mnumber'
+                               . ' and i.icat=c.catid'
+                               // exclude drafts
+                               . ' and i.idraft=0'
+                               . $selectblogs
+                                       // don't show future items
+                               . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime())
+                               . ' and '.$where;
+               
+               // take into account amount of months to search
+               if ( $amountMonths > 0 )
+               {
+                       $localtime = getdate($this->getCorrectTime());
+                       $timestamp_start = mktime(0,0,0,$localtime['mon'] - $amountMonths,1,$localtime['year']);
+                       $query .= ' and i.itime>' . DB::formatDateTime($timestamp_start);
+               }
+               
+               if ( $mode == '' )
+               {
+                       if ( $select )
+                       {
+                               $query .= ' ORDER BY score DESC';
+                       }
+                       else
+                       {
+                               $query .= ' ORDER BY i.itime DESC ';
+                       }
+               }
+               
+               return $query;
+       }
+       
+       /**
+        * Blog::getSqlBlog()
+        * Returns the SQL query that's normally used to display the blog items on the index type skins
+        * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        *
+        * @param       string  $extraQuery     extra query string
+        * @param       string  $mode           either empty, or 'count'. In this case, the query will be a SELECT COUNT(*) query
+        * @return      string  either a full SQL query, or an empty string
+        */
+       public function getSqlBlog($extraQuery, $mode = '')
+       {
+               if ( $mode == '' )
+               {
+                       $query = 'SELECT i.inumber as itemid, i.ititle as title, i.ibody as body, m.mname as author,
+                               m.mrealname as authorname, i.itime, i.imore as more, m.mnumber as authorid, m.memail as authormail,
+                               m.murl as authorurl, c.cname as category, i.icat as catid, i.iclosed as closed';
+               }
+               else
+               {
+                       $query = 'SELECT COUNT(*) as result ';
+               }
+               
+               $query  .= ' FROM '.sql_table('item').' as i, '.sql_table('member').' as m, '.sql_table('category').' as c'
+                               . ' WHERE i.iblog='.$this->blogid
+                               . ' and i.iauthor=m.mnumber'
+                               . ' and i.icat=c.catid'
+                               . ' and i.idraft=0' // exclude drafts
+                               . ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime()); // don't show future items
+               
+               if ( $this->selectedcatid )
+               {
+                       $query .= ' and i.icat=' . $this->selectedcatid . ' ';
+               }
+               
+               $query .= $extraQuery;
+               
+               if ( $mode == '' )
+               {
+                       $query .= ' ORDER BY i.itime DESC';
+               }
+               return $query;
+       }
+       
+       /**
+        * Blog::showArchiveList()
+        * Shows the archivelist using the given template
+        * 
+        * @param       string  $template       template name
+        * @param       string  $mode   year/month/day
+        * @param       integer $limit  limit of record count
+        * @return      void
+        */
+       public function showArchiveList($template, $mode = 'month', $limit = 0)
+       {
+               global $CONF, $catid, $manager;
+               
+               if ( !isset ($linkparams) )
+               {
+                       $linkparams = array();
+               }
+               
+               if ( $catid )
+               {
+                       $linkparams = array('catid' => $catid);
+               }
+               
+               $template =& $manager->getTemplate($template);
+               $listitem['blogid'] = $this->blogid;
+               
+               if ( !array_key_exists('ARCHIVELIST_HEADER', $template) || !$template['ARCHIVELIST_HEADER'] )
+               {
+                       $tplt = '';
+               }
+               else
+               {
+                       $tplt = $template['ARCHIVELIST_HEADER'];
+               }
+               
+               echo Template::fill($tplt, $listitem);
+               
+               $query = 'SELECT itime, SUBSTRING(itime,1,4) AS Year, SUBSTRING(itime,6,2) AS Month, SUBSTRING(itime,9,2) AS Day'
+                               . ' FROM '.sql_table('item')
+                               . ' WHERE iblog=' . $this->blogid
+                               . ' AND itime <=' . DB::formatDateTime($this->getCorrectTime()) // don't show future items!
+                               . ' AND idraft=0'; // don't show draft items
+               
+               if ( $catid )
+               {
+                       $query .= ' and icat=' . intval($catid);
+               }
+               
+               $query .= ' GROUP BY Year';
+               if ( $mode == 'month' || $mode == 'day' )
+               {
+                       $query .= ', Month';
+               }
+               if ( $mode == 'day' )
+               {
+                       $query .= ', Day';
+               }
+               
+               $query .= ' ORDER BY itime DESC';
+               
+               if ( $limit > 0 )
+               {
+                       $query .= ' LIMIT ' . intval($limit);
+               }
+               
+               $res = DB::getResult($query);
+               foreach ( $res as $current )
+               {
+                       /* string time -> unix timestamp */
+                       $current['itime'] = strtotime($current['itime']);
+                       
+                       if ( $mode == 'day' )
+                       {
+                               $archivedate = date('Y-m-d',$current['itime']);
+                               $archive['day'] = date('d',$current['itime']);
+                               $listitem['day'] = date('d',$current['itime']);
+                               $listitem['month'] = date('m',$current['itime']);
+                               $archive['month'] = $listitem['month'];
+                       }
+                       elseif ( $mode == 'year' )
+                       {
+                               $archivedate = date('Y',$current['itime']);
+                               $listitem['day'] = '';
+                               $listitem['month'] = '';
+                               $archive['day'] = '';
+                               $archive['month'] = '';
+                       }
+                       else
+                       {
+                               $archivedate = date('Y-m',$current['itime']);
+                               $listitem['month'] = date('m',$current['itime']);
+                               $archive['month'] = $listitem['month'];
+                               $listitem['day'] = '';
+                               $archive['day'] = '';
+                       }
+                       
+                       $listitem['year'] = date('Y',$current['itime']);
+                       $archive['year'] = $listitem['year'];
+                       $listitem['archivelink'] = Link::create_archive_link($this->blogid,$archivedate,$linkparams);
+                       $data = array('listitem' => &$listitem);
+                       $manager->notify('PreArchiveListItem', $data);
+                       
+                       $temp = Template::fill($template['ARCHIVELIST_LISTITEM'],$listitem);
+                       echo i18n::formatted_datetime($temp, $current['itime']);
+                       return;
+               }
+               
+               $res->closeCursor();
+               
+               if ( !array_key_exists('ARCHIVELIST_FOOTER', $template) || !$template['ARCHIVELIST_FOOTER'] )
+               {
+                       $tplt = '';
+               }
+               else
+               {
+                       $tplt = $template['ARCHIVELIST_FOOTER'];
+               }
+               
+               echo Template::fill($tplt, $listitem);
+               return;
+       }
+       
+       /**
+        * Blog::showCategoryList()
+        * Shows the list of categories using a given template
+        * 
+        * @param       string  $template       Template Name
+        * @return      void
+        */
+       public function showCategoryList($template)
+       {
+               global $CONF, $archive, $archivelist, $manager;
+               
+               /*
+                * determine arguments next to catids
+                * I guess this can be done in a better way, but it works
+                */
+               $linkparams = array();
+               if ( $archive )
+               {
+                       $blogurl = Link::create_archive_link($this->blogid, $archive, '');
+                       $linkparams['blogid'] = $this->blogid;
+                       $linkparams['archive'] = $archive;
+               }
+               else if ( $archivelist )
+               {
+                       $blogurl = Link::create_archivelist_link($this->blogid, '');
+                       $linkparams['archivelist'] = $archivelist;
+               }
+               else
+               {
+                       $blogurl = Link::create_blogid_link($this->blogid, '');
+                       $linkparams['blogid'] = $this->blogid;
+               }
+               
+               $template =& $manager->getTemplate($template);
+               
+               //: Change: Set nocatselected variable
+               if ( $this->selectedcatid )
+               {
+                       $nocatselected = 'no';
+               }
+               else
+               {
+                       $nocatselected = 'yes';
+               } 
+               
+               $args = array(
+                       'blogid'        => $this->blogid,
+                       'blogurl'       => $blogurl,
+                       'self'          => $CONF['Self'],
+                       'catiscurrent'  => $nocatselected, // Change: Set catiscurrent template variable for header
+                       'currentcat'    => $nocatselected 
+               );
+               
+               /* output header of category list item */
+               if ( !array_key_exists('CATLIST_HEADER', $template) || empty($template['CATLIST_HEADER']) )
+               {
+                       echo Template::fill(NULL, $args);
+               }
+               else
+               {
+                       echo Template::fill($template['CATLIST_HEADER'], $args);
+               }
+               
+               $query = "SELECT catid, cdesc as catdesc, cname as catname FROM %s WHERE cblog=%d ORDER BY cname ASC;";
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid);
+               $res = DB::getResult($query);
+               
+               foreach ( $res as $row )
+               {
+                       $args = array(
+                               'catid' => $row['catid'],
+                               'name'  => $row['catname'],
+                               'extra' => $linkparams
+                       );
+                       
+                       $row['blogid']          = $this->blogid;
+                       $row['blogurl']         = $blogurl;
+                       $row['catlink']         = Link::create_link('category', $args);
+                       $row['self']            = $CONF['Self'];
+                       
+                       // this gives catiscurrent = no when no category is selected.
+                       $row['catiscurrent'] = 'no';
+                       $row['currentcat'] = 'no';
+                       
+                       if ( $this->selectedcatid )
+                       {
+                               if ( $this->selectedcatid == $row['catid'] )
+                               {
+                                       $row['catiscurrent']    = 'yes';
+                                       $row['currentcat']              = 'yes';
+                               }
+                       }
+                       else
+                       {
+                               global $itemid;
+                               if ( (integer) $itemid && $manager->existsItem((integer) $itemid, 0, 0) )
+                               {
+                                       $iobj   =& $manager->getItem($itemid, 0, 0);
+                                       $cid    = $iobj['catid'];
+                                       
+                                       if ( $cid == $row['catid'] )
+                                       {
+                                               $row['catiscurrent']    = 'yes';
+                                               $row['currentcat']              = 'yes';
+                                       }
+                               }
+                       }
+                       $data = array('listitem' => &$row);
+                       $manager->notify('PreCategoryListItem', $data);
+                       
+                       if ( !array_key_exists('CATLIST_LISTITEM', $template) || empty($template['CATLIST_LISTITEM']))
+                       {
+                               echo Template::fill(NULL, $row);
+                       }
+                       else
+                       {
+                               echo Template::fill($template['CATLIST_LISTITEM'], $row);
+                       }
+               }
+               
+               $res->closeCursor();
+               
+               $args = array(
+                       'blogid'                => $this->blogid,
+                       'blogurl'               => $blogurl,
+                       'self'                  => $CONF['Self'],
+                       'catiscurrent'  => $nocatselected, //: Change: Set catiscurrent template variable for footer
+                       'currentcat'    => $nocatselected
+               );
+               
+               if ( !array_key_exists('CATLIST_FOOTER', $template) || empty($template['CATLIST_FOOTER']))
+               {
+                       echo Template::fill(NULL, $args);
+               }
+               else
+               {
+                       echo Template::fill($template['CATLIST_FOOTER'], $args);
+               }
+               
+               return;
+       }
+       
+       /**
+        * Blog::showBlogList()
+        * Shows a list of all blogs in the system using a given template
+        * ordered by number, name, shortname or description
+        * in ascending or descending order
+        * 
+        * @param       string  $template       tempalte name
+        * @param       string  $bnametype      bname/bshortname
+        * @param       string  $orderby        string for 'ORDER BY' SQL
+        * @param       string  $direction      ASC/DESC
+        * @return      void
+        */
+       static public function showBlogList($template, $bnametype, $orderby, $direction)
+       {
+               global $CONF, $manager;
+               
+               switch ( $orderby )
+               {
+                       case 'number':
+                               $orderby='bnumber';
+                               break;
+                       case 'name':
+                               $orderby='bname';
+                               break;
+                       case 'shortname':
+                               $orderby='bshortname';
+                               break;
+                       case 'description':
+                               $orderby='bdesc';
+                               break;
+                       default:
+                               $orderby='bnumber';
+                               break;
+               }
+               
+               $direction=strtolower($direction);
+               switch ( $direction )
+               {
+                       case 'asc':
+                               $direction='ASC';
+                               break;
+                       case 'desc':
+                               $direction='DESC';
+                               break;
+                       default:
+                               $direction='ASC';
+                               break;
+               }
+               
+               $template =& $manager->getTemplate($template);
+               
+               if ( array_key_exists('BLOGLIST_HEADER', $template) && !empty($template['BLOGLIST_HEADER']) )
+               {
+                       $vars = array(
+                               'sitename'      => $CONF['SiteName'],
+                               'siteurl'       => $CONF['IndexURL']
+                       );
+                       
+                       echo Template::fill($template['BLOGLIST_HEADER'], $vars);
+               }
+               
+               if ( array_key_exists('BLOGLIST_LISTITEM', $template) && !empty($template['BLOGLIST_LISTITEM']) )
+               {
+                       $query = 'SELECT bnumber, bname, bshortname, bdesc, burl FROM '.sql_table('blog').' ORDER BY '.$orderby.' '.$direction;
+                       $res = DB::getResult($query);
+                       
+                       foreach ( $res as $row )
+                       {
+                               $list = array();
+                               $list['bloglink'] = Link::create_blogid_link($row['bnumber']);
+                               $list['blogdesc'] = $row['bdesc'];
+                               $list['blogurl'] = $row['burl'];
+                               
+                               if ( $bnametype == 'shortname' )
+                               {
+                                       $list['blogname'] = $row['bshortname'];
+                               }
+                               else
+                               {
+                                       /* all other cases */
+                                       $list['blogname'] = $row['bname'];
+                               }
+                               $data = array('listitem' => &$list);
+                               $manager->notify('PreBlogListItem', $data);
+                               
+                               echo Template::fill($template['BLOGLIST_LISTITEM'], $list);
+                       }
+                       
+                       $res->closeCursor();
+               }
+               
+               
+               if ( array_key_exists('BLOGLIST_FOOTER', $template) && !empty($template['BLOGLIST_FOOTER']) )
+               {
+                       $vars = array(
+                               'sitename' => $CONF['SiteName'],
+                               'siteurl' => $CONF['IndexURL']
+                       );
+                       echo Template::fill($template['BLOGLIST_FOOTER']);
+               }
+               return;
+       }
+       
+       /**
+        * Blog::readSettings()
+        * Read the blog settings
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function readSettings()
+       {
+               $query =  'SELECT * FROM %s WHERE bnumber=%d;';
+               $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+               $res = DB::getResult($query);
+               
+               $this->isValid = ($res->rowCount() > 0);
+               if ( $this->isValid )
+               {
+                       $this->settings = $res->fetch(PDO::FETCH_ASSOC);
+               }
+               return;
+       }
+       
+       /**
+        * Blog::writeSettings()
+        * Write the blog settings
+        */
+       public function writeSettings()
+       {
+               // (can't use floatval since not available prior to PHP 4.2)
+               $offset = $this->getTimeOffset();
+               if ( !is_float($offset) )
+               {
+                       $offset = (integer) $offset;
+               }
+               
+               $query =  'UPDATE '.sql_table('blog')
+                          . ' SET bname=' . DB::quoteValue($this->getName()) . ','
+                          . '     bshortname='. DB::quoteValue($this->getShortName()) . ','
+                          . '     bcomments='. intval($this->commentsEnabled()) . ','
+                          . '     bmaxcomments=' . intval($this->getMaxComments()) . ','
+                          . '     btimeoffset=' . $offset . ','
+                          . '     bpublic=' . intval($this->isPublic()) . ','
+                          . '     breqemail=' . intval($this->emailRequired()) . ','
+                          . '     bconvertbreaks=' . intval($this->convertBreaks()) . ','
+                          . '     ballowpast=' . intval($this->allowPastPosting()) . ','
+                          . '     bnotify=' . DB::quoteValue($this->getNotifyAddress()) . ','
+                          . '     bnotifytype=' . intval($this->getNotifyType()) . ','
+                          . '     burl=' . DB::quoteValue($this->getURL()) . ','
+                          . '     bupdate=' . DB::quoteValue($this->getUpdateFile()) . ','
+                          . '     bdesc=' . DB::quoteValue($this->getDescription()) . ','
+                          . '     bdefcat=' . intval($this->getDefaultCategory()) . ','
+                          . '     bdefskin=' . intval($this->getDefaultSkin()) . ','
+                          . '     bincludesearch=' . intval($this->getSearchable())
+                          . ' WHERE bnumber=' . intval($this->blogid);
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Blog::updateUpdatefile()
+        * Update the update file if requested
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function updateUpdatefile()
+       {
+               if ( $this->getUpdateFile() )
+               {
+                       $f_update = fopen($this->getUpdateFile(), 'w');
+                       fputs($f_update,$this->getCorrectTime());
+                       fclose($f_update);
+               }
+               return;
+       }
+       
+       /**
+        * Blog::isValidCategory()
+        * Check if a category with a given catid is valid
+        * 
+        * @param       integer $catid  ID for category
+        * @return      boolean exists or not
+        */
+       public function isValidCategory($catid)
+       {
+               $query = 'SELECT * FROM %s WHERE cblog=%d and catid=%d;';
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+               $res = DB::getResult($query);
+               return ($res->rowCount() != 0);
+       }
+       
+       /**
+        * Blog::getCategoryName()
+        * Get the category name for a given catid
+        * 
+        * @param       integer $catid  ID for category
+        * @return      string  name of category
+        */
+       public function getCategoryName($catid)
+       {
+               $query = 'SELECT cname FROM %s WHERE cblog=%d and catid=%d;';
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+               $res = DB::getValue($query);
+               return $res;
+       }
+       
+       /**
+        * Blog::getCategoryDesc()
+        * Get the category description for a given catid
+        * 
+        * @param $catid
+        *      category id
+        */
+       public function getCategoryDesc($catid)
+       {
+               $query = 'SELECT cdesc FROM %s WHERE cblog=%d and catid=%d;';
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid, (integer) $catid);
+               $res = DB::getValue($query);
+               return $res;
+       }
+       
+       /**
+        * Blog::getCategoryIdFromName
+        * Get the category id for a given category name
+        * 
+        * @param       string  $name   category name
+        * @return      ID for category
+        */
+       public function getCategoryIdFromName($name)
+       {
+               $query = 'SELECT catid FROM %s WHERE cblog=%d and cname=%s;';
+               $query = sprintf($query, sql_table('category'), (integer) $this->blogid, DB::quoteValue($name));
+               
+               $res = DB::getValue();
+               if ( !$res )
+               {
+                       return $this->getDefaultCategory();
+               }
+               return $res;
+       }
+       
+       /**
+        * Blog::insertJavaScriptInfo()
+        * Insert a javascript that includes information about the settings
+        * of an author:  ConvertBreaks, MediaUrl and AuthorId
+        * 
+        * @param       $authorid       id of the author
+        */
+       public function insertJavaScriptInfo($authorid = '')
+       {
+               global $member, $CONF;
+               
+               if ( $authorid == '' )
+               {
+                       $authorid = $member->getID();
+               }
+               
+               echo "<script type=\"text/javascript\">\n";
+               
+               if ( !$this->convertBreaks() )
+               {
+                       echo "setConvertBreaks(false);\n";
+               }
+               else
+               {
+                       echo "setConvertBreaks(true);\n";
+               }
+               echo "setMediaUrl('{$CONF['MediaURL']}');\n";
+               echo "setAuthorId('{$authorid}');\n";
+               echo "</script>\n";
+               return;
+       }
+       
+       /**
+        * Blog::setAllowPastPosting()
+        * Set the the setting for allowing to publish postings in the past
+        * 
+        * @param       boolean $val    new value for ballowpast
+        * @return      void
+        */
+       public function setAllowPastPosting($val)
+       {
+               $this->setSetting('ballowpast', $val);
+               return;
+       }
+       
+       /**
+        * Blog::allowPastPosting()
+        * Get the the setting if it is allowed to publish postings in the past
+        * [should be named as getAllowPastPosting()]
+        * 
+        * @param       void
+        * @return      boolean
+        */
+       public function allowPastPosting()
+       {
+               return $this->getSetting('ballowpast');
+       }
+       
+       /**
+        * Blog::getCorrectTime()
+        * 
+        * @param       integer $t
+        * @return      integer
+        */
+       public function getCorrectTime($t=0)
+       {
+               if ( $t == 0 )
+               {
+                       $t = time();
+               }
+               return ($t + 3600 * $this->getTimeOffset());
+       }
+       
+       /**
+        * Blog::getName()
+        * 
+        * @param       void
+        * @return      string name of this weblog
+        */
+       public function getName()
+       {
+               return $this->getSetting('bname');
+       }
+       
+       /**
+        * Blog::getShortName()
+        * 
+        * @param       void
+        * @return      string  short name of this weblog
+        */
+       public function getShortName()
+       {
+               return $this->getSetting('bshortname');
+       }
+       
+       /**
+        * Blog::getMaxComments()
+        * 
+        * @param       void
+        * @return      integer maximum number of comments
+        */
+       public function getMaxComments()
+       {
+               return $this->getSetting('bmaxcomments');
+       }
+       
+       /**
+        * Blog::getNotifyAddress()
+        * 
+        * @param       void
+        * @return      string  mail address for notifying
+        */
+       public function getNotifyAddress()
+       {
+               return $this->getSetting('bnotify');
+       }
+       
+       /**
+        * Blog::getNotifyType()
+        * 
+        * @param       void
+        * @return      integer notifycation type
+        */
+       public function getNotifyType()
+       {
+               return $this->getSetting('bnotifytype');
+       }
+       
+       /**
+        * Blog::notifyOnComment()
+        * 
+        * @param       void
+        * @return      boolean
+        */
+       public function notifyOnComment()
+       {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 3) == 0));
+       }
+       
+       /**
+        * Blog::notifyOnVote()
+        * 
+        * @param       void
+        * @return      boolean
+        */
+       public function notifyOnVote()
+       {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 5) == 0));
+       }
+       
+       /**
+        * Blog::notifyOnNewItem()
+        * 
+        * @param       void
+        * @return      boolean
+        */
+       public function notifyOnNewItem()
+       {
+               $n = $this->getNotifyType();
+               return (($n != 0) && (($n % 7) == 0));
+       }
+       
+       /**
+        * Blog::setNotifyType()
+        * 
+        * @param       integer $val
+        * @return      void
+        */
+       public function setNotifyType($val)
+       {
+               $this->setSetting('bnotifytype',$val);
+               return;
+       }
+       
+       /**
+        * Blog::getTimeOffset()
+        * @param       void
+        * @return      
+        */
+       public function getTimeOffset()
+       {
+               return $this->getSetting('btimeoffset');
+       }
+       
+       /**
+        * Blog::commentsEnabled()
+        * @param       void
+        * @return      integer enabled or not
+        */
+       public function commentsEnabled()
+       {
+               return $this->getSetting('bcomments');
+       }
+       
+       /**
+        * Blog::getURL()
+        * @param       void
+        * @return      string  URI for this weblog
+        */
+       public function getURL()
+       {
+               return $this->getSetting('burl');
+       }
+       
+       /**
+        * Blog::getDefaultSkin()
+        * @param       void
+        * @return      name of skin as default for this weblog
+        */
+       public function getDefaultSkin()
+       {
+               return $this->getSetting('bdefskin');
+       }
+       
+       /**
+        * Blog::getUpdateFile()
+        * @param       void
+        * @return      string  name of file to be updated when weblog is updated
+        */
+       public function getUpdateFile()
+       {
+               return $this->getSetting('bupdate');
+       }
+       
+       /**
+        * Blog::getDescription()
+        * @param       void
+        * @return      string  description for this weblog
+        */
+       public function getDescription()
+       {
+               return $this->getSetting('bdesc');
+       }
+       
+       /**
+        * Blog::isPublic()
+        * @param       void
+        * @return      integer publlic or not
+        */
+       public function isPublic()
+       {
+               return $this->getSetting('bpublic');
+       }
+       
+       /**
+        * Blog::emailRequired()
+        * @param       void
+        * @return      integer email is required when posting comment or not
+        */
+       public function emailRequired()
+       {
+               return $this->getSetting('breqemail');
+       }
+       
+       /**
+        * Blog::getSearchable()
+        * @param       void
+        * @return      integer searchable or not
+        */
+       public function getSearchable()
+       {
+               return $this->getSetting('bincludesearch');
+       }
+       
+       /**
+        * Blog::getDefaultCategory()
+        * @param       void
+        * @return      ID for category as a default
+        */
+       public function getDefaultCategory()
+       {
+               return $this->getSetting('bdefcat');
+       }
+       
+       /**
+        * Blog::setPublic()
+        * @param       integer $val    allow comments by non-registered members or not
+        * @return      void
+        */
+       public function setPublic($val)
+       {
+               $this->setSetting('bpublic', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setSearchable()
+        * @param       integer $val    searchable from the other blogs or not
+        * @return      void
+        */
+       public function setSearchable($val)
+       {
+               $this->setSetting('bincludesearch', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setDescription
+        * @param       string  $val    description for this weblog
+        * @return      void
+        */
+       public function setDescription($val)
+       {
+               $this->setSetting('bdesc',$val);
+               return;
+       }
+       
+       /**
+        * Blog::setUpdateFile()
+        * @param       string  $val    name of file to beupdated when weblog is updated
+        * @return      
+        */
+       public function setUpdateFile($val)
+       {
+               $this->setSetting('bupdate',$val);
+               return;
+       }
+       
+       /**
+        * Blog::setDefaultSkin()
+        * @param       integer $val    ID for default skin to use when displaying this weblog
+        * @return      void
+        */
+       public function setDefaultSkin($val)
+       {
+               $this->setSetting('bdefskin', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setURL()
+        * @param       string  $val    URI for this weblog
+        * @return      
+        */
+       public function setURL($val)
+       {
+               $this->setSetting('burl', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setName()
+        * @param       string  $val    name of this weblog
+        * @return      void
+        */
+       public function setName($val)
+       {
+               $this->setSetting('bname', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setShortName()
+        * @param       string  $val    short name for this weblog
+        * @return      void
+        */
+       public function setShortName($val)
+       {
+               $this->setSetting('bshortname', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setCommentsEnabled()
+        * @param       integer $val    enabling posting comment or not
+        * @return      void
+        */
+       public function setCommentsEnabled($val)
+       {
+               $this->setSetting('bcomments',$val);
+               return;
+       }
+       
+       /**
+        * Blog::setMaxComments()
+        * @param       integer $val    maximum number of comments for this weblog
+        * @return      void
+        */
+       public function setMaxComments($val)
+       {
+               $this->setSetting('bmaxcomments', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setNotifyAddress()
+        * @param       string  $val    email to be notified if weblog updated
+        * @return      void
+        */
+       public function setNotifyAddress($val)
+       {
+               $this->setSetting('bnotify', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setEmailRequired()
+        * @param       string  requiring comments with email or not from non member
+        * @return      void
+        */
+       public function setEmailRequired($val)
+       {
+               $this->setSetting('breqemail', $val);
+               return;
+       }
+       
+       /**
+        * Blog::setTimeOffset()
+        * @param       integer $val    time offset
+        * @return      void
+        */
+       public function setTimeOffset($val)
+       {
+               // check validity of value
+               // 1. replace , by . (common mistake)
+               $val = str_replace(',','.',$val);
+               
+               // 2. cast to float or int
+               if ( is_numeric($val) && (i18n::strpos($val, '.5') === (i18n::strlen($val) - 2)) )
+               {
+                       $val = (float) $val;
+               }
+               else
+               {
+                       $val = (integer) $val;
+               }
+               
+               $this->setSetting('btimeoffset',$val);
+               return;
+       }
+       
+       /**
+        * Blog::setDefaultCategory()
+        * @param       integer $val    ID for default category for this weblog
+        * @return      
+        */
+       public function setDefaultCategory($val)
+       {
+               $this->setSetting('bdefcat',$val);
+               return;
+       }
+       
+       /**
+        * Blog::getSetting()
+        * @param       string  $key    key for setting of this weblog
+        * @return      mixed   value for the setting
+        */
+       public function getSetting($key)
+       {
+               return $this->settings[$key];
+       }
+       
+       /**
+        * Blog::setSetting()
+        * @param       string  $key    key for setting of this weblog
+        * @param       mixed   $value  value for the key
+        * @return      
+        */
+       public function setSetting($key, $value)
+       {
+               $this->settings[$key] = $value;
+               return;
+       }
+       
+       /**
+        * Blog::addTeamMember()
+        * Tries to add a member to the team. 
+        * Returns false if the member was already on the team
+        * 
+        * @param       integer $memberid       id for member
+        * @param       boolean $admin  super-admin or not
+        * @return      boolean Success/Fail
+        */
+       public function addTeamMember($memberid, $admin)
+       {
+               global $manager;
+               
+               $memberid = intval($memberid);
+               $admin = intval($admin);
+               
+               // check if member is already a member
+               $tmem =& $manager->getMember($memberid);
+               
+               if ( $tmem->isTeamMember($this->blogid) )
+               {
+                       return 0;
+               }
+               
+               $data = array(
+                       'blog'          => &$this,
+                       'member'        => &$tmem,
+                       'admin'         => &$admin
+               );
+               $manager->notify('PreAddTeamMember', $data);
+               
+               // add to team
+               $query = "INSERT INTO %s (TMEMBER, TBLOG, TADMIN) VALUES (%d, %d, %d);";
+               $query = sprintf($query, sql_table('team'), (integer) $memberid, (integer) $this->blogid, (integer) $admin);
+               DB::execute($query);
+               
+               $data = array(
+                       'blog'          => &$this,
+                       'member'        => &$tmem,
+                       'admin'         =>  $admin
+               );
+               $manager->notify('PostAddTeamMember', $data);
+               
+               $logMsg = sprintf(_TEAM_ADD_NEWTEAMMEMBER, $tmem->getDisplayName(), $memberid, $this->getName());
+               ActionLog::add(INFO, $logMsg);
+               
+               return 1;
+       }
+       
+       /**
+        * Blog::getID()
+        * @param       void
+        * @return      integer ID for this weblog
+        */
+       public function getID()
+       {
+               return (integer) $this->blogid;
+       }
+       
+       /**
+        * Checks if a blog with a given shortname exists 
+        * Returns true if there is a blog with the given shortname (static)
+        * 
+        * @param       string  $name           blog shortname
+        * @return      boolean exists or not
+        */
+       public function exists($name)
+       {
+               $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bshortname='. DB::quoteValue($name));
+               return ($r->rowCount() != 0);
+       }
+       
+       /**
+        * Checks if a blog with a given id exists 
+        * Returns true if there is a blog with the given ID (static)
+        * 
+        * @param       integer $id     ID for searched weblog
+        * @return      boolean exists or not
+        */
+       public function existsID($id)
+       {
+               $r = DB::getResult('SELECT * FROM '.sql_table('blog').' WHERE bnumber='.intval($id));
+               return ($r->rowCount() != 0);
+       }
+       
+       /**
+        * Blog::setFuturePost()
+        * flag there is a future post pending
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function setFuturePost()
+       {
+               $query =  "UPDATE %s SET bfuturepost='1' WHERE bnumber=%d;";
+               $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Blog::clearFuturePost()
+        * clear there is a future post pending
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function clearFuturePost()
+       {
+               $query =  "UPDATE %s SET bfuturepost='0' WHERE bnumber=%d;";
+               $query = sprintf($query, sql_table('blog'), (integer) $this->blogid);
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Blog::checkJustPosted()
+        * check if we should throw justPosted event 
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function checkJustPosted()
+       {
+               global $manager;
+               
+               if ( $this->settings['bfuturepost'] == 1 )
+               {
+                       $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d AND itime < NOW();";
+                       $query = sprintf($query, sql_table('item'), (integer) $this->blogid);
+                       
+                       $result = DB::getResult($query);
+                       if ( $result->rowCount() > 0 )
+                       {
+                               // This $pinged is allow a plugin to tell other hook to the event that a ping is sent already
+                               // Note that the plugins's calling order is subject to thri order in the plugin list
+                               $pinged = FALSE;
+                               $data = array('blogid' => $this->blogid, 'pinged' => &$pinged);
+                               $manager->notify('JustPosted', $data);
+                               
+                               // clear all expired future posts
+                               $query = "UPDATE %s SET iposted='1' WHERE iblog=%d AND itime < NOW();";
+                               $query = spriintf($query, sql_table('item'), (integer) $this->blogid);
+                               DB::execute($query);
+                               
+                               // check to see any pending future post, clear the flag is none
+                               $query = "SELECT * FROM %s WHERE iposted=0 AND iblog=%d;";
+                               $query = sprintf($query, sql_table('item'), (integer) $this->blogid);
+                               
+                               $result = DB::getResult($query);
+                               if ( $result->rowCount() == 0 )
+                               {
+                                       $this->clearFuturePost();
+                               }
+                       }
+               }
+               return;
+       }
+       
+       /**
+        * Blog::readLogFromList()
+        * Shows the given list of items for this blog
+        *
+        * @param       array   $itemarray      array of item numbers to be displayed
+        * @param       string  $template       string representing the template _NAME_ (!)
+        * @param       string  $highlight      contains a query that should be highlighted
+        * @param       boolean $comments       1=show comments 0=don't show comments
+        * @param       boolean $dateheads      1=show dateheads 0=don't show dateheads
+        * @param       boolean $showDrafts     0=do not show drafts 1=show drafts
+        * @param       boolean $showFuture     0=do not show future posts 1=show future posts
+        * @return      integer amount of items shown
+        */
+       public function readLogFromList($itemarray, $template, $highlight = '', $comments = 1, $dateheads = 1,$showDrafts = 0, $showFuture = 0)
+       {
+               $query = $this->getSqlItemList($itemarray,$showDrafts,$showFuture);
+               return $this->showUsingQuery($template, $query, $highlight, $comments, $dateheads);
+       }
+       
+       /**
+        * Blog::getSqlItemList()
+        * Returns the SQL query used to fill out templates for a list of items
+        * No LIMIT clause is added. (caller should add this if multiple pages are requested)
+        *
+        * @param       array   $itemarray      an array holding the item numbers of the items to be displayed
+        * @param       integer $showDrafts     0=do not show drafts 1=show drafts
+        * @param       integer $showFuture     0=do not show future posts 1=show future posts
+        * @return      string  either a full SQL query, or an empty string
+        */
+       public function getSqlItemList($itemarray,$showDrafts = 0,$showFuture = 0)
+       {
+               if ( !is_array($itemarray) )
+               {
+                       return '';
+               }
+               
+               $showDrafts = intval($showDrafts);
+               $showFuture = intval($showFuture);
+               $items = array();
+               
+               foreach ( $itemarray as $value )
+               {
+                       if ( intval($value) )
+                       {
+                               $items[] = intval($value);
+                       }
+               }
+               if ( !count($items) )
+               {
+                       return '';
+               }
+               
+               $i = count($items);
+               $query = '';
+               foreach ( $items as $value )
+               {
+                       $query .= '('
+                                       .       'SELECT'
+                                       .       ' i.inumber as itemid,'
+                                       .       ' i.ititle as title,'
+                                       .       ' i.ibody as body,'
+                                       .       ' m.mname as author,'
+                                       .       ' m.mrealname as authorname,'
+                                       .       ' i.itime,'
+                                       .       ' i.imore as more,'
+                                       .       ' m.mnumber as authorid,'
+                                       .       ' m.memail as authormail,'
+                                       .       ' m.murl as authorurl,'
+                                       .       ' c.cname as category,'
+                                       .       ' i.icat as catid,'
+                                       .       ' i.iclosed as closed';
+                       
+                       $query .= ' FROM '
+                                       . sql_table('item') . ' as i, '
+                                       . sql_table('member') . ' as m, '
+                                       . sql_table('category') . ' as c'
+                                       . ' WHERE'
+                                   .    ' i.iblog='.$this->blogid
+                                  . ' and i.iauthor=m.mnumber'
+                                  . ' and i.icat=c.catid';
+                       
+                       // exclude drafts       
+                       if ( !$showDrafts )
+                       {
+                               $query .= ' and i.idraft=0';
+                       }
+                       if ( !$showFuture )
+                       {
+                               // don't show future items
+                               $query .= ' and i.itime<=' . DB::formatDateTime($this->getCorrectTime());
+                       }
+                       
+                       $query .= ' and i.inumber='.intval($value);
+                       $query .= ')';
+                       $i--;
+                       if ($i) $query .= ' UNION ';
+               }
+               
+               return $query;
+       }
+       
+       /**
+        * Blog::convertBreaks()
+        * Get the the setting for the line break handling
+        * [should be named as getConvertBreaks()]
+        * 
+        * @deprecated
+        * @param       void
+        * @return      
+        */
+       public function convertBreaks()
+       {
+               return $this->getSetting('bconvertbreaks');
+       }
+       
+       /**
+        * Set the the setting for the line break handling
+        * 
+        * @deprecated
+        * @param       boolean $val    new value for bconvertbreaks
+        * @return      void
+        */
+       public function setConvertBreaks($val)
+       {
+               $this->setSetting('bconvertbreaks', $val);
+               return;
+       }
+ }
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: BODYACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $
++=======
+  * @version $Id: BODYACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  class BodyActions extends BaseActions
         */
        public function __construct()
        {
++<<<<<<< HEAD
 +              parent::__construct();  
++=======
+               parent::__construct();
++>>>>>>> skinnable-master
                return;
        }
        
                array_shift($params);
                
                // add item reference (array_unshift didn't work)
++<<<<<<< HEAD
 +              $params = array_merge(array(&$this->currentItem), $params);
 +              
 +              call_user_func_array(array(&$plugin, 'doItemVar'), $params);
++=======
+               $target = array(&$this->currentItem);
+               $params = array_merge($target, $params);
+               
+               call_user_func_array(array($plugin, 'doItemVar'), $params);
++>>>>>>> skinnable-master
                return;
        }
        
                // image/popup calls have arguments separated by |
                $args = func_get_args();
                $args = preg_split('#\|#', implode($args, ', '));
++<<<<<<< HEAD
 +              echo call_user_func_array(array(&$this, 'createImageCode'), $args);
++=======
+               echo call_user_func_array(array($this, 'createImageCode'), $args);
++>>>>>>> skinnable-master
        }
        
        /**
                // image/popup calls have arguments separated by |
                $args = func_get_args();
                $args = preg_split('#\|#', implode($args, ', '));
++<<<<<<< HEAD
 +              echo call_user_func_array(array(&$this, 'createMediaCode'), $args);
++=======
+               echo call_user_func_array(array($this, 'createMediaCode'), $args);
++>>>>>>> skinnable-master
        }
        
        /**
                // image/popup calls have arguments separated by |
                $args = func_get_args();
                $args = preg_split('#\|#', implode($args, ', '));
++<<<<<<< HEAD
 +              echo call_user_func_array(array(&$this, 'createPopupCode'), $args);
++=======
+               echo call_user_func_array(array($this, 'createPopupCode'), $args);
++>>>>>>> skinnable-master
        }
        
        /**
                                $condition = ($blog && ($blog->getSetting($name) == $value));
                                break;
                        case 'itemblogsetting':
++<<<<<<< HEAD
 +                              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
++=======
+                               $b =& $manager->getBlog($this->currentItem['blogid']);
++>>>>>>> skinnable-master
                                $condition = ($b && ($b->getSetting($name) == $value));
                                break;
                        case 'loggedin':
        {
                global $member, $manager;
                
++<<<<<<< HEAD
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
++=======
+               $b =& $manager->getBlog($this->currentItem['blogid']);
++>>>>>>> skinnable-master
                
                // when no parameter is defined, just check if author is current visitor
                if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
        {
                global $catid, $manager;
                
++<<<<<<< HEAD
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
++=======
+               $b =& $manager->getBlog($this->currentItem['blogid']);
++>>>>>>> skinnable-master
                
                // when no parameter is defined, just check if a category is selected
                if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
                $params = func_get_args();
                array_shift($params);
                
++<<<<<<< HEAD
 +              return call_user_func_array(array(&$plugin, 'doIf'), $params);
++=======
+               return call_user_func_array(array($plugin, 'doIf'), $params);
++>>>>>>> skinnable-master
        }
  }
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: BaseActions.php 1848 2012-05-16 12:17:00Z sakamocchi $
++=======
+  * @version $Id: BaseActions.php 1882 2012-06-17 07:52:43Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  class BaseActions
        
        /**
         * BaseActions::parse_locale()
++<<<<<<< HEAD
 +       * Parse locale to language-script-region according to RFC 4646
++=======
+        * Parse locale to language-region according to RFC 4646
++>>>>>>> skinnable-master
         * 
         * @param       void
         * @return      void
         */
        public function parse_locale()
        {
++<<<<<<< HEAD
 +              echo preg_replace('#_#', '-', i18n::get_current_locale());
++=======
+               echo preg_replace('#(.+)_(.+)_(.+)#', '$1-$3', i18n::get_current_locale());
++>>>>>>> skinnable-master
                return;
        }
        
        {
                $this->addIfExecute();
                $args = func_get_args();
++<<<<<<< HEAD
 +              $condition = call_user_func_array(array(&$this,'checkCondition'), $args);
++=======
+               $condition = call_user_func_array(array($this,'checkCondition'), $args);
++>>>>>>> skinnable-master
                $this->addIfCondition($condition);
                return;
        }
                {
                        ob_end_clean();
                        $args = func_get_args();
++<<<<<<< HEAD
 +                      $condition = call_user_func_array(array(&$this,'checkCondition'), $args);
++=======
+                       $condition = call_user_func_array(array($this,'checkCondition'), $args);
++>>>>>>> skinnable-master
                        $this->addIfCondition($condition);
                }
                return;
                $this->addIfExecute();
                
                $args = func_get_args();
++<<<<<<< HEAD
 +              $condition = call_user_func_array(array(&$this,'checkCondition'), $args);
++=======
+               $condition = call_user_func_array(array($this,'checkCondition'), $args);
++>>>>>>> skinnable-master
                $this->addIfCondition(!$condition);
                return;
        }
                {
                        ob_end_clean();
                        $args = func_get_args();
++<<<<<<< HEAD
 +                      $condition = call_user_func_array(array(&$this,'checkCondition'), $args);
++=======
+                       $condition = call_user_func_array(array($this,'checkCondition'), $args);
++>>>>>>> skinnable-master
                        $this->addIfCondition(!$condition);
                }
                return;
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2007 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * A class representing a single comment\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2007 The Nucleus Group\r
 + * @version $Id: COMMENT.php 1844 2012-05-13 11:14:38Z sakamocchi $\r
 + */\r
 +class Comment\r
 +{\r
 +      /**\r
 +       * Comment::getComment()\r
 +       * Returns the requested comment\r
 +       *\r
 +       * @static\r
 +       * @param       integer $commentid      id for comment\r
 +       * @return      array   comment information\r
 +       * \r
 +       */\r
 +      static function getComment($commentid)\r
 +      {\r
 +              $query = 'SELECT cnumber AS commentid,'\r
 +                            . ' cbody AS body,'\r
 +                            . ' cuser AS user,'\r
 +                            . ' cmail AS userid,'\r
 +                            . ' cemail AS email,'\r
 +                            . ' cmember AS memberid,'\r
 +                            . ' ctime,'\r
 +                            . ' chost AS host,'\r
 +                            . ' mname AS member,'\r
 +                            . ' cip AS ip,'\r
 +                            . ' cblog AS blogid'\r
 +                     . ' FROM %s LEFT OUTER JOIN %s ON cmember = mnumber'\r
 +                     . ' WHERE cnumber = %d;';\r
 +              \r
 +              $query = sprintf($query, sql_table('comment'), sql_table('member'), (integer) $commentid);\r
 +              $aCommentInfo = DB::getRow($query);\r
 +              \r
 +              if ( $aCommentInfo )\r
 +              {\r
 +                      $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);\r
 +              }\r
 +              \r
 +              return $aCommentInfo;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comment::prepare()\r
 +       * Prepares a comment to be saved\r
 +       *\r
 +       * @static\r
 +       * @param       array   $comment        comment data\r
 +       * @return      array   comment date\r
 +       * \r
 +       */\r
 +      static function prepare($comment)\r
 +      {\r
 +              $comment['user']        = strip_tags($comment['user']);\r
 +              $comment['userid']      = strip_tags($comment['userid']);\r
 +              $comment['email']       = strip_tags($comment['email']);\r
 +              \r
 +              // remove newlines from user; remove quotes and newlines from userid and email; trim whitespace from beginning and end\r
 +              $comment['user']        = trim(strtr($comment['user'], "\n", ' ') );\r
 +              $comment['userid']      = trim(strtr($comment['userid'], "\'\"\n", '-- ') );\r
 +              $comment['email']       = trim(strtr($comment['email'], "\'\"\n", '-- ') );\r
 +              \r
 +              // begin if: a comment userid is supplied, but does not have an "http://" or "https://" at the beginning - prepend an "http://"\r
 +              if ( array_key_exists('userid', $comment)\r
 +                && !empty($comment['userid'])\r
 +                && (i18n::strpos($comment['userid'], 'http://') !== 0)\r
 +                && (i18n::strpos($comment['userid'], 'https://') !== 0) )\r
 +              {\r
 +                      $comment['userid'] = 'http://' . $comment['userid'];\r
 +              }\r
 +              \r
 +              $comment['body'] = Comment::prepareBody($comment['body']);\r
 +              \r
 +              return $comment;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comment::prepareBody()\r
 +       * Prepares the body of a comment\r
 +       *\r
 +       * @static\r
 +       * @param       string  $body   string for comment body\r
 +       * @return      string  validate string for comment body\r
 +       */\r
 +      static public function prepareBody($body)\r
 +      {\r
 +              // convert Windows and Mac style 'returns' to *nix newlines\r
 +              $body = preg_replace("/\r\n/", "\n", $body);\r
 +              $body = preg_replace("/\r/", "\n", $body);\r
 +              \r
 +              // then remove newlines when too many in a row (3 or more newlines get converted to 1 newline)\r
 +              $body = preg_replace("/\n{3,}/", "\n\n", $body);\r
 +              \r
 +              // encode special characters as entities\r
 +              $body = Entity::hsc($body);\r
 +              \r
 +              // trim away whitespace and newlines at beginning and end\r
 +              $body = trim($body);\r
 +              \r
 +              // add <br /> tags\r
 +              $body = addBreaks($body);\r
 +              \r
 +              // create hyperlinks for http:// addresses\r
 +              // there's a testcase for this in /build/testcases/urllinking.txt\r
 +              $replace_from = array(\r
 +                      '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
 +                      '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
 +                      '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',\r
 +                      '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/i'\r
 +              );\r
 +              \r
 +              return preg_replace_callback($replace_from, array(__CLASS__, 'prepareBody_cb'), $body);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comment::createLinkCode()\r
 +       * Creates a link code for unlinked URLs with different protocols\r
 +       *\r
 +       * @static\r
 +       * @param       string  $pre    Prefix of comment\r
 +       * @param       string  $url    URL\r
 +       * @param       string  $protocol       http, mailto and so on\r
 +       * @return      string  string  including anchor element and child text\r
 +       */\r
 +      static private function createLinkCode($pre, $url, $protocol = 'http')\r
 +      {\r
 +              $post = '';\r
 +              \r
 +              // it's possible that $url ends contains entities we don't want,\r
 +              // since htmlspecialchars is applied _before_ URL linking\r
 +              // move the part of URL, starting from the disallowed entity to the 'post' link part\r
 +              $aBadEntities = array('&quot;', '&gt;', '&lt;');\r
 +              foreach ( $aBadEntities as $entity )\r
 +              {\r
 +                      $pos = i18n::strpos($url, $entity);\r
 +                      \r
 +                      if ( $pos )\r
 +                      {\r
 +                              $post = i18n::substr($url, $pos) . $post;\r
 +                              $url = i18n::substr($url, 0, $pos);\r
 +                      }\r
 +              }\r
 +              \r
 +              // remove entities at end (&&&&)\r
 +              if ( preg_match('/(&\w+;)+$/i', $url, $matches) )\r
 +              {\r
 +                      $post = $matches[0] . $post;    // found entities (1 or more)\r
 +                      $url = i18n::substr($url, 0, i18n::strlen($url) - i18n::strlen($post) );\r
 +              }\r
 +              \r
 +              // move ending comma from url to 'post' part\r
 +              if ( i18n::substr($url, i18n::strlen($url) - 1) == ',' )\r
 +              {\r
 +                      $url = i18n::substr($url, 0, i18n::strlen($url) - 1);\r
 +                      $post = ',' . $post;\r
 +              }\r
 +              \r
 +              if ( !preg_match('#^' . $protocol . '://#', $url) )\r
 +              {\r
 +                      $linkedUrl = $protocol . ( ($protocol == 'mailto') ? ':' : '://') . $url;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $linkedUrl = $url;\r
 +              }\r
 +              \r
 +              if ( $protocol != 'mailto' )\r
 +              {\r
 +                      $displayedUrl = $linkedUrl;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $displayedUrl = $url;\r
 +              }\r
 +              \r
 +              return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . Entity::hsc(Entity::shorten($displayedUrl,30,'...')) . '</a>' . $post;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comment::prepareBody_cb()\r
 +       * This method is a callback for creating link codes\r
 +       * \r
 +       * @param       array   $match  elements for achor\r
 +       * @return      string  including anchor element and child text\r
 +       * \r
 +       */\r
 +      static public function prepareBody_cb($match)\r
 +      {\r
 +              if ( !preg_match('/^[a-z]+/i', $match[2], $protocol) )\r
 +              {\r
 +                      return $match[0];\r
 +              }\r
 +              \r
 +              switch( strtolower($protocol[0]) )\r
 +              {\r
 +                      case 'https':\r
 +                              return self::createLinkCode($match[1], $match[2], 'https');\r
 +                      break;\r
 +                      \r
 +                      case 'ftp':\r
 +                              return self::createLinkCode($match[1], $match[2], 'ftp');\r
 +                      break;\r
 +                      \r
 +                      case 'mailto':\r
 +                              return self::createLinkCode($match[1], $match[3], 'mailto');\r
 +                      break;\r
 +                      \r
 +                      default:\r
 +                              return self::createLinkCode($match[1], $match[2], 'http');\r
 +                      break;\r
 +              }\r
 +              return;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2007 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * A class representing a single comment
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2007 The Nucleus Group
+  * @version $Id: COMMENT.php 1844 2012-05-13 11:14:38Z sakamocchi $
+  */
+ class Comment 
+ {
+       /**
+        * Comment::getComment()
+        * Returns the requested comment
+        *
+        * @static
+        * @param       integer $commentid      id for comment
+        * @return      array   comment information
+        * 
+        */
+       static function getComment($commentid)
+       {
+               $query = 'SELECT cnumber AS commentid,'
+                             . ' cbody AS body,'
+                             . ' cuser AS user,'
+                             . ' cmail AS userid,'
+                             . ' cemail AS email,'
+                             . ' cmember AS memberid,'
+                             . ' ctime,'
+                             . ' chost AS host,'
+                             . ' mname AS member,'
+                             . ' cip AS ip,'
+                             . ' cblog AS blogid'
+                      . ' FROM %s LEFT OUTER JOIN %s ON cmember = mnumber'
+                      . ' WHERE cnumber = %d;';
+               
+               $query = sprintf($query, sql_table('comment'), sql_table('member'), (integer) $commentid);
+               $aCommentInfo = DB::getRow($query);
+               
+               if ( $aCommentInfo )
+               {
+                       $aCommentInfo['timestamp'] = strtotime($aCommentInfo['ctime']);
+               }
+               
+               return $aCommentInfo;
+       }
+       
+       /**
+        * Comment::prepare()
+        * Prepares a comment to be saved
+        *
+        * @static
+        * @param       array   $comment        comment data
+        * @return      array   comment date
+        * 
+        */
+       static function prepare($comment)
+       {
+               $comment['user']        = strip_tags($comment['user']);
+               $comment['userid']      = strip_tags($comment['userid']);
+               $comment['email']       = strip_tags($comment['email']);
+               
+               // remove newlines from user; remove quotes and newlines from userid and email; trim whitespace from beginning and end
+               $comment['user']        = trim(strtr($comment['user'], "\n", ' ') );
+               $comment['userid']      = trim(strtr($comment['userid'], "\'\"\n", '-- ') );
+               $comment['email']       = trim(strtr($comment['email'], "\'\"\n", '-- ') );
+               
+               // begin if: a comment userid is supplied, but does not have an "http://" or "https://" at the beginning - prepend an "http://"
+               if ( array_key_exists('userid', $comment)
+                 && !empty($comment['userid'])
+                 && (i18n::strpos($comment['userid'], 'http://') !== 0)
+                 && (i18n::strpos($comment['userid'], 'https://') !== 0) )
+               {
+                       $comment['userid'] = 'http://' . $comment['userid'];
+               }
+               
+               $comment['body'] = Comment::prepareBody($comment['body']);
+               
+               return $comment;
+       }
+       
+       /**
+        * Comment::prepareBody()
+        * Prepares the body of a comment
+        *
+        * @static
+        * @param       string  $body   string for comment body
+        * @return      string  validate string for comment body
+        */
+       static public function prepareBody($body)
+       {
+               // convert Windows and Mac style 'returns' to *nix newlines
+               $body = preg_replace("/\r\n/", "\n", $body);
+               $body = preg_replace("/\r/", "\n", $body);
+               
+               // then remove newlines when too many in a row (3 or more newlines get converted to 1 newline)
+               $body = preg_replace("/\n{3,}/", "\n\n", $body);
+               
+               // encode special characters as entities
+               $body = Entity::hsc($body);
+               
+               // trim away whitespace and newlines at beginning and end
+               $body = trim($body);
+               
+               // add <br /> tags
+               $body = addBreaks($body);
+               
+               // create hyperlinks for http:// addresses
+               // there's a testcase for this in /build/testcases/urllinking.txt
+               $replace_from = array(
+                       '/([^:\/\/\w]|^)((https:\/\/)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+                       '/([^:\/\/\w]|^)((http:\/\/|www\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+                       '/([^:\/\/\w]|^)((ftp:\/\/|ftp\.)([\w\.-]+)([\/\w+\.~%&?@=_:;#,-]+))/i',
+                       '/([^:\/\/\w]|^)(mailto:(([a-zA-Z\@\%\.\-\+_])+))/i'
+               );
+               
+               return preg_replace_callback($replace_from, array(__CLASS__, 'prepareBody_cb'), $body);
+       }
+       
+       /**
+        * Comment::createLinkCode()
+        * Creates a link code for unlinked URLs with different protocols
+        *
+        * @static
+        * @param       string  $pre    Prefix of comment
+        * @param       string  $url    URL
+        * @param       string  $protocol       http, mailto and so on
+        * @return      string  string  including anchor element and child text
+        */
+       static private function createLinkCode($pre, $url, $protocol = 'http')
+       {
+               $post = '';
+               
+               // it's possible that $url ends contains entities we don't want,
+               // since htmlspecialchars is applied _before_ URL linking
+               // move the part of URL, starting from the disallowed entity to the 'post' link part
+               $aBadEntities = array('&quot;', '&gt;', '&lt;');
+               foreach ( $aBadEntities as $entity )
+               {
+                       $pos = i18n::strpos($url, $entity);
+                       
+                       if ( $pos )
+                       {
+                               $post = i18n::substr($url, $pos) . $post;
+                               $url = i18n::substr($url, 0, $pos);
+                       }
+               }
+               
+               // remove entities at end (&&&&)
+               if ( preg_match('/(&\w+;)+$/i', $url, $matches) )
+               {
+                       $post = $matches[0] . $post;    // found entities (1 or more)
+                       $url = i18n::substr($url, 0, i18n::strlen($url) - i18n::strlen($post) );
+               }
+               
+               // move ending comma from url to 'post' part
+               if ( i18n::substr($url, i18n::strlen($url) - 1) == ',' )
+               {
+                       $url = i18n::substr($url, 0, i18n::strlen($url) - 1);
+                       $post = ',' . $post;
+               }
+               
+               if ( !preg_match('#^' . $protocol . '://#', $url) )
+               {
+                       $linkedUrl = $protocol . ( ($protocol == 'mailto') ? ':' : '://') . $url;
+               }
+               else
+               {
+                       $linkedUrl = $url;
+               }
+               
+               if ( $protocol != 'mailto' )
+               {
+                       $displayedUrl = $linkedUrl;
+               }
+               else
+               {
+                       $displayedUrl = $url;
+               }
+               
+               return $pre . '<a href="' . $linkedUrl . '" rel="nofollow">' . Entity::hsc(Entity::shorten($displayedUrl,30,'...')) . '</a>' . $post;
+       }
+       
+       /**
+        * Comment::prepareBody_cb()
+        * This method is a callback for creating link codes
+        * 
+        * @param       array   $match  elements for achor
+        * @return      string  including anchor element and child text
+        * 
+        */
+       static public function prepareBody_cb($match)
+       {
+               if ( !preg_match('/^[a-z]+/i', $match[2], $protocol) )
+               {
+                       return $match[0];
+               }
+               
+               switch( strtolower($protocol[0]) )
+               {
+                       case 'https':
+                               return self::createLinkCode($match[1], $match[2], 'https');
+                       break;
+                       
+                       case 'ftp':
+                               return self::createLinkCode($match[1], $match[2], 'ftp');
+                       break;
+                       
+                       case 'mailto':
+                               return self::createLinkCode($match[1], $match[3], 'mailto');
+                       break;
+                       
+                       default:
+                               return self::createLinkCode($match[1], $match[2], 'http');
+                       break;
+               }
+               return;
+       }
+ }
++>>>>>>> skinnable-master
@@@ -232,8 -232,8 +232,13 @@@ class CommentActions extends BaseAction
        public function parse_blogurl()
        {
                global $manager;
++<<<<<<< HEAD
 +              $blogid = getBlogIDFromItemID($this->commentsObj->itemid);
 +              $blog =& $manager->getBlog($blogid);
++=======
+               $item =& $manager->getItem($this->commentsObj->itemid, 1, 1);
+               $blog =& $manager->getBlog($item['blogid']);
++>>>>>>> skinnable-master
                echo $blog->getURL();
                return;
        }
                array_shift($params);
                
                // pass info on current item and current comment as well
++<<<<<<< HEAD
 +              $params = array_merge(array(&$this->currentComment), $params);
 +              $params = array_merge(array(&$this->commentsObj->itemActions->currentItem), $params);
 +              
 +              call_user_func_array(array(&$plugin,'doTemplateCommentsVar'), $params);
++=======
+               $target = array(&$this->currentComment);
+               $params = array_merge($target, $params);
+               $target = array(&$this->commentsObj->itemActions->currentItem);
+               $params = array_merge($target, $params);
+               
+               call_user_func_array(array($plugin,'doTemplateCommentsVar'), $params);
++>>>>>>> skinnable-master
                return;
        }
        
         */
        public function parse_userlinkraw()
        {
++<<<<<<< HEAD
 +              echo $this->currentComment['userlinkraw'];
++=======
+               echo (array_key_exists('userlinkraw', $this->currentComment) && !empty($this->currentComment['userlinkraw'])) ? $this->currentComment['userlinkraw'] : '';
++>>>>>>> skinnable-master
                return;
        }
        
                                $condition = ($blog && ($blog->getSetting($name) == $value));
                                break;
                        case 'itemblogsetting':
++<<<<<<< HEAD
 +                              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
 +                              $condition = ($b && ($b->getSetting($name) == $value));
++=======
+                               $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+                               $blog =& $manager->getBlog($item['blogid']);
+                               $condition = ($blog && ($blog->getSetting($name) == $value));
++>>>>>>> skinnable-master
                                break;
                        case 'loggedin':
                                $condition = $member->isLoggedIn();
                        return FALSE;
                }
                
++<<<<<<< HEAD
 +              $mem =& $manager->getMember($this->currentComment['memberid']);
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
 +              $citem =& $manager->getItem($this->currentComment['itemid'], 1, 1);
 +              
 +              // when no parameter is defined, just check if item author is current visitor
 +              if (($key != 'isadmin' && $key != 'name' && $key != 'isauthor' && $key != 'isonteam')) {
 +                      return (intval($member->getID()) > 0 && intval($member->getID()) == intval($citem['authorid']));
++=======
+               $member =& $manager->getMember($this->currentComment['memberid']);
+               $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+               
+               // when no parameter is defined, just check if item author is current visitor
+               if ( ($key != 'isadmin' && $key != 'name' && $key != 'isauthor' && $key != 'isonteam') )
+               {
+                       return (intval($memberber->getID()) > 0 && intval($memberber->getID()) == (integer) $item['authorid']);
++>>>>>>> skinnable-master
                }
                
                // check comment author name
                        {
                                return FALSE;
                        }
++<<<<<<< HEAD
 +                      if ( $value == strtolower($mem->getDisplayName()) )
++=======
+                       if ( $value == strtolower($member->getDisplayName()) )
++>>>>>>> skinnable-master
                        {
                                return TRUE;
                        }
                // check if comment author is admin
                if ( $key == 'isadmin' )
                {
++<<<<<<< HEAD
 +                      $blogid = intval($b->getID());
 +                      if ( $mem->isAdmin() )
 +                      {
 +                              return TRUE;
 +                      }
 +                      return $mem->isBlogAdmin($blogid);
++=======
+                       if ( $member->isAdmin() )
+                       {
+                               return TRUE;
+                       }
+                       return $member->isBlogAdmin($item['blogid']);
++>>>>>>> skinnable-master
                }
                
                // check if comment author is item author
                if ( $key == 'isauthor' )
                {
++<<<<<<< HEAD
 +                      return (intval($citem['authorid']) == intval($this->currentComment['memberid']));
++=======
+                       return ((integer) $item['authorid'] == (integer) $this->currentComment['memberid']);
++>>>>>>> skinnable-master
                }
                
                // check if comment author is on team
                if ( $key == 'isonteam' )
                {
++<<<<<<< HEAD
 +                      return $mem->teamRights(intval($b->getID()));
++=======
+                       return $member->teamRights((integer) $item['blogid']);
++>>>>>>> skinnable-master
                }
                return FALSE;
        }
        private function ifItemCategory($key = '', $value = '')
        {
                global $catid, $manager;
++<<<<<<< HEAD
 +      
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
 +              $citem =& $manager->getItem($this->currentComment['itemid'],1,1);
 +              $icatid = $citem['catid'];
 +      
 +              // when no parameter is defined, just check if a category is selected
 +              if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
 +              {
 +                      return $b->isValidCategory($icatid);
 +              }
 +      
 +              // check category name
 +              if ( $key == 'catname' )
 +              {
 +                      $value = $b->getCategoryIdFromName($value);
 +                      if ( $value == $icatid )
 +                      {
 +                              return $b->isValidCategory($icatid);
 +                      }
 +              }
 +      
 +              // check category id
 +              if ( ($key == 'catid') && ($value == $icatid) )
 +              {
 +                      return $b->isValidCategory($icatid);
++=======
+               
+               $item =& $manager->getItem($this->currentComment['itemid'],1,1);
+               $blog =& $manager->getBlog($item['blogid']);
+               
+               // when no parameter is defined, just check if a category is selected
+               if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
+               {
+                       return $blog->isValidCategory($item['catid']);
+               }
+               
+               // check category name
+               if ( $key == 'catname' )
+               {
+                       $value = $blog->getCategoryIdFromName($value);
+                       if ( $value == $item['catid'] )
+                       {
+                               return $blog->isValidCategory($item['catid']);
+                       }
+               }
+               
+               // check category id
+               if ( ($key == 'catid') && ($value == $item['catid']) )
+               {
+                       return $blog->isValidCategory($item['catid']);
++>>>>>>> skinnable-master
                }
                return FALSE;
        }
         */
        private function ifOnTeam($blogName = '')
        {
++<<<<<<< HEAD
 +              global $blog, $member, $manager;
 +              
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
 +              
 +              // when no blog found
 +              if ( ($blogName == '') && (!is_object($b)) )
++=======
+               global $member, $manager;
+               
+               $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+               $blog =& $manager->getBlog($item['blogid']);
+               
+               // when no blog found
+               if ( ($blogName == '') && !is_object($blog) )
++>>>>>>> skinnable-master
                {
                        return 0;
                }
                // use current blog
                if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
                {
++<<<<<<< HEAD
 +                      $blogid = $b->getID();
++=======
+                       $blogid = $blog->getID();
++>>>>>>> skinnable-master
                }
                
                return $member->teamRights($blogid);
         */
        private function ifAdmin($blogName = '')
        {
++<<<<<<< HEAD
 +              global $blog, $member, $manager;
 +              
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentComment['itemid']));
 +              
 +              // when no blog found
 +              if ( ($blogName == '') && (!is_object($b)) )
++=======
+               global $member, $manager;
+               
+               $item =& $manager->getItem($this->currentComment['itemid'], 1, 1);
+               $blog =& $manager->getBlog($item['blogid']);
+               
+               // when no blog found
+               if ( ($blogName == '') && !is_object($blog) )
++>>>>>>> skinnable-master
                {
                        return 0;
                }
                // use current blog
                if ( ($blogName == '') || !$manager->existsBlogID($blogid) )
                {
++<<<<<<< HEAD
 +                      $blogid = $b->getID();
++=======
+                       $blogid = $blog->getID();
++>>>>>>> skinnable-master
                }
                
                return $member->isBlogAdmin($blogid);
                $params = func_get_args();
                array_shift($params);
                
++<<<<<<< HEAD
 +              return call_user_func_array(array(&$plugin, 'doIf'), $params);
++=======
+               return call_user_func_array(array($plugin, 'doIf'), $params);
++>>>>>>> skinnable-master
        }
  }
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * A class representing the comments (all of them) for a certain post on a ceratin blog\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: COMMENTS.php 1527 2011-06-21 10:43:44Z sakamocchi $\r
 + */\r
 +\r
 +if ( !function_exists('requestVar') ) exit;\r
 +require_once dirname(__FILE__) . '/COMMENTACTIONS.php';\r
 +\r
 +class Comments\r
 +{\r
 +      // reference to the itemActions object that is calling the showComments function\r
 +      public $itemActions;\r
 +      \r
 +      // item for which comment are being displayed\r
 +      public $itemid;\r
 +      \r
 +      // total amount of comments displayed\r
 +      public $commentcount;\r
 +      \r
 +      /**\r
 +       * Comments::__construct()\r
 +       * Creates a new Comments object for the given blog and item\r
 +       *\r
 +       * @param       integer $itemid id of the item\r
 +       * @return      void\r
 +       */\r
 +      public function __construct($itemid)\r
 +      {\r
 +              $this->itemid = (integer) $itemid;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comments::setItemActions()\r
 +       * Used when parsing comments\r
 +       *\r
 +       * @param       object  $itemActions    itemActions object, that will take care of the parsing\r
 +       * @return      void\r
 +       */\r
 +      public function setItemActions(&$itemActions)\r
 +      {\r
 +              $this->itemActions =& $itemActions;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comments::showComments()\r
 +       * Shows maximum $max comments to the given item using the given template\r
 +       * returns the amount of shown comments (if maxToShow = -1, then there is no limit)\r
 +       *\r
 +       * @param       array   template        template to use\r
 +       * @param       integer maxToShow       max. comments to show\r
 +       * @param       integer showNone        indicates if the 'no comments' thingie should be outputted\r
 +       *                                                              when there are no comments (useful for closed items)\r
 +       * @param       string  highlight       Highlight to use (if any)\r
 +       * @return      integer number of comments\r
 +       */\r
 +      public function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '')\r
 +      {\r
 +              global $CONF, $manager;\r
 +              \r
 +              if ( $maxToShow == 0 )\r
 +              {\r
 +                      $this->commentcount = $this->amountComments();\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = 'SELECT citem as itemid, cnumber as commentid, cbody as body, cuser as user, cmail as userid, '\r
 +                             . 'cemail as email, cmember as memberid, ctime, chost as host, cip as ip, cblog as blogid '\r
 +                             . 'FROM %s as c WHERE citem=%d ORDER BY ctime';\r
 +                      \r
 +                      $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);\r
 +                      $comments = DB::getResult($query);\r
 +                      $this->commentcount = $comments->rowCount();\r
 +              }\r
 +              \r
 +              // create parser object & action handler\r
 +              $handler = new CommentActions($this);\r
 +              $handler->setTemplate($template);\r
 +              \r
 +              $parser = new Parser($handler);\r
 +              \r
 +              // if no result was found\r
 +              if ( $this->commentcount == 0 )\r
 +              {\r
 +                      // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used\r
 +                      if ( $showNone )\r
 +                      {\r
 +                              $parser->parse($template['COMMENTS_NONE']);\r
 +                      }\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // if too many comments to show\r
 +              if ( ($maxToShow != -1) && ($this->commentcount > $maxToShow) )\r
 +              {\r
 +                      $parser->parse($template['COMMENTS_TOOMUCH']);\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              $parser->parse($template['COMMENTS_HEADER']);\r
 +              \r
 +              foreach ( $comments as $comment )\r
 +              {\r
 +                      $comment['timestamp'] = strtotime($comment['ctime']);\r
 +                      $handler->setCurrentComment($comment);\r
 +                      $handler->setHighlight($highlight);\r
 +                      \r
 +                      $manager->notify('PreComment', array('comment' => &$comment));\r
 +                      $parser->parse($template['COMMENTS_BODY']);\r
 +                      $manager->notify('PostComment', array('comment' => &$comment));\r
 +              }\r
 +              \r
 +              $parser->parse($template['COMMENTS_FOOTER']);\r
 +              \r
 +              $comments->closeCursor();\r
 +              \r
 +              return $this->commentcount;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comments::amountComments()\r
 +       * Returns the amount of comments for this itemid\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer number of comments\r
 +       */\r
 +      public function amountComments()\r
 +      {\r
 +              $query = 'SELECT COUNT(*) FROM %s WHERE citem=%d;';\r
 +              $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);\r
 +              $res = DB::getValue($query);\r
 +              \r
 +              return $res;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comments::addComment()\r
 +       * Adds a new comment to the database\r
 +       * \r
 +       * @param string $timestamp\r
 +       * @param array $comment\r
 +       * @return mixed\r
 +       */\r
 +      public function addComment($timestamp, $comment)\r
 +      {\r
 +              global $CONF, $member, $manager;\r
 +              \r
 +              $blogid = getBlogIDFromItemID($this->itemid);\r
 +              \r
 +              $settings =& $manager->getBlog($blogid);\r
 +              $settings->readSettings();\r
 +              \r
 +              // begin if: comments disabled\r
 +              if ( !$settings->commentsEnabled() )\r
 +              {\r
 +                      return _ERROR_COMMENTS_DISABLED;\r
 +              }\r
 +              \r
 +              // begin if: public cannot comment\r
 +              if ( !$settings->isPublic() && !$member->isLoggedIn() )\r
 +              {\r
 +                      return _ERROR_COMMENTS_NONPUBLIC;\r
 +              }\r
 +              \r
 +              // begin if: comment uses a protected member name\r
 +              if ( $CONF['ProtectMemNames'] && !$member->isLoggedIn() && Member::isNameProtected($comment['user']) )\r
 +              {\r
 +                      return _ERROR_COMMENTS_MEMBERNICK;\r
 +              }\r
 +              \r
 +              // begin if: email required, but missing (doesn't apply to members)\r
 +              if ( $settings->emailRequired() && i18n::strlen($comment['email']) == 0 && !$member->isLoggedIn() )\r
 +              {\r
 +                      return _ERROR_EMAIL_REQUIRED;\r
 +              }\r
 +              \r
 +              // begin if: commenter's name is too long\r
 +              if ( i18n::strlen($comment['user']) > 40 )\r
 +              {\r
 +                      return _ERROR_USER_TOO_LONG;\r
 +              }\r
 +              \r
 +              // begin if: commenter's email is too long\r
 +              if ( i18n::strlen($comment['email']) > 100 )\r
 +              {\r
 +                      return _ERROR_EMAIL_TOO_LONG;\r
 +              }\r
 +              \r
 +              // begin if: commenter's url is too long\r
 +              if ( i18n::strlen($comment['userid']) > 100 )\r
 +              {\r
 +                      return _ERROR_URL_TOO_LONG;\r
 +              }\r
 +              \r
 +              $comment['timestamp'] = $timestamp;\r
 +              $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR') );\r
 +              $comment['ip'] = serverVar('REMOTE_ADDR');\r
 +              \r
 +              // begin if: member is logged in, use that data\r
 +              if ( $member->isLoggedIn() )\r
 +              {\r
 +                      $comment['memberid'] = $member->getID();\r
 +                      $comment['user'] = '';\r
 +                      $comment['userid'] = '';\r
 +                      $comment['email'] = '';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $comment['memberid'] = 0;\r
 +              }\r
 +              \r
 +              // spam check\r
 +              $continue = FALSE;\r
 +              $plugins = array();\r
 +              \r
 +              if ( isset($manager->subscriptions['ValidateForm']) )\r
 +              {\r
 +                      $plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);\r
 +              }\r
 +              \r
 +              if ( isset($manager->subscriptions['PreAddComment']) )\r
 +              {\r
 +                      $plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);\r
 +              }\r
 +              \r
 +              if ( isset($manager->subscriptions['PostAddComment']) )\r
 +              {\r
 +                      $plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);\r
 +              }\r
 +              \r
 +              $plugins = array_unique($plugins);\r
 +              \r
 +              while ( list(, $plugin) = each($plugins) )\r
 +              {\r
 +                      $p = $manager->getPlugin($plugin);\r
 +                      $continue = $continue || $p->supportsFeature('handleSpam');\r
 +              }\r
 +              \r
 +              $spamcheck = array(\r
 +                      'type'          => 'comment',\r
 +                      'body'          => $comment['body'],\r
 +                      'id'            => $comment['itemid'],\r
 +                      'live'          => TRUE,\r
 +                      'return'        => $continue\r
 +              );\r
 +              \r
 +              // begin if: member logged in\r
 +              if ( $member->isLoggedIn() )\r
 +              {\r
 +                      $spamcheck['author'] = $member->displayname;\r
 +                      $spamcheck['email'] = $member->email;\r
 +              }\r
 +              // else: public\r
 +              else\r
 +              {\r
 +                      $spamcheck['author'] = $comment['user'];\r
 +                      $spamcheck['email'] = $comment['email'];\r
 +                      $spamcheck['url'] = $comment['userid'];\r
 +              }\r
 +              \r
 +              $manager->notify('SpamCheck', array('spamcheck' => &$spamcheck) );\r
 +              \r
 +              if ( !$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE )\r
 +              {\r
 +                      return _ERROR_COMMENTS_SPAM;\r
 +              }\r
 +              \r
 +              // isValidComment returns either "1" or an error message\r
 +              $isvalid = $this->isValidComment($comment, $spamcheck);\r
 +              if ( $isvalid != 1 )\r
 +              {\r
 +                      return $isvalid;\r
 +              }\r
 +              \r
 +              // begin if: send email to notification address\r
 +              if ( $settings->getNotifyAddress() && $settings->notifyOnComment() )\r
 +              {\r
 +              \r
 +                      $message = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";\r
 +                      $temp = parse_url($CONF['Self']);\r
 +                      \r
 +                      if ( $temp['scheme'] )\r
 +                      {\r
 +                              $message .= Link::create_item_link($this->itemid) . "\n\n";\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $tempurl = $settings->getURL();\r
 +                              \r
 +                              if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )\r
 +                              {\r
 +                                      $message .= $tempurl . '?itemid=' . $this->itemid . "\n\n";\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $message .= $tempurl . '/?itemid=' . $this->itemid . "\n\n";\r
 +                              }\r
 +                      }\r
 +                      \r
 +                      if ( $comment['memberid'] == 0 )\r
 +                      {\r
 +                              $message .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";\r
 +                              $message .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $message .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";\r
 +                      }\r
 +                      \r
 +                      $message .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";\r
 +                      $message .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";\r
 +                      $message .= NOTIFICATION::get_mail_footer();\r
 +                      \r
 +                      $item =& $manager->getItem($this->itemid, 0, 0);\r
 +                      $subject = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';\r
 +                      \r
 +                      $from = $member->getNotifyFromMailAddress($comment['email']);\r
 +                      \r
 +                      NOTIFICATION::mail($settings->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());\r
 +              }\r
 +              \r
 +              $comment = Comment::prepare($comment);\r
 +              \r
 +              $manager->notify('PreAddComment', array('comment' => &$comment, 'spamcheck' => &$spamcheck) );\r
 +              \r
 +              $name           = DB::quoteValue($comment['user']);\r
 +              $url            = DB::quoteValue($comment['userid']);\r
 +              $email      = DB::quoteValue($comment['email']);\r
 +              $body           = DB::quoteValue($comment['body']);\r
 +              $host           = DB::quoteValue($comment['host']);\r
 +              $ip                     = DB::quoteValue($comment['ip']);\r
 +              $memberid       = intval($comment['memberid']);\r
 +              $timestamp      = DB::formatDateTime($comment['timestamp']);\r
 +              $itemid         = $this->itemid;\r
 +              \r
 +              $qSql = 'SELECT COUNT(*) AS result '\r
 +                    . 'FROM ' . sql_table('comment')\r
 +                    . ' WHERE '\r
 +                    .      'cmail   = ' . $url\r
 +                    . ' AND cmember = ' . $memberid\r
 +                    . ' AND cbody   = ' . $body\r
 +                    . ' AND citem   = ' . $itemid\r
 +                    . ' AND cblog   = ' . $blogid;\r
 +              $result = (integer) DB::getValue($qSql);\r
 +              \r
 +              if ( $result > 0 )\r
 +              {\r
 +                      return _ERROR_BADACTION;\r
 +              }\r
 +              \r
 +              $query = sprintf('INSERT INTO %s (cuser, cmail, cemail, cmember, cbody, citem, ctime, chost, cip, cblog) '\r
 +                      . 'VALUES (%s, %s, %s, %d, %s, %d, %s, %s, %s, %d)'\r
 +                      , sql_table('comment'), $name, $url, $email, $memberid, $body, $itemid, $timestamp, $host, $ip, $blogid);\r
 +              \r
 +              DB::execute($query);\r
 +              \r
 +              // post add comment\r
 +              $commentid = DB::getInsertId();\r
 +              $manager->notify('PostAddComment', array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck) );\r
 +              \r
 +              // succeeded !\r
 +              return TRUE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Comments::isValidComment()\r
 +       * Checks if a comment is valid and call plugins\r
 +       * that can check if the comment is a spam comment        \r
 +       * \r
 +       * @param       array   $comment        array with comment elements\r
 +       * @param       array   $spamcheck      array with spamcheck elements\r
 +       * @return      boolean valid or not\r
 +       */\r
 +      private function isValidComment(&$comment, &$spamcheck)\r
 +      {\r
 +              global $member, $manager;\r
 +              \r
 +              // check if there exists a item for this date\r
 +              $item =& $manager->getItem($this->itemid, 0, 0);\r
 +              \r
 +              if ( !$item )\r
 +              {\r
 +                      return _ERROR_NOSUCHITEM;\r
 +              }\r
 +              \r
 +              if ( $item['closed'] )\r
 +              {\r
 +                      return _ERROR_ITEMCLOSED;\r
 +              }\r
 +              \r
 +              // don't allow words that are too long\r
 +              if ( preg_match('/[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}/', $comment['body']) != 0 )\r
 +              {\r
 +                      return _ERROR_COMMENT_LONGWORD;\r
 +              }\r
 +              \r
 +              // check lengths of comment\r
 +              if ( i18n::strlen($comment['body']) < 3 )\r
 +              {\r
 +                      return _ERROR_COMMENT_NOCOMMENT;\r
 +              }\r
 +              \r
 +              if ( i18n::strlen($comment['body']) > 5000 )\r
 +              {\r
 +                      return _ERROR_COMMENT_TOOLONG;\r
 +              }\r
 +              \r
 +              // only check username if no member logged in\r
 +              if ( !$member->isLoggedIn() && (i18n::strlen($comment['user']) < 2) )\r
 +              {\r
 +                      return _ERROR_COMMENT_NOUSERNAME;\r
 +              }\r
 +              \r
 +              if ( (i18n::strlen($comment['email']) != 0) && !NOTIFICATION::address_validation(trim($comment['email'])) )\r
 +              {\r
 +                      return _ERROR_BADMAILADDRESS;\r
 +              }\r
 +              \r
 +              // let plugins do verification (any plugin which thinks the comment is invalid\r
 +              // can change 'error' to something other than '1')\r
 +              $result = 1;\r
 +              $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck) );\r
 +              \r
 +              return $result;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * A class representing the comments (all of them) for a certain post on a ceratin blog
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: COMMENTS.php 1527 2011-06-21 10:43:44Z sakamocchi $
+  */
+ if ( !function_exists('requestVar') ) exit;
+ require_once dirname(__FILE__) . '/COMMENTACTIONS.php';
+ class Comments
+ {
+       // reference to the itemActions object that is calling the showComments function
+       public $itemActions;
+       
+       // item for which comment are being displayed
+       public $itemid;
+       
+       // total amount of comments displayed
+       public $commentcount;
+       
+       /**
+        * Comments::__construct()
+        * Creates a new Comments object for the given blog and item
+        *
+        * @param       integer $itemid id of the item
+        * @return      void
+        */
+       public function __construct($itemid)
+       {
+               $this->itemid = (integer) $itemid;
+               return;
+       }
+       
+       /**
+        * Comments::setItemActions()
+        * Used when parsing comments
+        *
+        * @param       object  $itemActions    itemActions object, that will take care of the parsing
+        * @return      void
+        */
+       public function setItemActions(&$itemActions)
+       {
+               $this->itemActions =& $itemActions;
+               return;
+       }
+       
+       /**
+        * Comments::showComments()
+        * Shows maximum $max comments to the given item using the given template
+        * returns the amount of shown comments (if maxToShow = -1, then there is no limit)
+        *
+        * @param       array   template        template to use
+        * @param       integer maxToShow       max. comments to show
+        * @param       integer showNone        indicates if the 'no comments' thingie should be outputted
+        *                                                              when there are no comments (useful for closed items)
+        * @param       string  highlight       Highlight to use (if any)
+        * @return      integer number of comments
+        */
+       public function showComments($template, $maxToShow = -1, $showNone = 1, $highlight = '')
+       {
+               global $CONF, $manager;
+               
+               if ( $maxToShow == 0 )
+               {
+                       $this->commentcount = $this->amountComments();
+               }
+               else
+               {
+                       $query = 'SELECT citem as itemid, cnumber as commentid, cbody as body, cuser as user, cmail as userid, '
+                              . 'cemail as email, cmember as memberid, ctime, chost as host, cip as ip, cblog as blogid '
+                              . 'FROM %s as c WHERE citem=%d ORDER BY ctime';
+                       
+                       $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);
+                       $comments = DB::getResult($query);
+                       $this->commentcount = $comments->rowCount();
+               }
+               
+               // create parser object & action handler
+               $handler = new CommentActions($this);
+               $handler->setTemplate($template);
+               
+               $parser = new Parser($handler);
+               
+               // if no result was found
+               if ( $this->commentcount == 0 )
+               {
+                       // note: when no reactions, COMMENTS_HEADER and COMMENTS_FOOTER are _NOT_ used
+                       if ( $showNone )
+                       {
+                               $parser->parse($template['COMMENTS_NONE']);
+                       }
+                       return 0;
+               }
+               
+               // if too many comments to show
+               if ( ($maxToShow != -1) && ($this->commentcount > $maxToShow) )
+               {
+                       $parser->parse($template['COMMENTS_TOOMUCH']);
+                       return 0;
+               }
+               
+               $parser->parse($template['COMMENTS_HEADER']);
+               
+               foreach ( $comments as $comment )
+               {
+                       $comment['timestamp'] = strtotime($comment['ctime']);
+                       $handler->setCurrentComment($comment);
+                       $handler->setHighlight($highlight);
+                       $data = array('comment' => &$comment);
+                       $manager->notify('PreComment', $data);
+                       $parser->parse($template['COMMENTS_BODY']);
+                       $manager->notify('PostComment', $data);
+               }
+               
+               $parser->parse($template['COMMENTS_FOOTER']);
+               
+               $comments->closeCursor();
+               
+               return $this->commentcount;
+       }
+       
+       /**
+        * Comments::amountComments()
+        * Returns the amount of comments for this itemid
+        * 
+        * @param       void
+        * @return      integer number of comments
+        */
+       public function amountComments()
+       {
+               $query = 'SELECT COUNT(*) FROM %s WHERE citem=%d;';
+               $query = sprintf($query, sql_table('comment'), (integer) $this->itemid);
+               $res = DB::getValue($query);
+               
+               return $res;
+       }
+       
+       /**
+        * Comments::addComment()
+        * Adds a new comment to the database
+        * 
+        * @param string $timestamp
+        * @param array $comment
+        * @return mixed
+        */
+       public function addComment($timestamp, $comment)
+       {
+               global $CONF, $member, $manager;
+               
+               $blogid = getBlogIDFromItemID($this->itemid);
+               
+               $settings =& $manager->getBlog($blogid);
+               $settings->readSettings();
+               
+               // begin if: comments disabled
+               if ( !$settings->commentsEnabled() )
+               {
+                       return _ERROR_COMMENTS_DISABLED;
+               }
+               
+               // begin if: public cannot comment
+               if ( !$settings->isPublic() && !$member->isLoggedIn() )
+               {
+                       return _ERROR_COMMENTS_NONPUBLIC;
+               }
+               
+               // begin if: comment uses a protected member name
+               if ( $CONF['ProtectMemNames'] && !$member->isLoggedIn() && Member::isNameProtected($comment['user']) )
+               {
+                       return _ERROR_COMMENTS_MEMBERNICK;
+               }
+               
+               // begin if: email required, but missing (doesn't apply to members)
+               if ( $settings->emailRequired() && i18n::strlen($comment['email']) == 0 && !$member->isLoggedIn() )
+               {
+                       return _ERROR_EMAIL_REQUIRED;
+               }
+               
+               // begin if: commenter's name is too long
+               if ( i18n::strlen($comment['user']) > 40 )
+               {
+                       return _ERROR_USER_TOO_LONG;
+               }
+               
+               // begin if: commenter's email is too long
+               if ( i18n::strlen($comment['email']) > 100 )
+               {
+                       return _ERROR_EMAIL_TOO_LONG;
+               }
+               
+               // begin if: commenter's url is too long
+               if ( i18n::strlen($comment['userid']) > 100 )
+               {
+                       return _ERROR_URL_TOO_LONG;
+               }
+               
+               $comment['timestamp'] = $timestamp;
+               $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR') );
+               $comment['ip'] = serverVar('REMOTE_ADDR');
+               
+               // begin if: member is logged in, use that data
+               if ( $member->isLoggedIn() )
+               {
+                       $comment['memberid'] = $member->getID();
+                       $comment['user'] = '';
+                       $comment['userid'] = '';
+                       $comment['email'] = '';
+               }
+               else
+               {
+                       $comment['memberid'] = 0;
+               }
+               
+               // spam check
+               $continue = FALSE;
+               $plugins = array();
+               
+               if ( isset($manager->subscriptions['ValidateForm']) )
+               {
+                       $plugins = array_merge($plugins, $manager->subscriptions['ValidateForm']);
+               }
+               
+               if ( isset($manager->subscriptions['PreAddComment']) )
+               {
+                       $plugins = array_merge($plugins, $manager->subscriptions['PreAddComment']);
+               }
+               
+               if ( isset($manager->subscriptions['PostAddComment']) )
+               {
+                       $plugins = array_merge($plugins, $manager->subscriptions['PostAddComment']);
+               }
+               
+               $plugins = array_unique($plugins);
+               
+               while ( list(, $plugin) = each($plugins) )
+               {
+                       $p = $manager->getPlugin($plugin);
+                       $continue = $continue || $p->supportsFeature('handleSpam');
+               }
+               
+               $spamcheck = array(
+                       'type'          => 'comment',
+                       'body'          => $comment['body'],
+                       'id'            => $comment['itemid'],
+                       'live'          => TRUE,
+                       'return'        => $continue
+               );
+               
+               // begin if: member logged in
+               if ( $member->isLoggedIn() )
+               {
+                       $spamcheck['author'] = $member->displayname;
+                       $spamcheck['email'] = $member->email;
+               }
+               // else: public
+               else
+               {
+                       $spamcheck['author'] = $comment['user'];
+                       $spamcheck['email'] = $comment['email'];
+                       $spamcheck['url'] = $comment['userid'];
+               }
+               $data = array('spamcheck' => &$spamcheck);
+               $manager->notify('SpamCheck', $data);
+               
+               if ( !$continue && isset($spamcheck['result']) && $spamcheck['result'] == TRUE )
+               {
+                       return _ERROR_COMMENTS_SPAM;
+               }
+               
+               // isValidComment returns either "1" or an error message
+               $isvalid = $this->isValidComment($comment, $spamcheck);
+               if ( $isvalid != 1 )
+               {
+                       return $isvalid;
+               }
+               
+               // begin if: send email to notification address
+               if ( $settings->getNotifyAddress() && $settings->notifyOnComment() )
+               {
+               
+                       $message = _NOTIFY_NC_MSG . ' ' . $this->itemid . "\n";
+                       $temp = parse_url($CONF['Self']);
+                       
+                       if ( $temp['scheme'] )
+                       {
+                               $message .= Link::create_item_link($this->itemid) . "\n\n";
+                       }
+                       else
+                       {
+                               $tempurl = $settings->getURL();
+                               
+                               if ( i18n::substr($tempurl, -1) == '/' || i18n::substr($tempurl, -4) == '.php' )
+                               {
+                                       $message .= $tempurl . '?itemid=' . $this->itemid . "\n\n";
+                               }
+                               else
+                               {
+                                       $message .= $tempurl . '/?itemid=' . $this->itemid . "\n\n";
+                               }
+                       }
+                       
+                       if ( $comment['memberid'] == 0 )
+                       {
+                               $message .= _NOTIFY_USER . ' ' . $comment['user'] . "\n";
+                               $message .= _NOTIFY_USERID . ' ' . $comment['userid'] . "\n";
+                       }
+                       else
+                       {
+                               $message .= _NOTIFY_MEMBER .' ' . $member->getDisplayName() . ' (ID=' . $member->getID() . ")\n";
+                       }
+                       
+                       $message .= _NOTIFY_HOST . ' ' . $comment['host'] . "\n";
+                       $message .= _NOTIFY_COMMENT . "\n " . $comment['body'] . "\n";
+                       $message .= NOTIFICATION::get_mail_footer();
+                       
+                       $item =& $manager->getItem($this->itemid, 0, 0);
+                       $subject = _NOTIFY_NC_TITLE . ' ' . strip_tags($item['title']) . ' (' . $this->itemid . ')';
+                       
+                       $from = $member->getNotifyFromMailAddress($comment['email']);
+                       
+                       NOTIFICATION::mail($settings->getNotifyAddress(), $subject, $message, $from, i18n::get_current_charset());
+               }
+               
+               $comment = Comment::prepare($comment);
+               $data = array('comment' => &$comment, 'spamcheck' => &$spamcheck);
+               $manager->notify('PreAddComment', $data);
+               
+               $name           = DB::quoteValue($comment['user']);
+               $url            = DB::quoteValue($comment['userid']);
+               $email          = DB::quoteValue($comment['email']);
+               $body           = DB::quoteValue($comment['body']);
+               $host           = DB::quoteValue($comment['host']);
+               $ip                     = DB::quoteValue($comment['ip']);
+               $memberid       = intval($comment['memberid']);
+               $timestamp      = DB::formatDateTime($comment['timestamp']);
+               $itemid         = $this->itemid;
+               
+               $qSql = 'SELECT COUNT(*) AS result '
+                     . 'FROM ' . sql_table('comment')
+                     . ' WHERE '
+                     .      'cmail   = ' . $url
+                     . ' AND cmember = ' . $memberid
+                     . ' AND cbody   = ' . $body
+                     . ' AND citem   = ' . $itemid
+                     . ' AND cblog   = ' . $blogid;
+               $result = (integer) DB::getValue($qSql);
+               
+               if ( $result > 0 )
+               {
+                       return _ERROR_BADACTION;
+               }
+               
+               $query = sprintf('INSERT INTO %s (cuser, cmail, cemail, cmember, cbody, citem, ctime, chost, cip, cblog) '
+                       . 'VALUES (%s, %s, %s, %d, %s, %d, %s, %s, %s, %d)'
+                       , sql_table('comment'), $name, $url, $email, $memberid, $body, $itemid, $timestamp, $host, $ip, $blogid);
+               
+               DB::execute($query);
+               
+               // post add comment
+               $commentid = DB::getInsertId();
+               $data = array('comment' => &$comment, 'commentid' => &$commentid, 'spamcheck' => &$spamcheck);
+               $manager->notify('PostAddComment', $data);
+               
+               // succeeded !
+               return TRUE;
+       }
+       
+       /**
+        * Comments::isValidComment()
+        * Checks if a comment is valid and call plugins
+        * that can check if the comment is a spam comment        
+        * 
+        * @param       array   $comment        array with comment elements
+        * @param       array   $spamcheck      array with spamcheck elements
+        * @return      boolean valid or not
+        */
+       private function isValidComment(&$comment, &$spamcheck)
+       {
+               global $member, $manager;
+               
+               // check if there exists a item for this date
+               $item =& $manager->getItem($this->itemid, 0, 0);
+               
+               if ( !$item )
+               {
+                       return _ERROR_NOSUCHITEM;
+               }
+               
+               if ( $item['closed'] )
+               {
+                       return _ERROR_ITEMCLOSED;
+               }
+               
+               // don't allow words that are too long
+               if ( preg_match('/[a-zA-Z0-9|\.,;:!\?=\/\\\\]{90,90}/', $comment['body']) != 0 )
+               {
+                       return _ERROR_COMMENT_LONGWORD;
+               }
+               
+               // check lengths of comment
+               if ( i18n::strlen($comment['body']) < 3 )
+               {
+                       return _ERROR_COMMENT_NOCOMMENT;
+               }
+               
+               if ( i18n::strlen($comment['body']) > 5000 )
+               {
+                       return _ERROR_COMMENT_TOOLONG;
+               }
+               
+               // only check username if no member logged in
+               if ( !$member->isLoggedIn() && (i18n::strlen($comment['user']) < 2) )
+               {
+                       return _ERROR_COMMENT_NOUSERNAME;
+               }
+               
+               if ( (i18n::strlen($comment['email']) != 0) && !NOTIFICATION::address_validation(trim($comment['email'])) )
+               {
+                       return _ERROR_BADMAILADDRESS;
+               }
+               
+               // let plugins do verification (any plugin which thinks the comment is invalid
+               // can change 'error' to something other than '1')
+               $result = 1;
+               $data = array('type' => 'comment', 'comment' => &$comment, 'error' => &$result, 'spamcheck' => &$spamcheck);
+               $manager->notify('ValidateForm', $data);
+               
+               return $result;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: ITEM.php 1668 2012-02-19 14:36:44Z sakamocchi $\r
 + */\r
 +\r
 +/**\r
 + * A class representing an item\r
 + *\r
 + */\r
 +class Item\r
 +{\r
 +      /**\r
 +       * Item::$actiontypes\r
 +       * actiontype list for handling items\r
 +       * \r
 +       * @static\r
 +       */\r
 +      static private $actiontypes = array(\r
 +              'addnow', 'adddraft', 'addfuture', 'edit',\r
 +              'changedate', 'backtodrafts', 'delete'\r
 +      );\r
 +      \r
 +      /**\r
 +       * Item::$itemid\r
 +       * item id\r
 +       * @deprecated\r
 +       */\r
 +      public $itemid;\r
 +      \r
 +      /**\r
 +       * Item::__construct()\r
 +       * Creates a new ITEM object\r
 +       * \r
 +       * @deprecated\r
 +       * @param integer       $item_id        id for item\r
 +       * @return void\r
 +       */\r
 +      public function __construct($item_id)\r
 +      {\r
 +              $this->itemid = $item_id;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::getitem()\r
 +       * Returns one item with the specific itemid\r
 +       * \r
 +       * @static\r
 +       * @param int $item_id\r
 +       * @param bool $allow_draft\r
 +       * @param bool $allow_future\r
 +       * @return mixed\r
 +       */\r
 +      static public function getitem($item_id, $allow_draft, $allow_future)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $item_id = (integer) $item_id;\r
 +              \r
 +              $query = 'SELECT ' .\r
 +                      'i.idraft AS draft, ' .\r
 +                      'i.inumber AS itemid, ' .\r
 +                      'i.iclosed AS closed, ' .\r
 +                      'i.ititle AS title, ' .\r
 +                      'i.ibody AS body, ' .\r
 +                      'm.mname AS author, ' .\r
 +                      'i.iauthor AS authorid, ' .\r
 +                      'i.itime, ' .\r
 +                      'i.imore AS more, ' .\r
 +                      'i.ikarmapos AS karmapos, ' .\r
 +                      'i.ikarmaneg AS karmaneg, ' .\r
 +                      'i.icat AS catid, ' .\r
 +                      'i.iblog AS blogid ' .\r
 +                      'FROM %s AS i, %s AS m, %s AS b ' .\r
 +                      'WHERE i.inumber = %d ' .\r
 +                      'AND i.iauthor = m.mnumber ' .\r
 +                      'AND i.iblog = b.bnumber ';\r
 +              \r
 +              $query = sprintf($query, sql_table('item'), sql_table('member'), sql_table('blog'), $item_id);\r
 +              \r
 +              if ( !$allow_draft )\r
 +              {\r
 +                      $query .= "AND i.idraft = 0 ";\r
 +              }\r
 +              \r
 +              if ( !$allow_future )\r
 +              {\r
 +                      $blog =& $manager->getBlog(getBlogIDFromItemID($item_id));\r
 +                      $query .= 'AND i.itime <= ' . DB::formatDateTime($blog->getCorrectTime());\r
 +              }\r
 +              \r
 +              $query .= ' LIMIT 1';\r
 +              $result = DB::getResult($query);\r
 +              \r
 +              if ( $result->rowCount() == 1 )\r
 +              {\r
 +                      $aItemInfo = $result->fetch(PDO::FETCH_ASSOC);\r
 +                      $aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);\r
 +                      return $aItemInfo;\r
 +              }\r
 +              return 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::createFromRequest()\r
 +       * Tries to create an item from the data in the current request (comes from\r
 +       * bookmarklet or admin area\r
 +       *\r
 +       * @static\r
 +       * @param       void\r
 +       * @return      array   (status = added/error/newcategory, message)\r
 +       * \r
 +       */\r
 +      static public function createFromRequest()\r
 +      {\r
 +              global $member, $manager;\r
 +              \r
 +              /*\r
 +               * TODO: these values from user agent should be validated but not implemented yet\r
 +               */\r
 +              $i_author               = $member->getID();\r
 +              $i_body                 = postVar('body');\r
 +              $i_title                = postVar('title');\r
 +              $i_more                 = postVar('more');\r
 +              $i_actiontype   = postVar('actiontype');\r
 +              $i_closed               = intPostVar('closed');\r
 +              $i_hour                 = intPostVar('hour');\r
 +              $i_minutes              = intPostVar('minutes');\r
 +              $i_month                = intPostVar('month');\r
 +              $i_day                  = intPostVar('day');\r
 +              $i_year                 = intPostVar('year');\r
 +              $i_catid                = postVar('catid');\r
 +              $i_draftid              = intPostVar('draftid');\r
 +              \r
 +              if ( !$member->canAddItem($i_catid) )\r
 +              {\r
 +                      return array('status' => 'error', 'message' => _ERROR_DISALLOWED);\r
 +              }\r
 +              \r
 +              if ( !in_array($i_actiontype, self::$actiontypes) )\r
 +              {\r
 +                      $i_actiontype = 'addnow';\r
 +              }\r
 +              \r
 +              $i_draft = (integer) ( $i_actiontype == 'adddraft' );\r
 +              \r
 +              if ( !trim($i_body) )\r
 +              {\r
 +                      return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);\r
 +              }\r
 +              \r
 +              // create new category if needed\r
 +              if ( i18n::strpos($i_catid, 'newcat') === 0 )\r
 +              {\r
 +                      // get blogid\r
 +                      list($i_blogid) = sscanf($i_catid, "newcat-%d");\r
 +                      \r
 +                      // create\r
 +                      $blog =& $manager->getBlog($i_blogid);\r
 +                      $i_catid = $blog->createNewCategory();\r
 +                      \r
 +                      // show error when sth goes wrong\r
 +                      if ( !$i_catid )\r
 +                      {\r
 +                              return array('status' => 'error','message' => 'Could not create new category');\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      // force blogid (must be same as category id)\r
 +                      $i_blogid = getBlogIDFromCatID($i_catid);\r
 +                      $blog =& $manager->getBlog($i_blogid);\r
 +              }\r
 +              \r
 +              if ( $i_actiontype == 'addfuture' )\r
 +              {\r
 +                      $posttime = mktime($i_hour, $i_minutes, 0, $i_month, $i_day, $i_year);\r
 +                      \r
 +                      // make sure the date is in the future, unless we allow past dates\r
 +                      if ( (!$blog->allowPastPosting()) && ($posttime < $blog->getCorrectTime()) )\r
 +                      {\r
 +                              $posttime = $blog->getCorrectTime();\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      if ( !$i_draft )\r
 +                      {\r
 +                              $posttime = $blog->getCorrectTime();\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $posttime = 0;\r
 +                      }\r
 +              }\r
 +              \r
 +              if ( $posttime > $blog->getCorrectTime() )\r
 +              {\r
 +                      $posted = 0;\r
 +                      $blog->setFuturePost();\r
 +              }\r
 +              else\r
 +              {\r
 +                      $posted = 1;\r
 +              }\r
 +              \r
 +              $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft, $posted);\r
 +              \r
 +              //Setting the itemOptions\r
 +              $aOptions = requestArray('plugoption');\r
 +              NucleusPlugin::apply_plugin_options($aOptions, $itemid);\r
 +              $data = array(\r
 +                      'context'       => 'item',\r
 +                      'itemid'        => $itemid,\r
 +                      'item'          => array(\r
 +                              'title'         => $i_title,\r
 +                              'body'          => $i_body,\r
 +                              'more'          => $i_more,\r
 +                              'closed'        => $i_closed,\r
 +                              'catid'         => $i_catid\r
 +                      )\r
 +              );\r
 +              \r
 +              $manager->notify('PostPluginOptionsUpdate', $data);\r
 +              \r
 +              if ( $i_draftid > 0 )\r
 +              {\r
 +                      // delete permission is checked inside Item::delete()\r
 +                      self::delete($i_draftid);\r
 +              }\r
 +              \r
 +              // success\r
 +              if ( $i_catid != intRequestVar('catid') )\r
 +              {\r
 +                      return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);\r
 +              }\r
 +              \r
 +              return array('status' => 'added', 'itemid' => $itemid);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::update()\r
 +       * Updates an item\r
 +       *\r
 +       * @static\r
 +       * @param       integer $itemid item id\r
 +       * @param       integer $catid  category id\r
 +       * @param       string  $title  title\r
 +       * @param       string  $body   body text\r
 +       * @param       string  $more   more text\r
 +       * @param       boolean $closed closed or not\r
 +       * @param       boolean $wasdraft       previously draft or not\r
 +       * @param       boolean $publish        published or not\r
 +       * @param       timestamp       $timestamp      timestamp\r
 +       * @return      void\r
 +       */\r
 +      static public function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $itemid = (integer) $itemid;\r
 +              $closed = (boolean) $closed;\r
 +              \r
 +              // get destination blogid\r
 +              $new_blogid = getBlogIDFromCatID($catid);\r
 +              $old_blogid = getBlogIDFromItemID($itemid);\r
 +              \r
 +              // move will be done on end of method\r
 +              $moveNeeded = 0;\r
 +              if ( $new_blogid != $old_blogid )\r
 +              {\r
 +                      $moveNeeded = 1;\r
 +              }\r
 +              \r
 +              $blog =& $manager->getBlog($new_blogid);\r
 +              \r
 +              // begin if: convert line breaks to <br/>\r
 +              if ( $blog->convertBreaks() )\r
 +              {\r
 +                      $body = addBreaks($body);\r
 +                      $more = addBreaks($more);\r
 +              }\r
 +              \r
 +              // call plugins\r
 +              $data = array(\r
 +                      'itemid'        => $itemid,\r
 +                      'title'         => &$title,\r
 +                      'body'          => &$body,\r
 +                      'more'          => &$more,\r
 +                      'blog'          => &$blog,\r
 +                      'closed'        => &$closed,\r
 +                      'catid'         => &$catid\r
 +              );\r
 +              $manager->notify('PreUpdateItem', $data);\r
 +              \r
 +              // update item itself\r
 +              $query =  'UPDATE ' . sql_table('item')\r
 +                              . ' SET'\r
 +                              . ' ibody = ' . DB::quoteValue($body) . ','\r
 +                              . ' ititle = ' . DB::quoteValue($title) . ','\r
 +                              . ' imore = ' . DB::quoteValue($more) . ','\r
 +                              . ' iclosed = ' . intval($closed) . ','\r
 +                              . ' icat = ' . intval($catid);\r
 +              \r
 +              // if we received an updated timestamp that is in the past, but past posting is not allowed,\r
 +              // reject that date change (timestamp = 0 will make sure the current date is kept)\r
 +              if ( (!$blog->allowPastPosting()) && ($timestamp < $blog->getCorrectTime()) )\r
 +              {\r
 +                      $timestamp = 0;\r
 +              }\r
 +              \r
 +              // begin if: post is in the future\r
 +              if ( $timestamp > $blog->getCorrectTime(time()) )\r
 +              {\r
 +                      $isFuture = 1;\r
 +                      $query .= ', iposted = 0';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $isFuture = 0;\r
 +                      $query .= ', iposted = 1';\r
 +              }\r
 +              \r
 +              if ( $wasdraft && $publish )\r
 +              {\r
 +                      // set timestamp to current date only if it's not a future item\r
 +                      // draft items have timestamp == 0\r
 +                      // don't allow timestamps in the past (unless otherwise defined in blogsettings)\r
 +                      $query .= ', idraft = 0';\r
 +                      \r
 +                      if ( $timestamp == 0 )\r
 +                      {\r
 +                              $timestamp = $blog->getCorrectTime();\r
 +                      }\r
 +                      \r
 +                      // send new item notification\r
 +                      if ( !$isFuture && $blog->getNotifyAddress() && $blog->notifyOnNewItem() )\r
 +                      {\r
 +                              $blog->sendNewItemNotification($itemid, $title, $body);\r
 +                      }\r
 +              }\r
 +              \r
 +              // save back to drafts\r
 +              if ( !$wasdraft && !$publish )\r
 +              {\r
 +                      $query .= ', idraft = 1';\r
 +                      // set timestamp back to zero for a draft\r
 +                      $query .= ', itime = ' . DB::formatDateTime($timestamp);\r
 +              }\r
 +              \r
 +              // update timestamp when needed\r
 +              if ( $timestamp != 0 )\r
 +              {\r
 +                      $query .= ', itime = ' . DB::formatDateTime($timestamp);\r
 +              }\r
 +              \r
 +              // make sure the correct item is updated\r
 +              $query .= ' WHERE inumber = ' . $itemid;\r
 +              \r
 +              // off we go!\r
 +              DB::execute($query);\r
 +              \r
 +              $manager->notify('PostUpdateItem', array('itemid' => $itemid));\r
 +              \r
 +              // when needed, move item and comments to new blog\r
 +              if ( $moveNeeded )\r
 +              {\r
 +                      self::move($itemid, $catid);\r
 +              }\r
 +              \r
 +              //update the itemOptions\r
 +              $aOptions = requestArray('plugoption');\r
 +              NucleusPlugin::apply_plugin_options($aOptions);\r
 +              $data = array(\r
 +                      'context'       => 'item',\r
 +                      'itemid'        => $itemid,\r
 +                      'item'          => array(\r
 +                              'title'         => $title,\r
 +                              'body'          => $body,\r
 +                              'more'          => $more,\r
 +                              'closed'        => $closed,\r
 +                              'catid'         => $catid\r
 +                      )\r
 +              );\r
 +              $manager->notify('PostPluginOptionsUpdate', $data);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::move()\r
 +       * Move an item to another blog (no checks)\r
 +       *\r
 +       * @static\r
 +       * @param       integer $itemid\r
 +       * @param       integer $new_catid\r
 +       * @return      void\r
 +       */\r
 +      static public function move($itemid, $new_catid)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $itemid = (integer) $itemid;\r
 +              $new_catid = (integer) $new_catid;\r
 +              $new_blogid = getBlogIDFromCatID($new_catid);\r
 +              \r
 +              $data = array(\r
 +                      'itemid'                => $itemid,\r
 +                      'destblogid'    => $new_blogid,\r
 +                      'destcatid'             => $new_catid\r
 +              );\r
 +              $manager->notify('PreMoveItem', $data);\r
 +              \r
 +              // update item table\r
 +              $query = "UPDATE %s SET iblog=%d, icat=%d WHERE inumber=%d";\r
 +              $query = sprintf($query, sql_table('item'), $new_blogid, $new_catid, $itemid);\r
 +              DB::execute($query);\r
 +              \r
 +              // update comments\r
 +              $query = "UPDATE %s SET cblog=%d WHERE citem=%d";\r
 +              $query = sprintf($query, sql_table('comment'), $new_blogid, $itemid);\r
 +              DB::execute($query);\r
 +              \r
 +              $data = array(\r
 +                      'itemid'                => $itemid,\r
 +                      'destblogid'    => $new_blogid,\r
 +                      'destcatid'             => $new_catid\r
 +              );\r
 +              $manager->notify('PostMoveItem', $data);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::delete()\r
 +       * Deletes an item\r
 +       * \r
 +       * @param       integer $itemid\r
 +       * @return      void\r
 +       */\r
 +      static public function delete($itemid)\r
 +      {\r
 +              global $manager, $member;\r
 +              \r
 +              $itemid = (integer) $itemid;\r
 +              \r
 +              // check permission\r
 +              if ( !$member->canAlterItem($itemid) )\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              \r
 +              $manager->notify('PreDeleteItem', array('itemid' => $itemid));\r
 +              \r
 +              // delete item\r
 +              $query = "DELETE FROM %s WHERE inumber=%d;";\r
 +              $query = sprintf($query, sql_table('item'), $itemid);\r
 +              DB::execute($query);\r
 +              \r
 +              // delete the comments associated with the item\r
 +              $query = "DELETE FROM %s WHERE citem=%d;";\r
 +              $query = sprintf($query, sql_table('comment'), $itemid);\r
 +              DB::execute($query);\r
 +              \r
 +              // delete all associated plugin options\r
 +              NucleusPlugin::delete_option_values('item', $itemid);\r
 +              \r
 +              $manager->notify('PostDeleteItem', array('itemid' => $itemid));\r
 +              \r
 +              return 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::exists()\r
 +       * Returns true if there is an item with the given ID\r
 +       *\r
 +       * @static\r
 +       * @param       integer $itemid\r
 +       * @param       boolean $future\r
 +       * @param       boolean $draft\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      static public function exists($itemid, $future, $draft)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $itemid = (integer) $itemid;\r
 +              \r
 +              $query = 'SELECT * FROM %s WHERE inumber=%d';\r
 +              $query = sprintf($query, sql_table('item'), $itemid);\r
 +              \r
 +              if ( !$future )\r
 +              {\r
 +                      $blogid = getBlogIDFromItemID($itemid);\r
 +                      if ( !$blogid )\r
 +                      {\r
 +                              return 0;\r
 +                      }\r
 +                      $blog =& $manager->getBlog($blogid);\r
 +                      $query .= ' AND itime<=' . DB::formatDateTime($blog->getCorrectTime());\r
 +              }\r
 +              \r
 +              if ( !$draft )\r
 +              {\r
 +                      $query .= ' AND idraft=0';\r
 +              }\r
 +              \r
 +              $result = DB::getResult($query);\r
 +              return ( $result->rowCount() != 0 );\r
 +      }\r
 +      \r
 +      /**\r
 +       * Item::createDraftFromRequest()\r
 +       * Tries to create an draft from the data\r
 +       *  in the current request (comes from bookmarklet or admin area)\r
 +       *   Used by xmlHTTPRequest AutoDraft\r
 +       *\r
 +       * Returns an array with status info:\r
 +       * status = 'added', 'error', 'newcategory'\r
 +       *\r
 +       * @static\r
 +       * @param       void\r
 +       * @return      array   (status = added/error/newcategory, message)\r
 +       */\r
 +      static public function createDraftFromRequest()\r
 +      {\r
 +              global $member, $manager;\r
 +              \r
 +              /*\r
 +               * TODO: these values from user agent should be validated but not implemented yet\r
 +               */\r
 +              $i_author       = $member->getID();\r
 +              $i_body         = postVar('body');\r
 +              $i_title        = postVar('title');\r
 +              $i_more         = postVar('more');\r
 +              $i_closed       = intPostVar('closed');\r
 +              $i_catid        = postVar('catid');\r
 +              $i_draft        = 1;\r
 +              $type           = postVar('type');\r
 +              $i_draftid      = intPostVar('draftid');\r
 +              \r
 +              if ( $type == 'edit' )\r
 +              {\r
 +                      $itemid = intPostVar('itemid');\r
 +                      $i_blogid = getBlogIDFromItemID($itemid);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $i_blogid = intPostVar('blogid');\r
 +              }\r
 +              \r
 +              if ( !$member->canAddItem($i_catid) )\r
 +              {\r
 +                      return array('status' => 'error', 'message' => _ERROR_DISALLOWED);\r
 +              }\r
 +              \r
 +              if ( !trim($i_body) )\r
 +              {\r
 +                      return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);\r
 +              }\r
 +              \r
 +              // create new category if needed\r
 +              if ( i18n::strpos($i_catid,'newcat') === 0 )\r
 +              {\r
 +                      // Set in default category\r
 +                      $blog =& $manager->getBlog($i_blogid);\r
 +                      $i_catid = $blog->getDefaultCategory();\r
 +              }\r
 +              else\r
 +              {\r
 +                      // force blogid (must be same as category id)\r
 +                      $i_blogid = getBlogIDFromCatID($i_catid);\r
 +                      $blog =& $manager->getBlog($i_blogid);\r
 +              }\r
 +              \r
 +              $posttime = 0;\r
 +              \r
 +              if ( $i_draftid > 0 )\r
 +              {\r
 +                      self::update($i_draftid, $i_catid, $i_title, $i_body, $i_more, $i_closed, 1, 0, 0);\r
 +                      $itemid = $i_draftid;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft);\r
 +              }\r
 +              \r
 +              return array('status' => 'added', 'draftid' => $itemid);\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: ITEM.php 1877 2012-06-17 07:40:11Z sakamocchi $
+  */
+ /**
+  * A class representing an item
+  *
+  */
+ class Item
+ {
+       /**
+        * Item::$actiontypes
+        * actiontype list for handling items
+        * 
+        * @static
+        */
+       static private $actiontypes = array(
+               'addnow', 'adddraft', 'addfuture', 'edit',
+               'changedate', 'backtodrafts', 'delete'
+       );
+       
+       /**
+        * Item::$itemid
+        * item id
+        * @deprecated
+        */
+       public $itemid;
+       
+       /**
+        * Item::__construct()
+        * Creates a new ITEM object
+        * 
+        * @deprecated
+        * @param integer       $item_id        id for item
+        * @return void
+        */
+       public function __construct($item_id)
+       {
+               $this->itemid = $item_id;
+               return;
+       }
+       
+       /**
+        * Item::getitem()
+        * Returns one item with the specific itemid
+        * 
+        * @static
+        * @param int $item_id
+        * @param bool $allow_draft
+        * @param bool $allow_future
+        * @return mixed
+        */
+       static public function getitem($item_id, $allow_draft, $allow_future)
+       {
+               global $manager;
+               
+               $item_id = (integer) $item_id;
+               
+               $query = 'SELECT ' .
+                       'i.idraft AS draft, ' .
+                       'i.inumber AS itemid, ' .
+                       'i.iclosed AS closed, ' .
+                       'i.ititle AS title, ' .
+                       'i.ibody AS body, ' .
+                       'm.mname AS author, ' .
+                       'i.iauthor AS authorid, ' .
+                       'i.itime, ' .
+                       'i.imore AS more, ' .
+                       'i.ikarmapos AS karmapos, ' .
+                       'i.ikarmaneg AS karmaneg, ' .
+                       'i.icat AS catid, ' .
+                       'i.iblog AS blogid ' .
+                       'FROM %s AS i, %s AS m, %s AS b ' .
+                       'WHERE i.inumber = %d ' .
+                       'AND i.iauthor = m.mnumber ' .
+                       'AND i.iblog = b.bnumber ';
+               
+               $query = sprintf($query, sql_table('item'), sql_table('member'), sql_table('blog'), $item_id);
+               
+               if ( !$allow_draft )
+               {
+                       $query .= "AND i.idraft = 0 ";
+               }
+               
+               if ( !$allow_future )
+               {
+                       $blog =& $manager->getBlog(getBlogIDFromItemID($item_id));
+                       $query .= 'AND i.itime <= ' . DB::formatDateTime($blog->getCorrectTime());
+               }
+               
+               $query .= ' LIMIT 1';
+               $result = DB::getResult($query);
+               
+               if ( $result->rowCount() != 1 )
+               {
+                       return 0;
+               }
+               
+               $aItemInfo = $result->fetch(PDO::FETCH_ASSOC);
+               $aItemInfo['timestamp'] = strtotime($aItemInfo['itime']);
+               return $aItemInfo;
+       }
+       
+       /**
+        * Item::createFromRequest()
+        * Tries to create an item from the data in the current request (comes from
+        * bookmarklet or admin area
+        *
+        * @static
+        * @param       void
+        * @return      array   (status = added/error/newcategory, message)
+        * 
+        */
+       static public function createFromRequest()
+       {
+               global $member, $manager;
+               
+               /*
+                * TODO: these values from user agent should be validated but not implemented yet
+                */
+               $i_author               = $member->getID();
+               $i_body                 = postVar('body');
+               $i_title                = postVar('title');
+               $i_more                 = postVar('more');
+               $i_actiontype   = postVar('actiontype');
+               $i_closed               = intPostVar('closed');
+               $i_hour                 = intPostVar('hour');
+               $i_minutes              = intPostVar('minutes');
+               $i_month                = intPostVar('month');
+               $i_day                  = intPostVar('day');
+               $i_year                 = intPostVar('year');
+               $i_catid                = postVar('catid');
+               $i_draftid              = intPostVar('draftid');
+               
+               if ( !$member->canAddItem($i_catid) )
+               {
+                       return array('status' => 'error', 'message' => _ERROR_DISALLOWED);
+               }
+               
+               if ( !in_array($i_actiontype, self::$actiontypes) )
+               {
+                       $i_actiontype = 'addnow';
+               }
+               
+               $i_draft = (integer) ( $i_actiontype == 'adddraft' );
+               
+               if ( !trim($i_body) )
+               {
+                       return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);
+               }
+               
+               // create new category if needed
+               if ( i18n::strpos($i_catid, 'newcat') === 0 )
+               {
+                       // get blogid
+                       list($i_blogid) = sscanf($i_catid, "newcat-%d");
+                       
+                       // create
+                       $blog =& $manager->getBlog($i_blogid);
+                       $i_catid = $blog->createNewCategory();
+                       
+                       // show error when sth goes wrong
+                       if ( !$i_catid )
+                       {
+                               return array('status' => 'error','message' => 'Could not create new category');
+                       }
+               }
+               else
+               {
+                       // force blogid (must be same as category id)
+                       $i_blogid = getBlogIDFromCatID($i_catid);
+                       $blog =& $manager->getBlog($i_blogid);
+               }
+               
+               if ( $i_actiontype == 'addfuture' )
+               {
+                       $posttime = mktime($i_hour, $i_minutes, 0, $i_month, $i_day, $i_year);
+                       
+                       // make sure the date is in the future, unless we allow past dates
+                       if ( (!$blog->allowPastPosting()) && ($posttime < $blog->getCorrectTime()) )
+                       {
+                               $posttime = $blog->getCorrectTime();
+                       }
+               }
+               else
+               {
+                       if ( !$i_draft )
+                       {
+                               $posttime = $blog->getCorrectTime();
+                       }
+                       else
+                       {
+                               $posttime = 0;
+                       }
+               }
+               
+               if ( $posttime > $blog->getCorrectTime() )
+               {
+                       $posted = 0;
+                       $blog->setFuturePost();
+               }
+               else
+               {
+                       $posted = 1;
+               }
+               
+               $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft, $posted);
+               
+               //Setting the itemOptions
+               $aOptions = requestArray('plugoption');
+               NucleusPlugin::apply_plugin_options($aOptions, $itemid);
+               $data = array(
+                       'context'       => 'item',
+                       'itemid'        => $itemid,
+                       'item'          => array(
+                               'title'         => $i_title,
+                               'body'          => $i_body,
+                               'more'          => $i_more,
+                               'closed'        => $i_closed,
+                               'catid'         => $i_catid
+                       )
+               );
+               
+               $manager->notify('PostPluginOptionsUpdate', $data);
+               
+               if ( $i_draftid > 0 )
+               {
+                       // delete permission is checked inside Item::delete()
+                       self::delete($i_draftid);
+               }
+               
+               // success
+               if ( $i_catid != intRequestVar('catid') )
+               {
+                       return array('status' => 'newcategory', 'itemid' => $itemid, 'catid' => $i_catid);
+               }
+               
+               return array('status' => 'added', 'itemid' => $itemid);
+       }
+       
+       /**
+        * Item::update()
+        * Updates an item
+        *
+        * @static
+        * @param       integer $itemid item id
+        * @param       integer $catid  category id
+        * @param       string  $title  title
+        * @param       string  $body   body text
+        * @param       string  $more   more text
+        * @param       boolean $closed closed or not
+        * @param       boolean $wasdraft       previously draft or not
+        * @param       boolean $publish        published or not
+        * @param       timestamp       $timestamp      timestamp
+        * @return      void
+        */
+       static public function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)
+       {
+               global $manager;
+               
+               $itemid = (integer) $itemid;
+               $closed = (boolean) $closed;
+               
+               // get destination blogid
+               $new_blogid = getBlogIDFromCatID($catid);
+               $old_blogid = getBlogIDFromItemID($itemid);
+               
+               // move will be done on end of method
+               $moveNeeded = 0;
+               if ( $new_blogid != $old_blogid )
+               {
+                       $moveNeeded = 1;
+               }
+               
+               $blog =& $manager->getBlog($new_blogid);
+               
+               // begin if: convert line breaks to <br/>
+               if ( $blog->convertBreaks() )
+               {
+                       $body = addBreaks($body);
+                       $more = addBreaks($more);
+               }
+               
+               // call plugins
+               $data = array(
+                       'itemid'        => $itemid,
+                       'title'         => &$title,
+                       'body'          => &$body,
+                       'more'          => &$more,
+                       'blog'          => &$blog,
+                       'closed'        => &$closed,
+                       'catid'         => &$catid
+               );
+               $manager->notify('PreUpdateItem', $data);
+               
+               // update item itself
+               $query =  'UPDATE ' . sql_table('item')
+                               . ' SET'
+                               . ' ibody = ' . DB::quoteValue($body) . ','
+                               . ' ititle = ' . DB::quoteValue($title) . ','
+                               . ' imore = ' . DB::quoteValue($more) . ','
+                               . ' iclosed = ' . intval($closed) . ','
+                               . ' icat = ' . intval($catid);
+               
+               // if we received an updated timestamp that is in the past, but past posting is not allowed,
+               // reject that date change (timestamp = 0 will make sure the current date is kept)
+               if ( (!$blog->allowPastPosting()) && ($timestamp < $blog->getCorrectTime()) )
+               {
+                       $timestamp = 0;
+               }
+               
+               // begin if: post is in the future
+               if ( $timestamp > $blog->getCorrectTime(time()) )
+               {
+                       $isFuture = 1;
+                       $query .= ', iposted = 0';
+               }
+               else
+               {
+                       $isFuture = 0;
+                       $query .= ', iposted = 1';
+               }
+               
+               if ( $wasdraft && $publish )
+               {
+                       // set timestamp to current date only if it's not a future item
+                       // draft items have timestamp == 0
+                       // don't allow timestamps in the past (unless otherwise defined in blogsettings)
+                       $query .= ', idraft = 0';
+                       
+                       if ( $timestamp == 0 )
+                       {
+                               $timestamp = $blog->getCorrectTime();
+                       }
+                       
+                       // send new item notification
+                       if ( !$isFuture && $blog->getNotifyAddress() && $blog->notifyOnNewItem() )
+                       {
+                               $blog->sendNewItemNotification($itemid, $title, $body);
+                       }
+               }
+               
+               // save back to drafts
+               if ( !$wasdraft && !$publish )
+               {
+                       $query .= ', idraft = 1';
+                       // set timestamp back to zero for a draft
+                       $query .= ', itime = ' . DB::formatDateTime($timestamp);
+               }
+               
+               // update timestamp when needed
+               if ( $timestamp != 0 )
+               {
+                       $query .= ', itime = ' . DB::formatDateTime($timestamp);
+               }
+               
+               // make sure the correct item is updated
+               $query .= ' WHERE inumber = ' . $itemid;
+               
+               // off we go!
+               DB::execute($query);
+               $data = array('itemid' => $itemid);
+               $manager->notify('PostUpdateItem', $data);
+               
+               // when needed, move item and comments to new blog
+               if ( $moveNeeded )
+               {
+                       self::move($itemid, $catid);
+               }
+               
+               //update the itemOptions
+               $aOptions = requestArray('plugoption');
+               NucleusPlugin::apply_plugin_options($aOptions);
+               $data = array(
+                       'context'       => 'item',
+                       'itemid'        => $itemid,
+                       'item'          => array(
+                               'title'         => $title,
+                               'body'          => $body,
+                               'more'          => $more,
+                               'closed'        => $closed,
+                               'catid'         => $catid
+                       )
+               );
+               $manager->notify('PostPluginOptionsUpdate', $data);
+               return;
+       }
+       
+       /**
+        * Item::move()
+        * Move an item to another blog (no checks)
+        *
+        * @static
+        * @param       integer $itemid
+        * @param       integer $new_catid
+        * @return      void
+        */
+       static public function move($itemid, $new_catid)
+       {
+               global $manager;
+               
+               $itemid         = (integer) $itemid;
+               $new_catid      = (integer) $new_catid;
+               $new_blogid     = getBlogIDFromCatID($new_catid);
+               
+               $data = array(
+                       'itemid'                => $itemid,
+                       'destblogid'    => $new_blogid,
+                       'destcatid'             => $new_catid
+               );
+               $manager->notify('PreMoveItem', $data);
+               
+               // update item table
+               $query = "UPDATE %s SET iblog=%d, icat=%d WHERE inumber=%d";
+               $query = sprintf($query, sql_table('item'), $new_blogid, $new_catid, $itemid);
+               DB::execute($query);
+               
+               // update comments
+               $query = "UPDATE %s SET cblog=%d WHERE citem=%d";
+               $query = sprintf($query, sql_table('comment'), $new_blogid, $itemid);
+               DB::execute($query);
+               
+               $data = array(
+                       'itemid'                => $itemid,
+                       'destblogid'    => $new_blogid,
+                       'destcatid'             => $new_catid
+               );
+               $manager->notify('PostMoveItem', $data);
+               return;
+       }
+       
+       /**
+        * Item::delete()
+        * Deletes an item
+        * 
+        * @param       integer $itemid
+        * @return      void
+        */
+       static public function delete($itemid)
+       {
+               global $manager, $member;
+               
+               $itemid = (integer) $itemid;
+               
+               // check permission
+               if ( !$member->canAlterItem($itemid) )
+               {
+                       return 1;
+               }
+               $data = array('itemid' => $itemid);
+               $manager->notify('PreDeleteItem', $data);
+               
+               // delete item
+               $query = "DELETE FROM %s WHERE inumber=%d;";
+               $query = sprintf($query, sql_table('item'), $itemid);
+               DB::execute($query);
+               
+               // delete the comments associated with the item
+               $query = "DELETE FROM %s WHERE citem=%d;";
+               $query = sprintf($query, sql_table('comment'), $itemid);
+               DB::execute($query);
+               
+               // delete all associated plugin options
+               NucleusPlugin::delete_option_values('item', $itemid);
+               
+               $manager->notify('PostDeleteItem', $data);
+               
+               return 0;
+       }
+       
+       /**
+        * Item::exists()
+        * Returns true if there is an item with the given ID
+        *
+        * @static
+        * @param       integer $itemid
+        * @param       boolean $future
+        * @param       boolean $draft
+        * @return      boolean exists or not
+        */
+       static public function exists($itemid, $future, $draft)
+       {
+               global $manager;
+               
+               $itemid = (integer) $itemid;
+               
+               $query = 'SELECT * FROM %s WHERE inumber=%d';
+               $query = sprintf($query, sql_table('item'), $itemid);
+               
+               if ( !$future )
+               {
+                       $blogid = getBlogIDFromItemID($itemid);
+                       if ( !$blogid )
+                       {
+                               return 0;
+                       }
+                       $blog =& $manager->getBlog($blogid);
+                       $query .= ' AND itime<=' . DB::formatDateTime($blog->getCorrectTime());
+               }
+               
+               if ( !$draft )
+               {
+                       $query .= ' AND idraft=0';
+               }
+               
+               $result = DB::getResult($query);
+               return ( $result->rowCount() != 0 );
+       }
+       
+       /**
+        * Item::createDraftFromRequest()
+        * Tries to create an draft from the data
+        *  in the current request (comes from bookmarklet or admin area)
+        *   Used by xmlHTTPRequest AutoDraft
+        *
+        * Returns an array with status info:
+        * status = 'added', 'error', 'newcategory'
+        *
+        * @static
+        * @param       void
+        * @return      array   (status = added/error/newcategory, message)
+        */
+       static public function createDraftFromRequest()
+       {
+               global $member, $manager;
+               
+               /*
+                * TODO: these values from user agent should be validated but not implemented yet
+                */
+               $i_author       = $member->getID();
+               $i_body         = postVar('body');
+               $i_title        = postVar('title');
+               $i_more         = postVar('more');
+               $i_closed       = intPostVar('closed');
+               $i_catid        = postVar('catid');
+               $i_draft        = 1;
+               $type           = postVar('type');
+               $i_draftid      = intPostVar('draftid');
+               
+               if ( $type == 'edit' )
+               {
+                       $itemid = intPostVar('itemid');
+                       $i_blogid = getBlogIDFromItemID($itemid);
+               }
+               else
+               {
+                       $i_blogid = intPostVar('blogid');
+               }
+               
+               if ( !$member->canAddItem($i_catid) )
+               {
+                       return array('status' => 'error', 'message' => _ERROR_DISALLOWED);
+               }
+               
+               if ( !trim($i_body) )
+               {
+                       return array('status' => 'error', 'message' => _ERROR_NOEMPTYITEMS);
+               }
+               
+               // create new category if needed
+               if ( i18n::strpos($i_catid,'newcat') === 0 )
+               {
+                       // Set in default category
+                       $blog =& $manager->getBlog($i_blogid);
+                       $i_catid = $blog->getDefaultCategory();
+               }
+               else
+               {
+                       // force blogid (must be same as category id)
+                       $i_blogid = getBlogIDFromCatID($i_catid);
+                       $blog =& $manager->getBlog($i_blogid);
+               }
+               
+               $posttime = 0;
+               
+               if ( $i_draftid > 0 )
+               {
+                       self::update($i_draftid, $i_catid, $i_title, $i_body, $i_more, $i_closed, 1, 0, 0);
+                       $itemid = $i_draftid;
+               }
+               else
+               {
+                       $itemid = $blog->additem($i_catid, $i_title, $i_body, $i_more, $i_blogid, $i_author, $posttime, $i_closed, $i_draft);
+               }
+               
+               return array('status' => 'added', 'draftid' => $itemid);
+       }
+ }
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ITEMACTIONS.php 1757 2012-04-15 09:02:32Z sakamocchi $
++=======
+  * @version $Id: ITEMACTIONS.php 1886 2012-06-17 08:27:27Z sakamocchi $
++>>>>>>> skinnable-master
   */
  class ItemActions extends BaseActions
  {
        /* actions defined in BodyAction class */
                'image',
                'media',
++<<<<<<< HEAD
 +              'popup',
++=======
+               'popup'
++>>>>>>> skinnable-master
                );
        
        /**
                array_shift($params);
                
                // add item reference (array_unshift didn't work)
++<<<<<<< HEAD
 +              $params = array_merge(array(&$this->currentItem),$params);
 +              
 +              call_user_func_array(array(&$plugin,'doTemplateVar'), $params);
++=======
+               $target = array(&$this->currentItem);
+               $params = array_merge($target,$params);
+               
+               call_user_func_array(array($plugin,'doTemplateVar'), $params);
++>>>>>>> skinnable-master
                return;
        }
        
                $handler->setCurrentItem($this->currentItem);
                
                $parser = new Parser($handler);
++<<<<<<< HEAD
 +              $parser->parse($handler->highlight($data));
++=======
+               $highlight = $handler->highlight($data);
+               $parser->parse($highlight);
++>>>>>>> skinnable-master
                return;
        }
        
                                $condition = ($blog && ($blog->getSetting($name) == $value));
                                break;
                        case 'itemblogsetting':
++<<<<<<< HEAD
 +                              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
 +                              $condition = ($b && ($b->getSetting($name) == $value));
++=======
+                               $item =& $manager->getItem($this->currentItem['itemid'], 1, 1);
+                               $t_blog =& $manager->getBlog($item['blogid']);
+                               $condition = ($t_blog && ($t_blog->getSetting($name) == $value));
++>>>>>>> skinnable-master
                                break;
                        case 'loggedin':
                                $condition = $member->isLoggedIn();
        {
                global $member, $manager;
                
++<<<<<<< HEAD
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
 +              
++=======
++>>>>>>> skinnable-master
                // when no parameter is defined, just check if author is current visitor
                if ( ($key != 'isadmin' && $key != 'name') || ($key == 'name' && $value == '') )
                {
                // check if author is admin
                if ( ($key == 'isadmin') )
                {
++<<<<<<< HEAD
 +                      $aid = intval($this->currentItem['authorid']);
 +                      $blogid = intval($b->getID());                  
 +                      $amember =& $manager->getMember($aid);
 +                      if ( $amember->isAdmin() )
 +                      {
 +                              return TRUE;
 +                      }
 +                      return (boolean) $amember->isBlogAdmin($blogid);
++=======
+                       $i_author =& $manager->getMember($this->currentItem['authorid']);
+                       if ( $i_author->isAdmin() )
+                       {
+                               return TRUE;
+                       }
+                       return (boolean) $i_author->isBlogAdmin($this->currentItem['blogid']);
++>>>>>>> skinnable-master
                }
                
                return FALSE;
        {
                global $catid, $manager;
                
++<<<<<<< HEAD
 +              $b =& $manager->getBlog(getBlogIDFromItemID($this->currentItem['itemid']));
++=======
+               $blog =& $manager->getBlog($this->currentItem['blogid']);
++>>>>>>> skinnable-master
                
                // when no parameter is defined, just check if a category is selected
                if ( ($key != 'catname' && $key != 'catid') || ($value == '') )
                {
++<<<<<<< HEAD
 +                      return (boolean) $b->isValidCategory($catid);
++=======
+                       return (boolean) $blog->isValidCategory($catid);
++>>>>>>> skinnable-master
                }
                
                $icatid = $this->currentItem['catid'];
                // check category name
                if ( $key == 'catname' )
                {
++<<<<<<< HEAD
 +                      $value = $b->getCategoryIdFromName($value);
 +                      if ( $value == $icatid )
 +                      {
 +                              return (boolean) $b->isValidCategory($icatid);
++=======
+                       $value = $blog->getCategoryIdFromName($value);
+                       if ( $value == $icatid )
+                       {
+                               return (boolean) $blog->isValidCategory($icatid);
++>>>>>>> skinnable-master
                        }
                }
                
                // check category id
                if ( ($key == 'catid') && ($value == $icatid) )
                {
++<<<<<<< HEAD
 +                      return (boolean) $b->isValidCategory($icatid);
++=======
+                       return (boolean) $blog->isValidCategory($icatid);
++>>>>>>> skinnable-master
                }
                return FALSE;
        }
                $params = func_get_args();
                array_shift($params);
                
++<<<<<<< HEAD
 +              return (boolean) call_user_func_array(array(&$plugin, 'doIf'), $params);
++=======
+               return (boolean) call_user_func_array(array($plugin, 'doIf'), $params);
++>>>>>>> skinnable-master
        }
  }
 -?>
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Class representing the karma votes for a certain item\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: KARMA.php 1470 2010-11-29 22:10:16Z ftruscot $\r
 + */\r
 +class Karma\r
 +{\r
 +      // id of item about which this object contains information\r
 +      var $itemid;\r
 +      \r
 +      // indicates if the karma vote info has already been intialized from the DB\r
 +      var $inforead;\r
 +      \r
 +      // amount of positive/negative votes\r
 +      var $karmapos;\r
 +      var $karmaneg;\r
 +      \r
 +      function KARMA($itemid, $initpos = 0, $initneg = 0, $initread = 0) {\r
 +              // itemid\r
 +              $this->itemid = intval($itemid);\r
 +\r
 +              // have we read the karma info yet?\r
 +              $this->inforead = intval($initread);\r
 +\r
 +              // number of positive and negative votes\r
 +              $this->karmapos = intval($initpos);\r
 +              $this->karmaneg = intval($initneg);\r
 +      }\r
 +\r
 +      function getNbPosVotes() {\r
 +              if (!$this->inforead) $this->readFromDatabase();\r
 +              return $this->karmapos;\r
 +      }\r
 +      function getNbNegVotes() {\r
 +              if (!$this->inforead) $this->readFromDatabase();\r
 +              return $this->karmaneg;\r
 +      }\r
 +      function getNbOfVotes() {\r
 +              if (!$this->inforead) $this->readFromDatabase();\r
 +              return ($this->karmapos + $this->karmaneg);\r
 +      }\r
 +      function getTotalScore() {\r
 +              if (!$this->inforead) $this->readFromDatabase();\r
 +              return ($this->karmapos - $this->karmaneg);\r
 +      }\r
 +\r
 +      function setNbPosVotes($val) {\r
 +              $this->karmapos = intval($val);\r
 +      }\r
 +      function setNbNegVotes($val) {\r
 +              $this->karmaneg = intval($val);\r
 +      }\r
 +\r
 +\r
 +      // adds a positive vote\r
 +      function votePositive() {\r
 +              $newKarma = $this->getNbPosVotes() + 1;\r
 +              $this->setNbPosVotes($newKarma);\r
 +              $this->writeToDatabase();\r
 +              $this->saveIP();\r
 +      }\r
 +\r
 +      // adds a negative vote\r
 +      function voteNegative() {\r
 +              $newKarma = $this->getNbNegVotes() + 1;\r
 +              $this->setNbNegVotes($newKarma);\r
 +              $this->writeToDatabase();\r
 +              $this->saveIP();\r
 +      }\r
 +\r
 +\r
 +\r
 +      // these methods shouldn't be called directly\r
 +      function readFromDatabase() {\r
 +              $query = 'SELECT ikarmapos, ikarmaneg FROM '.sql_table('item').' WHERE inumber=' . $this->itemid;\r
 +              $res = DB::getRow($query);\r
 +\r
 +              $this->karmapos = $res['ikarmapos'];\r
 +              $this->karmaneg = $res['ikarmaneg'];\r
 +              $this->inforead = 1;\r
 +      }\r
 +\r
 +\r
 +      function writeToDatabase() {\r
 +              $query = 'UPDATE '.sql_table('item').' SET ikarmapos=' . $this->karmapos . ', ikarmaneg='.$this->karmaneg.' WHERE inumber=' . $this->itemid;\r
 +              DB::execute($query);\r
 +      }\r
 +\r
 +      // checks if a vote is still allowed for an IP\r
 +      function isVoteAllowed($ip) {\r
 +              $query = 'SELECT * FROM '.sql_table('karma')." WHERE itemid={$this->itemid} and ip=". DB::quoteValue($ip);\r
 +              $res = DB::getResult($query);\r
 +              return ($res->rowCount() == 0);\r
 +      }\r
 +\r
 +      // save IP in database so no multiple votes are possible\r
 +      function saveIP() {\r
 +              $query = 'INSERT INTO ' . sql_table('karma') .' (itemid, ip) VALUES (' . $this->itemid . ','. DB::quoteValue(serverVar('REMOTE_ADDR')) .')';\r
 +              DB::execute($query);\r
 +      }\r
 +}\r
 +\r
 +?>\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Class representing the karma votes for a certain item
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: KARMA.php 1812 2012-05-01 14:59:07Z sakamocchi $
+  */
+ class Karma
+ {
+       // id of item about which this object contains information
+       var $itemid;
+       
+       // indicates if the karma vote info has already been intialized from the DB
+       var $inforead;
+       
+       // amount of positive/negative votes
+       var $karmapos;
+       var $karmaneg;
+       
+       function KARMA($itemid, $initpos = 0, $initneg = 0, $initread = 0) {
+               // itemid
+               $this->itemid = intval($itemid);
+               // have we read the karma info yet?
+               $this->inforead = intval($initread);
+               // number of positive and negative votes
+               $this->karmapos = intval($initpos);
+               $this->karmaneg = intval($initneg);
+       }
+       function getNbPosVotes() {
+               if (!$this->inforead) $this->readFromDatabase();
+               return $this->karmapos;
+       }
+       function getNbNegVotes() {
+               if (!$this->inforead) $this->readFromDatabase();
+               return $this->karmaneg;
+       }
+       function getNbOfVotes() {
+               if (!$this->inforead) $this->readFromDatabase();
+               return ($this->karmapos + $this->karmaneg);
+       }
+       function getTotalScore() {
+               if (!$this->inforead) $this->readFromDatabase();
+               return ($this->karmapos - $this->karmaneg);
+       }
+       function setNbPosVotes($val) {
+               $this->karmapos = intval($val);
+       }
+       function setNbNegVotes($val) {
+               $this->karmaneg = intval($val);
+       }
+       // adds a positive vote
+       function votePositive() {
+               $newKarma = $this->getNbPosVotes() + 1;
+               $this->setNbPosVotes($newKarma);
+               $this->writeToDatabase();
+               $this->saveIP();
+       }
+       // adds a negative vote
+       function voteNegative() {
+               $newKarma = $this->getNbNegVotes() + 1;
+               $this->setNbNegVotes($newKarma);
+               $this->writeToDatabase();
+               $this->saveIP();
+       }
+       // these methods shouldn't be called directly
+       function readFromDatabase() {
+               $query = 'SELECT ikarmapos, ikarmaneg FROM '.sql_table('item').' WHERE inumber=' . $this->itemid;
+               $res = DB::getRow($query);
+               $this->karmapos = $res['ikarmapos'];
+               $this->karmaneg = $res['ikarmaneg'];
+               $this->inforead = 1;
+       }
+       function writeToDatabase() {
+               $query = 'UPDATE '.sql_table('item').' SET ikarmapos=' . $this->karmapos . ', ikarmaneg='.$this->karmaneg.' WHERE inumber=' . $this->itemid;
+               DB::execute($query);
+       }
+       // checks if a vote is still allowed for an IP
+       function isVoteAllowed($ip) {
+               $query = 'SELECT * FROM '.sql_table('karma')." WHERE itemid={$this->itemid} and ip=". DB::quoteValue($ip);
+               $res = DB::getResult($query);
+               return ($res->rowCount() == 0);
+       }
+       // save IP in database so no multiple votes are possible
+       function saveIP() {
+               $query = 'INSERT INTO ' . sql_table('karma') .' (itemid, ip) VALUES (' . $this->itemid . ','. DB::quoteValue(serverVar('REMOTE_ADDR')) .')';
+               DB::execute($query);
+       }
+ }
++?>
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2009 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * This class makes sure each item/weblog/comment object gets requested from\r
 + * the database only once, by keeping them in a cache. The class also acts as\r
 + * a dynamic classloader, loading classes _only_ when they are first needed,\r
 + * hoping to diminish execution time\r
 + *\r
 + * The class is a singleton, meaning that there will be only one object of it\r
 + * active at all times. The object can be requested using Manager::instance()\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: MANAGER.php 1731 2012-04-08 15:10:35Z sakamocchi $\r
 + */\r
 +class Manager\r
 +{\r
 +      /**\r
 +       * Cached ITEM, BLOG, PLUGIN, KARMA and MEMBER objects. When these objects are requested\r
 +       * through the global $manager object (getItem, getBlog, ...), only the first call\r
 +       * will create an object. Subsequent calls will return the same object.\r
 +       *\r
 +       * The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used\r
 +       * rather than an ID)\r
 +       */\r
 +      private $items;\r
 +      private $blogs;\r
 +      private $plugins;\r
 +      private $karma;\r
 +      private $templates;\r
 +      private $members;\r
 +      \r
 +      /**\r
 +       * cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName)\r
 +       * e.g. which plugins exists?\r
 +       *\r
 +       * $cachedInfo['installedPlugins'] = array($pid -> $name)\r
 +       */\r
 +      private $cachedInfo;\r
 +      \r
 +      /**\r
 +       * The plugin subscriptionlist\r
 +       *\r
 +       * The subcription array has the following structure\r
 +       *              $subscriptions[$EventName] = array containing names of plugin classes to be\r
 +       *                                                                       notified when that event happens\r
 +       * \r
 +       * NOTE: this is referred by Comments::addComment() for spamcheck API\r
 +       * TODO: we should add new methods to get this\r
 +       */\r
 +      public $subscriptions;\r
 +      \r
 +      /**\r
 +       * Ticket functions. These are uses by the admin area to make it impossible to simulate certain GET/POST\r
 +       * requests. tickets are user specific\r
 +       */\r
 +      private $currentRequestTicket = '';\r
 +      \r
 +      /**\r
 +       * Returns the only instance of this class. Creates the instance if it\r
 +       * does not yet exists. Users should use this function as\r
 +       * $manager =& Manager::instance(); to get a reference to the object\r
 +       * instead of a copy\r
 +       */\r
 +      public function &instance()\r
 +      {\r
 +              static $instance = array();\r
 +              if ( empty($instance) )\r
 +              {\r
 +                      $instance[0] = new Manager();\r
 +              }\r
 +              return $instance[0];\r
 +      }\r
 +      \r
 +      /**\r
 +       * The constructor of this class initializes the object caches\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              $this->items = array();\r
 +              $this->blogs = array();\r
 +              $this->plugins = array();\r
 +              $this->karma = array();\r
 +              $this->parserPrefs = array();\r
 +              $this->cachedInfo = array();\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the requested item object. If it is not in the cache, it will\r
 +       * first be loaded and then placed in the cache.\r
 +       * Intended use: $item =& $manager->getItem(1234)\r
 +       */\r
 +      public function &getItem($itemid, $allowdraft, $allowfuture)\r
 +      {\r
 +              $item =& $this->items[$itemid];\r
 +              \r
 +              // check the draft and future rules if the item was already cached\r
 +              if ( $item )\r
 +              {\r
 +                      if ( (!$allowdraft) && ($item['draft']) )\r
 +                      {\r
 +                              return 0;\r
 +                      }\r
 +                      \r
 +                      $blog =& $this->getBlog(getBlogIDFromItemID($itemid));\r
 +                      \r
 +                      if ( (!$allowfuture) && ($item['timestamp'] > $blog->getCorrectTime()) )\r
 +                      {\r
 +                              return 0;\r
 +                      }\r
 +              }\r
 +              \r
 +              if ( !$item )\r
 +              {\r
 +                      // load class if needed\r
 +                      $this->loadClass('ITEM');\r
 +                      // load item object\r
 +                      $item = Item::getitem($itemid, $allowdraft, $allowfuture);\r
 +                      $this->items[$itemid] = $item;\r
 +              }\r
 +              return $item;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Loads a class if it has not yet been loaded\r
 +       */\r
 +      public function loadClass($name)\r
 +      {\r
 +              $this->_loadClass($name, $name . '.php');\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if an item exists\r
 +       */\r
 +      public function existsItem($id,$future,$draft)\r
 +      {\r
 +              $this->_loadClass('ITEM','ITEM.php');\r
 +              return Item::exists($id,$future,$draft);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a category exists\r
 +       */\r
 +      public function existsCategory($id)\r
 +      {\r
 +              return (DB::getValue('SELECT COUNT(*) as result FROM '.sql_table('category').' WHERE catid='.intval($id)) > 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the blog object for a given blogid\r
 +       */\r
 +      public function &getBlog($blogid)\r
 +      {\r
 +              $blog =& $this->blogs[$blogid];\r
 +              \r
 +              if ( !$blog )\r
 +              {\r
 +                      // load class if needed\r
 +                      $this->_loadClass('BLOG','BLOG.php');\r
 +                      // load blog object\r
 +                      $blog = new Blog($blogid);\r
 +                      $this->blogs[$blogid] =& $blog;\r
 +              }\r
 +              return $blog;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a blog exists\r
 +       */\r
 +      public function existsBlog($name)\r
 +      {\r
 +              $this->_loadClass('BLOG','BLOG.php');\r
 +              return Blog::exists($name);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a blog id exists\r
 +       */\r
 +      public function existsBlogID($id)\r
 +      {\r
 +              $this->_loadClass('BLOG','BLOG.php');\r
 +              return Blog::existsID($id);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns a previously read template\r
 +       */\r
 +      public function &getTemplate($templateName)\r
 +      {\r
 +              $template =& $this->templates[$templateName];\r
 +              \r
 +              if ( !$template )\r
 +              {\r
 +                      $template = Template::read($templateName);\r
 +                      $this->templates[$templateName] =& $template;\r
 +              }\r
 +              return $template;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns a KARMA object (karma votes)\r
 +       */\r
 +      public function &getKarma($itemid)\r
 +      {\r
 +              $karma =& $this->karma[$itemid];\r
 +              \r
 +              if ( !$karma )\r
 +              {\r
 +                      // load class if needed\r
 +                      $this->_loadClass('KARMA','KARMA.php');\r
 +                      // create KARMA object\r
 +                      $karma = new Karma($itemid);\r
 +                      $this->karma[$itemid] =& $karma;\r
 +              }\r
 +              return $karma;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns a MEMBER object\r
 +       */\r
 +      public function &getMember($memberid)\r
 +      {\r
 +              $mem =& $this->members[$memberid];\r
 +              \r
 +              if ( !$mem )\r
 +              {\r
 +                      // load class if needed\r
 +                      $this->_loadClass('MEMBER','MEMBER.php');\r
 +                      // create MEMBER object\r
 +                      $mem =& Member::createFromID($memberid);\r
 +                      $this->members[$memberid] =& $mem;\r
 +              }\r
 +              return $mem;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Set the global parser preferences\r
 +       */\r
 +      public function setParserProperty($name, $value)\r
 +      {\r
 +              $this->parserPrefs[$name] = $value;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Get the global parser preferences\r
 +       */\r
 +      public function getParserProperty($name)\r
 +      {\r
 +              return $this->parserPrefs[$name];\r
 +      }\r
 +      \r
 +      /**\r
 +       * A helper function to load a class\r
 +       * \r
 +       *      private\r
 +       */\r
 +      private function _loadClass($name, $filename)\r
 +      {\r
 +              if ( !class_exists($name) )\r
 +              {\r
 +                              global $DIR_LIBS;\r
 +                              include($DIR_LIBS . $filename);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::_loadPlugin()\r
 +       * loading a certain plugin\r
 +       * \r
 +       * @param       string $name plugin name\r
 +       * @return      void\r
 +       */\r
 +      private function _loadPlugin($name)\r
 +      {\r
 +              global $DIR_PLUGINS, $MYSQL_HANDLER, $MYSQL_PREFIX;\r
 +              \r
 +              if ( class_exists($name) )\r
 +              {\r
 +                      return;\r
 +              }\r
 +              \r
 +              $fileName = "{$DIR_PLUGINS}{$name}.php";\r
 +              \r
 +              if ( !file_exists($fileName) )\r
 +              {\r
 +                      if ( !defined('_MANAGER_PLUGINFILE_NOTFOUND') )\r
 +                      {\r
 +                              define('_MANAGER_PLUGINFILE_NOTFOUND', 'Plugin %s was not loaded (File not found)');\r
 +                      }\r
 +                      ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOTFOUND, $name)); \r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // load plugin\r
 +              include($fileName);\r
 +              \r
 +              // check if class exists (avoid errors in eval'd code)\r
 +              if ( !class_exists($name) )\r
 +              {\r
 +                      ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOCLASS, $name));\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // add to plugin array\r
 +              $this->plugins[$name] = new $name();\r
 +              \r
 +              // get plugid\r
 +              $this->plugins[$name]->setID($this->getPidFromName($name));\r
 +              \r
 +              // unload plugin if a prefix is used and the plugin cannot handle this\r
 +              if ( ($MYSQL_PREFIX != '')\r
 +                && !$this->plugins[$name]->supportsFeature('SqlTablePrefix') )\r
 +              {\r
 +                      unset($this->plugins[$name]);\r
 +                      ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINTABLEPREFIX_NOTSUPPORT, $name));\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // unload plugin if using non-mysql handler and plugin does not support it \r
 +              if ( (!in_array('mysql',$MYSQL_HANDLER))\r
 +                && !$this->plugins[$name]->supportsFeature('SqlApi') )\r
 +              {\r
 +                      unset($this->plugins[$name]);\r
 +                      ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINSQLAPI_NOTSUPPORT, $name));\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // call init method\r
 +              $this->plugins[$name]->init();\r
 +              \r
 +              return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Manager:getPlugin()\r
 +       * Returns a PLUGIN object\r
 +       * \r
 +       * @param       string  $name   name of plugin\r
 +       * @return      object  plugin object\r
 +       */\r
 +      public function &getPlugin($name)\r
 +      {\r
 +              // retrieve the name of the plugin in the right capitalisation\r
 +              $name = $this->getUpperCaseName ($name);\r
 +              \r
 +              // get the plugin       \r
 +              $plugin =& $this->plugins[$name]; \r
 +              \r
 +              if ( !$plugin )\r
 +              {\r
 +                      // load class if needed\r
 +                      $this->_loadPlugin($name);\r
 +                      $plugin =& $this->plugins[$name];\r
 +              }\r
 +              return $plugin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::pluginLoaded()\r
 +       * Checks if the given plugin IS loaded or not\r
 +       * \r
 +       * @param       string  $name   name of plugin\r
 +       * @return      object  plugin object\r
 +       */\r
 +      public function &pluginLoaded($name)\r
 +      {\r
 +              $plugin =& $this->plugins[$name];\r
 +              return $plugin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::pidLoaded()\r
 +       * \r
 +       * @param       integer $pid    id for plugin\r
 +       * @return      object  plugin object\r
 +       */\r
 +      public function &pidLoaded($pid)\r
 +      {\r
 +              $plugin=false;\r
 +              reset($this->plugins);\r
 +              while ( list($name) = each($this->plugins) )\r
 +              {\r
 +                      if ( $pid!=$this->plugins[$name]->getId() )\r
 +                      {\r
 +                              continue;\r
 +                      }\r
 +                      $plugin= & $this->plugins[$name];\r
 +                      break;\r
 +              }\r
 +              return $plugin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::pluginInstalled()\r
 +       * checks if the given plugin IS installed or not\r
 +       * \r
 +       * @param       string  $name   name of plugin\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      public function pluginInstalled($name)\r
 +      {\r
 +              $this->_initCacheInfo('installedPlugins');\r
 +              return ($this->getPidFromName($name) != -1);\r
 +      }\r
 +\r
 +      /**\r
 +       * Manager::pidInstalled()\r
 +       * checks if the given plugin IS installed or not\r
 +       * \r
 +       * @param       integer $pid    id of plugin\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      public function pidInstalled($pid)\r
 +      {\r
 +              $this->_initCacheInfo('installedPlugins');\r
 +              return ($this->cachedInfo['installedPlugins'][$pid] != '');\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::getPidFromName()\r
 +       * \r
 +       * @param       string  $name   name of plugin\r
 +       * @return      mixed   id for plugin or -1 if not exists\r
 +       */\r
 +      public function getPidFromName($name)\r
 +      {\r
 +              $this->_initCacheInfo('installedPlugins');\r
 +              foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )\r
 +              {\r
 +                      if (strtolower($pfile) == strtolower($name))\r
 +                      {\r
 +                              return $pid;\r
 +                      }\r
 +              }\r
 +              return -1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::getPluginNameFromPid()\r
 +       * \r
 +       * @param       string  $pid    ID for plugin\r
 +       * @return      string  name of plugin\r
 +       */\r
 +      public function getPluginNameFromPid($pid)\r
 +      {\r
 +              if ( !array_key_exists($pid, $this->cachedInfo['installedPlugins']) )\r
 +              {\r
 +                      $query = 'SELECT pfile FROM %s WHERE pid=%d;';\r
 +                      $query = sprintf($query, sql_table('plugin'), (integer) $pid);\r
 +                      return DB::getValue($query);\r
 +              }\r
 +              return $this->cachedInfo['installedPlugins'][$pid];\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::getUpperCaseName()\r
 +       * Retrieve the name of a plugin in the right capitalisation\r
 +       * \r
 +       * @param       string  $name   name of plugin\r
 +       * @return      string  name according to UpperCamelCase\r
 +       */\r
 +      public function getUpperCaseName ($name)\r
 +      {\r
 +              $this->_initCacheInfo('installedPlugins');\r
 +              foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )\r
 +              {\r
 +                      if ( strtolower($pfile) == strtolower($name) )\r
 +                      {\r
 +                              return $pfile;\r
 +                      }\r
 +              }\r
 +              return -1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::clearCachedInfo()\r
 +       * \r
 +       * @param       string  $what\r
 +       * @return      void\r
 +       */\r
 +      public function clearCachedInfo($what)\r
 +      {\r
 +              unset($this->cachedInfo[$what]);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::_initCacheInfo()\r
 +       * Loads some info on the first call only\r
 +       * \r
 +       * @param       string  $what   'installedPlugins'\r
 +       * @return      void\r
 +       */\r
 +      private function _initCacheInfo($what)\r
 +      {\r
 +              if ( array_key_exists($what, $this->cachedInfo)\r
 +                && is_array($this->cachedInfo[$what]) )\r
 +              {\r
 +                      return;\r
 +              }\r
 +              \r
 +              switch ($what)\r
 +              {\r
 +                      // 'installedPlugins' = array ($pid => $name)\r
 +                      case 'installedPlugins':\r
 +                              $this->cachedInfo['installedPlugins'] = array();\r
 +                              $res = DB::getResult('SELECT pid, pfile FROM ' . sql_table('plugin'));\r
 +                              foreach ( $res as $row )\r
 +                              {\r
 +                                      $this->cachedInfo['installedPlugins'][$row['pid']] = $row['pfile'];\r
 +                              }\r
 +                              break;\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::notify()\r
 +       * A function to notify plugins that something has happened. Only the plugins\r
 +       * that are subscribed to the event will get notified.\r
 +       * Upon the first call, the list of subscriptions will be fetched from the\r
 +       * database. The plugins itsself will only get loaded when they are first needed\r
 +       *\r
 +       * @param       string  $eventName      Name of the event (method to be called on plugins)\r
 +       * @param       string  $data           Can contain any type of data,\r
 +       *                                                              depending on the event type. Usually this is an itemid, blogid, ...\r
 +       *                                                              but it can also be an array containing multiple values\r
 +       * @return      void\r
 +       */\r
 +      public function notify($eventName, $data)\r
 +      {\r
 +              // load subscription list if needed\r
 +              if ( !is_array($this->subscriptions) )\r
 +              {\r
 +                      $this->_loadSubscriptions();\r
 +              }\r
 +              \r
 +              // get listening objects\r
 +              $listeners = false;\r
 +              if ( array_key_exists($eventName, $this->subscriptions)\r
 +                && !empty($this->subscriptions[$eventName]) )\r
 +              {\r
 +                      $listeners = $this->subscriptions[$eventName];\r
 +              }\r
 +              \r
 +              // notify all of them\r
 +              if ( is_array($listeners) )\r
 +              {\r
 +                      foreach( $listeners as $listener )\r
 +                      {\r
 +                              // load class if needed\r
 +                              $this->_loadPlugin($listener);\r
 +                              \r
 +                              // do notify (if method exists)\r
 +                              if ( array_key_exists($listener, $this->plugins)\r
 +                                && !empty($this->plugins[$listener])\r
 +                                && method_exists($this->plugins[$listener], 'event_' . $eventName) )\r
 +                              {\r
 +                                      call_user_func(array(&$this->plugins[$listener],'event_' . $eventName), $data);\r
 +                              }\r
 +                      }\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::_loadSubscriptions()\r
 +       * Loads plugin subscriptions\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function _loadSubscriptions()\r
 +      {\r
 +              // initialize as array\r
 +              $this->subscriptions = array();\r
 +              \r
 +              $query = "SELECT p.pfile as pfile, e.event as event"\r
 +                     . " FROM %s as e, %s as p"\r
 +                     . " WHERE e.pid=p.pid ORDER BY p.porder ASC";\r
 +              $query = sprintf($query, sql_table('plugin_event'), sql_table('plugin'));\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      $pluginName = $row['pfile'];\r
 +                      $eventName = $row['event'];\r
 +                      $this->subscriptions[$eventName][] = $pluginName;\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::getNumberOfSubscribers()\r
 +       * \r
 +       * @param       string  $event  name of events\r
 +       * @return      integer number of event subscriber\r
 +       */\r
 +      public function getNumberOfSubscribers($event)\r
 +      {\r
 +              $query = 'SELECT COUNT(*) as count FROM %s WHERE event=%s;';\r
 +              $query = sprintf($query, sql_table('plugin_event'), DB::quoteValue($event));\r
 +              return (integer) DB::getValue($query);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::addTicketToUrl()\r
 +       * GET requests: Adds ticket to URL (URL should NOT be html-encoded!, ticket is added at the end)\r
 +       * \r
 +       * @param       string  url     string for URI\r
 +       * @return      void\r
 +       */\r
 +      public function addTicketToUrl($url)\r
 +      {\r
 +              $ticketCode = 'ticket=' . $this->_generateTicket();\r
 +              if ( i18n::strpos($url, '?') === FALSE )\r
 +              {\r
 +                      $ticketCode = "{$url}?{$ticketCode}";\r
 +              }\r
 +              else\r
 +              {\r
 +                      $ticketCode = "{$url}&{$ticketCode}";\r
 +              }\r
 +              return $ticketCode;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::addTicketHidden()\r
 +       * POST requests: Adds ticket as hidden formvar\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function addTicketHidden()\r
 +      {\r
 +              $ticket = $this->_generateTicket();\r
 +              echo '<input type="hidden" name="ticket" value="', Entity::hsc($ticket), '" />';\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::getNewTicket()\r
 +       * Get a new ticket\r
 +       * (xmlHTTPRequest AutoSaveDraft uses this to refresh the ticket)\r
 +       * \r
 +       * @param       void\r
 +       * @return      string  string of ticket\r
 +       */\r
 +      public function getNewTicket()\r
 +      {\r
 +              $this->currentRequestTicket = '';\r
 +              return $this->_generateTicket();\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::checkTicket()\r
 +       * Checks the ticket that was passed along with the current request\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean correct or not\r
 +       */\r
 +      public function checkTicket()\r
 +      {\r
 +              global $member;\r
 +              \r
 +              // get ticket from request\r
 +              $ticket = requestVar('ticket');\r
 +              \r
 +              // no ticket -> don't allow\r
 +              if ( $ticket == '' )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              // remove expired tickets first\r
 +              $this->_cleanUpExpiredTickets();\r
 +              \r
 +              // get member id\r
 +              if (!$member->isLoggedIn())\r
 +              {\r
 +                      $memberId = -1;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $memberId = $member->getID();\r
 +              }\r
 +              \r
 +              // check if ticket is a valid one\r
 +              $query = sprintf('SELECT COUNT(*) as result FROM %s WHERE member=%d and ticket=%s',\r
 +                      sql_table('tickets'),\r
 +                      intval($memberId),\r
 +                      DB::quoteValue($ticket)\r
 +              );\r
 +              \r
 +              /*\r
 +               * NOTE:\r
 +               * [in the original implementation, the checked ticket was deleted. This would lead to invalid\r
 +               * tickets when using the browsers back button and clicking another link/form\r
 +               * leaving the keys in the database is not a real problem, since they're member-specific and\r
 +               * only valid for a period of one hour]\r
 +               */\r
 +              if ( DB::getValue($query) != 1 )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              return TRUE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Manager::_cleanUpExpiredTickets()\r
 +       * Removes the expired tickets\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function _cleanUpExpiredTickets()\r
 +      {\r
 +              // remove tickets older than 1 hour\r
 +              $oldTime = time() - 60 * 60;\r
 +              $query = 'DELETE FROM %s WHERE ctime < %s';\r
 +              $query = sprintf($query, sql_table('tickets'), DB::formatDateTime($oldTime));\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Manager::_generateTicket()\r
 +       * Generates/returns a ticket (one ticket per page request)\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      private function _generateTicket()\r
 +      {\r
 +              if ( $this->currentRequestTicket == '' )\r
 +              {\r
 +                      // generate new ticket (only one ticket will be generated per page request)\r
 +                      // and store in database\r
 +                      global $member;\r
 +                      // get member id\r
 +                      if ( !$member->isLoggedIn() )\r
 +                      {\r
 +                              $memberId = -1;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $memberId = $member->getID();\r
 +                      }\r
 +                      \r
 +                      $ok = false;\r
 +                      while ( !$ok )\r
 +                      {\r
 +                              // generate a random token\r
 +                              srand((double)microtime()*1000000);\r
 +                              $ticket = md5(uniqid(rand(), true));\r
 +                              \r
 +                              // add in database as non-active\r
 +                              $query = 'INSERT INTO %s (ticket, member, ctime) VALUES (%s, %d, %s)';\r
 +                              $query = sprintf($query, sql_table('tickets'), DB::quoteValue($ticket), (integer) $memberId, DB::formatDateTime());\r
 +                              \r
 +                              if ( DB::execute($query) !== FALSE )\r
 +                              {\r
 +                                      $ok = true;\r
 +                              }\r
 +                      }\r
 +                      $this->currentRequestTicket = $ticket;\r
 +              }\r
 +              return $this->currentRequestTicket;\r
 +      }\r
 +}\r
 +\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * This class makes sure each item/weblog/comment object gets requested from
+  * the database only once, by keeping them in a cache. The class also acts as
+  * a dynamic classloader, loading classes _only_ when they are first needed,
+  * hoping to diminish execution time
+  *
+  * The class is a singleton, meaning that there will be only one object of it
+  * active at all times. The object can be requested using Manager::instance()
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: MANAGER.php 1878 2012-06-17 07:42:07Z sakamocchi $
+  */
+ class Manager
+ {
+       /**
+        * Cached ITEM, BLOG, PLUGIN, KARMA and MEMBER objects. When these objects are requested
+        * through the global $manager object (getItem, getBlog, ...), only the first call
+        * will create an object. Subsequent calls will return the same object.
+        *
+        * The $items, $blogs, ... arrays map an id to an object (for plugins, the name is used
+        * rather than an ID)
+        */
+       private $items;
+       private $blogs;
+       private $plugins;
+       private $karma;
+       private $templates;
+       private $members;
+       private $skins;
+       
+       /**
+        * cachedInfo to avoid repeated SQL queries (see pidInstalled/pluginInstalled/getPidFromName)
+        * e.g. which plugins exists?
+        *
+        * $cachedInfo['installedPlugins'] = array($pid -> $name)
+        */
+       private $cachedInfo;
+       
+       /**
+        * The plugin subscriptionlist
+        *
+        * The subcription array has the following structure
+        *              $subscriptions[$EventName] = array containing names of plugin classes to be
+        *                                                                       notified when that event happens
+        * 
+        * NOTE: this is referred by Comments::addComment() for spamcheck API
+        * TODO: we should add new methods to get this
+        */
+       public $subscriptions;
+       
+       /**
+        * Ticket functions. These are uses by the admin area to make it impossible to simulate certain GET/POST
+        * requests. tickets are user specific
+        */
+       private $currentRequestTicket = '';
+       
+       /**
+        * Returns the only instance of this class. Creates the instance if it
+        * does not yet exists. Users should use this function as
+        * $manager =& Manager::instance(); to get a reference to the object
+        * instead of a copy
+        */
+       static public function &instance()
+       {
+               static $instance = array();
+               if ( empty($instance) )
+               {
+                       $instance[0] = new Manager();
+               }
+               return $instance[0];
+       }
+       
+       /**
+        * The constructor of this class initializes the object caches
+        */
+       public function __construct()
+       {
+               $this->items = array();
+               $this->blogs = array();
+               $this->plugins = array();
+               $this->karma = array();
+               $this->templates = array();
+               $this->skins = array();
+               $this->parserPrefs = array();
+               $this->cachedInfo = array();
+               $this->members = array();
+               return;
+       }
+       
+       /**
+        * Returns the requested item object. If it is not in the cache, it will
+        * first be loaded and then placed in the cache.
+        * Intended use: $item =& $manager->getItem(1234, 0, 0)
+        */
+       public function &getItem($itemid, $allowdraft, $allowfuture)
+       {
+               /* confirm to cached */
+               if ( !array_key_exists($itemid, $this->items) )
+               {
+                       $this->loadClass('ITEM');
+                       $item = Item::getitem($itemid, $allowdraft, $allowfuture);
+                       $this->items[$itemid] = $item;
+               }
+               
+               $item =& $this->items[$itemid];
+               if ( !$allowdraft && ($item['draft']) )
+               {
+                       return 0;
+               }
+               
+               $blog =& $this->getBlog($item['blogid']);
+               if ( !$allowfuture && ($item['timestamp'] > $blog->getCorrectTime()) )
+               {
+                       return 0;
+               }
+               
+               return $item;
+       }
+       
+       /**
+        * Loads a class if it has not yet been loaded
+        */
+       public function loadClass($name)
+       {
+               $this->_loadClass($name, $name . '.php');
+               return;
+       }
+       
+       /**
+        * Checks if an item exists
+        */
+       public function existsItem($id,$future,$draft)
+       {
+               $this->_loadClass('ITEM','ITEM.php');
+               return Item::exists($id,$future,$draft);
+       }
+       
+       /**
+        * Checks if a category exists
+        */
+       public function existsCategory($id)
+       {
+               return (DB::getValue('SELECT COUNT(*) as result FROM '.sql_table('category').' WHERE catid='.intval($id)) > 0);
+       }
+       
+       /**
+        * Returns the blog object for a given blogid
+        */
+       public function &getBlog($blogid)
+       {
+               if ( !array_key_exists($blogid, $this->blogs) )
+               {
+                       $this->_loadClass('BLOG','BLOG.php');
+                       $this->blogs[$blogid] = new Blog($blogid);
+               }
+               return $this->blogs[$blogid];
+       }
+       
+       /**
+        * Checks if a blog exists
+        */
+       public function existsBlog($name)
+       {
+               $this->_loadClass('BLOG','BLOG.php');
+               return Blog::exists($name);
+       }
+       
+       /**
+        * Checks if a blog id exists
+        */
+       public function existsBlogID($id)
+       {
+               $this->_loadClass('BLOG','BLOG.php');
+               return Blog::existsID($id);
+       }
+       
+       /**
+        * Returns a previously read template
+        */
+       public function &getTemplate($templateName)
+       {
+               if ( !array_key_exists($templateName, $this->templates) )
+               {
+                       $this->_loadClass('Template','TEMPLATE.php');
+                       $tmplate_tmp = Template::read($templateName);
+                       $this->templates[$templateName] =& $tmplate_tmp;
+               }
+               return $this->templates[$templateName];
+       }
+       
+       /**
+        * Returns a KARMA object (karma votes)
+        */
+       public function &getKarma($itemid)
+       {
+               if ( !array_key_exists($itemid, $this->karma) )
+               {
+                       $this->_loadClass('Karma','KARMA.php');
+                       $this->karma[$itemid] = new Karma($itemid);
+               }
+               return $this->karma[$itemid];
+       }
+       
+       /**
+        * Returns a MEMBER object
+        */
+       public function &getMember($memberid)
+       {
+               if ( !array_key_exists($memberid, $this->members) )
+               {
+                       $this->_loadClass('Member','MEMBER.php');
+                       $this->members[$memberid] =& Member::createFromID($memberid);;
+               }
+               return $this->members[$memberid];
+       }
+       
+       /**
+        * Manager::getSkin()
+        * 
+        * @param       integer $skinid                         ID for skin
+        * @param       string  $action_class           action class for handling skin variables
+        * @param       string  $event_identifier       identifier for event name
+        * @return      object  instance of Skin class
+        */
+       public function &getSkin($skinid, $action_class='Actions', $event_identifier='Skin')
+       {
+               if ( !array_key_exists($skinid, $this->skins) )
+               {
+                       $this->_loadClass('Skin', 'SKIN.php');
+                       $this->skins[$skinid] = new Skin($skinid, $action_class, $event_identifier);
+               }
+               
+               return $this->skins[$skinid];
+       }
+       
+       /**
+        * Set the global parser preferences
+        */
+       public function setParserProperty($name, $value)
+       {
+               $this->parserPrefs[$name] = $value;
+               return;
+       }
+       
+       /**
+        * Get the global parser preferences
+        */
+       public function getParserProperty($name)
+       {
+               return $this->parserPrefs[$name];
+       }
+       
+       /**
+        * A helper function to load a class
+        * 
+        *      private
+        */
+       private function _loadClass($name, $filename)
+       {
+               global $DIR_LIBS;
+               
+               if ( !class_exists($name) )
+               {
+                       include($DIR_LIBS . $filename);
+               }
+               return;
+       }
+       
+       /**
+        * Manager::_loadPlugin()
+        * loading a certain plugin
+        * 
+        * @param       string $name plugin name
+        * @return      void
+        */
+       private function _loadPlugin($name)
+       {
+               global $DIR_PLUGINS, $MYSQL_HANDLER, $MYSQL_PREFIX;
+               
+               if ( class_exists($name) )
+               {
+                       return;
+               }
+               
+               $fileName = "{$DIR_PLUGINS}{$name}.php";
+               
+               if ( !file_exists($fileName) )
+               {
+                       if ( !defined('_MANAGER_PLUGINFILE_NOTFOUND') )
+                       {
+                               define('_MANAGER_PLUGINFILE_NOTFOUND', 'Plugin %s was not loaded (File not found)');
+                       }
+                       ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOTFOUND, $name)); 
+                       return 0;
+               }
+               
+               // load plugin
+               include($fileName);
+               
+               // check if class exists (avoid errors in eval'd code)
+               if ( !class_exists($name) )
+               {
+                       ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINFILE_NOCLASS, $name));
+                       return 0;
+               }
+               
+               // add to plugin array
+               $this->plugins[$name] = new $name();
+               
+               // get plugid
+               $this->plugins[$name]->setID($this->getPidFromName($name));
+               
+               // unload plugin if a prefix is used and the plugin cannot handle this
+               if ( ($MYSQL_PREFIX != '')
+                 && !$this->plugins[$name]->supportsFeature('SqlTablePrefix') )
+               {
+                       unset($this->plugins[$name]);
+                       ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINTABLEPREFIX_NOTSUPPORT, $name));
+                       return 0;
+               }
+               
+               // unload plugin if using non-mysql handler and plugin does not support it 
+               if ( (!in_array('mysql',$MYSQL_HANDLER))
+                 && !$this->plugins[$name]->supportsFeature('SqlApi') )
+               {
+                       unset($this->plugins[$name]);
+                       ActionLog::add(WARNING, sprintf(_MANAGER_PLUGINSQLAPI_NOTSUPPORT, $name));
+                       return 0;
+               }
+               
+               // call init method
+               $this->plugins[$name]->init();
+               
+               return;
+       }
+       /**
+        * Manager:getPlugin()
+        * Returns a PLUGIN object
+        * 
+        * @param       string  $name   name of plugin
+        * @return      object  plugin object
+        */
+       public function &getPlugin($name)
+       {
+               // retrieve the name of the plugin in the right capitalisation
+               $name = $this->getUpperCaseName ($name);
+               
+               // get the plugin       
+               $plugin =& $this->plugins[$name]; 
+               
+               if ( !$plugin )
+               {
+                       // load class if needed
+                       $this->_loadPlugin($name);
+                       $plugin =& $this->plugins[$name];
+               }
+               return $plugin;
+       }
+       
+       /**
+        * Manager::pluginLoaded()
+        * Checks if the given plugin IS loaded or not
+        * 
+        * @param       string  $name   name of plugin
+        * @return      object  plugin object
+        */
+       public function &pluginLoaded($name)
+       {
+               $plugin =& $this->plugins[$name];
+               return $plugin;
+       }
+       
+       /**
+        * Manager::pidLoaded()
+        * 
+        * @param       integer $pid    id for plugin
+        * @return      object  plugin object
+        */
+       public function &pidLoaded($pid)
+       {
+               $plugin=false;
+               reset($this->plugins);
+               while ( list($name) = each($this->plugins) )
+               {
+                       if ( $pid!=$this->plugins[$name]->getId() )
+                       {
+                               continue;
+                       }
+                       $plugin= & $this->plugins[$name];
+                       break;
+               }
+               return $plugin;
+       }
+       
+       /**
+        * Manager::pluginInstalled()
+        * checks if the given plugin IS installed or not
+        * 
+        * @param       string  $name   name of plugin
+        * @return      boolean exists or not
+        */
+       public function pluginInstalled($name)
+       {
+               $this->_initCacheInfo('installedPlugins');
+               return ($this->getPidFromName($name) != -1);
+       }
+       /**
+        * Manager::pidInstalled()
+        * checks if the given plugin IS installed or not
+        * 
+        * @param       integer $pid    id of plugin
+        * @return      boolean exists or not
+        */
+       public function pidInstalled($pid)
+       {
+               $this->_initCacheInfo('installedPlugins');
+               return ($this->cachedInfo['installedPlugins'][$pid] != '');
+       }
+       
+       /**
+        * Manager::getPidFromName()
+        * 
+        * @param       string  $name   name of plugin
+        * @return      mixed   id for plugin or -1 if not exists
+        */
+       public function getPidFromName($name)
+       {
+               $this->_initCacheInfo('installedPlugins');
+               foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )
+               {
+                       if (strtolower($pfile) == strtolower($name))
+                       {
+                               return $pid;
+                       }
+               }
+               return -1;
+       }
+       
+       /**
+        * Manager::getPluginNameFromPid()
+        * 
+        * @param       string  $pid    ID for plugin
+        * @return      string  name of plugin
+        */
+       public function getPluginNameFromPid($pid)
+       {
+               if ( !array_key_exists($pid, $this->cachedInfo['installedPlugins']) )
+               {
+                       $query = 'SELECT pfile FROM %s WHERE pid=%d;';
+                       $query = sprintf($query, sql_table('plugin'), (integer) $pid);
+                       return DB::getValue($query);
+               }
+               return $this->cachedInfo['installedPlugins'][$pid];
+       }
+       
+       /**
+        * Manager::getUpperCaseName()
+        * Retrieve the name of a plugin in the right capitalisation
+        * 
+        * @param       string  $name   name of plugin
+        * @return      string  name according to UpperCamelCase
+        */
+       public function getUpperCaseName ($name)
+       {
+               $this->_initCacheInfo('installedPlugins');
+               foreach ( $this->cachedInfo['installedPlugins'] as $pid => $pfile )
+               {
+                       if ( strtolower($pfile) == strtolower($name) )
+                       {
+                               return $pfile;
+                       }
+               }
+               return -1;
+       }
+       
+       /**
+        * Manager::clearCachedInfo()
+        * 
+        * @param       string  $what
+        * @return      void
+        */
+       public function clearCachedInfo($what)
+       {
+               unset($this->cachedInfo[$what]);
+               return;
+       }
+       
+       /**
+        * Manager::_initCacheInfo()
+        * Loads some info on the first call only
+        * 
+        * @param       string  $what   'installedPlugins'
+        * @return      void
+        */
+       private function _initCacheInfo($what)
+       {
+               if ( array_key_exists($what, $this->cachedInfo)
+                 && is_array($this->cachedInfo[$what]) )
+               {
+                       return;
+               }
+               
+               switch ($what)
+               {
+                       // 'installedPlugins' = array ($pid => $name)
+                       case 'installedPlugins':
+                               $this->cachedInfo['installedPlugins'] = array();
+                               $res = DB::getResult('SELECT pid, pfile FROM ' . sql_table('plugin'));
+                               foreach ( $res as $row )
+                               {
+                                       $this->cachedInfo['installedPlugins'][$row['pid']] = $row['pfile'];
+                               }
+                               break;
+               }
+               return;
+       }
+       
+       /**
+        * Manager::notify()
+        * A function to notify plugins that something has happened. Only the plugins
+        * that are subscribed to the event will get notified.
+        * Upon the first call, the list of subscriptions will be fetched from the
+        * database. The plugins itsself will only get loaded when they are first needed
+        *
+        * @param       string  $eventName      Name of the event (method to be called on plugins)
+        * @param       string  $data           Can contain any type of data,
+        *                                                              depending on the event type. Usually this is an itemid, blogid, ...
+        *                                                              but it can also be an array containing multiple values
+        * @return      void
+        */
+       public function notify($eventName, &$data)
+       {
+               // load subscription list if needed
+               if ( !is_array($this->subscriptions) )
+               {
+                       $this->_loadSubscriptions();
+               }
+               
+               // get listening objects
+               $listeners = false;
+               if ( array_key_exists($eventName, $this->subscriptions)
+                 && !empty($this->subscriptions[$eventName]) )
+               {
+                       $listeners = $this->subscriptions[$eventName];
+               }
+               
+               // notify all of them
+               if ( is_array($listeners) )
+               {
+                       foreach( $listeners as $listener )
+                       {
+                               // load class if needed
+                               $this->_loadPlugin($listener);
+                               
+                               // do notify (if method exists)
+                               if ( array_key_exists($listener, $this->plugins)
+                                 && !empty($this->plugins[$listener])
+                                 && method_exists($this->plugins[$listener], 'event_' . $eventName) )
+                               {
+                                       call_user_func(array($this->plugins[$listener], 'event_' . $eventName), $data);
+                               }
+                       }
+               }
+               return;
+       }
+       
+       /**
+        * Manager::_loadSubscriptions()
+        * Loads plugin subscriptions
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function _loadSubscriptions()
+       {
+               // initialize as array
+               $this->subscriptions = array();
+               
+               $query = "SELECT p.pfile as pfile, e.event as event"
+                      . " FROM %s as e, %s as p"
+                      . " WHERE e.pid=p.pid ORDER BY p.porder ASC";
+               $query = sprintf($query, sql_table('plugin_event'), sql_table('plugin'));
+               $res = DB::getResult($query);
+               
+               foreach ( $res as $row )
+               {
+                       $pluginName = $row['pfile'];
+                       $eventName = $row['event'];
+                       $this->subscriptions[$eventName][] = $pluginName;
+               }
+               return;
+       }
+       
+       /**
+        * Manager::getNumberOfSubscribers()
+        * 
+        * @param       string  $event  name of events
+        * @return      integer number of event subscriber
+        */
+       public function getNumberOfSubscribers($event)
+       {
+               $query = 'SELECT COUNT(*) as count FROM %s WHERE event=%s;';
+               $query = sprintf($query, sql_table('plugin_event'), DB::quoteValue($event));
+               return (integer) DB::getValue($query);
+       }
+       
+       /**
+        * Manager::addTicketToUrl()
+        * GET requests: Adds ticket to URL (URL should NOT be html-encoded!, ticket is added at the end)
+        * 
+        * @param       string  url     string for URI
+        * @return      void
+        */
+       public function addTicketToUrl($url)
+       {
+               $ticketCode = 'ticket=' . $this->_generateTicket();
+               if ( i18n::strpos($url, '?') === FALSE )
+               {
+                       $ticketCode = "{$url}?{$ticketCode}";
+               }
+               else
+               {
+                       $ticketCode = "{$url}&{$ticketCode}";
+               }
+               return $ticketCode;
+       }
+       
+       /**
+        * Manager::addTicketHidden()
+        * POST requests: Adds ticket as hidden formvar
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function addTicketHidden()
+       {
+               $ticket = $this->_generateTicket();
+               echo '<input type="hidden" name="ticket" value="', Entity::hsc($ticket), '" />';
+               return;
+       }
+       
+       /**
+        * Manager::getNewTicket()
+        * Get a new ticket
+        * (xmlHTTPRequest AutoSaveDraft uses this to refresh the ticket)
+        * 
+        * @param       void
+        * @return      string  string of ticket
+        */
+       public function getNewTicket()
+       {
+               $this->currentRequestTicket = '';
+               return $this->_generateTicket();
+       }
+       
+       /**
+        * Manager::checkTicket()
+        * Checks the ticket that was passed along with the current request
+        * 
+        * @param       void
+        * @return      boolean correct or not
+        */
+       public function checkTicket()
+       {
+               global $member;
+               
+               // get ticket from request
+               $ticket = requestVar('ticket');
+               
+               // no ticket -> don't allow
+               if ( $ticket == '' )
+               {
+                       return FALSE;
+               }
+               
+               // remove expired tickets first
+               $this->_cleanUpExpiredTickets();
+               
+               // get member id
+               if (!$member->isLoggedIn())
+               {
+                       $memberId = -1;
+               }
+               else
+               {
+                       $memberId = $member->getID();
+               }
+               
+               // check if ticket is a valid one
+               $query = sprintf('SELECT COUNT(*) as result FROM %s WHERE member=%d and ticket=%s',
+                       sql_table('tickets'),
+                       intval($memberId),
+                       DB::quoteValue($ticket)
+               );
+               
+               /*
+                * NOTE:
+                * [in the original implementation, the checked ticket was deleted. This would lead to invalid
+                * tickets when using the browsers back button and clicking another link/form
+                * leaving the keys in the database is not a real problem, since they're member-specific and
+                * only valid for a period of one hour]
+                */
+               if ( DB::getValue($query) != 1 )
+               {
+                       return FALSE;
+               }
+               
+               return TRUE;
+       }
+       /**
+        * Manager::_cleanUpExpiredTickets()
+        * Removes the expired tickets
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function _cleanUpExpiredTickets()
+       {
+               // remove tickets older than 1 hour
+               $oldTime = time() - 60 * 60;
+               $query = 'DELETE FROM %s WHERE ctime < %s';
+               $query = sprintf($query, sql_table('tickets'), DB::formatDateTime($oldTime));
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Manager::_generateTicket()
+        * Generates/returns a ticket (one ticket per page request)
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function _generateTicket()
+       {
+               if ( $this->currentRequestTicket == '' )
+               {
+                       // generate new ticket (only one ticket will be generated per page request)
+                       // and store in database
+                       global $member;
+                       // get member id
+                       if ( !$member->isLoggedIn() )
+                       {
+                               $memberId = -1;
+                       }
+                       else
+                       {
+                               $memberId = $member->getID();
+                       }
+                       
+                       $ok = false;
+                       while ( !$ok )
+                       {
+                               // generate a random token
+                               srand((double)microtime()*1000000);
+                               $ticket = md5(uniqid(rand(), true));
+                               
+                               // add in database as non-active
+                               $query = 'INSERT INTO %s (ticket, member, ctime) VALUES (%s, %d, %s)';
+                               $query = sprintf($query, sql_table('tickets'), DB::quoteValue($ticket), (integer) $memberId, DB::formatDateTime());
+                               
+                               if ( DB::execute($query) !== FALSE )
+                               {
+                                       $ok = true;
+                               }
+                       }
+                       $this->currentRequestTicket = $ticket;
+               }
+               return $this->currentRequestTicket;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Media classes for nucleus\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: MEDIA.php 1870 2012-05-22 14:57:15Z sakamocchi $\r
 + */\r
 +\r
 +define('PRIVATE_COLLECTION',          'Private Collection');\r
 +define('READ_ONLY_MEDIA_FOLDER',      '(Read Only)');\r
 +\r
 +class Media\r
 +{\r
 +      static public $thumbdir = '.thumb';\r
 +      static public $algorism = 'md5';\r
 +      static public $image_mime = array(\r
 +              'image/jpeg'    => '.jpeg',\r
 +              'image/png'             => '.png',\r
 +              'image/gif'             => '.gif',\r
 +      );\r
 +      \r
 +      /**\r
 +       * Media::getCollectionList()\r
 +       * Gets the list of collections available to the currently logged\r
 +       * in member\r
 +       * \r
 +       * @param       boolean $exceptReadOnly\r
 +       * @return array        dirname => display name\r
 +       */\r
 +      static public function getCollectionList($exceptReadOnly = FALSE)\r
 +      {\r
 +              global $member, $DIR_MEDIA;\r
 +              \r
 +              $collections = array();\r
 +              \r
 +              // add private directory for member\r
 +              $collections[$member->getID()] = PRIVATE_COLLECTION;\r
 +              \r
 +              // add global collections\r
 +              if ( !is_dir($DIR_MEDIA) )\r
 +              {\r
 +                      return $collections;\r
 +              }\r
 +              \r
 +              $dirhandle = opendir($DIR_MEDIA);\r
 +              while ( $dirname = readdir($dirhandle) )\r
 +              {\r
 +                      // only add non-numeric (numeric=private) dirs\r
 +                      if ( @is_dir($DIR_MEDIA . $dirname) &&\r
 +                              ($dirname != '.') &&\r
 +                              ($dirname != '..') &&\r
 +                              ($dirname != self::$thumbdir) &&\r
 +                              (!is_numeric($dirname)) )\r
 +                              {\r
 +                              if ( @is_writable($DIR_MEDIA . $dirname) )\r
 +                              {\r
 +                                      $collections[$dirname] = $dirname;\r
 +                              }\r
 +                              else if ( $exceptReadOnly == FALSE )\r
 +                              {\r
 +                                      $collections[$dirname] = $dirname . ' ' . READ_ONLY_MEDIA_FOLDER;\r
 +                              }\r
 +                      }\r
 +              }\r
 +              closedir($dirhandle);\r
 +              \r
 +              return $collections;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::getMediaListByCollection()\r
 +       * Returns an array of MediaObject objects for a certain collection\r
 +       *\r
 +       * @param       string  $collection     name of the collection\r
 +       * @param       string  $filter         filter on filename (defaults to none)\r
 +       * @return      void\r
 +       */\r
 +      static public function getMediaListByCollection($collection, $filter = '')\r
 +      {\r
 +              global $CONF, $DIR_MEDIA;\r
 +              \r
 +              $filelist = array();\r
 +              \r
 +              // 1. go through all objects and add them to the filelist\r
 +              $mediadir = $DIR_MEDIA . $collection . '/';\r
 +              \r
 +              // return if dir does not exist\r
 +              if ( !is_dir($mediadir) )\r
 +              {\r
 +                      return $filelist;\r
 +              }\r
 +              \r
 +              $dirhandle = opendir($mediadir);\r
 +              while ( $filename = readdir($dirhandle) )\r
 +              {\r
 +                      // only add files that match the filter\r
 +                      if ( !is_dir($mediadir . $filename) && self::checkFilter($filename, $filter) )\r
 +                      {\r
 +                              array_push($filelist, new MediaObject($collection, $filename, $DIR_MEDIA));\r
 +                      }\r
 +              }\r
 +              closedir($dirhandle);\r
 +              \r
 +              /* sort array */\r
 +              if ( !$CONF['MediaPrefix'] )\r
 +              {\r
 +                      usort($filelist,  array(__CLASS__, 'sort_media_by_timestamp'));\r
 +              }\r
 +              else\r
 +              {\r
 +                      usort($filelist,  array(__CLASS__, 'sort_media_by_filename'));\r
 +              }\r
 +              \r
 +              return $filelist;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::checkFilter()\r
 +       * \r
 +       * @param       string  $strText\r
 +       * @param       string  $strFilter\r
 +       * @return      boolean\r
 +       */\r
 +      static public function checkFilter($strText, $strFilter)\r
 +      {\r
 +              if ( $strFilter == '' )\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              else\r
 +              {\r
 +                      return is_integer(i18n::strpos(strtolower($strText), strtolower($strFilter)));\r
 +              }\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::isValidCollection()\r
 +       * checks if a collection exists with the given name, and if it's\r
 +       * allowed for the currently logged in member to upload files to it\r
 +       * \r
 +       * @param       string  $collectionName\r
 +       * @param       string  $exceptReadOnly\r
 +       * @return      boolean\r
 +       */\r
 +      static public function isValidCollection($collectionName, $exceptReadOnly = FALSE)\r
 +      {\r
 +              global $member, $DIR_MEDIA;\r
 +              \r
 +              // allow creating new private directory\r
 +              if ( $collectionName === (string)$member->getID() )\r
 +              {\r
 +                      return TRUE;\r
 +              }\r
 +              \r
 +              $collections = self::getCollectionList($exceptReadOnly);\r
 +              $dirname = $collections[$collectionName];\r
 +              \r
 +              if ( $dirname == NULL || $dirname === PRIVATE_COLLECTION )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              // other collections should exist and be writable\r
 +              $collectionDir = $DIR_MEDIA . $collectionName;\r
 +              if ( $exceptReadOnly )\r
 +              {\r
 +                      return ( @is_dir($collectionDir) && @is_writable($collectionDir) );\r
 +              }\r
 +              \r
 +              // other collections should exist\r
 +              return @is_dir($collectionDir);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::addMediaObject()\r
 +       * Adds an uploaded file to the media archive\r
 +       *\r
 +       * @param       string  $collection     collection\r
 +       * @param       array   $uploadfile     the postFileInfo(..) array\r
 +       * @param       string  $filename       the filename that should be used to save the file as\r
 +       *                                                              (date prefix should be already added here)\r
 +       * @return      string  blank if success, message if failed\r
 +       */\r
 +      static public function addMediaObject($collection, $uploadfile, $filename)\r
 +      {\r
 +              global $DIR_MEDIA, $manager;\r
 +              \r
 +              // clean filename of characters that may cause trouble in a filename using cleanFileName() function from globalfunctions.php\r
 +              $filename = cleanFileName($filename);\r
 +              \r
 +              // should already have tested for allowable types before calling this method. This will only catch files with no extension at all\r
 +              if ( $filename === FALSE )\r
 +              {\r
 +                      return _ERROR_BADFILETYPE;\r
 +              }\r
 +              \r
 +              // trigger PreMediaUpload event\r
 +              $manager->notify('PreMediaUpload',array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename));\r
 +              \r
 +              // don't allow uploads to unknown or forbidden collections\r
 +              $exceptReadOnly = TRUE;\r
 +              if ( !self::isValidCollection($collection,$exceptReadOnly) )\r
 +              {\r
 +                      return _ERROR_DISALLOWED;\r
 +              }\r
 +              \r
 +              // check dir permissions (try to create dir if it does not exist)\r
 +              $mediadir = $DIR_MEDIA . $collection;\r
 +              \r
 +              // try to create new private media directories if needed\r
 +              if ( !@is_dir($mediadir) && is_numeric($collection) )\r
 +              {\r
 +                      $oldumask = umask(0000);\r
 +                      if ( !@mkdir($mediadir, 0777) )\r
 +                      {\r
 +                              return _ERROR_BADPERMISSIONS;\r
 +                      }\r
 +                      umask($oldumask);\r
 +              }\r
 +              \r
 +              // if dir still not exists, the action is disallowed\r
 +              if ( !@is_dir($mediadir) )\r
 +              {\r
 +                      return _ERROR_DISALLOWED;\r
 +              }\r
 +              \r
 +              if ( !is_writeable($mediadir) )\r
 +              {\r
 +                      return _ERROR_BADPERMISSIONS;\r
 +              }\r
 +              \r
 +              // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)\r
 +              $mediadir .= '/';\r
 +              \r
 +              if ( file_exists($mediadir . $filename) )\r
 +              {\r
 +                      return _ERROR_UPLOADDUPLICATE;\r
 +              }\r
 +              \r
 +              // move file to directory\r
 +              if ( is_uploaded_file($uploadfile) )\r
 +              {\r
 +                      if ( !@move_uploaded_file($uploadfile, $mediadir . $filename) )\r
 +                      {\r
 +                              return _ERROR_UPLOADMOVEP;\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      if ( !copy($uploadfile, $mediadir . $filename) )\r
 +                      {\r
 +                              return _ERROR_UPLOADCOPY ;\r
 +                      }\r
 +              }\r
 +              \r
 +              // chmod uploaded file\r
 +              $oldumask = umask(0000);\r
 +              @chmod($mediadir . $filename, 0644);\r
 +              umask($oldumask);\r
 +              \r
 +              $manager->notify('PostMediaUpload',array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename));\r
 +              \r
 +              return '';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::addMediaObjectRaw()\r
 +       * Adds an uploaded file to the media dir.\r
 +       * \r
 +       * NOTE: does not check if $collection is valid.\r
 +       * \r
 +       * @param       string  $collection     collection to use\r
 +       * @param       string  $filename       the filename that should be used to save the file\r
 +       *                                                              as (date prefix should be already added here)\r
 +       * @param       &$data  File data (binary)\r
 +       * @return      string  blank if success, message if failed\r
 +       */\r
 +      static public function addMediaObjectRaw($collection, $filename, &$data)\r
 +      {\r
 +              global $DIR_MEDIA;\r
 +              \r
 +              // check dir permissions (try to create dir if it does not exist)\r
 +              $mediadir = $DIR_MEDIA . $collection;\r
 +              \r
 +              // try to create new private media directories if needed\r
 +              if ( !@is_dir($mediadir) && is_numeric($collection) )\r
 +              {\r
 +                      $oldumask = umask(0000);\r
 +                      if ( !@mkdir($mediadir, 0777) )\r
 +                      {\r
 +                              return _ERROR_BADPERMISSIONS;\r
 +                      }\r
 +                      umask($oldumask);\r
 +              }\r
 +              \r
 +              // if dir still not exists, the action is disallowed\r
 +              if ( !@is_dir($mediadir) )\r
 +              {\r
 +                      return _ERROR_DISALLOWED;\r
 +              }\r
 +              \r
 +              if ( !is_writeable($mediadir) )\r
 +              {\r
 +                      return _ERROR_BADPERMISSIONS;\r
 +              }\r
 +              \r
 +              // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)\r
 +              $mediadir .= '/';\r
 +              \r
 +              if ( file_exists($mediadir . $filename) )\r
 +              {\r
 +                      return _ERROR_UPLOADDUPLICATE;\r
 +              }\r
 +              \r
 +              // create file\r
 +              $fh = @fopen($mediadir . $filename, 'wb');\r
 +              if ( !$fh )\r
 +              {\r
 +                      return _ERROR_UPLOADFAILED;\r
 +              }\r
 +              $ok = @fwrite($fh, $data);\r
 +              @fclose($fh);\r
 +              if ( !$ok )\r
 +              {\r
 +                      return _ERROR_UPLOADFAILED;\r
 +              }\r
 +              \r
 +              // chmod uploaded file\r
 +              $oldumask = umask(0000);\r
 +              @chmod($mediadir . $filename, 0644);\r
 +              umask($oldumask);\r
 +              \r
 +              return '';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::responseResampledImage()\r
 +       * send resampled image via HTTP\r
 +       * \r
 +       * @param       object  $medium         MediaObject Object\r
 +       * @exit\r
 +       */\r
 +      static public function responseResampledImage($medium, $maxwidth=0, $maxheight=0)\r
 +      {\r
 +              if ( get_class($medium) !== 'MediaObject' )\r
 +              {\r
 +                      header("HTTP/1.1 500 Internal Server Error");\r
 +                      exit('Nucleus CMS: Fail to generate resampled image');\r
 +                      return;\r
 +              }\r
 +              \r
 +              $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);\r
 +              if ( $resampledimage === FALSE )\r
 +              {\r
 +                      unset($resampledimage);\r
 +                      header("HTTP/1.1 503 Service Unavailable");\r
 +                      exit('Nucleus CMS: Fail to generate resampled image');\r
 +                      return;\r
 +              }\r
 +              \r
 +              header("Content-type: {$medium->mime}");\r
 +              echo $resampledimage;\r
 +              \r
 +              unset($resampledimage);\r
 +              \r
 +              exit;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::storeResampledImage()\r
 +       * Store resampled image binary to filesystem as file\r
 +       * \r
 +       * @param       object  $medium         MediaObject Object\r
 +       * @param       integer $maxwidth       maximum width\r
 +       * @param       integer $maxheight      maximum height\r
 +       * @param       string  $path           directory path for destination\r
 +       * @param       string  $name           file name for destination\r
 +       * @return      boolean\r
 +       */\r
 +      static public function storeResampledImage($medium, $maxwidth=0, $maxheight=0, $path='', $name='')\r
 +      {\r
 +              global $DIR_MEDIA;\r
 +              \r
 +              if ( get_class($medium) !== 'MediaObject' )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              if ( $path !== '' )\r
 +              {\r
 +                      $path = realpath($path);\r
 +                      if ( !file_exists($path)\r
 +                        || strpos($path, $DIR_MEDIA) !== 0 )\r
 +                      {\r
 +                              return FALSE;\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      $path = '$DIR_MEDIA/' . self::$thumbdir;\r
 +              }\r
 +              \r
 +              if ( $name === '' )\r
 +              {\r
 +                      $name = $medium->getHashedname();\r
 +              }\r
 +              \r
 +              $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);\r
 +              if ( !$resampledimage )\r
 +              {\r
 +                      unset($resampledimage);\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              $handle = @fopen("{$path}/{$name}", 'w');\r
 +              if ( !$handle )\r
 +              {\r
 +                      unset ($resampledimage);\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              if ( !@fwrite($handle, $resampledimage) )\r
 +              {\r
 +                      unset($resampledimage);\r
 +                      @unlink("{$path}/{$name}");\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              unset($resampledimage);\r
 +              fclose($handle);\r
 +              \r
 +              if ( !@chmod("{$path}/{$name}", 0774) )\r
 +              {\r
 +                      @unlink("{$path}/{$name}");\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              return TRUE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::sort_media_by_timestamp()\r
 +       * User-defined sort method to sort an array of MediaObjects\r
 +       * \r
 +       * @param       object  $a\r
 +       * @param       object  $b\r
 +       * @return      boolean\r
 +       */\r
 +      static private function sort_media_by_timestamp($a, $b)\r
 +      {\r
 +              if ($a->timestamp == $b->timestamp) return 0;\r
 +              return ($a->timestamp > $b->timestamp) ? -1 : 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Media::sort_media_by_filename()\r
 +       * User-defined sort method to sort an array of MediaObjects\r
 +       * \r
 +       * @param       object  $a\r
 +       * @param       object  $b\r
 +       * @return      boolean\r
 +       */\r
 +      static private function sort_media_by_filename($a, $b)\r
 +      {\r
 +              if ($a->filename == $b->filename) return 0;\r
 +              return ($a->filename > $b->filename) ? -1 : 1;\r
 +      }\r
 +}\r
 +\r
 +class MediaObject\r
 +{\r
 +      public $mime = '';\r
 +      \r
 +      public $root = '';\r
 +      public $path = '';\r
 +      public $private;\r
 +      public $collection;\r
 +      public $filename = '';\r
 +      \r
 +      public $prefix = '';\r
 +      public $name = '';\r
 +      public $suffix = '';\r
 +      \r
 +      public $timestamp = 0;\r
 +      public $size = 0;\r
 +      \r
 +      public $width = 0;\r
 +      public $height = 0;\r
 +      public $resampledwidth = 0;\r
 +      public $resampledheight = 0;\r
 +      \r
 +      /**\r
 +       * MediaObject::__construct()\r
 +       * \r
 +       * @param       string          $collection     \r
 +       * @param       string          $filename       \r
 +       * @param       string          $root           fullpath to media directory\r
 +       */\r
 +      public function __construct($collection, $filename, $root=0)\r
 +      {\r
 +              global $CONF, $DIR_MEDIA;\r
 +              \r
 +              /* for backward compatibility */\r
 +              if ( is_numeric($root) )\r
 +              {\r
 +                      $root = $DIR_MEDIA;\r
 +              }\r
 +              \r
 +              $root = preg_replace('#/*$#', '', $root);\r
 +              \r
 +              /* get and validate fullpath for the medium */\r
 +              if ( !file_exists($root)\r
 +                || FALSE === ($fullpath = realpath("{$root}/{$collection}/{$filename}"))\r
 +                || strpos($fullpath, $root) !== 0\r
 +                || !file_exists($fullpath) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              /* store fundamentals */\r
 +              $this->root = $root;\r
 +              $this->private = (integer) $collection;\r
 +              $this->collection = $collection;\r
 +              $this->filename = basename($fullpath);\r
 +              $this->timestamp = filemtime($fullpath);\r
 +              \r
 +              /* store relative directory path from root directory for media */\r
 +              $this->path = preg_replace(array("#{$this->root}/#", "#/{$this->filename}#"), '', $fullpath);\r
 +              if ( $this->path === $this->name )\r
 +              {\r
 +                      $this->path = ''; \r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * MediaObject::refine()\r
 +       * refine data\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function refine()\r
 +      {\r
 +              global $CONF;\r
 +              \r
 +              /* store size (byte order) */\r
 +              $this->size = filesize("{$this->root}/{$this->path}/{$this->filename}");\r
 +              \r
 +              /* get width and height if this is image binary */\r
 +              if ( FALSE === ($info = @getimagesize ("{$this->root}/{$this->path}/{$this->filename}")) )\r
 +              {\r
 +                      $this->mime = 'application/octet-stream';\r
 +                      $this->width = 0;\r
 +                      $this->height = 0;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $this->mime = $info['mime'];\r
 +                      $this->width = $info[0];\r
 +                      $this->height = $info[1];\r
 +              }\r
 +              \r
 +              /* utilise Fileinfo subsystem if available */\r
 +              if ( defined('FILEINFO_MIME_TYPE') && function_exists ('finfo_open')\r
 +                && (FALSE !== ($info = finfo_open(FILEINFO_MIME_TYPE))) )\r
 +              {\r
 +                      $this->mime = finfo_file($info, "{$this->root}/{$this->path}/{$this->filename}");\r
 +              }\r
 +              \r
 +              /* store data with parsed filename */\r
 +              if ( preg_match('#^(.*)\.([a-zA-Z0-9]{2,})$#', $this->filename, $info) === 1 )\r
 +              {\r
 +                      $this->name = $info[1];\r
 +                      $this->suffix = $info[2];\r
 +                      \r
 +                      if ( $CONF['MediaPrefix'] && preg_match('#^([0-9]{8})\-(.*)$#', $this->name, $info) == 1 )\r
 +                      {\r
 +                              $this->prefix = preg_replace('#^([0-9]{4})([0-9]{2})([0-9]{2})$#', '$1/$2/$3', $info[1]);\r
 +                              $this->name = $info[2];\r
 +                      }\r
 +              }\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * MediaObject::setResampledSize()\r
 +       * Set resampled size\r
 +       * \r
 +       * @param       integer $maxwidth\r
 +       * @param       integer $maxheight\r
 +       * @return      boolean\r
 +       */\r
 +      public function setResampledSize($maxwidth=0, $maxheight=0)\r
 +      {\r
 +              if ( ($maxwidth == 0) && ($maxheight == 0) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              else if ( $this->width == 0 || $this->height  == 0 )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              else if ($this->width < $maxwidth && $this->height < $maxheight )\r
 +              {\r
 +                      $this->resampledwidth = $this->width;\r
 +                      $this->resampledheight = $this->height;\r
 +              }\r
 +              else if ( $maxheight == 0 || $this->width > $this->height )\r
 +              {\r
 +                      $this->resampledheight = intval ($this->height * $maxwidth / $this->width);\r
 +                      $this->resampledwidth = $maxwidth;\r
 +              }\r
 +              else if ( $maxwidth == 0 || $this->width <= $this->height )\r
 +              {\r
 +                      $this->resampledwidth = intval ($this->width * $maxheight / $this->height);\r
 +                      $this->resampledheight = $maxheight;\r
 +              }\r
 +              return TRUE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * MediaObject::getResampledBinary()\r
 +       * Return resampled image binary\r
 +       * \r
 +       * @param       void\r
 +       * @return      mixed   binary if success, FALSE if failed\r
 +       */\r
 +      public function getResampledBinary($maxwidth=0, $maxheight=0)\r
 +      {\r
 +              static $gdinfo = array();\r
 +              static $original;\r
 +              static $resampledimage;\r
 +              \r
 +              if ( !$this->setResampledSize($maxwidth, $maxheight) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              if ( $gdinfo = array() )\r
 +              {\r
 +                      $gdinfo = gd_info();\r
 +              }\r
 +              \r
 +              if ( $this->path !== '' )\r
 +              {\r
 +                      $fullpath = "{$this->root}/{$this->path}/{$this->name}";\r
 +              }\r
 +              else\r
 +              {\r
 +                      $fullpath = "{$this->root}/{$this->name}";\r
 +              }\r
 +              if ( !file_exists($fullpath) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              if ( !array_key_exists($this->mime, Media::$image_mime)\r
 +                || $this->width == 0\r
 +                || $this->height == 0\r
 +                || $this->resampledwidth == 0\r
 +                || $this->resampledheight == 0 )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              /* check current available memory */\r
 +              $memorymax = trim(ini_get("memory_limit"));\r
 +              switch ( strtolower ($memorymax[strlen($memorymax)-1]) )\r
 +              {\r
 +                      case 'g':\r
 +                              $memorymax *= 1024;\r
 +                      case 'm':\r
 +                              $memorymax *= 1024;\r
 +                      case 'k':\r
 +                              $memorymax *= 1024;\r
 +              }\r
 +              \r
 +              /*\r
 +               * this code is based on analyze if gd.c in php source code\r
 +               * if you can read C/C++, please check these elements and notify us if you have some ideas\r
 +               */\r
 +              if ( (memory_get_usage()\r
 +                 + ($this->resampledwidth * $this->resampledheight * 5 + $this->resampledheight * 24 + 10000)\r
 +                 + ($this->width * $this->height * 5 + $this->height * 24 + 10000))\r
 +                > $memorymax )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              switch ( $this->mime )\r
 +              {\r
 +                      case 'image/gif':\r
 +                              if ( (!array_key_exists('GIF Read Support', $gdinfo) || !isset($gdinfo['GIF Read Support']))\r
 +                                || (!array_key_exists('GIF Create Support', $gdinfo) || !isset($gdinfo['GIF Create Support'])) )\r
 +                              {\r
 +                                      return FALSE;\r
 +                              }\r
 +                              $function = 'imagecreatefromgif';\r
 +                              break;\r
 +                      case 'image/jpeg':\r
 +                              if ( (!array_key_exists('JPEG Support', $gdinfo) || !isset($gdinfo['JPEG Support']))\r
 +                                && (!array_key_exists('JPG Support', $gdinfo) || !isset($gdinfo['JPG Support'])) )\r
 +                              {\r
 +                                      return FALSE;\r
 +                              }\r
 +                              $function = 'imagecreatefromjpeg';\r
 +                              break;\r
 +                      case 'image/png':\r
 +                              if ( !array_key_exists('PNG Support', $gdinfo) || !isset($gdinfo['PNG Support']) )\r
 +                              {\r
 +                                      return FALSE;\r
 +                              }\r
 +                              $function = 'imagecreatefrompng';\r
 +                              break;\r
 +                      default:\r
 +                              return FALSE;\r
 +              }\r
 +              \r
 +              if ( !is_callable($function) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              $original = call_user_func_array($function, array(&$fullpath));\r
 +              if ( !$original )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              $resampledimage = imagecreatetruecolor($this->resampledwidth, $this->resampledheight);\r
 +              if ( !$resampledimage )\r
 +              {\r
 +                      imagedestroy($original);\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              @set_time_limit(ini_get('max_execution_time'));\r
 +              if ( !ImageCopyResampled($resampledimage, $original, 0, 0, 0, 0, $this->resampledwidth, $this->resampledheight, $this->width, $this->height) )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              imagedestroy($original);\r
 +              \r
 +              ob_start();\r
 +              \r
 +              switch ( $this->mime )\r
 +              {\r
 +                      case 'image/gif':\r
 +                              imagegif($resampledimage);\r
 +                              break;\r
 +                      case 'image/jpeg':\r
 +                              imagejpeg($resampledimage);\r
 +                              break;\r
 +                      case 'image/png':\r
 +                              imagepng($resampledimage);\r
 +                              break;\r
 +                      case 'image/bmp':\r
 +                      case 'image/x-ms-bmp':\r
 +                              imagepng($resampledimage);\r
 +                              break;\r
 +                      default:\r
 +                              return FALSE;\r
 +              }\r
 +              \r
 +              imagedestroy($resampledimage);\r
 +              \r
 +              return ob_get_clean();\r
 +      }\r
 +      \r
 +      public function getHashedName()\r
 +      {\r
 +              return (string) hash(Media::$algorism, "{$this->path}/{$this->name}", FALSE);\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Media classes for nucleus
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2012 The Nucleus Group
+  * @version $Id: MEDIA.php 1875 2012-06-17 07:30:44Z sakamocchi $
+  */
+ define('PRIVATE_COLLECTION',          'Private Collection');
+ define('READ_ONLY_MEDIA_FOLDER',      '(Read Only)');
+ class Media
+ {
+       static public $thumbdir = '.thumb';
+       static public $algorism = 'md5';
+       static public $image_mime = array(
+               'image/jpeg'    => '.jpeg',
+               'image/png'             => '.png',
+               'image/gif'             => '.gif',
+       );
+       
+       /**
+        * Media::getCollectionList()
+        * Gets the list of collections available to the currently logged
+        * in member
+        * 
+        * @param       boolean $exceptReadOnly
+        * @return array        dirname => display name
+        */
+       static public function getCollectionList($exceptReadOnly = FALSE)
+       {
+               global $member, $DIR_MEDIA;
+               
+               $collections = array();
+               
+               // add private directory for member
+               $collections[$member->getID()] = PRIVATE_COLLECTION;
+               
+               // add global collections
+               if ( !is_dir($DIR_MEDIA) )
+               {
+                       return $collections;
+               }
+               
+               $dirhandle = opendir($DIR_MEDIA);
+               while ( $dirname = readdir($dirhandle) )
+               {
+                       // only add non-numeric (numeric=private) dirs
+                       if ( @is_dir($DIR_MEDIA . $dirname) &&
+                               ($dirname != '.') &&
+                               ($dirname != '..') &&
+                               ($dirname != self::$thumbdir) &&
+                               (!is_numeric($dirname)) )
+                               {
+                               if ( @is_writable($DIR_MEDIA . $dirname) )
+                               {
+                                       $collections[$dirname] = $dirname;
+                               }
+                               else if ( $exceptReadOnly == FALSE )
+                               {
+                                       $collections[$dirname] = $dirname . ' ' . READ_ONLY_MEDIA_FOLDER;
+                               }
+                       }
+               }
+               closedir($dirhandle);
+               
+               return $collections;
+       }
+       
+       /**
+        * Media::getMediaListByCollection()
+        * Returns an array of MediaObject objects for a certain collection
+        *
+        * @param       string  $collection     name of the collection
+        * @param       string  $filter         filter on filename (defaults to none)
+        * @return      void
+        */
+       static public function getMediaListByCollection($collection, $filter = '')
+       {
+               global $CONF, $DIR_MEDIA;
+               
+               $filelist = array();
+               
+               // 1. go through all objects and add them to the filelist
+               $mediadir = $DIR_MEDIA . $collection . '/';
+               
+               // return if dir does not exist
+               if ( !is_dir($mediadir) )
+               {
+                       return $filelist;
+               }
+               
+               $dirhandle = opendir($mediadir);
+               while ( $filename = readdir($dirhandle) )
+               {
+                       // only add files that match the filter
+                       if ( !is_dir($mediadir . $filename) && self::checkFilter($filename, $filter) )
+                       {
+                               array_push($filelist, new MediaObject($collection, $filename, $DIR_MEDIA));
+                       }
+               }
+               closedir($dirhandle);
+               
+               /* sort array */
+               if ( !$CONF['MediaPrefix'] )
+               {
+                       usort($filelist,  array(__CLASS__, 'sort_media_by_timestamp'));
+               }
+               else
+               {
+                       usort($filelist,  array(__CLASS__, 'sort_media_by_filename'));
+               }
+               
+               return $filelist;
+       }
+       
+       /**
+        * Media::checkFilter()
+        * 
+        * @param       string  $strText
+        * @param       string  $strFilter
+        * @return      boolean
+        */
+       static public function checkFilter($strText, $strFilter)
+       {
+               if ( $strFilter == '' )
+               {
+                       return 1;
+               }
+               else
+               {
+                       return is_integer(i18n::strpos(strtolower($strText), strtolower($strFilter)));
+               }
+       }
+       
+       /**
+        * Media::isValidCollection()
+        * checks if a collection exists with the given name, and if it's
+        * allowed for the currently logged in member to upload files to it
+        * 
+        * @param       string  $collectionName
+        * @param       string  $exceptReadOnly
+        * @return      boolean
+        */
+       static public function isValidCollection($collectionName, $exceptReadOnly = FALSE)
+       {
+               global $member, $DIR_MEDIA;
+               
+               // allow creating new private directory
+               if ( $collectionName === (string)$member->getID() )
+               {
+                       return TRUE;
+               }
+               
+               $collections = self::getCollectionList($exceptReadOnly);
+               $dirname = $collections[$collectionName];
+               
+               if ( $dirname == NULL || $dirname === PRIVATE_COLLECTION )
+               {
+                       return FALSE;
+               }
+               
+               // other collections should exist and be writable
+               $collectionDir = $DIR_MEDIA . $collectionName;
+               if ( $exceptReadOnly )
+               {
+                       return ( @is_dir($collectionDir) && @is_writable($collectionDir) );
+               }
+               
+               // other collections should exist
+               return @is_dir($collectionDir);
+       }
+       
+       /**
+        * Media::addMediaObject()
+        * Adds an uploaded file to the media archive
+        *
+        * @param       string  $collection     collection
+        * @param       array   $uploadfile     the postFileInfo(..) array
+        * @param       string  $filename       the filename that should be used to save the file as
+        *                                                              (date prefix should be already added here)
+        * @return      string  blank if success, message if failed
+        */
+       static public function addMediaObject($collection, $uploadfile, $filename)
+       {
+               global $DIR_MEDIA, $manager;
+               
+               // clean filename of characters that may cause trouble in a filename using cleanFileName() function from globalfunctions.php
+               $filename = cleanFileName($filename);
+               
+               // should already have tested for allowable types before calling this method. This will only catch files with no extension at all
+               if ( $filename === FALSE )
+               {
+                       return _ERROR_BADFILETYPE;
+               }
+               
+               // trigger PreMediaUpload event
+               $data = array('collection' => &$collection, 'uploadfile' => $uploadfile, 'filename' => &$filename);
+               $manager->notify('PreMediaUpload', $data);
+               
+               // don't allow uploads to unknown or forbidden collections
+               $exceptReadOnly = TRUE;
+               if ( !self::isValidCollection($collection,$exceptReadOnly) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               // check dir permissions (try to create dir if it does not exist)
+               $mediadir = $DIR_MEDIA . $collection;
+               
+               // try to create new private media directories if needed
+               if ( !@is_dir($mediadir) && is_numeric($collection) )
+               {
+                       $oldumask = umask(0000);
+                       if ( !@mkdir($mediadir, 0777) )
+                       {
+                               return _ERROR_BADPERMISSIONS;
+                       }
+                       umask($oldumask);
+               }
+               
+               // if dir still not exists, the action is disallowed
+               if ( !@is_dir($mediadir) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               if ( !is_writeable($mediadir) )
+               {
+                       return _ERROR_BADPERMISSIONS;
+               }
+               
+               // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)
+               $mediadir .= '/';
+               
+               if ( file_exists($mediadir . $filename) )
+               {
+                       return _ERROR_UPLOADDUPLICATE;
+               }
+               
+               // move file to directory
+               if ( is_uploaded_file($uploadfile) )
+               {
+                       if ( !@move_uploaded_file($uploadfile, $mediadir . $filename) )
+                       {
+                               return _ERROR_UPLOADMOVEP;
+                       }
+               }
+               else
+               {
+                       if ( !copy($uploadfile, $mediadir . $filename) )
+                       {
+                               return _ERROR_UPLOADCOPY ;
+                       }
+               }
+               
+               // chmod uploaded file
+               $oldumask = umask(0000);
+               @chmod($mediadir . $filename, 0644);
+               umask($oldumask);
+               $data = array('collection' => $collection, 'mediadir' => $mediadir, 'filename' => $filename);
+               $manager->notify('PostMediaUpload', $data);
+               
+               return '';
+       }
+       
+       /**
+        * Media::addMediaObjectRaw()
+        * Adds an uploaded file to the media dir.
+        * 
+        * NOTE: does not check if $collection is valid.
+        * 
+        * @param       string  $collection     collection to use
+        * @param       string  $filename       the filename that should be used to save the file
+        *                                                              as (date prefix should be already added here)
+        * @param       &$data  File data (binary)
+        * @return      string  blank if success, message if failed
+        */
+       static public function addMediaObjectRaw($collection, $filename, &$data)
+       {
+               global $DIR_MEDIA;
+               
+               // check dir permissions (try to create dir if it does not exist)
+               $mediadir = $DIR_MEDIA . $collection;
+               
+               // try to create new private media directories if needed
+               if ( !@is_dir($mediadir) && is_numeric($collection) )
+               {
+                       $oldumask = umask(0000);
+                       if ( !@mkdir($mediadir, 0777) )
+                       {
+                               return _ERROR_BADPERMISSIONS;
+                       }
+                       umask($oldumask);
+               }
+               
+               // if dir still not exists, the action is disallowed
+               if ( !@is_dir($mediadir) )
+               {
+                       return _ERROR_DISALLOWED;
+               }
+               
+               if ( !is_writeable($mediadir) )
+               {
+                       return _ERROR_BADPERMISSIONS;
+               }
+               
+               // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)
+               $mediadir .= '/';
+               
+               if ( file_exists($mediadir . $filename) )
+               {
+                       return _ERROR_UPLOADDUPLICATE;
+               }
+               
+               // create file
+               $fh = @fopen($mediadir . $filename, 'wb');
+               if ( !$fh )
+               {
+                       return _ERROR_UPLOADFAILED;
+               }
+               $ok = @fwrite($fh, $data);
+               @fclose($fh);
+               if ( !$ok )
+               {
+                       return _ERROR_UPLOADFAILED;
+               }
+               
+               // chmod uploaded file
+               $oldumask = umask(0000);
+               @chmod($mediadir . $filename, 0644);
+               umask($oldumask);
+               
+               return '';
+       }
+       
+       /**
+        * Media::responseResampledImage()
+        * send resampled image via HTTP
+        * 
+        * @param       object  $medium         MediaObject Object
+        * @exit
+        */
+       static public function responseResampledImage($medium, $maxwidth=0, $maxheight=0)
+       {
+               if ( get_class($medium) !== 'MediaObject' )
+               {
+                       header("HTTP/1.1 500 Internal Server Error");
+                       exit('Nucleus CMS: Fail to generate resampled image');
+                       return;
+               }
+               
+               $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);
+               if ( $resampledimage === FALSE )
+               {
+                       unset($resampledimage);
+                       header("HTTP/1.1 503 Service Unavailable");
+                       exit('Nucleus CMS: Fail to generate resampled image');
+                       return;
+               }
+               
+               header("Content-type: {$medium->mime}");
+               echo $resampledimage;
+               
+               unset($resampledimage);
+               
+               exit;
+       }
+       
+       /**
+        * Media::storeResampledImage()
+        * Store resampled image binary to filesystem as file
+        * 
+        * @param       object  $medium         MediaObject Object
+        * @param       integer $maxwidth       maximum width
+        * @param       integer $maxheight      maximum height
+        * @param       string  $path           directory path for destination
+        * @param       string  $name           file name for destination
+        * @return      boolean
+        */
+       static public function storeResampledImage($medium, $maxwidth=0, $maxheight=0, $path='', $name='')
+       {
+               global $DIR_MEDIA;
+               
+               if ( get_class($medium) !== 'MediaObject' )
+               {
+                       return FALSE;
+               }
+               
+               if ( $path !== '' )
+               {
+                       $path = realpath($path);
+                       if ( !file_exists($path)
+                         || strpos($path, $DIR_MEDIA) !== 0 )
+                       {
+                               return FALSE;
+                       }
+               }
+               else
+               {
+                       $path = '$DIR_MEDIA/' . self::$thumbdir;
+               }
+               
+               if ( $name === '' )
+               {
+                       $name = $medium->getHashedname();
+               }
+               
+               $resampledimage = $medium->getResampledBinary($maxwidth, $maxheight);
+               if ( !$resampledimage )
+               {
+                       unset($resampledimage);
+                       return FALSE;
+               }
+               
+               $handle = @fopen("{$path}/{$name}", 'w');
+               if ( !$handle )
+               {
+                       unset ($resampledimage);
+                       return FALSE;
+               }
+               
+               if ( !@fwrite($handle, $resampledimage) )
+               {
+                       unset($resampledimage);
+                       @unlink("{$path}/{$name}");
+                       return FALSE;
+               }
+               
+               unset($resampledimage);
+               fclose($handle);
+               
+               if ( !@chmod("{$path}/{$name}", 0774) )
+               {
+                       @unlink("{$path}/{$name}");
+                       return FALSE;
+               }
+               
+               return TRUE;
+       }
+       
+       /**
+        * Media::sort_media_by_timestamp()
+        * User-defined sort method to sort an array of MediaObjects
+        * 
+        * @param       object  $a
+        * @param       object  $b
+        * @return      boolean
+        */
+       static private function sort_media_by_timestamp($a, $b)
+       {
+               if ($a->timestamp == $b->timestamp) return 0;
+               return ($a->timestamp > $b->timestamp) ? -1 : 1;
+       }
+       
+       /**
+        * Media::sort_media_by_filename()
+        * User-defined sort method to sort an array of MediaObjects
+        * 
+        * @param       object  $a
+        * @param       object  $b
+        * @return      boolean
+        */
+       static private function sort_media_by_filename($a, $b)
+       {
+               if ($a->filename == $b->filename) return 0;
+               return ($a->filename > $b->filename) ? -1 : 1;
+       }
+ }
+ class MediaObject
+ {
+       public $mime = '';
+       
+       public $root = '';
+       public $path = '';
+       public $private;
+       public $collection;
+       public $filename = '';
+       
+       public $prefix = '';
+       public $name = '';
+       public $suffix = '';
+       
+       public $timestamp = 0;
+       public $size = 0;
+       
+       public $width = 0;
+       public $height = 0;
+       public $resampledwidth = 0;
+       public $resampledheight = 0;
+       
+       /**
+        * MediaObject::__construct()
+        * 
+        * @param       string          $collection     
+        * @param       string          $filename       
+        * @param       string          $root           fullpath to media directory
+        */
+       public function __construct($collection, $filename, $root=0)
+       {
+               global $CONF, $DIR_MEDIA;
+               
+               /* for backward compatibility */
+               if ( is_numeric($root) )
+               {
+                       $root = $DIR_MEDIA;
+               }
+               
+               $root = preg_replace('#/*$#', '', $root);
+               
+               /* get and validate fullpath for the medium */
+               if ( !file_exists($root)
+                 || FALSE === ($fullpath = realpath("{$root}/{$collection}/{$filename}"))
+                 || strpos($fullpath, $root) !== 0
+                 || !file_exists($fullpath) )
+               {
+                       return FALSE;
+               }
+               
+               /* store fundamentals */
+               $this->root = $root;
+               $this->private = (integer) $collection;
+               $this->collection = $collection;
+               $this->filename = basename($fullpath);
+               $this->timestamp = filemtime($fullpath);
+               
+               /* store relative directory path from root directory for media */
+               $this->path = preg_replace(array("#{$this->root}/#", "#/{$this->filename}#"), '', $fullpath);
+               if ( $this->path === $this->name )
+               {
+                       $this->path = ''; 
+               }
+               
+               return;
+       }
+       
+       /**
+        * MediaObject::refine()
+        * refine data
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function refine()
+       {
+               global $CONF;
+               
+               /* store size (byte order) */
+               $this->size = filesize("{$this->root}/{$this->path}/{$this->filename}");
+               
+               /* get width and height if this is image binary */
+               if ( FALSE === ($info = @getimagesize ("{$this->root}/{$this->path}/{$this->filename}")) )
+               {
+                       $this->mime = 'application/octet-stream';
+                       $this->width = 0;
+                       $this->height = 0;
+               }
+               else
+               {
+                       $this->mime = $info['mime'];
+                       $this->width = $info[0];
+                       $this->height = $info[1];
+               }
+               
+               /* utilise Fileinfo subsystem if available */
+               if ( defined('FILEINFO_MIME_TYPE') && function_exists ('finfo_open')
+                 && (FALSE !== ($info = finfo_open(FILEINFO_MIME_TYPE))) )
+               {
+                       $this->mime = finfo_file($info, "{$this->root}/{$this->path}/{$this->filename}");
+               }
+               
+               /* store data with parsed filename */
+               if ( preg_match('#^(.*)\.([a-zA-Z0-9]{2,})$#', $this->filename, $info) === 1 )
+               {
+                       $this->name = $info[1];
+                       $this->suffix = $info[2];
+                       
+                       if ( $CONF['MediaPrefix'] && preg_match('#^([0-9]{8})\-(.*)$#', $this->name, $info) == 1 )
+                       {
+                               $this->prefix = preg_replace('#^([0-9]{4})([0-9]{2})([0-9]{2})$#', '$1/$2/$3', $info[1]);
+                               $this->name = $info[2];
+                       }
+               }
+               
+               return;
+       }
+       
+       /**
+        * MediaObject::setResampledSize()
+        * Set resampled size
+        * 
+        * @param       integer $maxwidth
+        * @param       integer $maxheight
+        * @return      boolean
+        */
+       public function setResampledSize($maxwidth=0, $maxheight=0)
+       {
+               if ( ($maxwidth == 0) && ($maxheight == 0) )
+               {
+                       return FALSE;
+               }
+               else if ( $this->width == 0 || $this->height  == 0 )
+               {
+                       return FALSE;
+               }
+               else if ($this->width < $maxwidth && $this->height < $maxheight )
+               {
+                       $this->resampledwidth = $this->width;
+                       $this->resampledheight = $this->height;
+               }
+               else if ( $maxheight == 0 || $this->width > $this->height )
+               {
+                       $this->resampledheight = intval ($this->height * $maxwidth / $this->width);
+                       $this->resampledwidth = $maxwidth;
+               }
+               else if ( $maxwidth == 0 || $this->width <= $this->height )
+               {
+                       $this->resampledwidth = intval ($this->width * $maxheight / $this->height);
+                       $this->resampledheight = $maxheight;
+               }
+               return TRUE;
+       }
+       
+       /**
+        * MediaObject::getResampledBinary()
+        * Return resampled image binary
+        * 
+        * @param       void
+        * @return      mixed   binary if success, FALSE if failed
+        */
+       public function getResampledBinary($maxwidth=0, $maxheight=0)
+       {
+               static $gdinfo = array();
+               static $original;
+               static $resampledimage;
+               
+               if ( !$this->setResampledSize($maxwidth, $maxheight) )
+               {
+                       return FALSE;
+               }
+               
+               if ( $gdinfo = array() )
+               {
+                       $gdinfo = gd_info();
+               }
+               
+               if ( $this->path !== '' )
+               {
+                       $fullpath = "{$this->root}/{$this->path}/{$this->name}";
+               }
+               else
+               {
+                       $fullpath = "{$this->root}/{$this->name}";
+               }
+               if ( !file_exists($fullpath) )
+               {
+                       return FALSE;
+               }
+               
+               if ( !array_key_exists($this->mime, Media::$image_mime)
+                 || $this->width == 0
+                 || $this->height == 0
+                 || $this->resampledwidth == 0
+                 || $this->resampledheight == 0 )
+               {
+                       return FALSE;
+               }
+               
+               /* check current available memory */
+               $memorymax = trim(ini_get("memory_limit"));
+               switch ( strtolower ($memorymax[strlen($memorymax)-1]) )
+               {
+                       case 'g':
+                               $memorymax *= 1024;
+                       case 'm':
+                               $memorymax *= 1024;
+                       case 'k':
+                               $memorymax *= 1024;
+               }
+               
+               /*
+                * this code is based on analyze if gd.c in php source code
+                * if you can read C/C++, please check these elements and notify us if you have some ideas
+                */
+               if ( (memory_get_usage()
+                  + ($this->resampledwidth * $this->resampledheight * 5 + $this->resampledheight * 24 + 10000)
+                  + ($this->width * $this->height * 5 + $this->height * 24 + 10000))
+                 > $memorymax )
+               {
+                       return FALSE;
+               }
+               
+               switch ( $this->mime )
+               {
+                       case 'image/gif':
+                               if ( (!array_key_exists('GIF Read Support', $gdinfo) || !isset($gdinfo['GIF Read Support']))
+                                 || (!array_key_exists('GIF Create Support', $gdinfo) || !isset($gdinfo['GIF Create Support'])) )
+                               {
+                                       return FALSE;
+                               }
+                               $function = 'imagecreatefromgif';
+                               break;
+                       case 'image/jpeg':
+                               if ( (!array_key_exists('JPEG Support', $gdinfo) || !isset($gdinfo['JPEG Support']))
+                                 && (!array_key_exists('JPG Support', $gdinfo) || !isset($gdinfo['JPG Support'])) )
+                               {
+                                       return FALSE;
+                               }
+                               $function = 'imagecreatefromjpeg';
+                               break;
+                       case 'image/png':
+                               if ( !array_key_exists('PNG Support', $gdinfo) || !isset($gdinfo['PNG Support']) )
+                               {
+                                       return FALSE;
+                               }
+                               $function = 'imagecreatefrompng';
+                               break;
+                       default:
+                               return FALSE;
+               }
+               
+               if ( !is_callable($function) )
+               {
+                       return FALSE;
+               }
+               
+               $original = call_user_func_array($function, $fullpath);
+               if ( !$original )
+               {
+                       return FALSE;
+               }
+               
+               $resampledimage = imagecreatetruecolor($this->resampledwidth, $this->resampledheight);
+               if ( !$resampledimage )
+               {
+                       imagedestroy($original);
+                       return FALSE;
+               }
+               
+               @set_time_limit(ini_get('max_execution_time'));
+               if ( !ImageCopyResampled($resampledimage, $original, 0, 0, 0, 0, $this->resampledwidth, $this->resampledheight, $this->width, $this->height) )
+               {
+                       return FALSE;
+               }
+               
+               imagedestroy($original);
+               
+               ob_start();
+               
+               switch ( $this->mime )
+               {
+                       case 'image/gif':
+                               imagegif($resampledimage);
+                               break;
+                       case 'image/jpeg':
+                               imagejpeg($resampledimage);
+                               break;
+                       case 'image/png':
+                               imagepng($resampledimage);
+                               break;
+                       case 'image/bmp':
+                       case 'image/x-ms-bmp':
+                               imagepng($resampledimage);
+                               break;
+                       default:
+                               return FALSE;
+               }
+               
+               imagedestroy($resampledimage);
+               
+               return ob_get_clean();
+       }
+       
+       public function getHashedName()
+       {
+               return (string) hash(Media::$algorism, "{$this->path}/{$this->name}", FALSE);
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/* \r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2009 The Nucleus Group\r
 + * \r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * A class representing site members\r
 + * \r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: MEMBER.php 1616 2012-01-08 09:48:15Z sakamocchi $\r
 + */\r
 +class Member\r
 +{\r
 +      // 1 when authenticated, 0 when not\r
 +      public $loggedin = 0;\r
 +      public $password;               // not the actual password, but rather a MD5 hash\r
 +      private $algorism = 'md5';\r
 +      \r
 +      public $cookiekey;              // value that should also be in the client cookie to allow authentication\r
 +      private $cookie_salt = FALSE;\r
 +      \r
 +      // member info\r
 +      public $id = -1;\r
 +      public $realname;\r
 +      public $displayname;\r
 +      public $email;\r
 +      public $url;\r
 +      public $admin = 0;                      // (either 0 or 1)\r
 +      public $canlogin = 0;           // (either 0 or 1)\r
 +      public $notes;\r
 +      public $autosave = 1;           // if the member use the autosave draft function\r
 +      private $locale = '';\r
 +      \r
 +      /**\r
 +       * Member::__construct()\r
 +       * Constructor for a member object\r
 +       * \r
 +       * @param       Void\r
 +       * @return      Void\r
 +       * \r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::createFromName()\r
 +       * Create a member object for a given displayname\r
 +       * \r
 +       * @static\r
 +       * @param       String  $displayname    login name\r
 +       * @return      Object  member object\r
 +       * \r
 +       */\r
 +      public static function &createFromName($displayname)\r
 +      {\r
 +              $mem = new Member();\r
 +              $mem->readFromName($displayname);\r
 +              return $mem;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::createFromID()\r
 +       * Create a member object for a given ID\r
 +       * \r
 +       * @static\r
 +       * @param       Integer $id     id for member\r
 +       */\r
 +      public static function &createFromID($id)\r
 +      {\r
 +              $mem = new Member();\r
 +              $mem->readFromID($id);\r
 +              return $mem;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::readFromName()\r
 +       * Read member table in database\r
 +       * \r
 +       * @param       String  $displayname    login name\r
 +       * @return      Object  SQL resource\r
 +       * \r
 +       */\r
 +      public function readFromName($displayname)\r
 +      {\r
 +              return $this->read('mname='.DB::quoteValue($displayname));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::readFromID()\r
 +       * Read member table in database\r
 +       * \r
 +       * @param       Integer $id     id for member\r
 +       * @return      Object  SQL resource\r
 +       * \r
 +       */\r
 +      public function readFromID($id)\r
 +      {\r
 +              return $this->read("mnumber=" . intval($id));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::hash()\r
 +       * hash the target string\r
 +       * \r
 +       * @param       String  $string target string\r
 +       * @return      Void    hashed string\r
 +       */\r
 +      public function hash($string)\r
 +      {\r
 +              switch ( $this->algorism )\r
 +              {\r
 +                      case 'md5':\r
 +                      default:\r
 +                              $string = md5($string);\r
 +              }\r
 +              return $string;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::set_cookie_salt()\r
 +       * \r
 +       * @param       integer $key    secureCookieKey value\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      private function set_cookie_salt($key = 0)\r
 +      {\r
 +              if ( !$key )\r
 +              {\r
 +                      $key = 24;\r
 +              }\r
 +              \r
 +              switch( $key )\r
 +              {\r
 +                      case 8:\r
 +                              $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
 +                              break;\r
 +                      case 16:\r
 +                              $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
 +                              break;\r
 +                      case 24:\r
 +                              $this->cookie_salt = preg_replace('/\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));\r
 +                              break;\r
 +                      case 32:\r
 +                              $this->cookie_salt = serverVar('REMOTE_ADDR');\r
 +                              break;\r
 +                      default:\r
 +                              $this->cookie_salt = 'none';\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::login()\r
 +       * Tries to login as a given user.\r
 +       * Returns true when succeeded, returns false when failed\r
 +       * 3.40 adds CustomLogin event\r
 +       * \r
 +       * @param       String  $login  login name for member\r
 +       * @param       String  $password       password for member\r
 +       * @param       Integer $shared whether the user agent is shared or not\r
 +       * \r
 +       */\r
 +      public function login($login, $password, $shared=1)\r
 +      {\r
 +              global $CONF, $errormessage, $manager;\r
 +              \r
 +              /* TODO: validation for $login, $password, $shared */\r
 +              if ( $login == '' || $password == '' )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              /* limiting the length of password to avoid hash collision */\r
 +              $password=i18n::substr($password, 0, 40);\r
 +              \r
 +              /* \r
 +               * generate cookie salt from secure cookie key settings\r
 +              * (either 'none', 0, 8, 16, 24, or 32)\r
 +              */\r
 +              if ( !$this->cookie_salt )\r
 +              {\r
 +                      $salt = 0;\r
 +                      if ( array_key_exists('secureCookieKey', $CONF) )\r
 +                      {\r
 +                              $salt = $CONF['secureCookieKey'];\r
 +                      }\r
 +                      $this->set_cookie_salt($salt);\r
 +              }\r
 +              \r
 +              $success = 0;\r
 +              $allowlocal = 1;\r
 +              $manager->notify('CustomLogin', array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal));\r
 +              \r
 +              $this->loggedin = 0;\r
 +              if ( $success )\r
 +              {\r
 +                      $this->loggedin = ( $this->readFromName($login) );\r
 +              }\r
 +              elseif ( $allowlocal )\r
 +              {\r
 +                      $this->loggedin = ( $this->readFromName($login) && $this->checkPassword($password) );\r
 +              }\r
 +              \r
 +              /* login failed */\r
 +              if ( !$this->loggedin )\r
 +              {\r
 +                      $trimlogin = trim($login);\r
 +                      if ( empty($trimlogin) )\r
 +                      {\r
 +                              $errormessage = "Please enter a username.";\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $errormessage = 'Login failed for ' . $login;\r
 +                      }\r
 +                      $manager->notify('LoginFailed', array('username' => $login) );\r
 +                      ActionLog::add(INFO, $errormessage);\r
 +              }\r
 +              /* login success */\r
 +              else\r
 +              {\r
 +                      /* For lower compatibility */\r
 +                      if ( strlen($this->password) === 32 )\r
 +                      {\r
 +                              $this->password = $this->hash($password);\r
 +                      }\r
 +                      \r
 +                      $this->newCookieKey();\r
 +                      $this->setCookies($shared);\r
 +                      \r
 +                      if ( $this->cookie_salt !== 'none' )\r
 +                      {\r
 +                              /* secure cookie key */\r
 +                              $this->setCookieKey($this->hash($this->getCookieKey() . $this->cookie_salt));\r
 +                              $this->write();\r
 +                      }\r
 +                      \r
 +                      $errormessage = '';\r
 +                      $manager->notify('LoginSuccess', array('member' => &$member, 'username' => $login) );\r
 +                      ActionLog::add(INFO, "Login successful for $login (sharedpc=$shared)");\r
 +              }\r
 +              \r
 +              return $this->loggedin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::cookielogin()\r
 +       * Login using cookie key\r
 +       * \r
 +       * @param       String  $login  not used\r
 +       * @param       String  $cookiekey      not used\r
 +       * @return      Boolean login or not\r
 +       */\r
 +      public function cookielogin($login='', $cookiekey='')\r
 +      {\r
 +              global $CONF, $manager;\r
 +              \r
 +              if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )\r
 +              {\r
 +                      /* Cookie Authentication */\r
 +                      $ck = cookieVar("{$CONF['CookiePrefix']}loginkey");\r
 +                              \r
 +                      /* TODO: validation for each cookie values */\r
 +                              \r
 +                      /* limiting the length of password to avoid hash collision */\r
 +                      $ck = i18n::substr($ck,0,32);\r
 +                              \r
 +                      /* \r
 +                       * generate cookie salt from secure cookie key settings\r
 +                      * (either 'none', 0, 8, 16, 24, or 32)\r
 +                      */\r
 +                      if ( !$this->cookie_salt )\r
 +                      {\r
 +                              $salt = 0;\r
 +                              if ( array_key_exists('secureCookieKey', $CONF) )\r
 +                              {\r
 +                                      $salt = $CONF['secureCookieKey'];\r
 +                              }\r
 +                              $this->set_cookie_salt($salt);\r
 +                      }\r
 +                      \r
 +                      if ( $this->cookie_salt !== 'none' )\r
 +                      {\r
 +                              $ck = $this->hash($ck . $this->cookie_salt);\r
 +                      }\r
 +                      $this->loggedin = ( $this->readFromName(cookieVar("{$CONF['CookiePrefix']}user")) && $this->checkCookieKey($ck) );\r
 +                      unset($ck);\r
 +                              \r
 +                      /* renew cookies when not on a shared computer */\r
 +                      if ( $this->loggedin && (cookieVar($CONF['CookiePrefix'] . 'sharedpc') != 1) )\r
 +                      {\r
 +                              $this->setCookieKey(cookieVar("{$CONF['CookiePrefix']}loginkey"));\r
 +                              $this->setCookies();\r
 +                      }\r
 +              }\r
 +              return $this->loggedin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::logout()\r
 +       * logout and expire cookie\r
 +       * \r
 +       * @param       Void\r
 +       * @return      Void\r
 +       */\r
 +      public function logout()\r
 +      {\r
 +              global $CONF, $manager;\r
 +              \r
 +              if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )\r
 +              {\r
 +                      /* remove cookies on logout */\r
 +                      setcookie("{$CONF['CookiePrefix']}user", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +                      setcookie("{$CONF['CookiePrefix']}loginkey", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +                      $manager->notify('Logout', array('username' => cookieVar("{$CONF['CookiePrefix']}user") ) );\r
 +              }\r
 +              \r
 +              $this->loggedin = 0;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::isLoggedIn()\r
 +       * return member is loggedin or not\r
 +       * \r
 +       * @param       Void\r
 +       * @return      Void\r
 +       */\r
 +      public function isLoggedIn()\r
 +      {\r
 +              return $this->loggedin;\r
 +      }\r
 +      \r
 +      /**\r
 +       * MEMBER:read()\r
 +       * Read member information from the database\r
 +       * \r
 +       * @param       String  $where  where statement\r
 +       * @return      Resource        SQL resource\r
 +       * \r
 +       */\r
 +      public function read($where)\r
 +      {\r
 +              // read info\r
 +              $query =  'SELECT * FROM '.sql_table('member') . ' WHERE ' . $where;\r
 +              \r
 +              $row = DB::getRow($query);\r
 +              \r
 +              $this->setRealName($row['mrealname']);\r
 +              $this->setEmail($row['memail']);\r
 +              $this->password = $row['mpassword'];\r
 +              $this->setCookieKey($row['mcookiekey']);\r
 +              $this->setURL($row['murl']);\r
 +              $this->setDisplayName($row['mname']);\r
 +              $this->setAdmin($row['madmin']);\r
 +              $this->id = $row['mnumber'];\r
 +              $this->setCanLogin($row['mcanlogin']);\r
 +              $this->setNotes($row['mnotes']);\r
 +              $this->setLocale($row['mlocale']);\r
 +              $this->setAutosave($row['mautosave']);\r
 +              \r
 +              return $row ? TRUE : FALSE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::isBlogAdmin()\r
 +       * Returns true if member is an admin for the given blog\r
 +       * (returns false if not a team member)\r
 +       * \r
 +       * @param       Integer $blogid weblog id\r
 +       * @return      Integer weblog admin or not\r
 +       * \r
 +       */\r
 +      public function isBlogAdmin($blogid)\r
 +      {\r
 +              $query = 'SELECT tadmin FROM '.sql_table('team').' WHERE'\r
 +              . ' tblog=' . intval($blogid)\r
 +              . ' and tmember='. $this->getID();\r
 +              $res = DB::getValue($query);\r
 +              if ( $res )\r
 +                      return ($res == 1);\r
 +              else\r
 +                      return 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::blogAdminRights()\r
 +       * \r
 +       * @param       integer $blogid ID of target weblog\r
 +       * @return      boolean whether to have admin rights to the weblog or not\r
 +       * \r
 +       */\r
 +      public function blogAdminRights($blogid)\r
 +      {\r
 +              return ($this->isAdmin() || $this->isBlogAdmin($blogid));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::teamRights()\r
 +       * \r
 +       * @param       integer $blogid ID of target weblog\r
 +       * @return      boolean whether to have admin right to the weblog or not\r
 +       * \r
 +       */\r
 +      public function teamRights($blogid)\r
 +      {\r
 +              return ($this->isAdmin() || $this->isTeamMember($blogid));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::isTeamMember()\r
 +       * Returns true if this member is a team member of the given blog\r
 +       * \r
 +       * @param       integer $blogid ID of target weblog\r
 +       * @return      boolean whether to join the weblog or not\r
 +       * \r
 +       */\r
 +      public function isTeamMember($blogid)\r
 +      {\r
 +              $query = 'SELECT * FROM '.sql_table('team').' WHERE'\r
 +                         . ' tblog=' . intval($blogid)\r
 +                         . ' and tmember='. $this->getID();\r
 +              $res = DB::getResult($query);\r
 +              return ($res->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::canAddItem()\r
 +       * \r
 +       * @param       integer $catid  ID of target category\r
 +       * @return      boolean whether to be able to add items to the category or not\r
 +       * \r
 +       */\r
 +      public function canAddItem($catid)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              // if this is a 'newcat' style newcat\r
 +              // no blog admin of destination blog -> NOK\r
 +              // blog admin of destination blog -> OK\r
 +              if ( i18n::strpos($catid,'newcat') === 0 )\r
 +              {\r
 +                      // get blogid\r
 +                      list($blogid) = sscanf($catid,"newcat-%d");\r
 +                      return $this->blogAdminRights($blogid);\r
 +              }\r
 +              \r
 +              // category does not exist -> NOK\r
 +              if ( !$manager->existsCategory($catid) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              $blogid = getBlogIDFromCatID($catid);\r
 +              \r
 +              // no team rights for blog -> NOK\r
 +              if (!$this->teamRights($blogid))\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // all other cases: OK\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::canAlterComment()\r
 +       * Returns true if this member can edit/delete a commentitem. This can be in the\r
 +       * following cases:\r
 +       *        - member is a super-admin\r
 +       *   - member is the author of the comment\r
 +       *   - member is admin of the blog associated with the comment\r
 +       *   - member is author of the item associated with the comment\r
 +       * \r
 +       * @param       integer $commentid      ID of target comment\r
 +       * @return      boolean delete/edit the comment or not\r
 +       * \r
 +       */\r
 +      public function canAlterComment($commentid)\r
 +      {\r
 +              if ( $this->isAdmin() )\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              \r
 +              $query =  'SELECT citem as itemid, iblog as blogid, cmember as cauthor, iauthor'\r
 +                         . ' FROM '.sql_table('comment') .', '.sql_table('item').', '.sql_table('blog')\r
 +                         . ' WHERE citem=inumber and iblog=bnumber and cnumber=' . intval($commentid);\r
 +              $res = DB::getRow($query);\r
 +              \r
 +              return ($res['cauthor'] == $this->getID()) or $this->isBlogAdmin($res['blogid']) or ($res['iauthor'] == $this->getID());\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::canAlterItem()\r
 +       * Returns true if this member can edit/delete an item. This is true in the following\r
 +       * cases: - member is a super-admin\r
 +       *             - member is the author of the item\r
 +       *        - member is admin of the the associated blog\r
 +       * \r
 +       * @param       integer $itemid ID of target item\r
 +       * @return      boolean delete/edit the item or not\r
 +       * \r
 +       */\r
 +      public function canAlterItem($itemid)\r
 +      {\r
 +              if ($this->isAdmin()) return 1;\r
 +              \r
 +              $query =  'SELECT iblog, iauthor FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);\r
 +              $res = DB::getRow($query);\r
 +              return ($res['iauthor'] == $this->getID()) or $this->isBlogAdmin($res['iblog']);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::canBeDeleted()\r
 +       * Return true if member can be deleted. This means that there are no items posted by the member left\r
 +       * \r
 +       * @param       void\r
 +       * @return      boolean whether there is no items or exists\r
 +       * \r
 +       */\r
 +      public function canBeDeleted()\r
 +      {\r
 +              $res = DB::getResult('SELECT * FROM '.sql_table('item').' WHERE iauthor=' . $this->getID());\r
 +              return ( $res->rowCount() == 0 );\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::canUpdateItem()\r
 +       * returns true if this member can move/update an item to a given category,\r
 +       * false if not (see comments fot the tests that are executed)\r
 +       * \r
 +       * @param       integer $itemid\r
 +       * @param       string  $newcat (can also be of form 'newcat-x' with x=blogid)\r
 +       * @return      boolean whether being able to update the item or not\r
 +       * \r
 +       */\r
 +      public function canUpdateItem($itemid, $newcat)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              // item does not exists -> NOK\r
 +              if ( !$manager->existsItem($itemid,1,1) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // cannot alter item -> NOK\r
 +              if (!$this->canAlterItem($itemid))\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // if this is a 'newcat' style newcat\r
 +              // no blog admin of destination blog -> NOK\r
 +              // blog admin of destination blog -> OK\r
 +              if ( i18n::strpos($newcat, 'newcat') === 0 )\r
 +              {\r
 +                      // get blogid\r
 +                      list($blogid) = sscanf($newcat, 'newcat-%d');\r
 +                      return $this->blogAdminRights($blogid);\r
 +              }\r
 +              \r
 +              // category does not exist -> NOK\r
 +              if (!$manager->existsCategory($newcat))\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // get item\r
 +              $item =& $manager->getItem($itemid,1,1);\r
 +              \r
 +              // old catid = new catid -> OK\r
 +              if ($item['catid'] == $newcat)\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              \r
 +              // not a valid category -> NOK\r
 +              $validCat = DB::getValue('SELECT COUNT(*) AS result FROM '.sql_table('category').' WHERE catid='.intval($newcat));\r
 +              if ( !$validCat )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // get destination blog\r
 +              $source_blogid = getBlogIDFromItemID($itemid);\r
 +              $dest_blogid = getBlogIDFromCatID($newcat);\r
 +              \r
 +              // not a team member of destination blog -> NOK\r
 +              if ( !$this->teamRights($dest_blogid) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // if member is author of item -> OK\r
 +              if ( $item['authorid'] == $this->getID() )\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              \r
 +              // if member has admin rights on both blogs: OK\r
 +              if ( ($this->blogAdminRights($dest_blogid)) && ($this->blogAdminRights($source_blogid)) )\r
 +              {\r
 +                      return 1;\r
 +              }\r
 +              \r
 +              // all other cases: NOK\r
 +              return 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::setCookies()\r
 +       * Sets the cookies for the member\r
 +       * \r
 +       * @param boolean       $shared set this to 1 when using a shared computer. Cookies will expire\r
 +       *                              at the end of the session in this case.\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      public function setCookies($shared = 0)\r
 +      {\r
 +              global $CONF;\r
 +              \r
 +              if ( $CONF['SessionCookie'] || $shared )\r
 +              {\r
 +                      $lifetime = 0;\r
 +              }\r
 +              else\r
 +              {\r
 +                      $lifetime = time()+2592000;\r
 +              }\r
 +              \r
 +              setcookie($CONF['CookiePrefix'] . 'user', $this->getDisplayName(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +              setcookie($CONF['CookiePrefix'] . 'loginkey', $this->getCookieKey(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +              \r
 +              // make sure cookies on shared pcs don't get renewed\r
 +              if ( $shared )\r
 +              {\r
 +                      setcookie($CONF['CookiePrefix'] .'sharedpc', '1',$lifetime,$CONF['CookiePath'],$CONF['CookieDomain'],$CONF['CookieSecure']);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::sendActivationLink()\r
 +       * Send activation mail\r
 +       * \r
 +       * @param       string  $type   activation type\r
 +       * @param       string  $extra  extra info\r
 +       * @return      void\r
 +       */\r
 +      public function sendActivationLink($type, $extra='')\r
 +      {\r
 +              global $CONF;\r
 +              \r
 +              if ( !isset($CONF['ActivationDays']) )\r
 +              {\r
 +                      $CONF['ActivationDays'] = 2;\r
 +              }\r
 +              \r
 +              // generate key and URL\r
 +              $key = $this->generateActivationEntry($type, $extra);\r
 +              $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key;\r
 +              \r
 +              // choose text to use in mail\r
 +              switch ( $type )\r
 +              {\r
 +                      case 'register':\r
 +                              $message = _ACTIVATE_REGISTER_MAIL;\r
 +                              $subject = _ACTIVATE_REGISTER_MAILTITLE;\r
 +                              break;\r
 +                      case 'forgot':\r
 +                              $message = _ACTIVATE_FORGOT_MAIL;\r
 +                              $subject = _ACTIVATE_FORGOT_MAILTITLE;\r
 +                              break;\r
 +                      case 'addresschange':\r
 +                              $message = _ACTIVATE_CHANGE_MAIL;\r
 +                              $subject = _ACTIVATE_CHANGE_MAILTITLE;\r
 +                              break;\r
 +                      default;\r
 +              }\r
 +              \r
 +              // fill out variables in text\r
 +              $aVars = array(\r
 +                      'siteName' => $CONF['SiteName'],\r
 +                      'siteUrl' => $CONF['IndexURL'],\r
 +                      'memberName' => $this->getDisplayName(),\r
 +                      'activationUrl' => $url,\r
 +                      'activationDays' => $CONF['ActivationDays']\r
 +              );\r
 +              \r
 +              $message = Template::fill($message, $aVars);\r
 +              $subject = Template::fill($subject, $aVars);\r
 +              \r
 +              // send mail\r
 +              NOTIFICATION::mail($this->getEmail(), $subject ,$message, $CONF['AdminEmail'], i18n::get_current_charset());\r
 +              \r
 +              ActionLog::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')');\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::getAdminBlogs()\r
 +       * Returns an array of all blogids for which member has admin rights\r
 +       * \r
 +       * @param       void\r
 +       * @return      array   weblog IDs in which this member has admin rights\r
 +       * \r
 +       */\r
 +      public function getAdminBlogs()\r
 +      {\r
 +              $blogs = array();\r
 +              \r
 +              if ($this->isAdmin())\r
 +              {\r
 +                      $query = 'SELECT bnumber as blogid from '.sql_table('blog');\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = 'SELECT tblog as blogid from '.sql_table('team').' where tadmin=1 and tmember=' . $this->getID();\r
 +              }\r
 +              \r
 +              $res = DB::getResult($query);\r
 +              if ( $res->rowCount() > 0 )\r
 +              {\r
 +                      foreach ( $res as $row )\r
 +                      {\r
 +                              array_push($blogs, $row['blogid']);\r
 +                      }\r
 +              }\r
 +              return $blogs;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::getTeamBlogs()\r
 +       * Returns an array of all blogids for which member has team rights\r
 +       * \r
 +       * @param       boolean $incAdmin       whether checking weblog admin rights or not\r
 +       * @return      array   weblog IDs in which this member join\r
 +       * \r
 +       */\r
 +      public function getTeamBlogs($incAdmin = 1)\r
 +      {\r
 +              $incAdmin = intval($incAdmin);\r
 +              $blogs = array();\r
 +              \r
 +              if ( $this->isAdmin() && $incAdmin )\r
 +              {\r
 +                      $query = 'SELECT bnumber as blogid from '.sql_table('blog');\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = 'SELECT tblog as blogid from '.sql_table('team').' where tmember=' . $this->getID();\r
 +              }\r
 +              \r
 +              $res = DB::getResult($query);\r
 +              if ( $res->rowCount() > 0 )\r
 +              {\r
 +                      foreach ( $res as $row )\r
 +                      {\r
 +                              array_push($blogs, $row['blogid']);\r
 +                      }\r
 +              }\r
 +              return $blogs;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::getNotifyFromMailAddress()\r
 +       * \r
 +       * Returns an email address from which notification of commenting/karma voting can\r
 +       * be sent. A suggestion can be given for when the member is not logged in\r
 +       * \r
 +       * @param       String  $suggest\r
 +       * @return      String  mail address or suggestion\r
 +       */\r
 +      public function getNotifyFromMailAddress($suggest = "")\r
 +      {\r
 +              global $CONF;\r
 +              if ( $this->isLoggedIn() )\r
 +              {\r
 +                      return $this->getDisplayName() . " <" . $this->getEmail() . ">";\r
 +              }\r
 +              else if ( NOTIFICATION::address_validation($suggest) )\r
 +              {\r
 +                      return $suggest;\r
 +              }\r
 +              return $CONF['AdminEmail'];\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::write()\r
 +       * Write data to database\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      public function write()\r
 +      {\r
 +              $query =  'UPDATE '.sql_table('member')\r
 +                      . ' SET mname=' . DB::quoteValue($this->displayname) . ', '\r
 +                         . 'mrealname='. DB::quoteValue($this->realname) . ', '\r
 +                         . 'mpassword='. DB::quoteValue($this->password) . ', '\r
 +                         . 'mcookiekey='. DB::quoteValue($this->cookiekey) . ', '\r
 +                         . 'murl=' . DB::quoteValue($this->url) . ', '\r
 +                         . 'memail=' . DB::quoteValue($this->email) . ', '\r
 +                         . 'madmin=' . intval($this->admin) . ', '\r
 +                         . 'mnotes=' . DB::quoteValue($this->notes) . ', '\r
 +                         . 'mcanlogin=' . intval($this->canlogin) . ', '\r
 +                         . 'mlocale=' . DB::quoteValue($this->locale) . ', '\r
 +                         . 'mautosave=' . intval($this->autosave) . ' '\r
 +                      . 'WHERE mnumber=' . intval($this->id);\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      public function checkCookieKey($key)\r
 +      {\r
 +              return ( ($key != '') && ( $key == $this->getCookieKey() ) );\r
 +      }\r
 +      \r
 +      public function checkPassword($pw)\r
 +      {\r
 +              /* for lower compatibility (md5) */\r
 +              if ( strlen($this->password) === 32 )\r
 +              {\r
 +                      return (md5($pw) == $this->password);\r
 +              }\r
 +              return ($this->hash($pw) == $this->password);\r
 +      }\r
 +      \r
 +      public function getRealName()\r
 +      {\r
 +              return $this->realname;\r
 +      }\r
 +      \r
 +      public function setRealName($name)\r
 +      {\r
 +              $this->realname = $name;\r
 +      }\r
 +      \r
 +      public function getEmail()\r
 +      {\r
 +              return $this->email;\r
 +      }\r
 +      \r
 +      public function setEmail($email)\r
 +      {\r
 +              $this->email = $email;\r
 +      }\r
 +      \r
 +      public function getPassword()\r
 +      {\r
 +              return $this->password;\r
 +      }\r
 +      \r
 +      public function setPassword($pwd)\r
 +      {\r
 +              $this->password = $this->hash($pwd);\r
 +      }\r
 +      \r
 +      public function getCookieKey()\r
 +      {\r
 +              return $this->cookiekey;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::newCookieKey()\r
 +       * Generate new cookiekey, save it, and return it\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      public function newCookieKey()\r
 +      {\r
 +              mt_srand( (double) microtime() * 1000000);\r
 +              $this->cookiekey = $this->hash(uniqid(mt_rand()));\r
 +              $this->write();\r
 +              return $this->cookiekey;\r
 +      }\r
 +      \r
 +      public function setCookieKey($val)\r
 +      {\r
 +              $this->cookiekey = $val;\r
 +      }\r
 +      \r
 +      public function getURL()\r
 +      {\r
 +              return $this->url;\r
 +      }\r
 +      \r
 +      public function setURL($site)\r
 +      {\r
 +              $this->url = $site;\r
 +      }\r
 +      \r
 +      public function getLocale()\r
 +      {\r
 +              return $this->locale;\r
 +      }\r
 +      \r
 +      public function setLocale($locale)\r
 +      {\r
 +              if ( !preg_match('#^(.+)_(.+)_(.+)$#', $locale)\r
 +               && ($locale = i18n::convert_old_language_file_name_to_locale($locale)) === FALSE )\r
 +              {\r
 +                      $locale = '';\r
 +              }\r
 +              $this->locale = $locale;\r
 +              return;\r
 +      }\r
 +      \r
 +      public function setDisplayName($nick)\r
 +      {\r
 +              $this->displayname = $nick;\r
 +      }\r
 +      \r
 +      public function getDisplayName()\r
 +      {\r
 +              return $this->displayname;\r
 +      }\r
 +      \r
 +      public function isAdmin()\r
 +      {\r
 +              return $this->admin;\r
 +      }\r
 +      \r
 +      public function setAdmin($val)\r
 +      {\r
 +              $this->admin = $val;\r
 +      }\r
 +      \r
 +      public function canLogin()\r
 +      {\r
 +              return $this->canlogin;\r
 +      }\r
 +      \r
 +      public function setCanLogin($val)\r
 +      {\r
 +              $this->canlogin = $val;\r
 +      }\r
 +      \r
 +      public function getNotes()\r
 +      {\r
 +              return $this->notes;\r
 +      }\r
 +      \r
 +      public function setNotes($val)\r
 +      {\r
 +              $this->notes = $val;\r
 +      }\r
 +      \r
 +      public function getAutosave()\r
 +      {\r
 +              return $this->autosave;\r
 +      }\r
 +      \r
 +      public function setAutosave($val)\r
 +      {\r
 +              $this->autosave = $val;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::getID()\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer id of this member object\r
 +       * \r
 +       */\r
 +      public function getID()\r
 +      {\r
 +              return $this->id;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::exists()\r
 +       * Returns true if there is a member with the given login name\r
 +       * \r
 +       * @static\r
 +       * @param       string  $name   target name\r
 +       * @return      boolean whether target name exists or not\r
 +       */\r
 +      public static function exists($name)\r
 +      {\r
 +              $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mname=' . DB::quoteValue($name));\r
 +              return ( $r->rowCount() != 0 );\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::existsID()\r
 +       * Returns true if there is a member with the given ID\r
 +       * \r
 +       * @static\r
 +       * @param       integer $id     target id\r
 +       * @return      boolean whether target id exists or not\r
 +       * \r
 +       */\r
 +      public static function existsID($id)\r
 +      {\r
 +              $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mnumber=' . intval($id));\r
 +              return ( $r->rowCount() != 0 );\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::isNameProtected()\r
 +       *  Checks if a username is protected.\r
 +       *  If so, it can not be used on anonymous comments\r
 +       * \r
 +       * @param       string  $name   target name\r
 +       * @return      boolean whether the name exists or not\r
 +       * \r
 +       */\r
 +      public function isNameProtected($name)\r
 +      {\r
 +              // extract name\r
 +              $name = strip_tags($name);\r
 +              $name = trim($name);\r
 +              return self::exists($name);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::create()\r
 +       * Adds a new member\r
 +       * \r
 +       * @static\r
 +       * @param       String  $name\r
 +       * @param       String  $realname\r
 +       * @param       String  $password\r
 +       * @param       String  $email\r
 +       * @param       String  $url\r
 +       * @param       String  $admin\r
 +       * @param       String  $canlogin\r
 +       * @param       String  $notes\r
 +       * @return      String  1 if success, others if fail\r
 +       */\r
 +      static public function create($name, $realname, $password, $email, $url, $admin, $canlogin, $notes)\r
 +      {\r
 +              if ( !NOTIFICATION::address_validation($email) )\r
 +              {\r
 +                      return _ERROR_BADMAILADDRESS;\r
 +              }\r
 +              \r
 +              /* TODO: this method should be in MEMBER class, not globalfunctions */\r
 +              if ( !isValidDisplayName($name) )\r
 +              {\r
 +                      return _ERROR_BADNAME;\r
 +              }\r
 +              \r
 +              if ( self::exists($name) )\r
 +              {\r
 +                      return _ERROR_NICKNAMEINUSE;\r
 +              }\r
 +              \r
 +              if ( !$realname )\r
 +              {\r
 +                      return _ERROR_REALNAMEMISSING;\r
 +              }\r
 +              \r
 +              /* TODO: check the number of characters */\r
 +              if ( !$password )\r
 +              {\r
 +                      return _ERROR_PASSWORDMISSING;\r
 +              }\r
 +              \r
 +              /* \r
 +               *  begin if: sometimes user didn't prefix the URL with http:// or https://,\r
 +               *  this cause a malformed URL. Let's fix it.\r
 +               */\r
 +              \r
 +              if ( !preg_match('#^https?://#', $url) )\r
 +              {\r
 +                      $url = 'http://' . $url;\r
 +              }\r
 +              \r
 +              $name           = DB::quoteValue($name);\r
 +              $realname       = DB::quoteValue($realname);\r
 +              /* NOTE: hashed password is automatically updated if the length is 32 bytes when logging in */\r
 +              $password       = DB::quoteValue(md5($password));\r
 +              $email          = DB::quoteValue($email);\r
 +              $url            = DB::quoteValue($url);\r
 +              $admin          = (integer) $admin;\r
 +              $canlogin       = (integer) $canlogin;\r
 +              $notes          = DB::quoteValue($notes);\r
 +              \r
 +              $query = "INSERT INTO %s"\r
 +                     . " (MNAME,MREALNAME,MPASSWORD,MEMAIL,MURL, MADMIN, MCANLOGIN, MNOTES)"\r
 +                     . " VALUES (%s, %s, %s, %s, %s, %d, %d, %s)";\r
 +              $query = sprintf($query, sql_table('member'), $name, $realname, $password, $email, $url, $admin, $canlogin, $notes);\r
 +              DB::execute($query);\r
 +              \r
 +              ActionLog::add(INFO, _ACTIONLOG_NEWMEMBER . ' ' . $name);\r
 +              \r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::getActivationInfo()\r
 +       * Returns activation info for a certain key (an object with properties vkey, vmember, ...)\r
 +       * \r
 +       * @static\r
 +       * @param       string  $key    activation key\r
 +       * @return      mixed   return 0 if failed, else return activation table object\r
 +       * \r
 +       */\r
 +      public static function getActivationInfo($key)\r
 +      {\r
 +              $query = 'SELECT * FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key);\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              if ( !$res || ($res->rowCount() == 0) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              return $res->fetch();\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::generateActivationEntry()\r
 +       * Creates an account activation key\r
 +       * addresschange -> old email address\r
 +       * \r
 +       * @param       string  $type   one of the following values (determines what to do when activation expires)\r
 +       *                              'register'      (new member registration)\r
 +       *                              'forgot'        (forgotton password)\r
 +       *                              'addresschange' (member address has changed)\r
 +       * @param       string  $extra  extra info (needed when validation link expires)\r
 +       * @return      string  activation key\r
 +       */\r
 +      public function generateActivationEntry($type, $extra = '')\r
 +      {\r
 +              // clean up old entries\r
 +              $this->cleanupActivationTable();\r
 +              \r
 +              // kill any existing entries for the current member (delete is ok)\r
 +              // (only one outstanding activation key can be present for a member)\r
 +              DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . intval($this->getID()));\r
 +              \r
 +              // indicates if the member can log in while the link is active\r
 +              $canLoginWhileActive = false;\r
 +              switch ( $type )\r
 +              {\r
 +                      case 'forgot':\r
 +                              $canLoginWhileActive = true;\r
 +                              break;\r
 +                      case 'register':\r
 +                              break;\r
 +                      case 'addresschange':\r
 +                              $extra = $extra . '/' . ( $this->canLogin() ? '1' : '0' );\r
 +                              break;\r
 +              }\r
 +              \r
 +              $ok = false;\r
 +              while ( !$ok )\r
 +              {\r
 +                      // generate a random key\r
 +                      srand((double)microtime()*1000000);\r
 +                      $key = $this->hash(uniqid(rand(), true));\r
 +                      \r
 +                      // attempt to add entry in database\r
 +                      // add in database as non-active\r
 +                      $query = 'INSERT INTO %s (vkey, vtime, vmember, vtype, vextra) VALUES (%s, %s, %d, %s, %s)';\r
 +                      $query = sprintf($query\r
 +                              , sql_table('activation')\r
 +                              , DB::quoteValue($key)\r
 +                              , DB::formatDateTime()\r
 +                              , intval($this->getID())\r
 +                              , DB::quoteValue($type)\r
 +                              , DB::quoteValue($extra)\r
 +                      );\r
 +                      if ( DB::execute($query) !== FALSE )\r
 +                              $ok = true;\r
 +              }\r
 +              \r
 +              // mark member as not allowed to log in\r
 +              if ( !$canLoginWhileActive )\r
 +              {\r
 +                      $this->setCanLogin(0);\r
 +                      $this->write();\r
 +              }\r
 +              \r
 +              // return the key\r
 +              return $key;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::activate()\r
 +       * Inidicates that an activation link has been clicked and any forms displayed\r
 +       * there have been successfully filled out.\r
 +       * \r
 +       * @param       string  $key    activation key\r
 +       * @return      boolean\r
 +       * \r
 +       */\r
 +      public function activate($key)\r
 +      {\r
 +              // get activate info\r
 +              $info = self::getActivationInfo($key);\r
 +              \r
 +              // no active key\r
 +              if ( !$info )\r
 +              {\r
 +                      return false;\r
 +              }\r
 +              \r
 +              switch ( $info['vtype'] )\r
 +              {\r
 +                      case 'forgot':\r
 +                              // nothing to do\r
 +                              break;\r
 +                      case 'register':\r
 +                              // set canlogin value\r
 +                              global $CONF;\r
 +                              DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($CONF['NewMemberCanLogon']). ' WHERE mnumber=' . intval($info['vmember']));\r
 +                              break;\r
 +                      case 'addresschange':\r
 +                              // reset old 'canlogin' value\r
 +                              list($oldEmail, $oldCanLogin) = preg_split('#/#', $info['vextra']);\r
 +                              DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ' WHERE mnumber=' . intval($info['vmember']));\r
 +                              break;\r
 +              }\r
 +              \r
 +              // delete from activation table\r
 +              DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key));\r
 +              \r
 +              // success!\r
 +              return true;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::cleanupActivationTable()\r
 +       * Cleans up entries in the activation table. All entries older than 2 days are removed.\r
 +       * (static)\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function cleanupActivationTable()\r
 +      {\r
 +              $actdays = 2;\r
 +              if ( isset($CONF['ActivationDays']) && intval($CONF['ActivationDays']) > 0 )\r
 +              {\r
 +                      $actdays = intval($CONF['ActivationDays']);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $CONF['ActivationDays'] = 2;\r
 +              }\r
 +              $boundary = time() - (60 * 60 * 24 * $actdays);\r
 +              \r
 +              // 1. walk over all entries, and see if special actions need to be performed\r
 +              $query = sprintf('SELECT * FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      switch ( $row['vtype'] )\r
 +                      {\r
 +                              case 'register':\r
 +                                      // delete all information about this site member. registration is undone because there was\r
 +                                      // no timely activation\r
 +                                      include_once($DIR_LIBS . 'ADMIN.php');\r
 +                                      Admin::deleteOneMember(intval($row['vmember']));\r
 +                                      break;\r
 +                              case 'addresschange':\r
 +                                      // revert the e-mail address of the member back to old address\r
 +                                      list($oldEmail, $oldCanLogin) = preg_split('#/#', $row['vextra']);\r
 +                                      DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ', memail=' . DB::quoteValue($oldEmail). ' WHERE mnumber=' . intval($row['vmember']));\r
 +                                      break;\r
 +                              case 'forgot':\r
 +                                      // delete the activation link and ignore. member can request a new password using the\r
 +                                      // forgot password link\r
 +                                      break;\r
 +                      }\r
 +              }\r
 +              \r
 +              // 2. delete activation entries for real\r
 +              $query = sprintf('DELETE FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Member::$language\r
 +       * \r
 +       * @obsolete\r
 +       * @param       void\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      public $language = '';\r
 +      /**\r
 +       * Member::getLanguage()\r
 +       * \r
 +       * @obsolete\r
 +       * @param       void\r
 +       * @return      void\r
 +       * \r
 +       */\r
 +      public function getLanguage()\r
 +      {\r
 +              if ( ($language = i18n::convert_locale_to_old_language_file_name($this->locale)) === FALSE )\r
 +              {\r
 +                      $language = '';\r
 +              }\r
 +              return $language;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /* 
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  * 
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * A class representing site members
+  * 
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: MEMBER.php 1616 2012-01-08 09:48:15Z sakamocchi $
+  */
+ class Member
+ {
+       // 1 when authenticated, 0 when not
+       public $loggedin = 0;
+       public $password;               // not the actual password, but rather a MD5 hash
+       private $algorism = 'md5';
+       
+       public $cookiekey;              // value that should also be in the client cookie to allow authentication
+       private $cookie_salt = FALSE;
+       
+       // member info
+       public $id = -1;
+       public $realname;
+       public $displayname;
+       public $email;
+       public $url;
+       public $admin = 0;                      // (either 0 or 1)
+       public $canlogin = 0;           // (either 0 or 1)
+       public $notes;
+       public $autosave = 1;           // if the member use the autosave draft function
+       public $adminskin = 0;          // if the member use the autosave draft function
+       public $bookmarklet = 0;                // if the member use the autosave draft function
+       private $locale = '';
+       
+       /**
+        * Member::__construct()
+        * Constructor for a member object
+        * 
+        * @param       Void
+        * @return      Void
+        * 
+        */
+       public function __construct()
+       {
+               return;
+       }
+       
+       /**
+        * Member::createFromName()
+        * Create a member object for a given displayname
+        * 
+        * @static
+        * @param       String  $displayname    login name
+        * @return      Object  member object
+        * 
+        */
+       public static function &createFromName($displayname)
+       {
+               $mem = new Member();
+               $mem->readFromName($displayname);
+               return $mem;
+       }
+       
+       /**
+        * Member::createFromID()
+        * Create a member object for a given ID
+        * 
+        * @static
+        * @param       Integer $id     id for member
+        */
+       public static function &createFromID($id)
+       {
+               $mem = new Member();
+               $mem->readFromID($id);
+               return $mem;
+       }
+       
+       /**
+        * Member::readFromName()
+        * Read member table in database
+        * 
+        * @param       String  $displayname    login name
+        * @return      Object  SQL resource
+        * 
+        */
+       public function readFromName($displayname)
+       {
+               return $this->read('mname='.DB::quoteValue($displayname));
+       }
+       
+       /**
+        * Member::readFromID()
+        * Read member table in database
+        * 
+        * @param       Integer $id     id for member
+        * @return      Object  SQL resource
+        * 
+        */
+       public function readFromID($id)
+       {
+               return $this->read("mnumber=" . intval($id));
+       }
+       
+       /**
+        * Member::hash()
+        * hash the target string
+        * 
+        * @param       String  $string target string
+        * @return      Void    hashed string
+        */
+       public function hash($string)
+       {
+               switch ( $this->algorism )
+               {
+                       case 'md5':
+                       default:
+                               $string = md5($string);
+               }
+               return $string;
+       }
+       
+       /**
+        * Member::set_cookie_salt()
+        * 
+        * @param       integer $key    secureCookieKey value
+        * @return      void
+        * 
+        */
+       private function set_cookie_salt($key = 0)
+       {
+               if ( !$key )
+               {
+                       $key = 24;
+               }
+               
+               switch( $key )
+               {
+                       case 8:
+                               $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+                               break;
+                       case 16:
+                               $this->cookie_salt = preg_replace('/\.[0-9]+\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+                               break;
+                       case 24:
+                               $this->cookie_salt = preg_replace('/\.[0-9]+$/', '', serverVar('REMOTE_ADDR'));
+                               break;
+                       case 32:
+                               $this->cookie_salt = serverVar('REMOTE_ADDR');
+                               break;
+                       default:
+                               $this->cookie_salt = 'none';
+               }
+               return;
+       }
+       
+       /**
+        * Member::login()
+        * Tries to login as a given user.
+        * Returns true when succeeded, returns false when failed
+        * 3.40 adds CustomLogin event
+        * 
+        * @param       String  $login  login name for member
+        * @param       String  $password       password for member
+        * @param       Integer $shared whether the user agent is shared or not
+        * 
+        */
+       public function login($login, $password, $shared=1)
+       {
+               global $CONF, $errormessage, $manager;
+               
+               /* TODO: validation for $login, $password, $shared */
+               if ( $login == '' || $password == '' )
+               {
+                       return 0;
+               }
+               /* limiting the length of password to avoid hash collision */
+               $password=i18n::substr($password, 0, 40);
+               
+               /* 
+                * generate cookie salt from secure cookie key settings
+               * (either 'none', 0, 8, 16, 24, or 32)
+               */
+               if ( !$this->cookie_salt )
+               {
+                       $salt = 0;
+                       if ( array_key_exists('secureCookieKey', $CONF) )
+                       {
+                               $salt = $CONF['secureCookieKey'];
+                       }
+                       $this->set_cookie_salt($salt);
+               }
+               
+               $success = 0;
+               $allowlocal = 1;
+               $data = array('login' => &$login, 'password'=>&$password, 'success'=>&$success, 'allowlocal'=>&$allowlocal);
+               $manager->notify('CustomLogin', $data);
+               
+               $this->loggedin = 0;
+               if ( $success )
+               {
+                       $this->loggedin = ( $this->readFromName($login) );
+               }
+               elseif ( $allowlocal )
+               {
+                       $this->loggedin = ( $this->readFromName($login) && $this->checkPassword($password) );
+               }
+               
+               /* login failed */
+               if ( !$this->loggedin )
+               {
+                       $trimlogin = trim($login);
+                       if ( empty($trimlogin) )
+                       {
+                               $errormessage = "Please enter a username.";
+                       }
+                       else
+                       {
+                               $errormessage = 'Login failed for ' . $login;
+                       }
+                       $data = array('username' => $login);
+                       $manager->notify('LoginFailed', $data);
+                       ActionLog::add(INFO, $errormessage);
+               }
+               /* login success */
+               else
+               {
+                       /* For lower compatibility */
+                       if ( strlen($this->password) === 32 )
+                       {
+                               $this->password = $this->hash($password);
+                       }
+                       
+                       $this->newCookieKey();
+                       $this->setCookies($shared);
+                       
+                       if ( $this->cookie_salt !== 'none' )
+                       {
+                               /* secure cookie key */
+                               $this->setCookieKey($this->hash($this->getCookieKey() . $this->cookie_salt));
+                               $this->write();
+                       }
+                       
+                       $errormessage = '';
+                       $data = array('member' => &$this, 'username' => $login);
+                       $manager->notify('LoginSuccess', $data);
+                       ActionLog::add(INFO, "Login successful for $login (sharedpc=$shared)");
+               }
+               
+               return $this->loggedin;
+       }
+       
+       /**
+        * Member::cookielogin()
+        * Login using cookie key
+        * 
+        * @param       String  $login  not used
+        * @param       String  $cookiekey      not used
+        * @return      Boolean login or not
+        */
+       public function cookielogin($login='', $cookiekey='')
+       {
+               global $CONF, $manager;
+               
+               if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )
+               {
+                       /* Cookie Authentication */
+                       $ck = cookieVar("{$CONF['CookiePrefix']}loginkey");
+                               
+                       /* TODO: validation for each cookie values */
+                               
+                       /* limiting the length of password to avoid hash collision */
+                       $ck = i18n::substr($ck,0,32);
+                               
+                       /* 
+                        * generate cookie salt from secure cookie key settings
+                       * (either 'none', 0, 8, 16, 24, or 32)
+                       */
+                       if ( !$this->cookie_salt )
+                       {
+                               $salt = 0;
+                               if ( array_key_exists('secureCookieKey', $CONF) )
+                               {
+                                       $salt = $CONF['secureCookieKey'];
+                               }
+                               $this->set_cookie_salt($salt);
+                       }
+                       
+                       if ( $this->cookie_salt !== 'none' )
+                       {
+                               $ck = $this->hash($ck . $this->cookie_salt);
+                       }
+                       $this->loggedin = ( $this->readFromName(cookieVar("{$CONF['CookiePrefix']}user")) && $this->checkCookieKey($ck) );
+                       unset($ck);
+                               
+                       /* renew cookies when not on a shared computer */
+                       if ( $this->loggedin && (cookieVar($CONF['CookiePrefix'] . 'sharedpc') != 1) )
+                       {
+                               $this->setCookieKey(cookieVar("{$CONF['CookiePrefix']}loginkey"));
+                               $this->setCookies();
+                       }
+               }
+               return $this->loggedin;
+       }
+       
+       /**
+        * Member::logout()
+        * logout and expire cookie
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       public function logout()
+       {
+               global $CONF, $manager;
+               
+               if ( !headers_sent() && cookieVar("{$CONF['CookiePrefix']}user") )
+               {
+                       /* remove cookies on logout */
+                       setcookie("{$CONF['CookiePrefix']}user", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+                       setcookie("{$CONF['CookiePrefix']}loginkey", '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+                       $data = array('username' => cookieVar("{$CONF['CookiePrefix']}user"));
+                       $manager->notify('Logout', $data);
+               }
+               
+               $this->loggedin = 0;
+               return;
+       }
+       
+       /**
+        * Member::isLoggedIn()
+        * return member is loggedin or not
+        * 
+        * @param       Void
+        * @return      Void
+        */
+       public function isLoggedIn()
+       {
+               return $this->loggedin;
+       }
+       
+       /**
+        * MEMBER:read()
+        * Read member information from the database
+        * 
+        * @param       String  $where  where statement
+        * @return      Resource        SQL resource
+        * 
+        */
+       public function read($where)
+       {
+               // read info
+               $query =  'SELECT * FROM '.sql_table('member') . ' WHERE ' . $where;
+               
+               $row = DB::getRow($query);
+               
+               $this->setRealName($row['mrealname']);
+               $this->setEmail($row['memail']);
+               $this->password = $row['mpassword'];
+               $this->setCookieKey($row['mcookiekey']);
+               $this->setURL($row['murl']);
+               $this->setDisplayName($row['mname']);
+               $this->setAdmin($row['madmin']);
+               $this->id = $row['mnumber'];
+               $this->setCanLogin($row['mcanlogin']);
+               $this->setNotes($row['mnotes']);
+               $this->setLocale($row['mlocale']);
+               $this->setAutosave($row['mautosave']);
+               $this->setAdminSkin($row['madminskin']);
+               $this->setBookmarklet($row['mbkmklt']);
+               
+               return $row ? TRUE : FALSE;
+       }
+       
+       /**
+        * Member::isBlogAdmin()
+        * Returns true if member is an admin for the given blog
+        * (returns false if not a team member)
+        * 
+        * @param       Integer $blogid weblog id
+        * @return      Integer weblog admin or not
+        * 
+        */
+       public function isBlogAdmin($blogid)
+       {
+               $query = 'SELECT tadmin FROM '.sql_table('team').' WHERE'
+               . ' tblog=' . intval($blogid)
+               . ' and tmember='. $this->getID();
+               $res = DB::getValue($query);
+               if ( $res )
+                       return ($res == 1);
+               else
+                       return 0;
+       }
+       
+       /**
+        * Member::blogAdminRights()
+        * 
+        * @param       integer $blogid ID of target weblog
+        * @return      boolean whether to have admin rights to the weblog or not
+        * 
+        */
+       public function blogAdminRights($blogid)
+       {
+               return ($this->isAdmin() || $this->isBlogAdmin($blogid));
+       }
+       
+       /**
+        * Member::teamRights()
+        * 
+        * @param       integer $blogid ID of target weblog
+        * @return      boolean whether to have admin right to the weblog or not
+        * 
+        */
+       public function teamRights($blogid)
+       {
+               return ($this->isAdmin() || $this->isTeamMember($blogid));
+       }
+       
+       /**
+        * Member::isTeamMember()
+        * Returns true if this member is a team member of the given blog
+        * 
+        * @param       integer $blogid ID of target weblog
+        * @return      boolean whether to join the weblog or not
+        * 
+        */
+       public function isTeamMember($blogid)
+       {
+               $query = 'SELECT * FROM '.sql_table('team').' WHERE'
+                          . ' tblog=' . intval($blogid)
+                          . ' and tmember='. $this->getID();
+               $res = DB::getResult($query);
+               return ($res->rowCount() != 0);
+       }
+       
+       /**
+        * Member::canAddItem()
+        * 
+        * @param       integer $catid  ID of target category
+        * @return      boolean whether to be able to add items to the category or not
+        * 
+        */
+       public function canAddItem($catid)
+       {
+               global $manager;
+               
+               // if this is a 'newcat' style newcat
+               // no blog admin of destination blog -> NOK
+               // blog admin of destination blog -> OK
+               if ( i18n::strpos($catid,'newcat') === 0 )
+               {
+                       // get blogid
+                       list($blogid) = sscanf($catid,"newcat-%d");
+                       return $this->blogAdminRights($blogid);
+               }
+               
+               // category does not exist -> NOK
+               if ( !$manager->existsCategory($catid) )
+               {
+                       return 0;
+               }
+               
+               $blogid = getBlogIDFromCatID($catid);
+               
+               // no team rights for blog -> NOK
+               if (!$this->teamRights($blogid))
+               {
+                       return 0;
+               }
+               
+               // all other cases: OK
+               return 1;
+       }
+       
+       /**
+        * Member::canAlterComment()
+        * Returns true if this member can edit/delete a commentitem. This can be in the
+        * following cases:
+        *        - member is a super-admin
+        *   - member is the author of the comment
+        *   - member is admin of the blog associated with the comment
+        *   - member is author of the item associated with the comment
+        * 
+        * @param       integer $commentid      ID of target comment
+        * @return      boolean delete/edit the comment or not
+        * 
+        */
+       public function canAlterComment($commentid)
+       {
+               if ( $this->isAdmin() )
+               {
+                       return 1;
+               }
+               
+               $query =  'SELECT citem as itemid, iblog as blogid, cmember as cauthor, iauthor'
+                          . ' FROM '.sql_table('comment') .', '.sql_table('item').', '.sql_table('blog')
+                          . ' WHERE citem=inumber and iblog=bnumber and cnumber=' . intval($commentid);
+               $res = DB::getRow($query);
+               
+               return ($res['cauthor'] == $this->getID()) or $this->isBlogAdmin($res['blogid']) or ($res['iauthor'] == $this->getID());
+       }
+       
+       /**
+        * Member::canAlterItem()
+        * Returns true if this member can edit/delete an item. This is true in the following
+        * cases: - member is a super-admin
+        *             - member is the author of the item
+        *        - member is admin of the the associated blog
+        * 
+        * @param       integer $itemid ID of target item
+        * @return      boolean delete/edit the item or not
+        * 
+        */
+       public function canAlterItem($itemid)
+       {
+               if ($this->isAdmin()) return 1;
+               
+               $query =  'SELECT iblog, iauthor FROM '.sql_table('item').' WHERE inumber=' . intval($itemid);
+               $res = DB::getRow($query);
+               return ($res['iauthor'] == $this->getID()) or $this->isBlogAdmin($res['iblog']);
+       }
+       
+       /**
+        * Member::canBeDeleted()
+        * Return true if member can be deleted. This means that there are no items posted by the member left
+        * 
+        * @param       void
+        * @return      boolean whether there is no items or exists
+        * 
+        */
+       public function canBeDeleted()
+       {
+               $res = DB::getResult('SELECT * FROM '.sql_table('item').' WHERE iauthor=' . $this->getID());
+               return ( $res->rowCount() == 0 );
+       }
+       
+       /**
+        * Member::canUpdateItem()
+        * returns true if this member can move/update an item to a given category,
+        * false if not (see comments fot the tests that are executed)
+        * 
+        * @param       integer $itemid
+        * @param       string  $newcat (can also be of form 'newcat-x' with x=blogid)
+        * @return      boolean whether being able to update the item or not
+        * 
+        */
+       public function canUpdateItem($itemid, $newcat)
+       {
+               global $manager;
+               
+               // item does not exists -> NOK
+               if ( !$manager->existsItem($itemid,1,1) )
+               {
+                       return 0;
+               }
+               
+               // cannot alter item -> NOK
+               if (!$this->canAlterItem($itemid))
+               {
+                       return 0;
+               }
+               
+               // if this is a 'newcat' style newcat
+               // no blog admin of destination blog -> NOK
+               // blog admin of destination blog -> OK
+               if ( i18n::strpos($newcat, 'newcat') === 0 )
+               {
+                       // get blogid
+                       list($blogid) = sscanf($newcat, 'newcat-%d');
+                       return $this->blogAdminRights($blogid);
+               }
+               
+               // category does not exist -> NOK
+               if (!$manager->existsCategory($newcat))
+               {
+                       return 0;
+               }
+               
+               // get item
+               $item =& $manager->getItem($itemid,1,1);
+               
+               // old catid = new catid -> OK
+               if ($item['catid'] == $newcat)
+               {
+                       return 1;
+               }
+               
+               // not a valid category -> NOK
+               $validCat = DB::getValue('SELECT COUNT(*) AS result FROM '.sql_table('category').' WHERE catid='.intval($newcat));
+               if ( !$validCat )
+               {
+                       return 0;
+               }
+               
+               // get destination blog
+               $item =& $manager->getItem($itemid, 1, 1);
+               $source_blogid = $item['blogid'];
+               $dest_blogid = getBlogIDFromCatID($newcat);
+               
+               // not a team member of destination blog -> NOK
+               if ( !$this->teamRights($dest_blogid) )
+               {
+                       return 0;
+               }
+               
+               // if member is author of item -> OK
+               if ( $item['authorid'] == $this->getID() )
+               {
+                       return 1;
+               }
+               
+               // if member has admin rights on both blogs: OK
+               if ( ($this->blogAdminRights($dest_blogid)) && ($this->blogAdminRights($source_blogid)) )
+               {
+                       return 1;
+               }
+               
+               // all other cases: NOK
+               return 0;
+       }
+       
+       /**
+        * Member::setCookies()
+        * Sets the cookies for the member
+        * 
+        * @param boolean       $shared set this to 1 when using a shared computer. Cookies will expire
+        *                              at the end of the session in this case.
+        * @return      void
+        * 
+        */
+       public function setCookies($shared = 0)
+       {
+               global $CONF;
+               
+               if ( $CONF['SessionCookie'] || $shared )
+               {
+                       $lifetime = 0;
+               }
+               else
+               {
+                       $lifetime = time()+2592000;
+               }
+               
+               setcookie($CONF['CookiePrefix'] . 'user', $this->getDisplayName(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+               setcookie($CONF['CookiePrefix'] . 'loginkey', $this->getCookieKey(), $lifetime, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+               
+               // make sure cookies on shared pcs don't get renewed
+               if ( $shared )
+               {
+                       setcookie($CONF['CookiePrefix'] .'sharedpc', '1',$lifetime,$CONF['CookiePath'],$CONF['CookieDomain'],$CONF['CookieSecure']);
+               }
+               return;
+       }
+       
+       /**
+        * Member::sendActivationLink()
+        * Send activation mail
+        * 
+        * @param       string  $type   activation type
+        * @param       string  $extra  extra info
+        * @return      void
+        */
+       public function sendActivationLink($type, $extra='')
+       {
+               global $CONF;
+               
+               if ( !isset($CONF['ActivationDays']) )
+               {
+                       $CONF['ActivationDays'] = 2;
+               }
+               
+               // generate key and URL
+               $key = $this->generateActivationEntry($type, $extra);
+               $url = $CONF['AdminURL'] . 'index.php?action=activate&key=' . $key;
+               
+               // choose text to use in mail
+               switch ( $type )
+               {
+                       case 'register':
+                               $message = _ACTIVATE_REGISTER_MAIL;
+                               $subject = _ACTIVATE_REGISTER_MAILTITLE;
+                               break;
+                       case 'forgot':
+                               $message = _ACTIVATE_FORGOT_MAIL;
+                               $subject = _ACTIVATE_FORGOT_MAILTITLE;
+                               break;
+                       case 'addresschange':
+                               $message = _ACTIVATE_CHANGE_MAIL;
+                               $subject = _ACTIVATE_CHANGE_MAILTITLE;
+                               break;
+                       default;
+               }
+               
+               // fill out variables in text
+               $aVars = array(
+                       'siteName' => $CONF['SiteName'],
+                       'siteUrl' => $CONF['IndexURL'],
+                       'memberName' => $this->getDisplayName(),
+                       'activationUrl' => $url,
+                       'activationDays' => $CONF['ActivationDays']
+               );
+               
+               $message = Template::fill($message, $aVars);
+               $subject = Template::fill($subject, $aVars);
+               
+               // send mail
+               NOTIFICATION::mail($this->getEmail(), $subject ,$message, $CONF['AdminEmail'], i18n::get_current_charset());
+               
+               ActionLog::add(INFO, _ACTIONLOG_ACTIVATIONLINK . ' (' . $this->getDisplayName() . ' / type: ' . $type . ')');
+               return;
+       }
+       
+       /**
+        * Member::getAdminBlogs()
+        * Returns an array of all blogids for which member has admin rights
+        * 
+        * @param       void
+        * @return      array   weblog IDs in which this member has admin rights
+        * 
+        */
+       public function getAdminBlogs()
+       {
+               $blogs = array();
+               
+               if ($this->isAdmin())
+               {
+                       $query = 'SELECT bnumber as blogid from '.sql_table('blog');
+               }
+               else
+               {
+                       $query = 'SELECT tblog as blogid from '.sql_table('team').' where tadmin=1 and tmember=' . $this->getID();
+               }
+               
+               $res = DB::getResult($query);
+               if ( $res->rowCount() > 0 )
+               {
+                       foreach ( $res as $row )
+                       {
+                               array_push($blogs, $row['blogid']);
+                       }
+               }
+               return $blogs;
+       }
+       
+       /**
+        * Member::getTeamBlogs()
+        * Returns an array of all blogids for which member has team rights
+        * 
+        * @param       boolean $incAdmin       whether checking weblog admin rights or not
+        * @return      array   weblog IDs in which this member join
+        * 
+        */
+       public function getTeamBlogs($incAdmin = 1)
+       {
+               $incAdmin = intval($incAdmin);
+               $blogs = array();
+               
+               if ( $this->isAdmin() && $incAdmin )
+               {
+                       $query = 'SELECT bnumber as blogid from '.sql_table('blog');
+               }
+               else
+               {
+                       $query = 'SELECT tblog as blogid from '.sql_table('team').' where tmember=' . $this->getID();
+               }
+               
+               $res = DB::getResult($query);
+               if ( $res->rowCount() > 0 )
+               {
+                       foreach ( $res as $row )
+                       {
+                               array_push($blogs, $row['blogid']);
+                       }
+               }
+               return $blogs;
+       }
+       
+       /**
+        * Member::getNotifyFromMailAddress()
+        * 
+        * Returns an email address from which notification of commenting/karma voting can
+        * be sent. A suggestion can be given for when the member is not logged in
+        * 
+        * @param       String  $suggest
+        * @return      String  mail address or suggestion
+        */
+       public function getNotifyFromMailAddress($suggest = "")
+       {
+               global $CONF;
+               if ( $this->isLoggedIn() )
+               {
+                       return $this->getDisplayName() . " <" . $this->getEmail() . ">";
+               }
+               else if ( NOTIFICATION::address_validation($suggest) )
+               {
+                       return $suggest;
+               }
+               return $CONF['AdminEmail'];
+       }
+       
+       /**
+        * Member::write()
+        * Write data to database
+        * 
+        * @param       void
+        * @return      void
+        * 
+        */
+       public function write()
+       {
+               $query =  'UPDATE '.sql_table('member')
+                       . ' SET mname=' . DB::quoteValue($this->displayname) . ', '
+                          . 'mrealname='. DB::quoteValue($this->realname) . ', '
+                          . 'mpassword='. DB::quoteValue($this->password) . ', '
+                          . 'mcookiekey='. DB::quoteValue($this->cookiekey) . ', '
+                          . 'murl=' . DB::quoteValue($this->url) . ', '
+                          . 'memail=' . DB::quoteValue($this->email) . ', '
+                          . 'madmin=' . intval($this->admin) . ', '
+                          . 'mnotes=' . DB::quoteValue($this->notes) . ', '
+                          . 'mcanlogin=' . intval($this->canlogin) . ', '
+                          . 'mlocale=' . DB::quoteValue($this->locale) . ', '
+                          . 'madminskin=' . DB::quoteValue($this->adminskin) . ', '
+                          . 'mbkmklt=' . DB::quoteValue($this->bookmarklet) . ', '
+                          . 'mautosave=' . intval($this->autosave) . ' '
+                       . 'WHERE mnumber=' . intval($this->id);
+               DB::execute($query);
+               return;
+       }
+       
+       public function checkCookieKey($key)
+       {
+               return ( ($key != '') && ( $key == $this->getCookieKey() ) );
+       }
+       
+       public function checkPassword($pw)
+       {
+               /* for lower compatibility (md5) */
+               if ( strlen($this->password) === 32 )
+               {
+                       return (md5($pw) == $this->password);
+               }
+               return ($this->hash($pw) == $this->password);
+       }
+       
+       public function getRealName()
+       {
+               return $this->realname;
+       }
+       
+       public function setRealName($name)
+       {
+               $this->realname = $name;
+       }
+       
+       public function getEmail()
+       {
+               return $this->email;
+       }
+       
+       public function setEmail($email)
+       {
+               $this->email = $email;
+       }
+       
+       public function getPassword()
+       {
+               return $this->password;
+       }
+       
+       public function setPassword($pwd)
+       {
+               $this->password = $this->hash($pwd);
+       }
+       
+       public function getCookieKey()
+       {
+               return $this->cookiekey;
+       }
+       
+       /**
+        * Member::newCookieKey()
+        * Generate new cookiekey, save it, and return it
+        * 
+        * @param       void
+        * @return      void
+        * 
+        */
+       public function newCookieKey()
+       {
+               mt_srand( (double) microtime() * 1000000);
+               $this->cookiekey = $this->hash(uniqid(mt_rand()));
+               $this->write();
+               return $this->cookiekey;
+       }
+       
+       public function setCookieKey($val)
+       {
+               $this->cookiekey = $val;
+       }
+       
+       public function getURL()
+       {
+               return $this->url;
+       }
+       
+       public function setURL($site)
+       {
+               $this->url = $site;
+       }
+       
+       public function setAdminSkin($skin)
+       {
+               $this->adminskin = $skin;
+       }
+       public function setBookmarklet($skin)
+       {
+               $this->bookmarklet = $skin;
+       }
+       
+       public function getAdminSkin()
+       {
+               return $this->adminskin;
+       }
+       public function getBookmarklet()
+       {
+               return $this->bookmarklet;
+       }
+       public function getLocale()
+       {
+               return $this->locale;
+       }
+       
+       public function setLocale($locale)
+       {
+               if ( !preg_match('#^(.+)_(.+)_(.+)$#', $locale)
+                && ($locale = i18n::convert_old_language_file_name_to_locale($locale)) === FALSE )
+               {
+                       $locale = '';
+               }
+               $this->locale = $locale;
+               return;
+       }
+       
+       public function setDisplayName($nick)
+       {
+               $this->displayname = $nick;
+       }
+       
+       public function getDisplayName()
+       {
+               return $this->displayname;
+       }
+       
+       public function isAdmin()
+       {
+               return $this->admin;
+       }
+       
+       public function setAdmin($val)
+       {
+               $this->admin = $val;
+       }
+       
+       public function canLogin()
+       {
+               return $this->canlogin;
+       }
+       
+       public function setCanLogin($val)
+       {
+               $this->canlogin = $val;
+       }
+       
+       public function getNotes()
+       {
+               return $this->notes;
+       }
+       
+       public function setNotes($val)
+       {
+               $this->notes = $val;
+       }
+       
+       public function getAutosave()
+       {
+               return $this->autosave;
+       }
+       
+       public function setAutosave($val)
+       {
+               $this->autosave = $val;
+               return;
+       }
+       
+       /**
+        * Member::getID()
+        * 
+        * @param       void
+        * @return      integer id of this member object
+        * 
+        */
+       public function getID()
+       {
+               return $this->id;
+       }
+       
+       /**
+        * Member::exists()
+        * Returns true if there is a member with the given login name
+        * 
+        * @static
+        * @param       string  $name   target name
+        * @return      boolean whether target name exists or not
+        */
+       public static function exists($name)
+       {
+               $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mname=' . DB::quoteValue($name));
+               return ( $r->rowCount() != 0 );
+       }
+       
+       /**
+        * Member::existsID()
+        * Returns true if there is a member with the given ID
+        * 
+        * @static
+        * @param       integer $id     target id
+        * @return      boolean whether target id exists or not
+        * 
+        */
+       public static function existsID($id)
+       {
+               $r = DB::getResult('SELECT * FROM ' . sql_table('member') . ' WHERE mnumber=' . intval($id));
+               return ( $r->rowCount() != 0 );
+       }
+       
+       /**
+        * Member::isNameProtected()
+        *  Checks if a username is protected.
+        *  If so, it can not be used on anonymous comments
+        * 
+        * @param       string  $name   target name
+        * @return      boolean whether the name exists or not
+        * 
+        */
+       public function isNameProtected($name)
+       {
+               // extract name
+               $name = strip_tags($name);
+               $name = trim($name);
+               return self::exists($name);
+       }
+       
+       /**
+        * Member::create()
+        * Adds a new member
+        * 
+        * @static
+        * @param       String  $name
+        * @param       String  $realname
+        * @param       String  $password
+        * @param       String  $email
+        * @param       String  $url
+        * @param       String  $admin
+        * @param       String  $canlogin
+        * @param       String  $notes
+        * @return      String  1 if success, others if fail
+        */
+       static public function create($name, $realname, $password, $email, $url, $admin, $canlogin, $notes)
+       {
+               if ( !NOTIFICATION::address_validation($email) )
+               {
+                       return _ERROR_BADMAILADDRESS;
+               }
+               
+               /* TODO: this method should be in MEMBER class, not globalfunctions */
+               if ( !isValidDisplayName($name) )
+               {
+                       return _ERROR_BADNAME;
+               }
+               
+               if ( self::exists($name) )
+               {
+                       return _ERROR_NICKNAMEINUSE;
+               }
+               
+               if ( !$realname )
+               {
+                       return _ERROR_REALNAMEMISSING;
+               }
+               
+               /* TODO: check the number of characters */
+               if ( !$password )
+               {
+                       return _ERROR_PASSWORDMISSING;
+               }
+               
+               /* 
+                *  begin if: sometimes user didn't prefix the URL with http:// or https://,
+                *  this cause a malformed URL. Let's fix it.
+                */
+               
+               if ( !preg_match('#^https?://#', $url) )
+               {
+                       $url = 'http://' . $url;
+               }
+               
+               $name           = DB::quoteValue($name);
+               $realname       = DB::quoteValue($realname);
+               /* NOTE: hashed password is automatically updated if the length is 32 bytes when logging in */
+               $password       = DB::quoteValue(md5($password));
+               $email          = DB::quoteValue($email);
+               $url            = DB::quoteValue($url);
+               $admin          = (integer) $admin;
+               $canlogin       = (integer) $canlogin;
+               $notes          = DB::quoteValue($notes);
+               
+               $query = "INSERT INTO %s"
+                      . " (MNAME,MREALNAME,MPASSWORD,MEMAIL,MURL, MADMIN, MCANLOGIN, MNOTES)"
+                      . " VALUES (%s, %s, %s, %s, %s, %d, %d, %s)";
+               $query = sprintf($query, sql_table('member'), $name, $realname, $password, $email, $url, $admin, $canlogin, $notes);
+               DB::execute($query);
+               
+               ActionLog::add(INFO, _ACTIONLOG_NEWMEMBER . ' ' . $name);
+               
+               return 1;
+       }
+       
+       /**
+        * Member::getActivationInfo()
+        * Returns activation info for a certain key (an object with properties vkey, vmember, ...)
+        * 
+        * @static
+        * @param       string  $key    activation key
+        * @return      mixed   return 0 if failed, else return activation table object
+        * 
+        */
+       public static function getActivationInfo($key)
+       {
+               $query = 'SELECT * FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key);
+               $res = DB::getResult($query);
+               
+               if ( !$res || ($res->rowCount() == 0) )
+               {
+                       return 0;
+               }
+               return $res->fetch();
+       }
+       
+       /**
+        * Member::generateActivationEntry()
+        * Creates an account activation key
+        * addresschange -> old email address
+        * 
+        * @param       string  $type   one of the following values (determines what to do when activation expires)
+        *                              'register'      (new member registration)
+        *                              'forgot'        (forgotton password)
+        *                              'addresschange' (member address has changed)
+        * @param       string  $extra  extra info (needed when validation link expires)
+        * @return      string  activation key
+        */
+       public function generateActivationEntry($type, $extra = '')
+       {
+               // clean up old entries
+               $this->cleanupActivationTable();
+               
+               // kill any existing entries for the current member (delete is ok)
+               // (only one outstanding activation key can be present for a member)
+               DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vmember=' . intval($this->getID()));
+               
+               // indicates if the member can log in while the link is active
+               $canLoginWhileActive = false;
+               switch ( $type )
+               {
+                       case 'forgot':
+                               $canLoginWhileActive = true;
+                               break;
+                       case 'register':
+                               break;
+                       case 'addresschange':
+                               $extra = $extra . '/' . ( $this->canLogin() ? '1' : '0' );
+                               break;
+               }
+               
+               $ok = false;
+               while ( !$ok )
+               {
+                       // generate a random key
+                       srand((double)microtime()*1000000);
+                       $key = $this->hash(uniqid(rand(), true));
+                       
+                       // attempt to add entry in database
+                       // add in database as non-active
+                       $query = 'INSERT INTO %s (vkey, vtime, vmember, vtype, vextra) VALUES (%s, %s, %d, %s, %s)';
+                       $query = sprintf($query
+                               , sql_table('activation')
+                               , DB::quoteValue($key)
+                               , DB::formatDateTime()
+                               , intval($this->getID())
+                               , DB::quoteValue($type)
+                               , DB::quoteValue($extra)
+                       );
+                       if ( DB::execute($query) !== FALSE )
+                               $ok = true;
+               }
+               
+               // mark member as not allowed to log in
+               if ( !$canLoginWhileActive )
+               {
+                       $this->setCanLogin(0);
+                       $this->write();
+               }
+               
+               // return the key
+               return $key;
+       }
+       
+       /**
+        * Member::activate()
+        * Inidicates that an activation link has been clicked and any forms displayed
+        * there have been successfully filled out.
+        * 
+        * @param       string  $key    activation key
+        * @return      boolean
+        * 
+        */
+       public function activate($key)
+       {
+               // get activate info
+               $info = self::getActivationInfo($key);
+               
+               // no active key
+               if ( !$info )
+               {
+                       return false;
+               }
+               
+               switch ( $info['vtype'] )
+               {
+                       case 'forgot':
+                               // nothing to do
+                               break;
+                       case 'register':
+                               // set canlogin value
+                               global $CONF;
+                               DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($CONF['NewMemberCanLogon']). ' WHERE mnumber=' . intval($info['vmember']));
+                               break;
+                       case 'addresschange':
+                               // reset old 'canlogin' value
+                               list($oldEmail, $oldCanLogin) = preg_split('#/#', $info['vextra']);
+                               DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ' WHERE mnumber=' . intval($info['vmember']));
+                               break;
+               }
+               
+               // delete from activation table
+               DB::execute('DELETE FROM ' . sql_table('activation') . ' WHERE vkey=' . DB::quoteValue($key));
+               
+               // success!
+               return true;
+       }
+       
+       /**
+        * Member::cleanupActivationTable()
+        * Cleans up entries in the activation table. All entries older than 2 days are removed.
+        * (static)
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function cleanupActivationTable()
+       {
+               $actdays = 2;
+               if ( isset($CONF['ActivationDays']) && intval($CONF['ActivationDays']) > 0 )
+               {
+                       $actdays = intval($CONF['ActivationDays']);
+               }
+               else
+               {
+                       $CONF['ActivationDays'] = 2;
+               }
+               $boundary = time() - (60 * 60 * 24 * $actdays);
+               
+               // 1. walk over all entries, and see if special actions need to be performed
+               $query = sprintf('SELECT * FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));
+               $res = DB::getResult($query);
+               
+               foreach ( $res as $row )
+               {
+                       switch ( $row['vtype'] )
+                       {
+                               case 'register':
+                                       // delete all information about this site member. registration is undone because there was
+                                       // no timely activation
+                                       include_once($DIR_LIBS . 'ADMIN.php');
+                                       Admin::deleteOneMember(intval($row['vmember']));
+                                       break;
+                               case 'addresschange':
+                                       // revert the e-mail address of the member back to old address
+                                       list($oldEmail, $oldCanLogin) = preg_split('#/#', $row['vextra']);
+                                       DB::execute('UPDATE ' . sql_table('member') . ' SET mcanlogin=' . intval($oldCanLogin). ', memail=' . DB::quoteValue($oldEmail). ' WHERE mnumber=' . intval($row['vmember']));
+                                       break;
+                               case 'forgot':
+                                       // delete the activation link and ignore. member can request a new password using the
+                                       // forgot password link
+                                       break;
+                       }
+               }
+               
+               // 2. delete activation entries for real
+               $query = sprintf('DELETE FROM %s WHERE vtime < %s', sql_table('activation'), DB::formatDateTime($boundary));
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Member::$language
+        * 
+        * @obsolete
+        * @param       void
+        * @return      void
+        * 
+        */
+       public $language = '';
+       /**
+        * Member::getLanguage()
+        * 
+        * @obsolete
+        * @param       void
+        * @return      void
+        * 
+        */
+       public function getLanguage()
+       {
+               if ( ($language = i18n::convert_locale_to_old_language_file_name($this->locale)) === FALSE )
+               {
+                       $language = '';
+               }
+               return $language;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Class used to represent a collection of e-mail addresses, to which a\r
 + * message can be sent (e.g. comment or karma vote notification).\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: NOTIFICATION.php 1534 2011-06-22 06:13:23Z sakamocchi $\r
 + */\r
 +class Notification\r
 +{\r
 +      static private $charset;\r
 +      static private $scheme = 'B';\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::address_validation()\r
 +       * Validating the string as address\r
 +       * \r
 +       * FIXME: this is just migrated from globalfunctions.php\r
 +       *  we should confirm this regular expression refering to RFC 5322\r
 +       * \r
 +       * @link        http://www.ietf.org/rfc/rfc5322.txt\r
 +       * @see         3.4. Address Specification\r
 +       * \r
 +       * @static\r
 +       * @param       String  $address        Address\r
 +       * @return      Boolean valid or not\r
 +       */\r
 +      static public function address_validation($address)\r
 +      {\r
 +              return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::get_mail_footer()\r
 +       * Return mail footer with Nucleus CMS singnature\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      String  Message body with \r
 +       */\r
 +      static public function get_mail_footer()\r
 +      {\r
 +              $message  = "\n";\r
 +              $message .= "\n";\r
 +              $message .= "-----------------------------\n";\r
 +              $message .=  "   Powered by Nucleus CMS\n";\r
 +              $message .=  "(http://www.nucleuscms.org/)\n";\r
 +              return $message;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::mail\r
 +       * Send mails with headers including 7bit-encoded multibyte string\r
 +       * \r
 +       * @static\r
 +       * @param       string  $to             receivers including singlebyte and multibyte strings, based on RFC 5322\r
 +       * @param       string  $subject        subject including singlebyte and multibyte strings\r
 +       * @param       string  $message        message including singlebyte and multibyte strings\r
 +       * @param       string  $from           senders including singlebyte and multibyte strings, based on RFC 5322\r
 +       * @param       string(B/Q)     $scheme 7bit-encoder scheme based on RFC 2047\r
 +       * @return      boolean accepted delivery or not\r
 +       */\r
 +      static public function mail($to, $subject, $message, $from, $charset, $scheme='B')\r
 +      {\r
 +              self::$charset = $charset;\r
 +              self::$scheme = $scheme;\r
 +              \r
 +              $to = self::mailbox_list_encoder($to);\r
 +              $subject = self::seven_bit_characters_encoder($subject);\r
 +              $from = 'From: ' . self::mailbox_list_encoder($from);\r
 +              \r
 +              /*\r
 +               * All of 7bit character encoding derives from ISO/IEC 646\r
 +               * So we can decide the body's encoding bit count by this regular expression.\r
 +               * \r
 +               */\r
 +              $bitcount = '8bit';\r
 +              if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )\r
 +              {\r
 +                      $bitcount = '7bit';\r
 +              }\r
 +              \r
 +              $header  = 'Content-Type: text/html; charset=' . self::$charset . "; format=flowed; delsp=yes\n";\r
 +              $header .= "Content-Transfer-Encoding: {$bitcount}\n";\r
 +              $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";\r
 +              \r
 +              return mail($to, $subject, $message, "{$from}\n{$header}");\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::mailbox_list_encoder\r
 +       * Encode multi byte strings included in mailbox.\r
 +       * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822\r
 +       * \r
 +       * @link        http://www.ietf.org/rfc/rfc5322.txt\r
 +       * @see         3.4. Address Specification\r
 +       * \r
 +       * @static\r
 +       * @param       string  $mailbox_list           mailbox list\r
 +       * @return      string  encoded string  \r
 +       * \r
 +       */\r
 +      static private function mailbox_list_encoder ($mailbox_list)\r
 +      {\r
 +              $encoded_mailboxes = array();\r
 +              $mailboxes = preg_split('#,#', $mailbox_list);\r
 +              foreach ( $mailboxes as $mailbox )\r
 +              {\r
 +                      if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )\r
 +                      {\r
 +                              $display_name = self::seven_bit_characters_encoder(trim($match[1]));\r
 +                              $local_part = trim($match[2]);\r
 +                              $domain = trim($match[3]);\r
 +                              $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";\r
 +                      }\r
 +                      else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )\r
 +                      {\r
 +                              $encoded_mailboxes[] = $mailbox;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              continue;\r
 +                      }\r
 +              }\r
 +              if ( $encoded_mailboxes == array() )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              return implode(',', $encoded_mailboxes);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::seven_bit_characters_encoder\r
 +       * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.\r
 +       * \r
 +       * @link http://www.ietf.org/rfc/rfc2047.txt\r
 +       * @see 2. Syntax of encoded-words\r
 +       * \r
 +       * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.\r
 +       *  This causes a trouble related to line breaking between single byte and multi-byte strings.\r
 +       *  To avoid this, single byte string is encoded as well as multi byte string here.\r
 +       * \r
 +       * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.\r
 +       * http://www.ietf.org/rfc/rfc2231.txt\r
 +       * \r
 +       * NOTE: iconv extension give the same functions as this in PHP5\r
 +       * iconv_mime_encode():\r
 +       * http://www.php.net/manual/en/function.iconv-mime-encode.php\r
 +       * \r
 +       * @static\r
 +       * @param       string  $charset        Character set encoding\r
 +       * @param       string  $type   type of 7 bit encoding, should be 'B' or 'Q'\r
 +       * @param       string  $string Target string with header field\r
 +       * @return      string  encoded string\r
 +       * \r
 +       */\r
 +      static private function seven_bit_characters_encoder($string)\r
 +      {\r
 +              $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';\r
 +              $footer = "?=";\r
 +              $restriction = 78 - strlen($header) - strlen($footer) ;\r
 +              \r
 +              $encoded_words = array();\r
 +              for ( $i = 0; $i < i18n::strlen($string); $i++ )\r
 +              {\r
 +                      if ( self::$scheme == 'B' )\r
 +                      {\r
 +                              if ( $i == 0 )\r
 +                              {\r
 +                                      $letters = '';\r
 +                              }\r
 +                              \r
 +                              $letter = i18n::substr($string, $i, 1);\r
 +                              $expected_length = strlen($letters) + strlen($letter) * 4 / 3;\r
 +                              \r
 +                              if ( $expected_length > $restriction )\r
 +                              {\r
 +                                      $encoded_text = self::b_encoder($letters);\r
 +                                      $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
 +                                      $letters = '';\r
 +                              }\r
 +                              \r
 +                              $letters .= $letter;\r
 +                              \r
 +                              if ( $i == i18n::strlen($string) - 1 )\r
 +                              {\r
 +                                      $encoded_text = self::b_encoder($letters);\r
 +                                      $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
 +                                      break;\r
 +                              }\r
 +                              continue;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              if ( $i == 0 )\r
 +                              {\r
 +                                      $encoded_text = '';\r
 +                              }\r
 +                              \r
 +                              $encoded_letter = self::q_encoder(i18n::substr($string, $i, 1));\r
 +                              $expected_length = strlen($encoded_text) + strlen($encoded_letter);\r
 +                              \r
 +                              if ( $expected_length > $restriction )\r
 +                              {\r
 +                                      $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
 +                                      $letters = '';\r
 +                              }\r
 +                              \r
 +                              $encoded_text .= $encoded_letter;\r
 +                              \r
 +                              if ( $i == i18n::strlen($string) - 1 )\r
 +                              {\r
 +                                      $encoded_words[] = "{$header}{$encoded_text}{$footer}";\r
 +                                      break;\r
 +                              }\r
 +                              continue;\r
 +                      }\r
 +              }\r
 +              \r
 +              return implode('', $encoded_words);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::b_encoder()\r
 +       * \r
 +       * B encoder according to RFC 2047.\r
 +       * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.\r
 +       * \r
 +       * @link http://www.ietf.org/rfc/rfc4648.txt\r
 +       * @see 6.8. Base64 Content-Transfer-Encoding\r
 +       * \r
 +       * NOTE: According to RFC 4648\r
 +       * (1)  The final quantum of encoding input is an integral multiple of 24 bits;\r
 +       *              here, the final unit of encoded output will be an integral multiple\r
 +       *              of 4 characters with no "=" padding.\r
 +       * (2)  The final quantum of encoding input is exactly 8 bits; here,\r
 +       *              the final unit of encoded output will be two characters followed\r
 +       *              by two "=" padding characters.\r
 +       * (3)  The final quantum of encoding input is exactly 16 bits; here,\r
 +       *              the final unit of encoded output will be three characters followed\r
 +       *              by one "=" padding character.\r
 +       * \r
 +       * @static\r
 +       * @param       string  $target targetted string\r
 +       * @return      string  encoded string\r
 +       */\r
 +      static private function b_encoder($target)\r
 +      {\r
 +              return base64_encode($target);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTIFICATION::q_encoder()\r
 +       * \r
 +       * Q encoder according to RFC 2047.\r
 +       * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,\r
 +       *  but the "Q" encoding and the "Quoted-Printable" are different a bit.\r
 +       * \r
 +       * @link http://www.ietf.org/rfc/rfc2047.txt\r
 +       * @see 4.2. The "Q" encoding\r
 +       * \r
 +       * NOTE: According to RFC 2047\r
 +       * (1)  Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.\r
 +       *              For example, if the character set in use were ISO-8859-1,\r
 +       *              the "=" character would thus be encoded as "=3D", and a SPACE by "=20".\r
 +       *              (Upper case should be used for hexadecimal digits "A" through "F".)\r
 +       * (2)  The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be\r
 +       *              represented as "_" (underscore, ASCII 95.).\r
 +       *              (This character may not pass through some internetwork mail gateways,\r
 +       *              but its use will greatly enhance readability of "Q" encoded data\r
 +       *              with mail readers that do not support this encoding.)\r
 +       *              Note that the "_" always represents hexadecimal 20,\r
 +       *              even if the SPACE character occupies a different code position\r
 +       *              in the character set in use.\r
 +       * (3)  8-bit values which correspond to printable ASCII characters\r
 +       *              other than "=", "?", and "_" (underscore), MAY be represented as those characters.\r
 +       *              (But see section 5 for restrictions.)\r
 +       *              In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.\r
 +       * \r
 +       * @static\r
 +       * @param       string  $target targetted string\r
 +       * @return      string  encoded string\r
 +       */\r
 +      static private function q_encoder($target)\r
 +      {\r
 +              $string = '';\r
 +              \r
 +              for ( $i = 0; $i < strlen($target); $i++ )\r
 +              {\r
 +                      $letter = substr ($target, $i, 1);\r
 +                      $order = ord($letter);\r
 +                      \r
 +                      // Printable ASCII characters without "=", "?", "_"\r
 +                      if ((33 <= $order && $order <= 60)\r
 +                       || (62 == $order)\r
 +                       || (64 <= $order && $order <= 94)\r
 +                       || (96 <= $order && $order <= 126))\r
 +                      {\r
 +                              $string .= strtoupper(dechex($order));\r
 +                      }\r
 +                      // Space shuold be encoded as the same strings as "_"\r
 +                      else if ($order == 32)\r
 +                      {\r
 +                              $string .= '_';\r
 +                      }\r
 +                      // Other characters\r
 +                      else\r
 +                      {\r
 +                              $string .= '=' . strtoupper(dechex($order));\r
 +                      }\r
 +              }\r
 +              \r
 +              return $string;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTICE: Deprecated\r
 +       * NOTIFICATION::$addresses\r
 +       * \r
 +       * @deprecated\r
 +       */\r
 +      private $addresses = array();\r
 +      \r
 +      /**\r
 +       * NOTICE: Deprecated\r
 +       * takes one string as argument, containing multiple e-mail addresses\r
 +       * separated by semicolons\r
 +       * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com\r
 +       * \r
 +       * @deprecated\r
 +       */\r
 +      function __construct($addresses)\r
 +      {\r
 +              $this->addresses = preg_split('#;#' , $addresses);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTICE: Deprecated\r
 +       * NOTIFICATION::validAddresses()\r
 +       * \r
 +       * returns true if all addresses are valid\r
 +       * \r
 +       * @deprecated\r
 +       * @param       Void\r
 +       * @return      Boolean\r
 +       */\r
 +      function validAddresses()\r
 +      {\r
 +              foreach ( $this->addresses as $address )\r
 +              {\r
 +                      if ( !self::address_validation(trim($address)) )\r
 +                      {\r
 +                              return 0;\r
 +                      }\r
 +              }\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NOTICE: Deprecated\r
 +       * NOTIFICATION::notify()\r
 +       * \r
 +       * Sends email messages to all the email addresses\r
 +       * \r
 +       * @deprecated\r
 +       * @param       String  $title  \r
 +       * @param       String  $message        \r
 +       * @param       String  $from   \r
 +       * @return      Void\r
 +       */\r
 +      function notify($title, $message, $from)\r
 +      {\r
 +              global $member;\r
 +              $addresses = array();\r
 +              \r
 +              foreach ($this->addresses as $address)\r
 +              {\r
 +                      if ( $member->isLoggedIn() && ($member->getEmail() == $address) )\r
 +                      {\r
 +                              continue;\r
 +                      }\r
 +                      $addresses[] = $address;\r
 +              }\r
 +              \r
 +              self::mail(implode(',', $addresses), $title, $message , $from);\r
 +              return;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Class used to represent a collection of e-mail addresses, to which a
+  * message can be sent (e.g. comment or karma vote notification).
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: NOTIFICATION.php 1836 2012-05-12 10:38:31Z sakamocchi $
+  */
+ class Notification
+ {
+       static private $charset;
+       static private $scheme = 'B';
+       
+       /**
+        * NOTIFICATION::address_validation()
+        * Validating the string as address
+        * 
+        * FIXME: this is just migrated from globalfunctions.php
+        *  we should confirm this regular expression refering to RFC 5322
+        * 
+        * @link        http://www.ietf.org/rfc/rfc5322.txt
+        * @see         3.4. Address Specification
+        * 
+        * @static
+        * @param       String  $address        Address
+        * @return      Boolean valid or not
+        */
+       static public function address_validation($address)
+       {
+               return (boolean) preg_match('#^(?!\\.)(?:\\.?[-a-zA-Z0-9!\\#$%&\'*+/=?^_`{|}~]+)+@(?!\\.)(?:\\.?(?!-)[-a-zA-Z0-9]+(?<!-)){2,}$#', $address);
+       }
+       
+       /**
+        * NOTIFICATION::get_mail_footer()
+        * Return mail footer with Nucleus CMS singnature
+        * 
+        * @static
+        * @param       void
+        * @return      String  Message body with 
+        */
+       static public function get_mail_footer()
+       {
+               $message  = "\n";
+               $message .= "\n";
+               $message .= "-----------------------------\n";
+               $message .=  "   Powered by Nucleus CMS\n";
+               $message .=  "(http://www.nucleuscms.org/)\n";
+               return $message;
+       }
+       
+       /**
+        * NOTIFICATION::mail
+        * Send mails with headers including 7bit-encoded multibyte string
+        * 
+        * @static
+        * @param       string  $to             receivers including singlebyte and multibyte strings, based on RFC 5322
+        * @param       string  $subject        subject including singlebyte and multibyte strings
+        * @param       string  $message        message including singlebyte and multibyte strings
+        * @param       string  $from           senders including singlebyte and multibyte strings, based on RFC 5322
+        * @param       string(B/Q)     $scheme 7bit-encoder scheme based on RFC 2047
+        * @return      boolean accepted delivery or not
+        */
+       static public function mail($to, $subject, $message, $from, $charset, $scheme='B')
+       {
+               self::$charset = $charset;
+               self::$scheme = $scheme;
+               
+               $to = self::mailbox_list_encoder($to);
+               $subject = self::seven_bit_characters_encoder($subject);
+               $from = 'From: ' . self::mailbox_list_encoder($from);
+               
+               /*
+                * All of 7bit character encoding derives from ISO/IEC 646
+                * So we can decide the body's encoding bit count by this regular expression.
+                * 
+                */
+               $bitcount = '8bit';
+               if ( preg_match('#\A[\x00-\x7f]*\z#', $message) )
+               {
+                       $bitcount = '7bit';
+               }
+               
+               $header  = 'Content-Type: text/plain; charset=' . self::$charset . "; format=flowed; delsp=yes\n";
+               $header .= "Content-Transfer-Encoding: {$bitcount}\n";
+               $header .= "X-Mailer: Nucleus CMS NOTIFICATION class\n";
+               
+               return mail($to, $subject, $message, "{$from}\n{$header}");
+       }
+       
+       /**
+        * NOTIFICATION::mailbox_list_encoder
+        * Encode multi byte strings included in mailbox.
+        * The format of mailbox is based on RFC 5322, which obsoletes RFC 2822
+        * 
+        * @link        http://www.ietf.org/rfc/rfc5322.txt
+        * @see         3.4. Address Specification
+        * 
+        * @static
+        * @param       string  $mailbox_list           mailbox list
+        * @return      string  encoded string  
+        * 
+        */
+       static private function mailbox_list_encoder ($mailbox_list)
+       {
+               $encoded_mailboxes = array();
+               $mailboxes = preg_split('#,#', $mailbox_list);
+               foreach ( $mailboxes as $mailbox )
+               {
+                       if ( preg_match("#^([^,]+)?<([^,]+)?@([^,]+)?>$#", $mailbox, $match) )
+                       {
+                               $display_name = self::seven_bit_characters_encoder(trim($match[1]));
+                               $local_part = trim($match[2]);
+                               $domain = trim($match[3]);
+                               $encoded_mailboxes[] = "{$display_name} <{$local_part}@{$domain}>";
+                       }
+                       else if ( preg_match("#([^,]+)?@([^,]+)?#", $mailbox) )
+                       {
+                               $encoded_mailboxes[] = $mailbox;
+                       }
+                       else
+                       {
+                               continue;
+                       }
+               }
+               if ( $encoded_mailboxes == array() )
+               {
+                       return FALSE;
+               }
+               return implode(',', $encoded_mailboxes);
+       }
+       
+       /**
+        * NOTIFICATION::seven_bit_characters_encoder
+        * Encoder into 7bit ASCII expression for Non-ASCII Text based on RFC 2047.
+        * 
+        * @link http://www.ietf.org/rfc/rfc2047.txt
+        * @see 2. Syntax of encoded-words
+        * 
+        * NOTE: RFC 2047 has a ambiguousity for dealing with 'linear-white-space'.
+        *  This causes a trouble related to line breaking between single byte and multi-byte strings.
+        *  To avoid this, single byte string is encoded as well as multi byte string here.
+        * 
+        * NOTE: RFC 2231 also defines the way to use non-ASCII characters in MIME header.
+        * http://www.ietf.org/rfc/rfc2231.txt
+        * 
+        * NOTE: iconv extension give the same functions as this in PHP5
+        * iconv_mime_encode():
+        * http://www.php.net/manual/en/function.iconv-mime-encode.php
+        * 
+        * @static
+        * @param       string  $charset        Character set encoding
+        * @param       string  $type   type of 7 bit encoding, should be 'B' or 'Q'
+        * @param       string  $string Target string with header field
+        * @return      string  encoded string
+        * 
+        */
+       static private function seven_bit_characters_encoder($string)
+       {
+               $header = chr(13) . chr(10) . chr(32) . '=?' . self::$charset . '?' . self::$scheme . '?';
+               $footer = "?=";
+               $restriction = 78 - strlen($header) - strlen($footer) ;
+               
+               $encoded_words = array();
+               for ( $i = 0; $i < i18n::strlen($string); $i++ )
+               {
+                       if ( self::$scheme == 'B' )
+                       {
+                               if ( $i == 0 )
+                               {
+                                       $letters = '';
+                               }
+                               
+                               $letter = i18n::substr($string, $i, 1);
+                               $expected_length = strlen($letters) + strlen($letter) * 4 / 3;
+                               
+                               if ( $expected_length > $restriction )
+                               {
+                                       $encoded_text = self::b_encoder($letters);
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       $letters = '';
+                               }
+                               
+                               $letters .= $letter;
+                               
+                               if ( $i == i18n::strlen($string) - 1 )
+                               {
+                                       $encoded_text = self::b_encoder($letters);
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       break;
+                               }
+                               continue;
+                       }
+                       else
+                       {
+                               if ( $i == 0 )
+                               {
+                                       $encoded_text = '';
+                               }
+                               
+                               $encoded_letter = self::q_encoder(i18n::substr($string, $i, 1));
+                               $expected_length = strlen($encoded_text) + strlen($encoded_letter);
+                               
+                               if ( $expected_length > $restriction )
+                               {
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       $letters = '';
+                               }
+                               
+                               $encoded_text .= $encoded_letter;
+                               
+                               if ( $i == i18n::strlen($string) - 1 )
+                               {
+                                       $encoded_words[] = "{$header}{$encoded_text}{$footer}";
+                                       break;
+                               }
+                               continue;
+                       }
+               }
+               
+               return implode('', $encoded_words);
+       }
+       
+       /**
+        * NOTIFICATION::b_encoder()
+        * 
+        * B encoder according to RFC 2047.
+        * The "B" encoding is identical to the "BASE64" encoding defined by RFC 4648.
+        * 
+        * @link http://www.ietf.org/rfc/rfc4648.txt
+        * @see 6.8. Base64 Content-Transfer-Encoding
+        * 
+        * NOTE: According to RFC 4648
+        * (1)  The final quantum of encoding input is an integral multiple of 24 bits;
+        *              here, the final unit of encoded output will be an integral multiple
+        *              of 4 characters with no "=" padding.
+        * (2)  The final quantum of encoding input is exactly 8 bits; here,
+        *              the final unit of encoded output will be two characters followed
+        *              by two "=" padding characters.
+        * (3)  The final quantum of encoding input is exactly 16 bits; here,
+        *              the final unit of encoded output will be three characters followed
+        *              by one "=" padding character.
+        * 
+        * @static
+        * @param       string  $target targetted string
+        * @return      string  encoded string
+        */
+       static private function b_encoder($target)
+       {
+               return base64_encode($target);
+       }
+       
+       /**
+        * NOTIFICATION::q_encoder()
+        * 
+        * Q encoder according to RFC 2047.
+        * The "Q" encoding is similar to "Quoted-Printable" content-transfer-encoding defined in RFC 2045,
+        *  but the "Q" encoding and the "Quoted-Printable" are different a bit.
+        * 
+        * @link http://www.ietf.org/rfc/rfc2047.txt
+        * @see 4.2. The "Q" encoding
+        * 
+        * NOTE: According to RFC 2047
+        * (1)  Any 8-bit value may be represented by a "=" followed by two hexadecimal digits.
+        *              For example, if the character set in use were ISO-8859-1,
+        *              the "=" character would thus be encoded as "=3D", and a SPACE by "=20".
+        *              (Upper case should be used for hexadecimal digits "A" through "F".)
+        * (2)  The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
+        *              represented as "_" (underscore, ASCII 95.).
+        *              (This character may not pass through some internetwork mail gateways,
+        *              but its use will greatly enhance readability of "Q" encoded data
+        *              with mail readers that do not support this encoding.)
+        *              Note that the "_" always represents hexadecimal 20,
+        *              even if the SPACE character occupies a different code position
+        *              in the character set in use.
+        * (3)  8-bit values which correspond to printable ASCII characters
+        *              other than "=", "?", and "_" (underscore), MAY be represented as those characters.
+        *              (But see section 5 for restrictions.)
+        *              In particular, SPACE and TAB MUST NOT be represented as themselves within encoded words.
+        * 
+        * @static
+        * @param       string  $target targetted string
+        * @return      string  encoded string
+        */
+       static private function q_encoder($target)
+       {
+               $string = '';
+               
+               for ( $i = 0; $i < strlen($target); $i++ )
+               {
+                       $letter = substr ($target, $i, 1);
+                       $order = ord($letter);
+                       
+                       // Printable ASCII characters without "=", "?", "_"
+                       if ((33 <= $order && $order <= 60)
+                        || (62 == $order)
+                        || (64 <= $order && $order <= 94)
+                        || (96 <= $order && $order <= 126))
+                       {
+                               $string .= strtoupper(dechex($order));
+                       }
+                       // Space shuold be encoded as the same strings as "_"
+                       else if ($order == 32)
+                       {
+                               $string .= '_';
+                       }
+                       // Other characters
+                       else
+                       {
+                               $string .= '=' . strtoupper(dechex($order));
+                       }
+               }
+               
+               return $string;
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::$addresses
+        * 
+        * @deprecated
+        */
+       private $addresses = array();
+       
+       /**
+        * NOTICE: Deprecated
+        * takes one string as argument, containing multiple e-mail addresses
+        * separated by semicolons
+        * eg: site@demuynck.org;nucleus@demuynck.org;foo@bar.com
+        * 
+        * @deprecated
+        */
+       function __construct($addresses)
+       {
+               $this->addresses = preg_split('#;#' , $addresses);
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::validAddresses()
+        * 
+        * returns true if all addresses are valid
+        * 
+        * @deprecated
+        * @param       Void
+        * @return      Boolean
+        */
+       function validAddresses()
+       {
+               foreach ( $this->addresses as $address )
+               {
+                       if ( !self::address_validation(trim($address)) )
+                       {
+                               return 0;
+                       }
+               }
+               return 1;
+       }
+       
+       /**
+        * NOTICE: Deprecated
+        * NOTIFICATION::notify()
+        * 
+        * Sends email messages to all the email addresses
+        * 
+        * @deprecated
+        * @param       String  $title  
+        * @param       String  $message        
+        * @param       String  $from   
+        * @return      Void
+        */
+       function notify($title, $message, $from)
+       {
+               global $member;
+               $addresses = array();
+               
+               foreach ($this->addresses as $address)
+               {
+                       if ( $member->isLoggedIn() && ($member->getEmail() == $address) )
+                       {
+                               continue;
+                       }
+                       $addresses[] = $address;
+               }
+               
+               self::mail(implode(',', $addresses), $title, $message , $from);
+               return;
+       }
+ }
++>>>>>>> skinnable-master
  /**
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: PARSER.php 1757 2012-04-15 09:02:32Z sakamocchi $
++=======
+  * @version $Id: PARSER.php 1879 2012-06-17 07:45:09Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  if ( !function_exists('requestVar') )
@@@ -62,8 -62,6 +66,11 @@@ class Parse
                $this->pdelim   =  $pdelim;
                $this->norestrictions = 0;      // set this to 1 to disable checking for allowedActions
                
++<<<<<<< HEAD
 +              $this->skin             = NULL;
 +              
++=======
++>>>>>>> skinnable-master
                $handler->setParser($this);
                
                return;
                
                if ( in_array($actionlc, $this->actions) || $this->norestrictions )
                {
++<<<<<<< HEAD
 +                      call_user_func_array(array(&$this->handler, "parse_{$actionlc}"), $params);
++=======
+                       call_user_func_array(array($this->handler, "parse_{$actionlc}"), $params);
++>>>>>>> skinnable-master
                }
                else
                {
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * This is an (abstract) class of which all Nucleus Plugins must inherit\r
 + *\r
 + * for more information on plugins and how to write your own, see the\r
 + * plugins.html file that is included with the Nucleus documenation\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: PLUGIN.php 1630 2012-01-28 12:16:14Z sakamocchi $\r
 + */\r
 +abstract class NucleusPlugin\r
 +{\r
 +      // these public functions should to be redefined in your plugin\r
 +      public function getName()\r
 +      {\r
 +              return __CLASS__;\r
 +      }\r
 +      \r
 +      public function getAuthor()\r
 +      {\r
 +              return 'Undefined';\r
 +      }\r
 +      \r
 +      public function getURL()\r
 +      {\r
 +              return 'Undefined';\r
 +      }\r
 +      \r
 +      public function getVersion()\r
 +      {\r
 +              return '0.0';\r
 +      }\r
 +      \r
 +      public function getDescription()\r
 +      {\r
 +              return 'Undefined';\r
 +      }\r
 +      \r
 +      // these final public function _may_ be redefined in your plugin\r
 +      \r
 +      public function getMinNucleusVersion()\r
 +      {\r
 +              return 150;\r
 +      }\r
 +      \r
 +      public function getMinNucleusPatchLevel()\r
 +      {\r
 +              return 0;\r
 +      }\r
 +      \r
 +      public function getEventList()\r
 +      {\r
 +              return array();\r
 +      }\r
 +      \r
 +      public function getTableList()\r
 +      {\r
 +              return array();\r
 +      }\r
 +      \r
 +      public function hasAdminArea()\r
 +      {\r
 +              return 0;\r
 +      }\r
 +      \r
 +      public function install()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      public function unInstall()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      public function init()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      public function doSkinVar($skinType)\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      public function doTemplateVar(&$item)\r
 +      {\r
 +              $args = func_get_args();\r
 +              array_shift($args);\r
 +              array_unshift($args, 'template');\r
 +              call_user_func_array(array(&$this,'doSkinVar'),$args);\r
 +              return;\r
 +      }\r
 +      \r
 +      public function doTemplateCommentsVar(&$item, &$comment)\r
 +      {\r
 +              $args = func_get_args();\r
 +              array_shift($args);\r
 +              array_shift($args);\r
 +              array_unshift($args, 'template');\r
 +              call_user_func_array(array(&$this,'doSkinVar'),$args);\r
 +              return;\r
 +      }\r
 +      \r
 +      public function doAction($type)\r
 +      {\r
 +              return _ERROR_PLUGIN_NOSUCHACTION;\r
 +      }\r
 +      \r
 +      public function doIf($key,$value)\r
 +      {\r
 +              return false;\r
 +      }\r
 +      \r
 +      public function doItemVar (&$item)\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Checks if a plugin supports a certain feature.\r
 +       *\r
 +       * @returns 1 if the feature is reported, 0 if not\r
 +       * @param $feature\r
 +       *  Name of the feature. See plugin documentation for more info\r
 +       *   'SqlTablePrefix' -> if the plugin uses the sql_table() method to get table names\r
 +       *   'HelpPage' -> if the plugin provides a helppage\r
 +       *   'SqlApi' -> if the plugin uses the complete sql_* or DB::* api (must also require nucleuscms 3.5)\r
 +       */\r
 +      public function supportsFeature($feature)\r
 +      {\r
 +              return 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Report a list of plugin that is required to final public function\r
 +       *\r
 +       * @returns an array of names of plugin, an empty array indicates no dependency\r
 +       */\r
 +      public function getPluginDep()\r
 +      {\r
 +              return array();\r
 +      }\r
 +      \r
 +      // these helper final public functions should not be redefined in your plugin\r
 +      \r
 +      /**\r
 +       * Creates a new option for this plugin\r
 +       *\r
 +       * @param name\r
 +       *              A string uniquely identifying your option. (max. length is 20 characters)\r
 +       * @param description\r
 +       *              A description that will show up in the nucleus admin area (max. length: 255 characters)\r
 +       * @param type\r
 +       *              Either 'text', 'yesno' or 'password'\r
 +       *              This info is used when showing 'edit plugin options' screens\r
 +       * @param value\r
 +       *              Initial value for the option (max. value length is 128 characters)\r
 +       */\r
 +      final public function createOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
 +      {\r
 +              return $this->create_option('global', $name, $desc, $type, $defValue, $typeExtras);\r
 +      }\r
 +      \r
 +      final public function createBlogOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
 +      {\r
 +              return $this->create_option('blog', $name, $desc, $type, $defValue, $typeExtras);\r
 +      }\r
 +      \r
 +      final public function createMemberOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
 +      {\r
 +              return $this->create_option('member', $name, $desc, $type, $defValue, $typeExtras);\r
 +      }\r
 +      \r
 +      final public function createCategoryOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
 +      {\r
 +              return $this->create_option('category', $name, $desc, $type, $defValue, $typeExtras);\r
 +      }\r
 +      \r
 +      final public function createItemOption($name, $desc, $type, $defValue = '', $typeExtras = '')\r
 +      {\r
 +              return $this->create_option('item', $name, $desc, $type, $defValue, $typeExtras);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Removes the option from the database\r
 +       *\r
 +       * Note: Options get erased automatically on plugin uninstall\r
 +       */\r
 +      final public function deleteOption($name)\r
 +      {\r
 +              return $this->delete_option('global', $name);\r
 +      }\r
 +      \r
 +      final public function deleteBlogOption($name)\r
 +      {\r
 +              return $this->delete_option('blog', $name);\r
 +      }\r
 +      \r
 +      final public function deleteMemberOption($name)\r
 +      {\r
 +              return $this->delete_option('member', $name);\r
 +      }\r
 +      \r
 +      final public function deleteCategoryOption($name)\r
 +      {\r
 +              return $this->delete_option('category', $name);\r
 +      }\r
 +      \r
 +      final public function deleteItemOption($name)\r
 +      {\r
 +              return $this->delete_option('item', $name);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Sets the value of an option to something new\r
 +       */\r
 +      final public function setOption($name, $value)\r
 +      {\r
 +              return $this->set_option('global', 0, $name, $value);\r
 +      }\r
 +      \r
 +      final public function setBlogOption($blogid, $name, $value)\r
 +      {\r
 +              return $this->set_option('blog', $blogid, $name, $value);\r
 +      }\r
 +      \r
 +      final public function setMemberOption($memberid, $name, $value)\r
 +      {\r
 +              return $this->set_option('member', $memberid, $name, $value);\r
 +      }\r
 +      \r
 +      final public function setCategoryOption($catid, $name, $value)\r
 +      {\r
 +              return $this->set_option('category', $catid, $name, $value);\r
 +      }\r
 +      \r
 +      final public function setItemOption($itemid, $name, $value) {\r
 +              return $this->set_option('item', $itemid, $name, $value);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Retrieves the current value for an option\r
 +       */\r
 +      final public function getOption($name)\r
 +      {\r
 +              // only request the options the very first time. On subsequent requests\r
 +              // the static collection is used to save SQL queries.\r
 +              if ( $this->plugin_options == 0 )\r
 +              {\r
 +                      $this->plugin_options = array();\r
 +                      \r
 +                      $query =  "SELECT d.oname as name, o.ovalue as value FROM %s o, %s d WHERE d.opid=%d AND d.oid=o.oid;";\r
 +                      $query = sprintf($query, sql_table('plugin_option'), sql_table('plugin_option_desc'), (integer) $this->plugid);\r
 +                      $result = DB::getResult($query);\r
 +                      foreach ( $result as $row )\r
 +                      {\r
 +                              $this->plugin_options[strtolower($row['name'])] = $row['value'];\r
 +                      }\r
 +              }\r
 +              if ( isset($this->plugin_options[strtolower($name)]) )\r
 +              {\r
 +                      return $this->plugin_options[strtolower($name)];\r
 +              }\r
 +              else\r
 +              {\r
 +                      return $this->get_option('global', 0, $name);\r
 +              }\r
 +      }\r
 +      \r
 +      final public function getBlogOption($blogid, $name)\r
 +      {\r
 +              return $this->get_option('blog', $blogid, $name);\r
 +      }\r
 +      \r
 +      final public function getMemberOption($memberid, $name)\r
 +      {\r
 +              return $this->get_option('member', $memberid, $name);\r
 +      }\r
 +      \r
 +      final public function getCategoryOption($catid, $name)\r
 +      {\r
 +              return $this->get_option('category', $catid, $name);\r
 +      }\r
 +      \r
 +      final public function getItemOption($itemid, $name)\r
 +      {\r
 +              return $this->get_option('item', $itemid, $name);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Retrieves an associative array with the option value for each\r
 +       * context id\r
 +       */\r
 +      final public function getAllBlogOptions($name)\r
 +      {\r
 +              return $this->get_all_options('blog', $name);\r
 +      }\r
 +      \r
 +      final public function getAllMemberOptions($name)\r
 +      {\r
 +              return $this->get_all_options('member', $name);\r
 +      }\r
 +      \r
 +      final public function getAllCategoryOptions($name)\r
 +      {\r
 +              return $this->get_all_options('category', $name);\r
 +      }\r
 +      \r
 +      final public function getAllItemOptions($name)\r
 +      {\r
 +              return $this->get_all_options('item', $name);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Retrieves an indexed array with the top (or bottom) of an option\r
 +       * (delegates to getOptionTop())\r
 +       */\r
 +      final public function getBlogOptionTop($name, $amount = 10, $sort = 'desc')\r
 +      {\r
 +              return $this->get_option_top('blog', $name, $amount, $sort);\r
 +      }\r
 +      \r
 +      final public function getMemberOptionTop($name, $amount = 10, $sort = 'desc')\r
 +      {\r
 +              return $this->get_option_top('member', $name, $amount, $sort);\r
 +      }\r
 +      \r
 +      final public function getCategoryOptionTop($name, $amount = 10, $sort = 'desc')\r
 +      {\r
 +              return $this->get_option_top('category', $name, $amount, $sort);\r
 +      }\r
 +      \r
 +      final public function getItemOptionTop($name, $amount = 10, $sort = 'desc')\r
 +      {\r
 +              return $this->get_option_top('item', $name, $amount, $sort);\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::getID()\r
 +       * get id for this plugin\r
 +       * \r
 +       * @access      public\r
 +       * @param       void\r
 +       * @return      integer this plugid id\r
 +       */\r
 +      final public function getID()\r
 +      {\r
 +              return (integer) $this->plugid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::setID()\r
 +       * set favorite id for this plugin\r
 +       * \r
 +       * @access      public\r
 +       * @param       integer $plugid favorite id for plugin\r
 +       * @return      void\r
 +       */\r
 +      final public function setID($plugid)\r
 +      {\r
 +              $this->plugid = (integer) $plugid;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the URL of the admin area for this plugin (in case there's\r
 +       * no such area, the returned information is invalid)\r
 +       *\r
 +       * public\r
 +       */\r
 +      final public function getAdminURL()\r
 +      {\r
 +              global $CONF;\r
 +              return $CONF['PluginURL'] . $this->getShortName() . '/';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the directory where the admin directory is located and\r
 +       * where the plugin can maintain his extra files\r
 +       *\r
 +       * public\r
 +       */\r
 +      final public function getDirectory()\r
 +      {\r
 +              global $DIR_PLUGINS;\r
 +              return $DIR_PLUGINS . $this->getShortName() . '/';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Derives the short name for the plugin from the classname (all\r
 +       * lowercase)\r
 +       *\r
 +       * public\r
 +       */\r
 +      final public function getShortName()\r
 +      {\r
 +              return str_replace('np_','',strtolower(get_class($this)));\r
 +      }\r
 +      \r
 +      /**\r
 +       *      Clears the option value cache which saves the option values during\r
 +       *      the plugin execution. This function is usefull if the options has\r
 +       *      changed during the plugin execution (especially in association with\r
 +       *      the PrePluginOptionsUpdate and the PostPluginOptionsUpdate events)\r
 +       *      \r
 +       *  public\r
 +       **/\r
 +      final public function clearOptionValueCache()\r
 +      {\r
 +              $this->option_values = array();\r
 +              $this->plugin_options = 0;\r
 +              return;\r
 +      }\r
 +      \r
 +      // internal functions of the class starts here\r
 +      protected $option_values;       // oid_contextid => value\r
 +      protected $option_info;         // context_name => array('oid' => ..., 'default' => ...)\r
 +      protected $plugin_options;      // see getOption()\r
 +      protected $plugid;                      // plugin id\r
 +      \r
 +      /**\r
 +       * Class constructor: Initializes some internal data\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              $this->option_values = array(); // oid_contextid => value\r
 +              $this->option_info = array();   // context_name => array('oid' => ..., 'default' => ...)\r
 +              $this->plugin_options = 0;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Retrieves an array of the top (or bottom) of an option from a plugin.\r
 +       * @author TeRanEX\r
 +       * @param  string $context the context for the option: item, blog, member,...\r
 +       * @param  string $name    the name of the option\r
 +       * @param  int    $amount  how many rows must be returned\r
 +       * @param  string $sort    desc or asc\r
 +       * @return array           array with both values and contextid's\r
 +       * @access private\r
 +       */\r
 +      final protected function get_option_top($context, $name, $amount = 10, $sort = 'desc')\r
 +      {\r
 +              if ( ($sort != 'desc') && ($sort != 'asc') )\r
 +              {\r
 +                      $sort= 'desc';\r
 +              }\r
 +              \r
 +              $oid = $this->get_option_id($context, $name);\r
 +              \r
 +              // retrieve the data and return\r
 +              $query = "SELECT otype, oextra FROM %s WHERE oid = %d;";\r
 +              $query = sprintf($query, sql_table('plugin_option_desc'), $oid);\r
 +              $row = DB::getRow($query);\r
 +              \r
 +              if ( ($this->optionCanBeNumeric($row['otype'])) && ($row['oextra'] == 'number' ) )\r
 +              {\r
 +                      $orderby = 'CAST(ovalue AS SIGNED)';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $orderby = 'ovalue';\r
 +              }\r
 +              $query = "SELECT ovalue value, ocontextid id FROM %s WHERE oid = %d ORDER BY %s %s LIMIT 0,%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option'), $oid, $orderby, $sort, (integer) $amount);\r
 +              $result = DB::getResult($query);\r
 +              \r
 +              // create the array\r
 +              $i = 0;\r
 +              $top = array();\r
 +              foreach( $result as $row )\r
 +              {\r
 +                      $top[$i++] = $row;\r
 +              }\r
 +              \r
 +              // return the array (duh!)\r
 +              return $top;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Creates an option in the database table plugin_option_desc\r
 +       *      \r
 +       * private\r
 +       */\r
 +      final protected function create_option($context, $name, $desc, $type, $defValue, $typeExtras = '')\r
 +      {\r
 +              // create in plugin_option_desc\r
 +              $query = 'INSERT INTO ' . sql_table('plugin_option_desc')\r
 +                              .' (opid, oname, ocontext, odesc, otype, odef, oextra)'\r
 +                              .' VALUES ('.intval($this->plugid)\r
 +                                      .', '.DB::quoteValue($name)\r
 +                                      .', '.DB::quoteValue($context)\r
 +                                      .', '.DB::quoteValue($desc)\r
 +                                      .', '.DB::quoteValue($type)\r
 +                                      .', '.DB::quoteValue($defValue)\r
 +                                      .', '.DB::quoteValue($typeExtras).')';\r
 +              DB::execute($query);\r
 +              $oid = DB::getInsertId();\r
 +              \r
 +              $key = $context . '_' . $name;\r
 +              $this->option_info[$key] = array('oid' => $oid, 'default' => $defValue);\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Deletes an option from the database tables\r
 +       * plugin_option and plugin_option_desc\r
 +       *\r
 +       * private\r
 +       */\r
 +      final protected function delete_option($context, $name)\r
 +      {\r
 +              $oid = $this->get_option_id($context, $name);\r
 +              if ( !$oid )\r
 +              {\r
 +                      return 0; // no such option\r
 +              }\r
 +              \r
 +              // delete all things from plugin_option\r
 +              $query = "DELETE FROM %s WHERE oid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option'), (integer) $oid);\r
 +              DB::execute($query);\r
 +              \r
 +              // delete entry from plugin_option_desc\r
 +              $query = "DELETE FROM %s WHERE oid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option_desc'), $oid);\r
 +              DB::execute($query);\r
 +              \r
 +              // clear from cache\r
 +              unset($this->option_info["{$context}_{$name}"]);\r
 +              $this->option_values = array();\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Update an option in the database table plugin_option\r
 +       *              \r
 +       * returns: 1 on success, 0 on failure\r
 +       * private\r
 +       */\r
 +      final protected function set_option($context, $contextid, $name, $value)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $oid = $this->get_option_id($context, $name);\r
 +              if ( !$oid )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              // check if context id exists\r
 +              switch ( $context )\r
 +              {\r
 +                      case 'member':\r
 +                              if ( !Member::existsID($contextid) )\r
 +                              {\r
 +                                      return 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'blog':\r
 +                              if ( !$manager->existsBlogID($contextid) )\r
 +                              {\r
 +                                      return 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'category':\r
 +                              if ( !$manager->existsCategory($contextid) )\r
 +                              {\r
 +                                      return 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'item':\r
 +                              if ( !$manager->existsItem($contextid, true, true) )\r
 +                              {\r
 +                                      return 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'global':\r
 +                              if ( $contextid != 0 )\r
 +                              {\r
 +                                      return 0;\r
 +                              }\r
 +                              break;\r
 +              }\r
 +              \r
 +              // update plugin_option\r
 +              $query = "DELETE FROM %s WHERE oid=%d and ocontextid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
 +              DB::execute($query);\r
 +              \r
 +              $query = "INSERT INTO %s (ovalue, oid, ocontextid) VALUES (%s, %d, %d);";\r
 +              $query = sprintf($query, sql_table('plugin_option'), DB::quoteValue($value), $oid, $contextid);\r
 +              DB::execute($query);\r
 +              \r
 +              // update cache\r
 +              $this->option_values["{$oid}_{$contextid}"] = $value;\r
 +              if ( $context == 'global' )\r
 +              {\r
 +                      $this->plugin_options[strtolower($name)] = $value;\r
 +              }\r
 +              \r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Get an option from Cache or database\r
 +       *       - if not in the option Cache read it from the database\r
 +       *   - if not in the database write default values into the database\r
 +       *              \r
 +       * private              \r
 +       */                                             \r
 +      final protected function get_option($context, $contextid, $name)\r
 +      {\r
 +              $oid = $this->get_option_id($context, $name);\r
 +              if ( !$oid )\r
 +              {\r
 +                      return '';\r
 +              }\r
 +              \r
 +              $key = "{$oid}_{$contextid}";\r
 +              \r
 +              if ( isset($this->option_values[$key]) )\r
 +              {\r
 +                      return $this->option_values[$key];\r
 +              }\r
 +              \r
 +              // get from DB\r
 +              $query = "SELECT ovalue FROM %s WHERE oid=%d and ocontextid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
 +              $result = DB::getResult($query);\r
 +              \r
 +              if ( !$result || ($result->rowCount() == 0) )\r
 +              {\r
 +                      // fill DB with default value\r
 +                      $this->option_values[$key] = $this->get_default_value($context, $name);\r
 +                      $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";\r
 +                      $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($this->option_values[$key]));\r
 +                      DB::execute($query);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $row = $result->fetch();\r
 +                      $this->option_values[$key] = $row['ovalue'];\r
 +              }\r
 +              \r
 +              return $this->option_values[$key];\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns assoc array with all values for a given option\r
 +       * (one option per possible context id)\r
 +       *\r
 +       * private                              \r
 +       */\r
 +      final protected function get_all_options($context, $name)\r
 +      {\r
 +              $oid = $this->get_option_id($context, $name);\r
 +              if ( !$oid )\r
 +              {\r
 +                      return array();\r
 +              }\r
 +              $default_value = $this->get_default_value($context, $name);\r
 +              \r
 +              $options = array();\r
 +              $query = "SELECT %s as contextid FROM %s;";\r
 +              switch ( $context )\r
 +              {\r
 +                      case 'blog':\r
 +                              $query = sprintf($query, 'bnumber', sql_table('blog'));\r
 +                              break;\r
 +                      case 'category':\r
 +                              $query = sprintf($query, 'catid', sql_table('category'));\r
 +                              break;\r
 +                      case 'member':\r
 +                              $query = sprintf($query, 'mnumber', sql_table('member'));\r
 +                              break;\r
 +                      case 'item':\r
 +                              $query = sprintf($query, 'inumber', sql_table('item'));\r
 +                              break;\r
 +              }\r
 +              \r
 +              $result = DB::getResult($query);\r
 +              if ( $result )\r
 +              {\r
 +                      foreach ( $result as $row )\r
 +                      {\r
 +                              $options[$row['contextid']] = $default_value;\r
 +                      }\r
 +              }\r
 +              \r
 +              $query = "SELECT ocontextid, ovalue FROM %s WHERE oid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option'), $oid);\r
 +              $result = DB::getResult($query);\r
 +              foreach ( $result as $row )\r
 +              {\r
 +                      $options[$row['ocontextid']] = $row['ovalue'];\r
 +              }\r
 +\r
 +              return $options;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::get_option_id\r
 +       * \r
 +       * Gets the 'option identifier' that corresponds to a given option name.\r
 +       * When this method is called for the first time, all the OIDs for the plugin\r
 +       * are loaded into memory, to avoid re-doing the same query all over.\r
 +       * \r
 +       * @param       string  $context        option context\r
 +       * @param       string  $name           plugin name\r
 +       * @return              integer option id\r
 +       */\r
 +      final protected function get_option_id($context, $name)\r
 +      {\r
 +              $key = "{$context}_{$name}";\r
 +              \r
 +              if ( array_key_exists($key, $this->option_info)\r
 +               && array_key_exists('oid', $this->option_info[$key]) )\r
 +              {\r
 +                      return $this->option_info[$key]['oid'];\r
 +              }\r
 +              \r
 +              // load all OIDs for this plugin from the database\r
 +              $this->option_info = array();\r
 +              $query = "SELECT oid, oname, ocontext, odef FROM %s WHERE opid=%d;";\r
 +              $query = sprintf($query, sql_table('plugin_option_desc'), $this->plugid);\r
 +              $result = DB::getResult($query);\r
 +              foreach ( $result as $row )\r
 +              {\r
 +                      $k = $row['ocontext'] . '_' . $row['oname'];\r
 +                      $this->option_info[$k] = array('oid' => $row['oid'], 'default' => $row['odef']);\r
 +              }\r
 +              $result->closeCursor();\r
 +              \r
 +              return $this->option_info[$key]['oid'];\r
 +      }\r
 +      final protected function get_default_value($context, $name)\r
 +      {\r
 +              $key = $context . '_' . $name;\r
 +              \r
 +              if ( array_key_exists($key, $this->option_info)\r
 +               && array_key_exists('default', $this->option_info[$key]) )\r
 +              {\r
 +                      return $this->option_info[$key]['default'];\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::delete_option_values()\r
 +       * Deletes all option values for a given context and contextid\r
 +       * (used when e.g. a blog, member or category is deleted)\r
 +       *\r
 +       *@static\r
 +       *@param        String  $context        global/blog/category/item/member\r
 +       *@param        Integer $contextid              ID\r
 +       *@return       Void\r
 +       */\r
 +      static public function delete_option_values($context, $contextid)\r
 +      {\r
 +              // delete all associated plugin options\r
 +              $aOIDs = array();\r
 +              // find ids\r
 +              $query = "SELECT oid FROM %s WHERE ocontext=%s;";\r
 +              $query = sprintf($query, sql_table('plugin_option_desc'), DB::quoteValue($context));\r
 +              \r
 +              $result = DB::getResult($query);\r
 +              foreach ( $result as $row )\r
 +              {\r
 +                      array_push($aOIDs, $row['oid']);\r
 +              }\r
 +              $result->closeCursor();\r
 +              // delete those options. go go go\r
 +              if ( count($aOIDs) > 0 )\r
 +              {\r
 +                      $query = "DELETE FROM %s WHERE oid in (%s) and ocontextid=%d;";\r
 +                      $query = sprintf($query, sql_table('plugin_option'), implode(',',$aOIDs), (integer) $contextid);\r
 +                      DB::execute($query);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::getOptionMeta()\r
 +       * splits the option's typeextra field (at ;'s) to split the meta collection\r
 +       * \r
 +       * @static\r
 +       * @param string $typeExtra the value of the typeExtra field of an option\r
 +       * @return array array of the meta-key/value-pairs\r
 +       */\r
 +      static public function getOptionMeta($typeExtra)\r
 +      {\r
 +              $meta = array();\r
 +              \r
 +              /* 1. if $typeExtra includes delimiter ';', split it to tokens */\r
 +              $tokens = preg_split('#;#', $typeExtra);\r
 +              \r
 +              /*\r
 +               * 2. if each of tokens includes "=", it consists of key => value\r
 +               *    else it's 'select' option\r
 +               */\r
 +              foreach ( $tokens as $token )\r
 +              {\r
 +                      $matches = array();\r
 +                      if ( preg_match("#^([^=]+)?=([^=]+)?$#", $token, $matches) )\r
 +                      {\r
 +                              $meta[$matches[1]] = $matches[2];\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $meta['select'] = $token;\r
 +                      }\r
 +              }\r
 +              return $meta;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::getOptionSelectValues()\r
 +       * filters the selectlists out of the meta collection\r
 +       * \r
 +       * @static\r
 +       * @param string $typeExtra the value of the typeExtra field of an option\r
 +       * @return string the selectlist\r
 +       */\r
 +      static public function getOptionSelectValues($typeExtra)\r
 +      {\r
 +              $meta = NucleusPlugin::getOptionMeta($typeExtra);\r
 +              \r
 +              if ( array_key_exists('select', $meta) )\r
 +              {\r
 +                      return $meta['select'];\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * checks if the eventlist in the database is up-to-date\r
 +       * @return bool if it is up-to-date it return true, else false\r
 +       * @author TeRanEX\r
 +       */\r
 +      public function subscribtionListIsUptodate()\r
 +      {\r
 +              $res = DB::getResult('SELECT event FROM '.sql_table('plugin_event').' WHERE pid = '.$this->plugid);\r
 +              $ev = array();\r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      array_push($ev, $row['event']);\r
 +              }\r
 +              if ( count($ev) != count($this->getEventList()) )\r
 +              {\r
 +                      return false;\r
 +              }\r
 +              $d = array_diff($ev, $this->getEventList());\r
 +              if ( count($d) > 0 )\r
 +              {\r
 +                      // there are differences so the db is not up-to-date\r
 +                      return false;\r
 +              }\r
 +              return true;\r
 +      }\r
 +      \r
 +      /**\r
 +       * NucleusPlugin::apply_plugin_options()\r
 +       * Update its entry in database table\r
 +       * \r
 +       * @static\r
 +       * @param       $options: array ( 'oid' => array( 'contextid' => 'value'))\r
 +       *                       (taken from request using requestVar())\r
 +       * @param       $new_contextid: integer (accepts a contextid when it is for a new\r
 +       *                       contextid there was no id available at the moment of writing the\r
 +       *                        formcontrols into the page (by ex: itemOptions for new item)\r
 +       * @return void\r
 +       */\r
 +      static public function apply_plugin_options(&$options, $new_contextid = 0)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              if ( !is_array($options) )\r
 +              {\r
 +                      return;\r
 +              }\r
 +              \r
 +              foreach ( $options as $oid => $values )\r
 +              {\r
 +                      // get option type info\r
 +                      $query = "SELECT opid, oname, ocontext, otype, oextra, odef FROM %s WHERE oid=%d;";\r
 +                      $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $oid);\r
 +                      $result = DB::getRow($query);\r
 +                      if ( $result )\r
 +                      {\r
 +                              foreach ( $values as $id => $value )\r
 +                              {\r
 +                                      // decide wether we are using the contextid of newContextid\r
 +                                      if ( $new_contextid != 0 )\r
 +                                      {\r
 +                                              $contextid = $new_contextid;\r
 +                                      }\r
 +                                      else\r
 +                                      {\r
 +                                              $contextid = $id;\r
 +                                      }\r
 +                                      \r
 +                                      // retreive any metadata\r
 +                                      $meta = NucleusPlugin::getOptionMeta($result['oextra']);\r
 +                                      \r
 +                                      // if the option is readonly or hidden it may not be saved\r
 +                                      if ( array_key_exists('access', $meta)\r
 +                                       && in_array($meta['access'], array('readonly', 'hidden')) )\r
 +                                      {\r
 +                                              return;\r
 +                                      }\r
 +                                      \r
 +                                      // value comes from request\r
 +                                      $value = undoMagic($value);\r
 +                                      \r
 +                                      /* validation the value according to its type */\r
 +                                      switch ( $result['otype'] )\r
 +                                      {\r
 +                                              case 'yesno':\r
 +                                                      if ( ($value != 'yes') && ($value != 'no') )\r
 +                                                      {\r
 +                                                              $value = 'no';\r
 +                                                      }\r
 +                                                      break;\r
 +                                              case 'text':\r
 +                                              case 'select':\r
 +                                                      if ( array_key_exists('datatype', $meta)\r
 +                                                       && ($meta['datatype'] == 'numerical') && ($value != (integer) $value) )\r
 +                                                      {\r
 +                                                              $value = (integer) $result['odef'];\r
 +                                                      }\r
 +                                                      break;\r
 +                                              case 'password':\r
 +                                              case 'textarea':\r
 +                                              default:\r
 +                                                      break;\r
 +                                      }\r
 +                                      \r
 +                                      /*\r
 +                                       * trigger event PrePluginOptionsUpdate to give the plugin the\r
 +                                       * possibility to change/validate the new value for the option\r
 +                                       */\r
 +                                      $data = array(\r
 +                                              'context'               => $result['ocontext'],\r
 +                                              'plugid'                => $result['opid'],\r
 +                                              'optionname'    => $result['oname'],\r
 +                                              'contextid'             => $contextid,\r
 +                                              'value'                 => &$value);\r
 +                                      $manager->notify('PrePluginOptionsUpdate', $data);\r
 +                                      \r
 +                                      // delete and insert its fields of table in database\r
 +                                      $query = "DELETE FROM %s WHERE oid=%d AND ocontextid=%d;";\r
 +                                      $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);\r
 +                                      DB::execute($query);\r
 +                                      $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";\r
 +                                      $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($value));\r
 +                                      DB::execute($query);\r
 +                                      \r
 +                                      // clear option value cache if the plugin object is already loaded\r
 +                                      $plugin=& $manager->pidLoaded($result['opid']);\r
 +                                      if ( $plugin )\r
 +                                      {\r
 +                                              $plugin->clearOptionValueCache();\r
 +                                      }\r
 +                                      \r
 +                                      continue;\r
 +                              }\r
 +                      }\r
 +                      continue;\r
 +              }\r
 +              return;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * This is an (abstract) class of which all Nucleus Plugins must inherit
+  *
+  * for more information on plugins and how to write your own, see the
+  * plugins.html file that is included with the Nucleus documenation
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: PLUGIN.php 1866 2012-05-20 13:21:55Z sakamocchi $
+  */
+ abstract class NucleusPlugin
+ {
+       // these public functions should to be redefined in your plugin
+       public function getName()
+       {
+               return __CLASS__;
+       }
+       
+       public function getAuthor()
+       {
+               return 'Undefined';
+       }
+       
+       public function getURL()
+       {
+               return 'Undefined';
+       }
+       
+       public function getVersion()
+       {
+               return '0.0';
+       }
+       
+       public function getDescription()
+       {
+               return 'Undefined';
+       }
+       
+       // these final public function _may_ be redefined in your plugin
+       
+       public function getMinNucleusVersion()
+       {
+               return 150;
+       }
+       
+       public function getMinNucleusPatchLevel()
+       {
+               return 0;
+       }
+       
+       public function getEventList()
+       {
+               return array();
+       }
+       
+       public function getTableList()
+       {
+               return array();
+       }
+       
+       public function hasAdminArea()
+       {
+               return 0;
+       }
+       
+       public function install()
+       {
+               return;
+       }
+       
+       public function unInstall()
+       {
+               return;
+       }
+       
+       public function init()
+       {
+               return;
+       }
+       
+       public function doSkinVar($skinType)
+       {
+               return;
+       }
+       
+       public function doTemplateVar(&$item)
+       {
+               $args = func_get_args();
+               array_shift($args);
+               array_unshift($args, 'template');
+               call_user_func_array(array($this, 'doSkinVar'), $args);
+               return;
+       }
+       
+       public function doTemplateCommentsVar(&$item, &$comment)
+       {
+               $args = func_get_args();
+               array_shift($args);
+               array_shift($args);
+               array_unshift($args, 'template');
+               call_user_func_array(array($this, 'doSkinVar'), $args);
+               return;
+       }
+       
+       public function doAction($type)
+       {
+               return _ERROR_PLUGIN_NOSUCHACTION;
+       }
+       
+       public function doIf($key,$value)
+       {
+               return false;
+       }
+       
+       public function doItemVar (&$item)
+       {
+               return;
+       }
+       
+       /**
+        * Checks if a plugin supports a certain feature.
+        *
+        * @returns 1 if the feature is reported, 0 if not
+        * @param $feature
+        *  Name of the feature. See plugin documentation for more info
+        *   'SqlTablePrefix' -> if the plugin uses the sql_table() method to get table names
+        *   'HelpPage' -> if the plugin provides a helppage
+        *   'SqlApi' -> if the plugin uses the complete sql_* or DB::* api (must also require nucleuscms 3.5)
+        */
+       public function supportsFeature($feature)
+       {
+               return 0;
+       }
+       
+       /**
+        * Report a list of plugin that is required to final public function
+        *
+        * @returns an array of names of plugin, an empty array indicates no dependency
+        */
+       public function getPluginDep()
+       {
+               return array();
+       }
+       
+       // these helper final public functions should not be redefined in your plugin
+       
+       /**
+        * Creates a new option for this plugin
+        *
+        * @param name
+        *              A string uniquely identifying your option. (max. length is 20 characters)
+        * @param description
+        *              A description that will show up in the nucleus admin area (max. length: 255 characters)
+        * @param type
+        *              Either 'text', 'yesno' or 'password'
+        *              This info is used when showing 'edit plugin options' screens
+        * @param value
+        *              Initial value for the option (max. value length is 128 characters)
+        */
+       final public function createOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+       {
+               return $this->create_option('global', $name, $desc, $type, $defValue, $typeExtras);
+       }
+       
+       final public function createBlogOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+       {
+               return $this->create_option('blog', $name, $desc, $type, $defValue, $typeExtras);
+       }
+       
+       final public function createMemberOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+       {
+               return $this->create_option('member', $name, $desc, $type, $defValue, $typeExtras);
+       }
+       
+       final public function createCategoryOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+       {
+               return $this->create_option('category', $name, $desc, $type, $defValue, $typeExtras);
+       }
+       
+       final public function createItemOption($name, $desc, $type, $defValue = '', $typeExtras = '')
+       {
+               return $this->create_option('item', $name, $desc, $type, $defValue, $typeExtras);
+       }
+       
+       /**
+        * Removes the option from the database
+        *
+        * Note: Options get erased automatically on plugin uninstall
+        */
+       final public function deleteOption($name)
+       {
+               return $this->delete_option('global', $name);
+       }
+       
+       final public function deleteBlogOption($name)
+       {
+               return $this->delete_option('blog', $name);
+       }
+       
+       final public function deleteMemberOption($name)
+       {
+               return $this->delete_option('member', $name);
+       }
+       
+       final public function deleteCategoryOption($name)
+       {
+               return $this->delete_option('category', $name);
+       }
+       
+       final public function deleteItemOption($name)
+       {
+               return $this->delete_option('item', $name);
+       }
+       
+       /**
+        * Sets the value of an option to something new
+        */
+       final public function setOption($name, $value)
+       {
+               return $this->set_option('global', 0, $name, $value);
+       }
+       
+       final public function setBlogOption($blogid, $name, $value)
+       {
+               return $this->set_option('blog', $blogid, $name, $value);
+       }
+       
+       final public function setMemberOption($memberid, $name, $value)
+       {
+               return $this->set_option('member', $memberid, $name, $value);
+       }
+       
+       final public function setCategoryOption($catid, $name, $value)
+       {
+               return $this->set_option('category', $catid, $name, $value);
+       }
+       
+       final public function setItemOption($itemid, $name, $value) {
+               return $this->set_option('item', $itemid, $name, $value);
+       }
+       
+       /**
+        * Retrieves the current value for an option
+        */
+       final public function getOption($name)
+       {
+               // only request the options the very first time. On subsequent requests
+               // the static collection is used to save SQL queries.
+               if ( $this->plugin_options == 0 )
+               {
+                       $this->plugin_options = array();
+                       
+                       $query =  "SELECT d.oname as name, o.ovalue as value FROM %s o, %s d WHERE d.opid=%d AND d.oid=o.oid;";
+                       $query = sprintf($query, sql_table('plugin_option'), sql_table('plugin_option_desc'), (integer) $this->plugid);
+                       $result = DB::getResult($query);
+                       foreach ( $result as $row )
+                       {
+                               $this->plugin_options[strtolower($row['name'])] = $row['value'];
+                       }
+               }
+               if ( isset($this->plugin_options[strtolower($name)]) )
+               {
+                       return $this->plugin_options[strtolower($name)];
+               }
+               else
+               {
+                       return $this->get_option('global', 0, $name);
+               }
+       }
+       
+       final public function getBlogOption($blogid, $name)
+       {
+               return $this->get_option('blog', $blogid, $name);
+       }
+       
+       final public function getMemberOption($memberid, $name)
+       {
+               return $this->get_option('member', $memberid, $name);
+       }
+       
+       final public function getCategoryOption($catid, $name)
+       {
+               return $this->get_option('category', $catid, $name);
+       }
+       
+       final public function getItemOption($itemid, $name)
+       {
+               return $this->get_option('item', $itemid, $name);
+       }
+       
+       /**
+        * Retrieves an associative array with the option value for each
+        * context id
+        */
+       final public function getAllBlogOptions($name)
+       {
+               return $this->get_all_options('blog', $name);
+       }
+       
+       final public function getAllMemberOptions($name)
+       {
+               return $this->get_all_options('member', $name);
+       }
+       
+       final public function getAllCategoryOptions($name)
+       {
+               return $this->get_all_options('category', $name);
+       }
+       
+       final public function getAllItemOptions($name)
+       {
+               return $this->get_all_options('item', $name);
+       }
+       
+       /**
+        * Retrieves an indexed array with the top (or bottom) of an option
+        * (delegates to getOptionTop())
+        */
+       final public function getBlogOptionTop($name, $amount = 10, $sort = 'desc')
+       {
+               return $this->get_option_top('blog', $name, $amount, $sort);
+       }
+       
+       final public function getMemberOptionTop($name, $amount = 10, $sort = 'desc')
+       {
+               return $this->get_option_top('member', $name, $amount, $sort);
+       }
+       
+       final public function getCategoryOptionTop($name, $amount = 10, $sort = 'desc')
+       {
+               return $this->get_option_top('category', $name, $amount, $sort);
+       }
+       
+       final public function getItemOptionTop($name, $amount = 10, $sort = 'desc')
+       {
+               return $this->get_option_top('item', $name, $amount, $sort);
+       }
+       
+       /**
+        * NucleusPlugin::getID()
+        * get id for this plugin
+        * 
+        * @access      public
+        * @param       void
+        * @return      integer this plugid id
+        */
+       final public function getID()
+       {
+               return (integer) $this->plugid;
+       }
+       
+       /**
+        * NucleusPlugin::setID()
+        * set favorite id for this plugin
+        * 
+        * @access      public
+        * @param       integer $plugid favorite id for plugin
+        * @return      void
+        */
+       final public function setID($plugid)
+       {
+               $this->plugid = (integer) $plugid;
+               return;
+       }
+       
+       /**
+        * Returns the URL of the admin area for this plugin (in case there's
+        * no such area, the returned information is invalid)
+        *
+        * public
+        */
+       final public function getAdminURL()
+       {
+               global $CONF;
+               return $CONF['PluginURL'] . $this->getShortName() . '/';
+       }
+       
+       /**
+        * Returns the directory where the admin directory is located and
+        * where the plugin can maintain his extra files
+        *
+        * public
+        */
+       final public function getDirectory()
+       {
+               global $DIR_PLUGINS;
+               return $DIR_PLUGINS . $this->getShortName() . '/';
+       }
+       
+       /**
+        * Derives the short name for the plugin from the classname (all
+        * lowercase)
+        *
+        * public
+        */
+       final public function getShortName()
+       {
+               return str_replace('np_','',strtolower(get_class($this)));
+       }
+       
+       /**
+        *      Clears the option value cache which saves the option values during
+        *      the plugin execution. This function is usefull if the options has
+        *      changed during the plugin execution (especially in association with
+        *      the PrePluginOptionsUpdate and the PostPluginOptionsUpdate events)
+        *      
+        *  public
+        **/
+       final public function clearOptionValueCache()
+       {
+               $this->option_values = array();
+               $this->plugin_options = 0;
+               return;
+       }
+       
+       // internal functions of the class starts here
+       protected $option_values;       // oid_contextid => value
+       protected $option_info;         // context_name => array('oid' => ..., 'default' => ...)
+       protected $plugin_options;      // see getOption()
+       protected $plugid;                      // plugin id
+       
+       /**
+        * Class constructor: Initializes some internal data
+        */
+       public function __construct()
+       {
+               $this->option_values = array(); // oid_contextid => value
+               $this->option_info = array();   // context_name => array('oid' => ..., 'default' => ...)
+               $this->plugin_options = 0;
+       }
+       
+       /**
+        * Retrieves an array of the top (or bottom) of an option from a plugin.
+        * @author TeRanEX
+        * @param  string $context the context for the option: item, blog, member,...
+        * @param  string $name    the name of the option
+        * @param  int    $amount  how many rows must be returned
+        * @param  string $sort    desc or asc
+        * @return array           array with both values and contextid's
+        * @access private
+        */
+       final protected function get_option_top($context, $name, $amount = 10, $sort = 'desc')
+       {
+               if ( ($sort != 'desc') && ($sort != 'asc') )
+               {
+                       $sort= 'desc';
+               }
+               
+               $oid = $this->get_option_id($context, $name);
+               
+               // retrieve the data and return
+               $query = "SELECT otype, oextra FROM %s WHERE oid = %d;";
+               $query = sprintf($query, sql_table('plugin_option_desc'), $oid);
+               $row = DB::getRow($query);
+               
+               if ( ($this->optionCanBeNumeric($row['otype'])) && ($row['oextra'] == 'number' ) )
+               {
+                       $orderby = 'CAST(ovalue AS SIGNED)';
+               }
+               else
+               {
+                       $orderby = 'ovalue';
+               }
+               $query = "SELECT ovalue value, ocontextid id FROM %s WHERE oid = %d ORDER BY %s %s LIMIT 0,%d;";
+               $query = sprintf($query, sql_table('plugin_option'), $oid, $orderby, $sort, (integer) $amount);
+               $result = DB::getResult($query);
+               
+               // create the array
+               $i = 0;
+               $top = array();
+               foreach( $result as $row )
+               {
+                       $top[$i++] = $row;
+               }
+               
+               // return the array (duh!)
+               return $top;
+       }
+       
+       /**
+        * Creates an option in the database table plugin_option_desc
+        *      
+        * private
+        */
+       final protected function create_option($context, $name, $desc, $type, $defValue, $typeExtras = '')
+       {
+               // create in plugin_option_desc
+               $query = 'INSERT INTO ' . sql_table('plugin_option_desc')
+                               .' (opid, oname, ocontext, odesc, otype, odef, oextra)'
+                               .' VALUES ('.intval($this->plugid)
+                                       .', '.DB::quoteValue($name)
+                                       .', '.DB::quoteValue($context)
+                                       .', '.DB::quoteValue($desc)
+                                       .', '.DB::quoteValue($type)
+                                       .', '.DB::quoteValue($defValue)
+                                       .', '.DB::quoteValue($typeExtras).')';
+               DB::execute($query);
+               $oid = DB::getInsertId();
+               
+               $key = $context . '_' . $name;
+               $this->option_info[$key] = array('oid' => $oid, 'default' => $defValue);
+               return 1;
+       }
+       
+       /**
+        * Deletes an option from the database tables
+        * plugin_option and plugin_option_desc
+        *
+        * private
+        */
+       final protected function delete_option($context, $name)
+       {
+               $oid = $this->get_option_id($context, $name);
+               if ( !$oid )
+               {
+                       return 0; // no such option
+               }
+               
+               // delete all things from plugin_option
+               $query = "DELETE FROM %s WHERE oid=%d;";
+               $query = sprintf($query, sql_table('plugin_option'), (integer) $oid);
+               DB::execute($query);
+               
+               // delete entry from plugin_option_desc
+               $query = "DELETE FROM %s WHERE oid=%d;";
+               $query = sprintf($query, sql_table('plugin_option_desc'), $oid);
+               DB::execute($query);
+               
+               // clear from cache
+               unset($this->option_info["{$context}_{$name}"]);
+               $this->option_values = array();
+               return 1;
+       }
+       
+       /**
+        * Update an option in the database table plugin_option
+        *              
+        * returns: 1 on success, 0 on failure
+        * private
+        */
+       final protected function set_option($context, $contextid, $name, $value)
+       {
+               global $manager;
+               
+               $oid = $this->get_option_id($context, $name);
+               if ( !$oid )
+               {
+                       return 0;
+               }
+               
+               // check if context id exists
+               switch ( $context )
+               {
+                       case 'member':
+                               if ( !Member::existsID($contextid) )
+                               {
+                                       return 0;
+                               }
+                               break;
+                       case 'blog':
+                               if ( !$manager->existsBlogID($contextid) )
+                               {
+                                       return 0;
+                               }
+                               break;
+                       case 'category':
+                               if ( !$manager->existsCategory($contextid) )
+                               {
+                                       return 0;
+                               }
+                               break;
+                       case 'item':
+                               if ( !$manager->existsItem($contextid, true, true) )
+                               {
+                                       return 0;
+                               }
+                               break;
+                       case 'global':
+                               if ( $contextid != 0 )
+                               {
+                                       return 0;
+                               }
+                               break;
+               }
+               
+               // update plugin_option
+               $query = "DELETE FROM %s WHERE oid=%d and ocontextid=%d;";
+               $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+               DB::execute($query);
+               
+               $query = "INSERT INTO %s (ovalue, oid, ocontextid) VALUES (%s, %d, %d);";
+               $query = sprintf($query, sql_table('plugin_option'), DB::quoteValue($value), $oid, $contextid);
+               DB::execute($query);
+               
+               // update cache
+               $this->option_values["{$oid}_{$contextid}"] = $value;
+               if ( $context == 'global' )
+               {
+                       $this->plugin_options[strtolower($name)] = $value;
+               }
+               
+               return 1;
+       }
+       
+       /**
+        * Get an option from Cache or database
+        *       - if not in the option Cache read it from the database
+        *   - if not in the database write default values into the database
+        *              
+        * private              
+        */                                             
+       final protected function get_option($context, $contextid, $name)
+       {
+               $oid = $this->get_option_id($context, $name);
+               if ( !$oid )
+               {
+                       return '';
+               }
+               
+               $key = "{$oid}_{$contextid}";
+               
+               if ( isset($this->option_values[$key]) )
+               {
+                       return $this->option_values[$key];
+               }
+               
+               // get from DB
+               $query = "SELECT ovalue FROM %s WHERE oid=%d and ocontextid=%d;";
+               $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+               $result = DB::getResult($query);
+               
+               if ( !$result || ($result->rowCount() == 0) )
+               {
+                       // fill DB with default value
+                       $this->option_values[$key] = $this->get_default_value($context, $name);
+                       $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";
+                       $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($this->option_values[$key]));
+                       DB::execute($query);
+               }
+               else
+               {
+                       $row = $result->fetch();
+                       $this->option_values[$key] = $row['ovalue'];
+               }
+               
+               return $this->option_values[$key];
+       }
+       
+       /**
+        * Returns assoc array with all values for a given option
+        * (one option per possible context id)
+        *
+        * private                              
+        */
+       final protected function get_all_options($context, $name)
+       {
+               $oid = $this->get_option_id($context, $name);
+               if ( !$oid )
+               {
+                       return array();
+               }
+               $default_value = $this->get_default_value($context, $name);
+               
+               $options = array();
+               $query = "SELECT %s as contextid FROM %s;";
+               switch ( $context )
+               {
+                       case 'blog':
+                               $query = sprintf($query, 'bnumber', sql_table('blog'));
+                               break;
+                       case 'category':
+                               $query = sprintf($query, 'catid', sql_table('category'));
+                               break;
+                       case 'member':
+                               $query = sprintf($query, 'mnumber', sql_table('member'));
+                               break;
+                       case 'item':
+                               $query = sprintf($query, 'inumber', sql_table('item'));
+                               break;
+               }
+               
+               $result = DB::getResult($query);
+               if ( $result )
+               {
+                       foreach ( $result as $row )
+                       {
+                               $options[$row['contextid']] = $default_value;
+                       }
+               }
+               
+               $query = "SELECT ocontextid, ovalue FROM %s WHERE oid=%d;";
+               $query = sprintf($query, sql_table('plugin_option'), $oid);
+               $result = DB::getResult($query);
+               foreach ( $result as $row )
+               {
+                       $options[$row['ocontextid']] = $row['ovalue'];
+               }
+               return $options;
+       }
+       
+       /**
+        * NucleusPlugin::get_option_id
+        * 
+        * Gets the 'option identifier' that corresponds to a given option name.
+        * When this method is called for the first time, all the OIDs for the plugin
+        * are loaded into memory, to avoid re-doing the same query all over.
+        * 
+        * @param       string  $context        option context
+        * @param       string  $name           plugin name
+        * @return              integer option id
+        */
+       final protected function get_option_id($context, $name)
+       {
+               $key = "{$context}_{$name}";
+               
+               if ( array_key_exists($key, $this->option_info)
+                && array_key_exists('oid', $this->option_info[$key]) )
+               {
+                       return $this->option_info[$key]['oid'];
+               }
+               
+               // load all OIDs for this plugin from the database
+               $this->option_info = array();
+               $query = "SELECT oid, oname, ocontext, odef FROM %s WHERE opid=%d;";
+               $query = sprintf($query, sql_table('plugin_option_desc'), $this->plugid);
+               $result = DB::getResult($query);
+               foreach ( $result as $row )
+               {
+                       $k = $row['ocontext'] . '_' . $row['oname'];
+                       $this->option_info[$k] = array('oid' => $row['oid'], 'default' => $row['odef']);
+               }
+               $result->closeCursor();
+               
+               return $this->option_info[$key]['oid'];
+       }
+       final protected function get_default_value($context, $name)
+       {
+               $key = $context . '_' . $name;
+               
+               if ( array_key_exists($key, $this->option_info)
+                && array_key_exists('default', $this->option_info[$key]) )
+               {
+                       return $this->option_info[$key]['default'];
+               }
+               return;
+       }
+       
+       /**
+        * NucleusPlugin::delete_option_values()
+        * Deletes all option values for a given context and contextid
+        * (used when e.g. a blog, member or category is deleted)
+        *
+        *@static
+        *@param        String  $context        global/blog/category/item/member
+        *@param        Integer $contextid              ID
+        *@return       Void
+        */
+       static public function delete_option_values($context, $contextid)
+       {
+               // delete all associated plugin options
+               $aOIDs = array();
+               // find ids
+               $query = "SELECT oid FROM %s WHERE ocontext=%s;";
+               $query = sprintf($query, sql_table('plugin_option_desc'), DB::quoteValue($context));
+               
+               $result = DB::getResult($query);
+               foreach ( $result as $row )
+               {
+                       array_push($aOIDs, $row['oid']);
+               }
+               $result->closeCursor();
+               // delete those options. go go go
+               if ( count($aOIDs) > 0 )
+               {
+                       $query = "DELETE FROM %s WHERE oid in (%s) and ocontextid=%d;";
+                       $query = sprintf($query, sql_table('plugin_option'), implode(',',$aOIDs), (integer) $contextid);
+                       DB::execute($query);
+               }
+               return;
+       }
+       
+       /**
+        * NucleusPlugin::getOptionMeta()
+        * splits the option's typeextra field (at ;'s) to split the meta collection
+        * 
+        * @static
+        * @param string $typeExtra the value of the typeExtra field of an option
+        * @return array array of the meta-key/value-pairs
+        */
+       static public function getOptionMeta($typeExtra)
+       {
+               $meta = array();
+               
+               /* 1. if $typeExtra includes delimiter ';', split it to tokens */
+               $tokens = preg_split('#;#', $typeExtra);
+               
+               /*
+                * 2. if each of tokens includes "=", it consists of key => value
+                *    else it's 'select' option
+                */
+               foreach ( $tokens as $token )
+               {
+                       $matches = array();
+                       if ( preg_match("#^([^=]+)?=([^=]+)?$#", $token, $matches) )
+                       {
+                               $meta[$matches[1]] = $matches[2];
+                       }
+                       else
+                       {
+                               $meta['select'] = $token;
+                       }
+               }
+               return $meta;
+       }
+       
+       /**
+        * NucleusPlugin::getOptionSelectValues()
+        * filters the selectlists out of the meta collection
+        * 
+        * @static
+        * @param string $typeExtra the value of the typeExtra field of an option
+        * @return string the selectlist
+        */
+       static public function getOptionSelectValues($typeExtra)
+       {
+               $meta = NucleusPlugin::getOptionMeta($typeExtra);
+               
+               if ( array_key_exists('select', $meta) )
+               {
+                       return $meta['select'];
+               }
+               return;
+       }
+       
+       /**
+        * checks if the eventlist in the database is up-to-date
+        * @return bool if it is up-to-date it return true, else false
+        * @author TeRanEX
+        */
+       public function subscribtionListIsUptodate()
+       {
+               $res = DB::getResult('SELECT event FROM '.sql_table('plugin_event').' WHERE pid = '.$this->plugid);
+               $ev = array();
+               foreach ( $res as $row )
+               {
+                       array_push($ev, $row['event']);
+               }
+               if ( count($ev) != count($this->getEventList()) )
+               {
+                       return false;
+               }
+               $d = array_diff($ev, $this->getEventList());
+               if ( count($d) > 0 )
+               {
+                       // there are differences so the db is not up-to-date
+                       return false;
+               }
+               return true;
+       }
+       
+       /**
+        * NucleusPlugin::apply_plugin_options()
+        * Update its entry in database table
+        * 
+        * @static
+        * @param       $options: array ( 'oid' => array( 'contextid' => 'value'))
+        *                       (taken from request using requestVar())
+        * @param       $new_contextid: integer (accepts a contextid when it is for a new
+        *                       contextid there was no id available at the moment of writing the
+        *                        formcontrols into the page (by ex: itemOptions for new item)
+        * @return void
+        */
+       static public function apply_plugin_options(&$options, $new_contextid = 0)
+       {
+               global $manager;
+               
+               if ( !is_array($options) )
+               {
+                       return;
+               }
+               
+               foreach ( $options as $oid => $values )
+               {
+                       // get option type info
+                       $query = "SELECT opid, oname, ocontext, otype, oextra, odef FROM %s WHERE oid=%d;";
+                       $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $oid);
+                       $result = DB::getRow($query);
+                       if ( $result )
+                       {
+                               foreach ( $values as $id => $value )
+                               {
+                                       // decide wether we are using the contextid of newContextid
+                                       if ( $new_contextid != 0 )
+                                       {
+                                               $contextid = $new_contextid;
+                                       }
+                                       else
+                                       {
+                                               $contextid = $id;
+                                       }
+                                       
+                                       // retreive any metadata
+                                       $meta = NucleusPlugin::getOptionMeta($result['oextra']);
+                                       
+                                       // if the option is readonly or hidden it may not be saved
+                                       if ( array_key_exists('access', $meta)
+                                        && in_array($meta['access'], array('readonly', 'hidden')) )
+                                       {
+                                               return;
+                                       }
+                                       
+                                       // value comes from request
+                                       $value = undoMagic($value);
+                                       
+                                       /* validation the value according to its type */
+                                       switch ( $result['otype'] )
+                                       {
+                                               case 'yesno':
+                                                       if ( ($value != 'yes') && ($value != 'no') )
+                                                       {
+                                                               $value = 'no';
+                                                       }
+                                                       break;
+                                               case 'text':
+                                               case 'select':
+                                                       if ( array_key_exists('datatype', $meta)
+                                                        && ($meta['datatype'] == 'numerical') && ($value != (integer) $value) )
+                                                       {
+                                                               $value = (integer) $result['odef'];
+                                                       }
+                                                       break;
+                                               case 'password':
+                                               case 'textarea':
+                                               default:
+                                                       break;
+                                       }
+                                       
+                                       /*
+                                        * trigger event PrePluginOptionsUpdate to give the plugin the
+                                        * possibility to change/validate the new value for the option
+                                        */
+                                       $data = array(
+                                               'context'               => $result['ocontext'],
+                                               'plugid'                => $result['opid'],
+                                               'optionname'    => $result['oname'],
+                                               'contextid'     => $contextid,
+                                               'value'         => &$value);
+                                       $manager->notify('PrePluginOptionsUpdate', $data);
+                                       
+                                       // delete and insert its fields of table in database
+                                       $query = "DELETE FROM %s WHERE oid=%d AND ocontextid=%d;";
+                                       $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid);
+                                       DB::execute($query);
+                                       $query = "INSERT INTO %s (oid, ocontextid, ovalue) VALUES (%d, %d, %s);";
+                                       $query = sprintf($query, sql_table('plugin_option'), (integer) $oid, (integer) $contextid, DB::quoteValue($value));
+                                       DB::execute($query);
+                                       
+                                       // clear option value cache if the plugin object is already loaded
+                                       $plugin=& $manager->pidLoaded($result['opid']);
+                                       if ( $plugin )
+                                       {
+                                               $plugin->clearOptionValueCache();
+                                       }
+                                       
+                                       continue;
+                               }
+                       }
+                       continue;
+               }
+               return;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * code to make it easier to create plugin admin areas\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: PLUGINADMIN.php 1626 2012-01-09 15:46:54Z sakamocchi $\r
 + */\r
 +\r
 +class PluginAdmin\r
 +{\r
 +      public $strFullName;            // NP_SomeThing\r
 +      public $plugin;                 // ref. to plugin object\r
 +      public $bValid;                 // evaluates to true when object is considered valid\r
 +      public $admin;                          // ref to an admin object\r
 +      \r
 +      public function __construct($pluginName)\r
 +      {\r
 +              global $manager, $DIR_LIBS;\r
 +              \r
 +              if ( !class_exists('Admin', FALSE) )\r
 +              {\r
 +                      include($DIR_LIBS . 'ADMIN.php');\r
 +              }\r
 +              \r
 +              $this->strFullName = "NP_{$pluginName}";\r
 +              \r
 +              // check if plugin exists and is installed\r
 +              if ( !$manager->pluginInstalled($this->strFullName) )\r
 +              {\r
 +                      doError(_ERROR_INVALID_PLUGIN);\r
 +              }\r
 +              \r
 +              $this->plugin =& $manager->getPlugin($this->strFullName);\r
 +              $this->bValid = $this->plugin;\r
 +              \r
 +              if ( !$this->bValid )\r
 +              {\r
 +                      doError(_ERROR_INVALID_PLUGIN);\r
 +              }\r
 +              \r
 +              $this->admin = new Admin();\r
 +              $this->admin->action = "plugin_{$pluginName}";\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * PluginAdmin::start()\r
 +       * \r
 +       * @param       string  $extraHead      child elements for header element\r
 +       * @return      void\r
 +       */\r
 +      public function start($extraHead = '')\r
 +      {\r
 +              global $CONF;\r
 +              $strBaseHref  = '<base href="' . Entity::hsc($CONF['AdminURL']) . '" />';\r
 +              $extraHead .= $strBaseHref;\r
 +              \r
 +              $this->admin->pagehead($extraHead);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * PluginAdmin::end()\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function end()\r
 +      {\r
 +              $this->_AddTicketByJS();\r
 +              $this->admin->pagefoot();\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * PluginAdmin::_AddTicketByJS()\r
 +       * Add ticket when not used in plugin's admin page\r
 +       * to avoid CSRF.\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function _AddTicketByJS()\r
 +      {\r
 +              global $CONF,$ticketforplugin;\r
 +              if ( !($ticket=$ticketforplugin['ticket']) ) \r
 +              {\r
 +                      return;\r
 +              }\r
 +              $ticket=Entity::hsc($ticket);\r
 +\r
 +?><script type="text/javascript">\r
 +/*<![CDATA[*/\r
 +/* Add tickets for available links (outside blog excluded) */\r
 +for (i=0;document.links[i];i++){\r
 +  if (document.links[i].href.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
 +    && !(document.links[i].href.indexOf('//',0)<0)) continue;\r
 +  if ((j=document.links[i].href.indexOf('?',0))<0) continue;\r
 +  if (document.links[i].href.indexOf('ticket=',j)>=0) continue;\r
 +  document.links[i].href=document.links[i].href.substring(0,j+1)+'ticket=<?php echo $ticket; ?>&'+document.links[i].href.substring(j+1);\r
 +}\r
 +/* Add tickets for forms (outside blog excluded) */\r
 +for (i=0;document.forms[i];i++){\r
 +  /* check if ticket is already used */\r
 +  for (j=0;document.forms[i].elements[j];j++) {\r
 +    if (document.forms[i].elements[j].name=='ticket') {\r
 +      j=-1;\r
 +      break;\r
 +    }\r
 +  }\r
 +  if (j==-1) continue;\r
 + \r
 +  /* check if the modification works */\r
 +  try{document.forms[i].innerHTML+='';}catch(e){\r
 +    /* Modificaion falied: this sometime happens on IE */\r
 +    if (!document.forms[i].action.name && document.forms[i].method.toUpperCase()=="POST") {\r
 +      /* <input name="action"/> is not used for POST method*/\r
 +      if (document.forms[i].action.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
 +        && !(document.forms[i].action.indexOf('//',0)<0)) continue;\r
 +      if (0<(j=document.forms[i].action.indexOf('?',0))) if (0<document.forms[i].action.indexOf('ticket=',j)) continue;\r
 +      if (j<0) document.forms[i].action+='?'+'ticket=<?php echo $ticket; ?>';\r
 +      else document.forms[i].action+='&'+'ticket=<?php echo $ticket; ?>';\r
 +      continue;\r
 +    }\r
 +    document.write('<?php echo _PLUGINADMIN_TICKETS_JAVASCRIPT ?>');\r
 +    j=document.forms[i].outerHTML;\r
 +    while (j!=j.replace('<','&lt;')) j=j.replace('<','&lt;');\r
 +    document.write('<p>'+j+'</p>');\r
 +    continue;\r
 +  }\r
 +  /* check the action paramer in form tag */\r
 +  /* note that <input name="action"/> may be used here */\r
 +  j=document.forms[i].innerHTML;\r
 +  document.forms[i].innerHTML='';\r
 +  if ((document.forms[i].action+'').indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0\r
 +      && !((document.forms[i].action+'').indexOf('//',0)<0)) {\r
 +    document.forms[i].innerHTML=j;\r
 +    continue;\r
 +  }\r
 +  /* add ticket */\r
 +  document.forms[i].innerHTML=j+'<input type="hidden" name="ticket" value="<?php echo $ticket; ?>"/>';\r
 +}\r
 +/*]]>*/\r
 +</script><?php\r
 +      return;\r
 +      }\r
 +}\r
 +\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * code to make it easier to create plugin admin areas
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2012 The Nucleus Group
+  * @version $Id: PLUGINADMIN.php 1886 2012-06-17 08:27:27Z sakamocchi $
+  */
+ class PluginAdmin
+ {
+       public $strFullName;    // NP_SomeThing
+       public $plugin;         // ref. to plugin object
+       public $bValid;         // evaluates to true when object is considered valid
+       public $admin;                  // ref to an admin object
+       private $skinContents;  // PluginAdmin contents
+       private $extrahead;             // extrahead
+       public function __construct($pluginName)
+       {
+               global $manager, $DIR_LIBS;
+               
+               if ( !class_exists('Admin', FALSE) )
+               {
+                       include($DIR_LIBS . 'ADMIN.php');
+               }
+               
+               $this->strFullName = "NP_{$pluginName}";
+               
+               // check if plugin exists and is installed
+               if ( !$manager->pluginInstalled($this->strFullName) )
+               {
+                       doError(_ERROR_INVALID_PLUGIN);
+                       return;
+               }
+               
+               $this->plugin = &$manager->getPlugin($this->strFullName);
+               $this->bValid =  $this->plugin;
+               
+               if ( !$this->bValid )
+               {
+                       doError(_ERROR_INVALID_PLUGIN);
+                       return;
+               }
+               
+               Admin::initialize();
+               Admin::$action = "plugin_{$pluginName}";
+               
+               return;
+       }
+       
+       /**
+        * PluginAdmin::start()
+        * 
+        * @param       string  $extraHead      child elements for header element
+        * @return      void
+        */
+       public function start($extraHead = '')
+       {
+               global $CONF;
+               $this->extrahead = $extraHead . '<base href="' . Entity::hsc($CONF['AdminURL']) . '" />' . "\n";
+               ob_start();
+               return;
+       }
+       
+       /**
+        * PluginAdmin::end()
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function end()
+       {
+               $this->AddTicketByJS();
+               $contents = ob_get_contents();
+               ob_end_clean();
+               $this->skinContents = '<%pagehead%>' . $contents . '<%pagefoot%>';
+               Admin::action_PluginAdmin($this->skinContents, $this->extrahead);
+               return;
+       }
+       
+       /**
+        * PluginAdmin::_AddTicketByJS()
+        * Add ticket when not used in plugin's admin page
+        * to avoid CSRF.
+        * 
+        * @param       void
+        * @return      void
+        */
+       private function AddTicketByJS()
+       {
+               global $CONF,$ticketforplugin;
+               if ( !($ticket = $ticketforplugin['ticket']) )
+               {
+                       return;
+               }
+               $ticket=Entity::hsc($ticket);
+ ?><script type="text/javascript">
+ /*<![CDATA[*/
+ /* Add tickets for available links (outside blog excluded) */
+ for (i=0;document.links[i];i++){
+   if (document.links[i].href.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+     && !(document.links[i].href.indexOf('//',0)<0)) continue;
+   if ((j=document.links[i].href.indexOf('?',0))<0) continue;
+   if (document.links[i].href.indexOf('ticket=',j)>=0) continue;
+   document.links[i].href=document.links[i].href.substring(0,j+1)+'ticket=<?php echo $ticket; ?>&'+document.links[i].href.substring(j+1);
+ }
+ /* Add tickets for forms (outside blog excluded) */
+ for (i=0;document.forms[i];i++){
+   /* check if ticket is already used */
+   for (j=0;document.forms[i].elements[j];j++) {
+     if (document.forms[i].elements[j].name=='ticket') {
+       j=-1;
+       break;
+     }
+   }
+   if (j==-1) continue;
+  
+   /* check if the modification works */
+   try{document.forms[i].innerHTML+='';}catch(e){
+     /* Modificaion falied: this sometime happens on IE */
+     if (!document.forms[i].action.name && document.forms[i].method.toUpperCase()=="POST") {
+       /* <input name="action"/> is not used for POST method*/
+       if (document.forms[i].action.indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+         && !(document.forms[i].action.indexOf('//',0)<0)) continue;
+       if (0<(j=document.forms[i].action.indexOf('?',0))) if (0<document.forms[i].action.indexOf('ticket=',j)) continue;
+       if (j<0) document.forms[i].action+='?'+'ticket=<?php echo $ticket; ?>';
+       else document.forms[i].action+='&'+'ticket=<?php echo $ticket; ?>';
+       continue;
+     }
+     document.write('<?php echo _PLUGINADMIN_TICKETS_JAVASCRIPT ?>');
+     j=document.forms[i].outerHTML;
+     while (j!=j.replace('<','&lt;')) j=j.replace('<','&lt;');
+     document.write('<p>'+j+'</p>');
+     continue;
+   }
+   /* check the action paramer in form tag */
+   /* note that <input name="action"/> may be used here */
+   j=document.forms[i].innerHTML;
+   document.forms[i].innerHTML='';
+   if ((document.forms[i].action+'').indexOf('<?php echo $CONF['PluginURL']; ?>',0)<0
+       && !((document.forms[i].action+'').indexOf('//',0)<0)) {
+     document.forms[i].innerHTML=j;
+     continue;
+   }
+   /* add ticket */
+   document.forms[i].innerHTML=j+'<input type="hidden" name="ticket" value="<?php echo $ticket; ?>"/>';
+ }
+ /*]]>*/
+ </script><?php
+       return;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2003-2009 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * SEARCH(querystring) offers different functionality to create an\r
 + * SQL query to find certain items. (and comments)\r
 + *\r
 + * based on code by David Altherr:\r
 + * http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15665/\r
 + * http://davidaltherr.net/web/php_functions/boolean/funcs.mysql.boolean.txt\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: SEARCH.php 1556 2011-07-11 14:18:48Z ftruscot $\r
 + */\r
 +\r
 +\r
 +\r
 +class Search\r
 +{\r
 +      var $querystring;\r
 +      var $marked;\r
 +      var $inclusive;\r
 +      var $blogs;\r
 +\r
 +\r
 +      function SEARCH($text) {\r
 +              global $blogid;\r
 +              $text = preg_replace ("/[<,>,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text);\r
 +              $this->querystring      = $text;\r
 +              $this->marked           = $this->boolean_mark_atoms($text);\r
 +              $this->inclusive        = $this->boolean_inclusive_atoms($text);\r
 +              $this->blogs            = array();\r
 +\r
 +              // get all public searchable blogs, no matter what, include the current blog allways.\r
 +              $res = DB::getResult('SELECT bnumber FROM '.sql_table('blog').' WHERE bincludesearch=1 ');\r
 +              foreach ( $res as $row )\r
 +                      $this->blogs[] = intval($row['bnumber']);\r
 +      }\r
 +\r
 +      function  boolean_sql_select($match){\r
 +              if (i18n::strlen($this->inclusive) > 0) {\r
 +                 /* build sql for determining score for each record */\r
 +                 $result=preg_split("# #",$this->inclusive);\r
 +                 for($cth=0;$cth<count($result);$cth++){\r
 +                         if(i18n::strlen($result[$cth])>=4){\r
 +                                 $stringsum_long .=  " $result[$cth] ";\r
 +                         }else{\r
 +                                 $stringsum_a[] = ' '.$this->boolean_sql_select_short($result[$cth],$match).' ';\r
 +                         }\r
 +                 }\r
 +\r
 +                 if(i18n::strlen($stringsum_long)>0){\r
 +                              $stringsum_long = DB::quoteValue($stringsum_long);\r
 +                              $stringsum_a[] = " match ({$match}) against ({$stringsum_long}) ";\r
 +                 }\r
 +\r
 +                 $stringsum .= implode("+",$stringsum_a);\r
 +                 return $stringsum;\r
 +              }\r
 +      }\r
 +\r
 +      function boolean_inclusive_atoms($string){\r
 +              $result = trim($string);\r
 +              $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);\r
 +\r
 +              # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
 +              # just added delimiters to regex and the 'i' for case-insensitive matching\r
 +\r
 +              /* convert normal boolean operators to shortened syntax */\r
 +              $result = preg_replace('# not #i', ' -', $result);\r
 +              $result = preg_replace('# and #i', ' ', $result);\r
 +              $result = preg_replace('# or #i', ',', $result);\r
 +\r
 +              /* drop unnecessary spaces */\r
 +              $result = str_replace(' ,', ',', $result);\r
 +              $result = str_replace(', ', ',', $result);\r
 +              $result = str_replace('- ', '-', $result);\r
 +              $result = str_replace('+', '', $result);\r
 +\r
 +              /* strip exlusive atoms */\r
 +              $result = preg_replace(\r
 +                      "#\-\([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_\,]{0,}\)#",\r
 +                      '',\r
 +                      $result);\r
 +\r
 +              $result = str_replace('(', ' ', $result);\r
 +              $result = str_replace(')', ' ', $result);\r
 +              $result = str_replace(',', ' ', $result);\r
 +\r
 +              return $result;\r
 +      }\r
 +\r
 +    function boolean_sql_where($match){\r
 +\r
 +        $result = $this->marked;\r
 +\r
 +        $this->boolean_sql_where_cb1($match); // set the static $match\r
 +\r
 +        $result = preg_replace_callback(\r
 +\r
 +            "/foo\[\(\'([^\)]{4,})\'\)\]bar/",\r
 +\r
 +            array($this,'boolean_sql_where_cb1'),\r
 +\r
 +            $result);\r
 +\r
 +        $this->boolean_sql_where_cb2($match); // set the static $match\r
 +\r
 +        $result = preg_replace_callback(\r
 +\r
 +            "/foo\[\(\'([^\)]{1,3})\'\)\]bar/",\r
 +\r
 +            array($this,'boolean_sql_where_cb2'),\r
 +\r
 +            $result);\r
 +\r
 +        return $result;\r
 +\r
 +    }\r
 +\r
 +    function boolean_sql_where_cb1($matches){\r
 +\r
 +        static $match;\r
 +\r
 +        if (!is_array($matches)) $match=$matches;\r
 +\r
 +        else return ' match ('.$match.') against ('.DB::quoteValue($matches[1]).') > 0 ';\r
 +\r
 +    }\r
 +\r
 +    function boolean_sql_where_cb2($matches){\r
 +\r
 +        static $match;\r
 +\r
 +        if (!is_array($matches)) $match=$matches;\r
 +\r
 +        else return ' ('.$this->boolean_sql_where_short($matches[1], $match).') ';\r
 +\r
 +    } \r
 +\r
 +      function boolean_mark_atoms($string){\r
 +              $result = trim($string);\r
 +              $result = preg_replace("/([[:space:]]{2,})/",' ',$result);\r
 +\r
 +              # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0\r
 +              # just added delimiters to regex and the 'i' for case-insensitive matching\r
 +\r
 +              /* convert normal boolean operators to shortened syntax */\r
 +              $result = preg_replace('# not #i', ' -', $result);\r
 +              $result = preg_replace('# and #i', ' ', $result);\r
 +              $result = preg_replace('# or #i', ',', $result);\r
 +\r
 +              /* strip excessive whitespace */\r
 +              $result = str_replace('( ', '(', $result);\r
 +              $result = str_replace(' )', ')', $result);\r
 +              $result = str_replace(', ', ',', $result);\r
 +              $result = str_replace(' ,', ',', $result);\r
 +              $result = str_replace('- ', '-', $result);\r
 +              $result = str_replace('+', '', $result);\r
 +\r
 +              // remove double spaces (we might have introduced some new ones above)\r
 +              $result = trim($result);\r
 +              $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);\r
 +\r
 +              /* apply arbitrary function to all 'word' atoms */\r
 +\r
 +              $result_a = preg_split('# #', $result);\r
 +\r
 +              for($word = 0;$word<count($result_a);$word++)\r
 +              {\r
 +                      $result_a[$word] = "foo[('" . $result_a[$word] . "')]bar";\r
 +              }\r
 +\r
 +              $result = implode(' ', $result_a);\r
 +\r
 +              /* dispatch ' ' to ' AND ' */\r
 +              $result = str_replace(' ', ' AND ', $result);\r
 +\r
 +              /* dispatch ',' to ' OR ' */\r
 +              $result = str_replace(',', ' OR ', $result);\r
 +\r
 +              /* dispatch '-' to ' NOT ' */\r
 +              $result = str_replace(' -', ' NOT ', $result);\r
 +              return $result;\r
 +      }\r
 +\r
 +      function boolean_sql_where_short($string,$match){\r
 +              $match_a = preg_split('#,#',$match);\r
 +              for($ith=0;$ith<count($match_a);$ith++){\r
 +                      $like_a[$ith] = ' $match_a[$ith] LIKE ' . DB::quoteValue("% {$string} %") . ' ';\r
 +              }\r
 +              $like = implode(" OR ",$like_a);\r
 +\r
 +              return $like;\r
 +      }\r
 +      function boolean_sql_select_short($string,$match){\r
 +              $match_a = preg_split('#,#',$match);\r
 +              $score_unit_weight = .2;\r
 +              for($ith=0;$ith<count($match_a);$ith++){\r
 +                      $score_a[$ith] =\r
 +                                                 " $score_unit_weight*(\r
 +                                                 LENGTH(" . DB::quoteValue($match_a[$ith]) . ") -\r
 +                                                 LENGTH(REPLACE(LOWER(" . DB::quoteValue($match_a[$ith]) . "),LOWER(" . DB::quoteValue($string) . "),'')))\r
 +                                                 /LENGTH(" . DB::quoteValue($string) . ") ";\r
 +              }\r
 +              $score = implode(" + ",$score_a);\r
 +\r
 +              return $score;\r
 +      }\r
 +}\r
 +?>\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2003-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * SEARCH(querystring) offers different functionality to create an
+  * SQL query to find certain items. (and comments)
+  *
+  * based on code by David Altherr:
+  * http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MySQL/18/15665/
+  * http://davidaltherr.net/web/php_functions/boolean/funcs.mysql.boolean.txt
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: SEARCH.php 1886 2012-06-17 08:27:27Z sakamocchi $
+  */
+ class Search
+ {
+       var $querystring;
+       var $marked;
+       var $inclusive;
+       var $blogs;
+       function SEARCH($text) {
+               global $blogid;
+               $text = preg_replace ("/[<,>,=,?,!,#,^,(,),[,\],:,;,\\\,%]/","",$text);
+               $this->querystring      = $text;
+               $this->marked           = $this->boolean_mark_atoms($text);
+               $this->inclusive        = $this->boolean_inclusive_atoms($text);
+               $this->blogs            = array();
+               // get all public searchable blogs, no matter what, include the current blog allways.
+               $res = DB::getResult('SELECT bnumber FROM '.sql_table('blog').' WHERE bincludesearch=1 ');
+               foreach ( $res as $row )
+                       $this->blogs[] = intval($row['bnumber']);
+       }
+       function  boolean_sql_select($match){
+               if (i18n::strlen($this->inclusive) > 0) {
+                  /* build sql for determining score for each record */
+                  $result=preg_split("# #",$this->inclusive);
+                  for($cth=0;$cth<count($result);$cth++){
+                          if(i18n::strlen($result[$cth])>=4){
+                                  $stringsum_long .=  " $result[$cth] ";
+                          }else{
+                                  $stringsum_a[] = ' '.$this->boolean_sql_select_short($result[$cth],$match).' ';
+                          }
+                  }
+                  if(i18n::strlen($stringsum_long)>0){
+                               $stringsum_long = DB::quoteValue($stringsum_long);
+                               $stringsum_a[] = " match ({$match}) against ({$stringsum_long}) ";
+                  }
+                  $stringsum .= implode("+",$stringsum_a);
+                  return $stringsum;
+               }
+       }
+       function boolean_inclusive_atoms($string){
+               $result = trim($string);
+               $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);
+               # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0
+               # just added delimiters to regex and the 'i' for case-insensitive matching
+               /* convert normal boolean operators to shortened syntax */
+               $result = preg_replace('# not #i', ' -', $result);
+               $result = preg_replace('# and #i', ' ', $result);
+               $result = preg_replace('# or #i', ',', $result);
+               /* drop unnecessary spaces */
+               $result = str_replace(' ,', ',', $result);
+               $result = str_replace(', ', ',', $result);
+               $result = str_replace('- ', '-', $result);
+               $result = str_replace('+', '', $result);
+               /* strip exlusive atoms */
+               $result = preg_replace(
+                       "#\-\([A-Za-z0-9]{1,}[A-Za-z0-9\-\.\_\,]{0,}\)#",
+                       '',
+                       $result);
+               $result = str_replace('(', ' ', $result);
+               $result = str_replace(')', ' ', $result);
+               $result = str_replace(',', ' ', $result);
+               return $result;
+       }
+     function boolean_sql_where($match){
+         $result = $this->marked;
+         $this->boolean_sql_where_cb1($match); // set the static $match
+         $result = preg_replace_callback(
+             "/foo\[\(\'([^\)]{4,})\'\)\]bar/",
+             array($this,'boolean_sql_where_cb1'),
+             $result);
+         $this->boolean_sql_where_cb2($match); // set the static $match
+         $result = preg_replace_callback(
+             "/foo\[\(\'([^\)]{1,3})\'\)\]bar/",
+             array($this,'boolean_sql_where_cb2'),
+             $result);
+         return $result;
+     }
+     function boolean_sql_where_cb1($matches){
+         static $match;
+         if (!is_array($matches)) $match=$matches;
+         else return ' match ('.$match.') against ('.DB::quoteValue($matches[1]).') > 0 ';
+     }
+     function boolean_sql_where_cb2($matches){
+         static $match;
+         if (!is_array($matches)) $match=$matches;
+         else return ' ('.$this->boolean_sql_where_short($matches[1], $match).') ';
+     } 
+       function boolean_mark_atoms($string){
+               $result = trim($string);
+               $result = preg_replace("/([[:space:]]{2,})/",' ',$result);
+               # replaced eregi_replace() below with preg_replace(). ereg* functions are deprecated in PHP 5.3.0
+               # just added delimiters to regex and the 'i' for case-insensitive matching
+               /* convert normal boolean operators to shortened syntax */
+               $result = preg_replace('# not #i', ' -', $result);
+               $result = preg_replace('# and #i', ' ', $result);
+               $result = preg_replace('# or #i', ',', $result);
+               /* strip excessive whitespace */
+               $result = str_replace('( ', '(', $result);
+               $result = str_replace(' )', ')', $result);
+               $result = str_replace(', ', ',', $result);
+               $result = str_replace(' ,', ',', $result);
+               $result = str_replace('- ', '-', $result);
+               $result = str_replace('+', '', $result);
+               // remove double spaces (we might have introduced some new ones above)
+               $result = trim($result);
+               $result = preg_replace("#([[:space:]]{2,})#", ' ', $result);
+               /* apply arbitrary function to all 'word' atoms */
+               $result_a = preg_split('# #', $result);
+               for($word = 0;$word<count($result_a);$word++)
+               {
+                       $result_a[$word] = "foo[('" . $result_a[$word] . "')]bar";
+               }
+               $result = implode(' ', $result_a);
+               /* dispatch ' ' to ' AND ' */
+               $result = str_replace(' ', ' AND ', $result);
+               /* dispatch ',' to ' OR ' */
+               $result = str_replace(',', ' OR ', $result);
+               /* dispatch '-' to ' NOT ' */
+               $result = str_replace(' -', ' NOT ', $result);
+               return $result;
+       }
+       function boolean_sql_where_short($string,$match){
+               $match_a = preg_split('#,#',$match);
+               for($ith=0;$ith<count($match_a);$ith++){
+                       $like_a[$ith] = ' $match_a[$ith] LIKE ' . DB::quoteValue("% {$string} %") . ' ';
+               }
+               $like = implode(" OR ",$like_a);
+               return $like;
+       }
+       function boolean_sql_select_short($string,$match){
+               $match_a = preg_split('#,#',$match);
+               $score_unit_weight = .2;
+               for($ith=0;$ith<count($match_a);$ith++){
+                       $score_a[$ith] =
+                                                  " $score_unit_weight*(
+                                                  LENGTH(" . DB::quoteValue($match_a[$ith]) . ") -
+                                                  LENGTH(REPLACE(LOWER(" . DB::quoteValue($match_a[$ith]) . "),LOWER(" . DB::quoteValue($string) . "),'')))
+                                                  /LENGTH(" . DB::quoteValue($string) . ") ";
+               }
+               $score = implode(" + ",$score_a);
+               return $score;
+       }
+ }
+ ?>
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: SKIN.php 1816 2012-05-03 01:40:10Z sakamocchi $
++=======
+  * @version $Id: SKIN.php 1886 2012-06-17 08:27:27Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  if ( !function_exists('requestVar') )
@@@ -54,9 -54,7 +58,13 @@@ class Ski
                
                $this->id = (integer) $id;
                
++<<<<<<< HEAD
 +              /*
 +               * NOTE: include needed action class
 +               */
++=======
+               /* NOTE: include needed action class */
++>>>>>>> skinnable-master
                if ( $action_class != 'Actions' )
                {
                        if ( !class_exists($action_class, FALSE)
                
                // retrieve contents
                $contents = FALSE;
++<<<<<<< HEAD
 +              if ( $type != 'fileparse' )
 +              {
 +                      $contents = $this->getContentFromDB($type);
 +              }
 +              else if ( $path !== ''  && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
 +              {
 +                      $contents = $this->getContentFromFile($path);
++=======
+               if ( $type == 'pluginadmin' )
+               {
+                       $contents = $path;
+               }
+               else
+               {
+                       if ( $type != 'fileparse' && $type != 'importAdmin')
+                       {
+                               $contents = $this->getContentFromDB($type);
+                       }
+                       else if ( $path !== ''  && i18n::strpos(realpath($path), realpath("$DIR_NUCLEUS/../")) == 0 )
+                       {
+                               $contents = $this->getContentFromFile($path);
+                       }
++>>>>>>> skinnable-master
                }
                // use base skin if this skin does not have contents
                if ( $contents === FALSE )
                $res = DB::getValue($query);
                
                $skintypeexists = !empty($res);
++<<<<<<< HEAD
 +              $skintypevalue = ($content == true);
++=======
+               $skintypevalue = !empty($content);
++>>>>>>> skinnable-master
                
                if( $skintypevalue && $skintypeexists )
                {
                                'type'          =>  $type,
                                'content'       => &$content
                        );
++<<<<<<< HEAD
 +                      
 +                      // PreUpdateSkinPart event
 +                      $manager->notify("PreUpdate{{$this->event_identifier}}Part", $data);
 +              }
 +              else if( $skintypevalue && !$skintypeexists )
 +              {
 +                      $data = array(
 +                              'skinid'        => $this->id,
 +                              'type'          => $type,
 +                              'content'       => &$content
 +                      );
 +                      
 +                      $manager->notify("PreAdd{$this->event_identifier}Part", $data);
 +              }
 +              else if( !$skintypevalue && $skintypeexists )
++=======
+                       $manager->notify("PreUpdate{$this->event_identifier}Part", $data);
+               }
+               else if( $skintypevalue )
+               {
+                       $data = array(
+                               'skinid'        =>  $this->id,
+                               'type'          =>  $type,
+                               'content'       => &$content
+                       );
+                       $manager->notify("PreAdd{$this->event_identifier}Part", $data);
+               }
+               else if( $skintypeexists )
++>>>>>>> skinnable-master
                {
                        $data = array(
                                'skinid'        => $this->id,
                                'type'          => $type
                        );
++<<<<<<< HEAD
 +                      
++=======
++>>>>>>> skinnable-master
                        $manager->notify("PreDelete{$this->event_identifier}Part", $data);
                }
                
                // delete old thingie
++<<<<<<< HEAD
 +              $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d";
++=======
+               $query = "DELETE FROM %s WHERE stype=%s and sdesc=%d;";
++>>>>>>> skinnable-master
                $query = sprintf($query, sql_table('skin'), DB::quoteValue($type), (integer) $this->id);
                DB::execute($query);
                
                // write new thingie
                if ( $content )
                {
++<<<<<<< HEAD
 +                      $query = "INSERT INTO %s (scontent, stype, sdesc) VALUE (%s, %s, %d)";
++=======
+                       $query = "INSERT INTO %s (scontent, stype, sdesc) VALUES (%s, %s, %d);";
++>>>>>>> skinnable-master
                        $query = sprintf($query, sql_table('skin'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->id);
                        DB::execute($query);
                }
                if( $skintypevalue && $skintypeexists )
                {
                        $data = array(
++<<<<<<< HEAD
 +                              'skinid'        => $this->id,
 +                              'type'          => $type,
 +                              'content'       => &$content
 +                      );
 +                      
 +                      // PostUpdateSkinPart event
 +                      $manager->notify("PostUpdate{$this->event_identifier}Part", $data);
 +              }
 +              else if( $skintypevalue && (!$skintypeexists) )
 +              {
 +                      $data = array(
 +                              'skinid'        => $this->id,
 +                              'type'          => $type,
 +                              'content'       => &$content
 +                      );
 +                      
 +                      // PostAddSkinPart event
 +                      $manager->notify("PostAdd{$this->event_identifier}Part", $data);
 +              }
 +              else if( (!$skintypevalue) && $skintypeexists )
++=======
+                               'skinid'        =>  $this->id,
+                               'type'          =>  $type,
+                               'content'       => &$content
+                       );
+                       $manager->notify("PostUpdate{$this->event_identifier}Part", $data);
+               }
+               else if( $skintypevalue )
+               {
+                       $data = array(
+                               'skinid'        =>  $this->id,
+                               'type'          =>  $type,
+                               'content'       => &$content
+                       );
+                       $manager->notify("PostAdd{$this->event_identifier}Part", $data);
+               }
+               else if( $skintypeexists )
++>>>>>>> skinnable-master
                {
                        $data = array(
                                'skinid'        => $this->id,
                                'type'          => $type
                        );
++<<<<<<< HEAD
 +                      
++=======
++>>>>>>> skinnable-master
                        $manager->notify("PostDelete{$this->event_identifier}Part", $data);
                }
                return;
        }
        
        /**
++<<<<<<< HEAD
 +       * Skin::getDefaultTypes()
++=======
+        * Skin::getNormalTypes()
++>>>>>>> skinnable-master
         * 
         * @param       string  void
         * @return      array   default skin types
         */
++<<<<<<< HEAD
 +      public function getDefaultTypes()
 +      {
 +              return call_user_func(array($this->action_class, 'getAvailableSkinTypes'));
++=======
+       public function getNormalTypes()
+       {
+               return call_user_func(array($this->action_class, 'getNormalSkinTypes'));
++>>>>>>> skinnable-master
        }
        
        /**
         */
        public function getAvailableTypes()
        {
++<<<<<<< HEAD
 +              $default_skintypes = $this->getDefaultTypes();
++=======
+               $default_skintypes = $this->getNormalTypes();
++>>>>>>> skinnable-master
                $query = "SELECT stype FROM %s WHERE sdesc=%d;";
                $query = sprintf($query, sql_table('skin'), (integer) $this->id);
                
         * Skin::getAllowedActionsForType()
         * Get the allowed actions for a skin type
         * returns an array with the allowed actions
++<<<<<<< HEAD
 +       * 
++=======
+        * @return      array   allowed action types
++>>>>>>> skinnable-master
         * @param       string  $skintype       type of the skin
         * @return      array   allowed action types
         */
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * A class representing a template\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: TEMPLATE.php 1726 2012-04-07 02:23:46Z sakamocchi $\r
 + */\r
 +class Template\r
 +{\r
 +      /**\r
 +       * Template::$id\r
 +       */\r
 +      private $id;\r
 +      \r
 +      /**\r
 +       * Template::__construct()\r
 +       * \r
 +       * @param       integer $templateid     id for template\r
 +       * @return      void\r
 +       */\r
 +      public function __construct($templateid)\r
 +      {\r
 +              $this->id = intval($templateid);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::getID()\r
 +       * \r
 +       * @param       void\r
 +       * @return      integer id for this instance of Template class\r
 +       */\r
 +      public function getID()\r
 +      {\r
 +              return (integer) $this->id;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::createFromName()\r
 +       * \r
 +       * @statc\r
 +       * @param       string  $name   template name\r
 +       * @return      object  instance of Template class generated by the name\r
 +       */\r
 +      static public function createFromName($name)\r
 +      {\r
 +              return new Template(Template::getIdFromName($name));\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::getIdFromName()\r
 +       * \r
 +       * @static\r
 +       * @param       string  $name   template name\r
 +       * @return      integer id for the template\r
 +       */\r
 +      static public function getIdFromName($name)\r
 +      {\r
 +              $name = DB::quoteValue($name);\r
 +              $query = "SELECT tdnumber FROM %s WHERE tdname=%s";\r
 +              $query = sprintf($query, sql_table('template_desc'), $name);\r
 +              return DB::getValue($query);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::updateGeneralInfo()\r
 +       * Updates the general information about the template\r
 +       * \r
 +       * @param       string  $name   template name\r
 +       * @param       string  $desc   description for this template\r
 +       * @return      void\r
 +       */\r
 +      public function updateGeneralInfo($name, $desc)\r
 +      {\r
 +              $query =  "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d";\r
 +              $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $this->getID());\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::update()\r
 +       * Updates the contents of one part of the template\r
 +       * \r
 +       * @param       String  $type   value for nucleus_template.tpartname\r
 +       * @param       String  $content        value for nucleus_template.tcontent\r
 +       * @return      Void\r
 +       */\r
 +      public function update($type, $content)\r
 +      {\r
 +              // delete old thingie\r
 +              $query = "DELETE FROM %s WHERE tpartname=%s and tdesc=%d";\r
 +              $query = sprintf($query, sql_table('template'), DB::quoteValue($type), (integer) $this->getID());\r
 +              DB::execute($query);\r
 +              \r
 +              // write new thingie\r
 +              if ( $content )\r
 +              {\r
 +                      $query = "INSERT %s (tcontent, tpartname, tdesc) VALUE (%s, %s, %d)";\r
 +                      $query = sprintf($query, sql_table('template'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->getID());\r
 +                      DB::execute($query);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::deleteAllParts()\r
 +       * Deletes all template parts from the database\r
 +       * \r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function deleteAllParts()\r
 +      {\r
 +              $query = "DELETE FROM %s WHERE tdesc=%d";\r
 +              $query = sprintf($query, sql_table('template'), (integer) $this->getID());\r
 +              DB::execute($query);\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Template::createNew()\r
 +       * Creates a new template\r
 +       *\r
 +       * @static\r
 +       * @param       string  $name   name for new template\r
 +       * @param       string  $desc   description for new template\r
 +       * @return      integer id for new template\r
 +       */\r
 +      static public function createNew($name, $desc)\r
 +      {\r
 +              global $manager;\r
 +              \r
 +              $manager->notify(\r
 +                      'PreAddTemplate',\r
 +                      array(\r
 +                              'name' => &$name,\r
 +                              'description' => &$desc\r
 +                      )\r
 +              );\r
 +              \r
 +              DB::execute('INSERT INTO '.sql_table('template_desc').' (tdname, tddesc) VALUES (' . DB::quoteValue($name) . ',' . DB::quoteValue($desc) . ')');\r
 +              $newId = DB::getInsertId();\r
 +              \r
 +              $manager->notify(\r
 +                      'PostAddTemplate',\r
 +                      array(\r
 +                              'templateid' => $newId,\r
 +                              'name' => $name,\r
 +                              'description' => $desc\r
 +                      )\r
 +              );\r
 +              \r
 +              return $newId;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Reads a template and returns an array with the parts.\r
 +       *\r
 +       * @static\r
 +       * @param       string  $name name of the template file\r
 +       * @return      array   template array\r
 +       */\r
 +      static public function read($name)\r
 +      {\r
 +              global $manager;\r
 +              $manager->notify(\r
 +                      'PreTemplateRead',\r
 +                      array(\r
 +                              'template' => &$name\r
 +                      )\r
 +              );\r
 +              \r
 +              $query = "SELECT tpartname, tcontent FROM %s, %s WHERE tdesc=tdnumber and tdname=%s";\r
 +              $query = sprintf($query, sql_table('template_desc'), sql_table('template'), DB::quoteValue($name));\r
 +              $res = DB::getResult($query);\r
 +              \r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      $template[$row['tpartname']] = $row['tcontent'];\r
 +              }\r
 +              \r
 +              /*\r
 +               * TODO: this is appropriate or not?\r
 +               */\r
 +              if ( array_key_exists('LOCALE', $template) && !empty($template['LOCALE']) )\r
 +              {\r
 +                      setlocale(LC_TIME, $template['LOCALE']);\r
 +              }\r
 +              else\r
 +              {\r
 +                      setlocale(LC_TIME,'');\r
 +              }\r
 +              \r
 +              return $template;\r
 +      }\r
 +      \r
 +      /**\r
 +       * fills a template with values\r
 +       * \r
 +       * @static\r
 +       * @param       string  $template       Template to be used\r
 +       * @param       array   $values         Array of all the values\r
 +       * @return      string  string filled with tag contents\r
 +       */\r
 +      static public function fill($template, $values)\r
 +      {\r
 +              \r
 +              if ( sizeof($values) != 0 )\r
 +              {\r
 +                      foreach ( $values as $key => $value )\r
 +                      {\r
 +                              $template = preg_replace('#<%' . preg_quote($key, '#') . '%>#', $value, $template);\r
 +                      }\r
 +              }\r
 +              \r
 +              // remove non matched template-tags\r
 +              return preg_replace('#<%([a-zA-Z]+)?%>#', '', $template);\r
 +      }\r
 +      \r
 +      /**\r
 +       * TEMPLATE::exists()\r
 +       * returns true if there is a template with the given shortname\r
 +       * \r
 +       * @static\r
 +       * @param       string  $name   template name\r
 +       * @return      boolean exists or not\r
 +       */\r
 +      static public function exists($name)\r
 +      {\r
 +              $query = "SELECT * FROM %s WHERE tdname=%s";\r
 +              $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name));\r
 +              $r = DB::getResult($query);\r
 +              return ($r->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * TEMPLATE::existsID()\r
 +       * returns true if there is a template with the given ID\r
 +       * \r
 +       * @static\r
 +       * @param       integer $id     id for template\r
 +       * @return      bookean exists or not\r
 +       */\r
 +      static public function existsID($id)\r
 +      {\r
 +              $query = "SELECT * FROM %s WHERE tdnumber=%d";\r
 +              $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
 +              $r = DB::getResult($query);\r
 +              return ($r->rowCount() != 0);\r
 +      }\r
 +      \r
 +      /**\r
 +       * TEMPLATE::getNameFromId()\r
 +       * \r
 +       * @static\r
 +       * @param       integer $id     id for template\r
 +       * @return      object  sql object\r
 +       */\r
 +      static public function getNameFromId($id)\r
 +      {\r
 +              $query = "SELECT tdname as result FROM %s WHERE tdnumber=%d";\r
 +              $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
 +              return DB::getValue($query);\r
 +      }\r
 +      \r
 +      /**\r
 +       * TEMPLATE::getDesc()\r
 +       * \r
 +       * @static\r
 +       * @param       integer $id     id for template\r
 +       * @return      string  description for the template\r
 +       */\r
 +      static public function getDesc($id)\r
 +      {\r
 +              $query = "SELECT tddesc FROM %s WHERE tdnumber=%d";\r
 +              $query = sprintf($query, sql_table('template_desc'), (integer) $id);\r
 +              return DB::getValue($query);\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * A class representing a template
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: TEMPLATE.php 1880 2012-06-17 07:48:14Z sakamocchi $
+  */
+ class Template
+ {
+       /**
+        * Template::$id
+        */
+       private $id;
+       
+       /**
+        * Template::__construct()
+        * 
+        * @param       integer $templateid     id for template
+        * @return      void
+        */
+       public function __construct($templateid)
+       {
+               $this->id = intval($templateid);
+               return;
+       }
+       
+       /**
+        * Template::getID()
+        * 
+        * @param       void
+        * @return      integer id for this instance of Template class
+        */
+       public function getID()
+       {
+               return (integer) $this->id;
+       }
+       
+       /**
+        * Template::createFromName()
+        * 
+        * @statc
+        * @param       string  $name   template name
+        * @return      object  instance of Template class generated by the name
+        */
+       static public function createFromName($name)
+       {
+               return new Template(Template::getIdFromName($name));
+       }
+       
+       /**
+        * Template::getIdFromName()
+        * 
+        * @static
+        * @param       string  $name   template name
+        * @return      integer id for the template
+        */
+       static public function getIdFromName($name)
+       {
+               $name = DB::quoteValue($name);
+               $query = "SELECT tdnumber FROM %s WHERE tdname=%s";
+               $query = sprintf($query, sql_table('template_desc'), $name);
+               return DB::getValue($query);
+       }
+       
+       /**
+        * Template::updateGeneralInfo()
+        * Updates the general information about the template
+        * 
+        * @param       string  $name   template name
+        * @param       string  $desc   description for this template
+        * @return      void
+        */
+       public function updateGeneralInfo($name, $desc)
+       {
+               $query =  "UPDATE %s SET tdname=%s, tddesc=%s WHERE tdnumber=%d";
+               $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name), DB::quoteValue($desc), (integer) $this->getID());
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Template::update()
+        * Updates the contents of one part of the template
+        * 
+        * @param       String  $type   value for nucleus_template.tpartname
+        * @param       String  $content        value for nucleus_template.tcontent
+        * @return      Void
+        */
+       public function update($type, $content)
+       {
+               // delete old thingie
+               $query = "DELETE FROM %s WHERE tpartname=%s and tdesc=%d";
+               $query = sprintf($query, sql_table('template'), DB::quoteValue($type), (integer) $this->getID());
+               DB::execute($query);
+               
+               // write new thingie
+               if ( $content )
+               {
+                       $query = "INSERT INTO %s (tcontent, tpartname, tdesc) VALUES (%s, %s, %d)";
+                       $query = sprintf($query, sql_table('template'), DB::quoteValue($content), DB::quoteValue($type), (integer) $this->getID());
+                       DB::execute($query);
+               }
+               return;
+       }
+       
+       /**
+        * Template::deleteAllParts()
+        * Deletes all template parts from the database
+        * 
+        * @param       void
+        * @return      void
+        */
+       public function deleteAllParts()
+       {
+               $query = "DELETE FROM %s WHERE tdesc=%d";
+               $query = sprintf($query, sql_table('template'), (integer) $this->getID());
+               DB::execute($query);
+               return;
+       }
+       
+       /**
+        * Template::createNew()
+        * Creates a new template
+        *
+        * @static
+        * @param       string  $name   name for new template
+        * @param       string  $desc   description for new template
+        * @return      integer id for new template
+        */
+       static public function createNew($name, $desc)
+       {
+               global $manager;
+               $data = array(
+                       'name'                  => &$name,
+                       'description'   => &$desc
+               );
+               $manager->notify('PreAddTemplate', $data);
+               
+               DB::execute('INSERT INTO '.sql_table('template_desc').' (tdname, tddesc) VALUES (' . DB::quoteValue($name) . ',' . DB::quoteValue($desc) . ')');
+               $newId = DB::getInsertId();
+               $data = array(
+                       'templateid'    => $newId,
+                       'name'                  => $name,
+                       'description'   => $desc
+               );
+               $manager->notify('PostAddTemplate', $data);
+               
+               return $newId;
+       }
+       
+       /**
+        * Reads a template and returns an array with the parts.
+        *
+        * @static
+        * @param       string  $name name of the template file
+        * @return      array   template array
+        */
+       static public function read($name)
+       {
+               global $manager;
+               $data = array('template' => &$name);
+               $manager->notify('PreTemplateRead', $data);
+               
+               $query = "SELECT tpartname, tcontent FROM %s, %s WHERE tdesc=tdnumber and tdname=%s";
+               $query = sprintf($query, sql_table('template_desc'), sql_table('template'), DB::quoteValue($name));
+               $res = DB::getResult($query);
+               
+               $template = array();
+               foreach ( $res as $row )
+               {
+                       $template[$row['tpartname']] = $row['tcontent'];
+               }
+               
+               return $template;
+       }
+       
+       /**
+        * fills a template with values
+        * 
+        * @static
+        * @param       string  $template       Template to be used
+        * @param       array   $values         Array of all the values
+        * @return      string  string filled with tag contents
+        */
+       static public function fill($template, $values)
+       {
+               
+               if ( sizeof($values) != 0 )
+               {
+                       foreach ( $values as $key => $value )
+                       {
+                               $template = preg_replace('#<%' . preg_quote($key, '#') . '%>#', $value, $template);
+                       }
+               }
+               
+               // remove non matched template-tags
+               return preg_replace('#<%([a-zA-Z]+)?%>#', '', $template);
+       }
+       
+       /**
+        * Template::exists()
+        * returns true if there is a template with the given shortname
+        * 
+        * @static
+        * @param       string  $name   template name
+        * @return      boolean exists or not
+        */
+       static public function exists($name)
+       {
+               $query = "SELECT * FROM %s WHERE tdname=%s";
+               $query = sprintf($query, sql_table('template_desc'), DB::quoteValue($name));
+               $r = DB::getResult($query);
+               return ($r->rowCount() != 0);
+       }
+       
+       /**
+        * Template::existsID()
+        * returns true if there is a template with the given ID
+        * 
+        * @static
+        * @param       integer $id     id for template
+        * @return      bookean exists or not
+        */
+       static public function existsID($id)
+       {
+               $query = "SELECT * FROM %s WHERE tdnumber=%d";
+               $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+               $r = DB::getResult($query);
+               return ($r->rowCount() != 0);
+       }
+       
+       /**
+        * Template::getNameFromId()
+        * 
+        * @static
+        * @param       integer $id     id for template
+        * @return      object  sql object
+        */
+       static public function getNameFromId($id)
+       {
+               $query = "SELECT tdname as result FROM %s WHERE tdnumber=%d";
+               $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+               return DB::getValue($query);
+       }
+       
+       /**
+        * Template::getDesc()
+        * 
+        * @static
+        * @param       integer $id     id for template
+        * @return      string  description for the template
+        */
+       static public function getDesc($id)
+       {
+               $query = "SELECT tddesc FROM %s WHERE tdnumber=%d";
+               $query = sprintf($query, sql_table('template_desc'), (integer) $id);
+               return DB::getValue($query);
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * Scripts to create/restore a backup of the Nucleus database\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: backup.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
 + */\r
 +\r
 +class Backup\r
 +{\r
 +      /**\r
 +       * Backup::Backup()\r
 +       * Constructor, just for compatibility\r
 +       *\r
 +       * @deprecated\r
 +       * @param       void\r
 +       * @return      void\r
 +       *\r
 +       */\r
 +      public function Backup()\r
 +      {\r
 +              return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::do_backup()\r
 +       * This function creates an sql dump of the database and sends it to\r
 +       * the user as a file (can be gzipped if they want)\r
 +       *\r
 +       * NOTE: this remains not-static for compatibility\r
 +       *\r
 +       * @param boolean       $gzip   1 = compress backup file, 0 = no compression (default)\r
 +       * @return      void\r
 +       *\r
 +       */\r
 +      public function do_backup($gzip = 0)\r
 +      {\r
 +              global $manager, $nucleus;\r
 +\r
 +              // tables of which backup is needed\r
 +              $tables = array(\r
 +                              sql_table('actionlog'),\r
 +                              sql_table('ban'),\r
 +                              sql_table('blog'),\r
 +                              sql_table('comment'),\r
 +                              sql_table('config'),\r
 +                              sql_table('item'),\r
 +                              sql_table('karma'),\r
 +                              sql_table('member'),\r
 +                              sql_table('skin'),\r
 +                              sql_table('skin_desc'),\r
 +                              sql_table('team'),\r
 +                              sql_table('template'),\r
 +                              sql_table('template_desc'),\r
 +                              sql_table('plugin'),\r
 +                              sql_table('plugin_event'),\r
 +                              sql_table('plugin_option'),\r
 +                              sql_table('plugin_option_desc'),\r
 +                              sql_table('category'),\r
 +                              sql_table('activation'),\r
 +                              sql_table('tickets'),\r
 +              );\r
 +\r
 +              // add tables that plugins want to backup to the list\r
 +              // catch all output generated by plugins\r
 +              ob_start();\r
 +              $query = sprintf('SELECT pfile FROM %s', sql_table('plugin'));\r
 +              $res = DB::getResult($query);\r
 +              foreach ( $res as $row )\r
 +              {\r
 +                      $plug =& $manager->getPlugin($row['pfile']);\r
 +                      if ( $plug )\r
 +                      {\r
 +                              $tables = array_merge($tables, (array) $plug->getTableList());\r
 +                      }\r
 +              }\r
 +              ob_end_clean();\r
 +\r
 +              // remove duplicates\r
 +              $tables = array_unique($tables);\r
 +\r
 +              // make sure browsers don't cache the backup\r
 +              header("Pragma: no-cache");\r
 +\r
 +              // don't allow gzip compression when extension is not loaded\r
 +              if ( ($gzip != 0) && !extension_loaded("zlib") )\r
 +              {\r
 +                      $gzip = 0;\r
 +              }\r
 +\r
 +              if ( !$gzip )\r
 +              {\r
 +                      $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql";\r
 +              }\r
 +              else\r
 +              {\r
 +                      // use an output buffer\r
 +                      @ob_start();\r
 +                      @ob_implicit_flush(0);\r
 +\r
 +                      // set filename\r
 +                      $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql.gz";\r
 +              }\r
 +\r
 +              // send headers that tell the browser a file is coming\r
 +              header("Content-Type: text/x-delimtext; name=\"$filename\"");\r
 +              header("Content-disposition: attachment; filename=$filename");\r
 +\r
 +              // dump header\r
 +              echo "/*\n";\r
 +              echo " * This is a backup file generated by Nucleus \n";\r
 +              echo " * http://www.nucleuscms.org/\n";\r
 +              echo " * \n";\r
 +              echo " * backup-date: " . i18n::formatted_datetime('rfc822GMT', time()) . "\n";\r
 +              echo " * Nucleus CMS version: " . $nucleus['version'] . "\n";\r
 +              echo " * \n";\r
 +              echo " * WARNING: Only try to restore on servers running the exact same version of Nucleus\n";\r
 +              echo " */\n";\r
 +\r
 +              // dump all tables\r
 +              reset($tables);\r
 +              array_walk($tables, array(__CLASS__, 'dump_table'));\r
 +\r
 +              if ( $gzip )\r
 +              {\r
 +                      $Size = ob_get_length();\r
 +                      $Crc = crc32(ob_get_contents());\r
 +                      $contents = gzcompress(ob_get_contents());\r
 +                      ob_end_clean();\r
 +                      echo "\x1f\x8b\x08\x00\x00\x00\x00\x00" . substr($contents, 0, strlen($contents) - 4)\r
 +                      . self::gzip_print_four_characters($Crc) . self::gzip_print_four_characters($Size);\r
 +              }\r
 +              exit;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::dump_table()\r
 +       * Creates a dump for a single table\r
 +       * ($tablename and $key are filled in by array_walk)\r
 +       *\r
 +       * @static\r
 +       * @param       string  $tablename\r
 +       * @param       string  $key\r
 +       */\r
 +      static private function dump_table($tablename, $key)\r
 +      {\r
 +              echo "/*\n";\r
 +              echo " * TABLE: " . $tablename . "\n";\r
 +              echo " */\n";\r
 +\r
 +              // dump table structure\r
 +              self::dump_structure($tablename);\r
 +\r
 +              // dump table contents\r
 +              self::dump_contents($tablename);\r
 +              return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::dump_structure()\r
 +       * Creates a dump of the table structure for one table\r
 +       *\r
 +       * @static\r
 +       * @param       string  $tablename\r
 +       * @return      void\r
 +       *\r
 +       */\r
 +      static private function dump_structure($tablename)\r
 +      {\r
 +              // add command to drop table on restore\r
 +              echo "DROP TABLE IF EXISTS {$tablename};\n\n";\r
 +              $result = DB::getRow("SHOW CREATE TABLE {$tablename}");\r
 +              echo $result['Create Table'];\r
 +              echo ";\n\n";\r
 +              return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::get_field_names()\r
 +       * Returns the field named for the given table in the\r
 +       * following format:\r
 +       * (column1, column2, ..., columnn)\r
 +       *\r
 +       * @static\r
 +       * @param       resource        $result\r
 +       * @param       integer $num_fields\r
 +       * @return      string\r
 +       */\r
 +      static private function get_field_names($result, $num_fields)\r
 +      {\r
 +              $fields = array();\r
 +              for ( $j = 0; $j < $num_fields; $j++ )\r
 +              {\r
 +                      $col = $result->getColumnMeta($j);\r
 +                      $fields[] = $col['name'];\r
 +              }\r
 +\r
 +              return '(' . implode(', ', $fields) . ')';\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::dump_contents()\r
 +       * Creates a dump of the table content for one table\r
 +       *\r
 +       * @static\r
 +       * @param       string  $tablename\r
 +       * @return      void\r
 +       *\r
 +       */\r
 +      static private function dump_contents($tablename)\r
 +      {\r
 +              /*\r
 +               * Grab the data from the table.\r
 +              */\r
 +              $result = DB::getResult("SELECT * FROM $tablename");\r
 +\r
 +              if ( $result->rowCount() > 0 )\r
 +              {\r
 +                      echo "\n";\r
 +                      echo "/*\n";\r
 +                      echo " * Table Data for {$tablename}\n";\r
 +                      echo " */\n";\r
 +              }\r
 +\r
 +              $num_fields = $result->columnCount();\r
 +\r
 +              /*\r
 +               * Compose fieldname list\r
 +              */\r
 +              $tablename_list = self::get_field_names($result, $num_fields);\r
 +\r
 +              /*\r
 +               * Loop through the resulting rows and build the sql statement.\r
 +              */\r
 +              foreach ( $result as $row )\r
 +              {\r
 +                      // Start building the SQL statement.\r
 +                      echo 'INSERT INTO ' . $tablename . ' ' . $tablename_list . ' VALUES(';\r
 +\r
 +                      // Loop through the rows and fill in data for each column\r
 +                      for ( $j = 0; $j < $num_fields; $j++ )\r
 +                      {\r
 +                              if ( !isset($row[$j]) )\r
 +                              {\r
 +                                      // no data for column\r
 +                                      echo ' NULL';\r
 +                              }\r
 +                              elseif ( $row[$j] != '' )\r
 +                              {\r
 +                                      // data\r
 +                                      echo ' ' . DB::quoteValue($row[$j]);\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      // empty column (!= no data!)\r
 +                                      echo "''";\r
 +                              }\r
 +\r
 +                              // only add comma when not last column\r
 +                              if ( $j != ($num_fields - 1) )\r
 +                              {\r
 +                                      echo ',';\r
 +                              }\r
 +                      }\r
 +                      echo ");\n";\r
 +              }\r
 +              echo "\n";\r
 +              return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::gzip_print_four_characters()\r
 +       *\r
 +       * @static\r
 +       * @param       integer $val\r
 +       * @return      integer\r
 +       */\r
 +      static private function gzip_print_four_characters($Val)\r
 +      {\r
 +              for ( $i = 0; $i < 4; $i ++ )\r
 +              {\r
 +                      $return .= chr($Val % 256);\r
 +                      $Val = floor($Val / 256);\r
 +              }\r
 +              return $return;\r
 +      }\r
 +\r
 +      /**\r
 +       * Backup::do_restore()\r
 +       * Restores a database backup\r
 +       *\r
 +       * NOTE: this remains not-static for compatibility\r
 +       *\r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      public function do_restore()\r
 +      {\r
 +              $uploadInfo = postFileInfo('backup_file');\r
 +\r
 +              // first of all: get uploaded file:\r
 +              if ( array_key_exists('name', $uploadInfo) && empty($uploadInfo['name']) )\r
 +              {\r
 +                      return 'No file uploaded';\r
 +              }\r
 +              if ( !is_uploaded_file($uploadInfo['tmp_name']) )\r
 +              {\r
 +                      return 'No file uploaded';\r
 +              }\r
 +\r
 +              $backup_file_name = $uploadInfo['name'];\r
 +              $backup_file_tmpname = $uploadInfo['tmp_name'];\r
 +              $backup_file_type = $uploadInfo['type'];\r
 +\r
 +              if ( !file_exists($backup_file_tmpname) )\r
 +              {\r
 +                      return 'File Upload Error';\r
 +              }\r
 +\r
 +              if ( !preg_match("#^(text/[a-zA-Z]+)|(application/(x\-)?gzip(\-compressed)?)|(application/octet-stream)$#i", $backup_file_type) )\r
 +              {\r
 +                      return 'The uploaded file is not of the correct type';\r
 +              }\r
 +\r
 +              $gzip = 0;\r
 +              if ( preg_match("#\.gz#i", $backup_file_name) )\r
 +              {\r
 +                      $gzip = 1;\r
 +              }\r
 +\r
 +              if ( !extension_loaded("zlib") && $gzip )\r
 +              {\r
 +                      return 'Cannot decompress gzipped backup (zlib package not installed)';\r
 +              }\r
 +\r
 +              // get sql query according to gzip setting (either decompress, or not)\r
 +              $contents = self::get_contents($backup_file_tmpname, $gzip);\r
 +              if ( $contents == '' )\r
 +              {\r
 +                      return 'Cannot get contents from this file.';\r
 +              }\r
 +\r
 +              /* detect lines */\r
 +              $lines = preg_split('/[\r\n]/', $contents);\r
 +              if( $lines === $contents )\r
 +              {\r
 +                      return 'Cannot parse contents from this file';\r
 +              }\r
 +\r
 +              /* get sql statements from each lines */\r
 +              $queries = self::get_queries($lines);\r
 +              if ( $queries === array() )\r
 +              {\r
 +                      return "Cannot get SQL queries from this file.";\r
 +              }\r
 +\r
 +              /* execute sql statements */\r
 +              foreach ( $queries as $query )\r
 +              {\r
 +                      if ( DB::execute($query) === FALSE )\r
 +                      {\r
 +                              $error = DB::getError();\r
 +                              debug('SQL Error: ' . $error[2]);\r
 +                              break;\r
 +                      }\r
 +                      continue;\r
 +              }\r
 +              return;\r
 +      }\r
 +\r
 +      static private function get_contents($temporary_name, $gzip = 0)\r
 +      {\r
 +              $contents = '';\r
 +              if ( $gzip )\r
 +              {\r
 +                      // decompress and read\r
 +                      $gz_ptr = gzopen($temporary_name, 'rb');\r
 +                      while ( !gzeof($gz_ptr) )\r
 +                      {\r
 +                              $contents .= gzgets($gz_ptr, 100000);\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      // just read\r
 +                      $fsize = filesize($temporary_name);\r
 +                      if ( $fsize > 0 )\r
 +                      {\r
 +                              $contents = fread(fopen($temporary_name, 'r'), $fsize);\r
 +                      }\r
 +              }\r
 +              return $contents;\r
 +      }\r
 +\r
 +      static private function get_queries($lines)\r
 +      {\r
 +              $query = '';\r
 +              $queries = array();\r
 +              foreach ( $lines as $line )\r
 +              {\r
 +                      $line = trim($line);\r
 +                      if ( !$line || $line[0] == '#' || preg_match('#^[\s|/]?\*#', $line) )\r
 +                      {\r
 +                              continue;\r
 +                      }\r
 +\r
 +                      if ( preg_match('/^(.*);$/', $line, $matches) === 0 )\r
 +                      {\r
 +                              $query .= $line;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $query .= $matches[1];\r
 +                              $queries[] = $query;\r
 +                              $query = '';\r
 +                      }\r
 +                      continue;\r
 +              }\r
 +              return $queries;\r
 +      }\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * Scripts to create/restore a backup of the Nucleus database
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: backup.php 1812 2012-05-01 14:59:07Z sakamocchi $
+  */
+ class Backup
+ {
+       /**
+        * Backup::Backup()
+        * Constructor, just for compatibility
+        *
+        * @deprecated
+        * @param       void
+        * @return      void
+        *
+        */
+       public function Backup()
+       {
+               return;
+       }
+       /**
+        * Backup::do_backup()
+        * This function creates an sql dump of the database and sends it to
+        * the user as a file (can be gzipped if they want)
+        *
+        * NOTE: this remains not-static for compatibility
+        *
+        * @param boolean       $gzip   1 = compress backup file, 0 = no compression (default)
+        * @return      void
+        *
+        */
+       public function do_backup($gzip = 0)
+       {
+               global $manager, $nucleus;
+               // tables of which backup is needed
+               $tables = array(
+                               sql_table('actionlog'),
+                               sql_table('ban'),
+                               sql_table('blog'),
+                               sql_table('comment'),
+                               sql_table('config'),
+                               sql_table('item'),
+                               sql_table('karma'),
+                               sql_table('member'),
+                               sql_table('skin'),
+                               sql_table('skin_desc'),
+                               sql_table('team'),
+                               sql_table('template'),
+                               sql_table('template_desc'),
+                               sql_table('plugin'),
+                               sql_table('plugin_event'),
+                               sql_table('plugin_option'),
+                               sql_table('plugin_option_desc'),
+                               sql_table('category'),
+                               sql_table('activation'),
+                               sql_table('tickets'),
+               );
+               // add tables that plugins want to backup to the list
+               // catch all output generated by plugins
+               ob_start();
+               $query = sprintf('SELECT pfile FROM %s', sql_table('plugin'));
+               $res = DB::getResult($query);
+               foreach ( $res as $row )
+               {
+                       $plug =& $manager->getPlugin($row['pfile']);
+                       if ( $plug )
+                       {
+                               $tables = array_merge($tables, (array) $plug->getTableList());
+                       }
+               }
+               ob_end_clean();
+               // remove duplicates
+               $tables = array_unique($tables);
+               // make sure browsers don't cache the backup
+               header("Pragma: no-cache");
+               // don't allow gzip compression when extension is not loaded
+               if ( ($gzip != 0) && !extension_loaded("zlib") )
+               {
+                       $gzip = 0;
+               }
+               if ( !$gzip )
+               {
+                       $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql";
+               }
+               else
+               {
+                       // use an output buffer
+                       @ob_start();
+                       @ob_implicit_flush(0);
+                               
+                       // set filename
+                       $filename = 'nucleus_db_backup_' . i18n::formatted_datetime('%Y-%m-%d-%H-%M-%S', time()) . ".sql.gz";
+               }
+               // send headers that tell the browser a file is coming
+               header("Content-Type: text/x-delimtext; name=\"$filename\"");
+               header("Content-disposition: attachment; filename=$filename");
+               // dump header
+               echo "/*\n";
+               echo " * This is a backup file generated by Nucleus \n";
+               echo " * http://www.nucleuscms.org/\n";
+               echo " * \n";
+               echo " * backup-date: " . i18n::formatted_datetime('rfc822GMT', time()) . "\n";
+               echo " * Nucleus CMS version: " . $nucleus['version'] . "\n";
+               echo " * \n";
+               echo " * WARNING: Only try to restore on servers running the exact same version of Nucleus\n";
+               echo " */\n";
+               // dump all tables
+               reset($tables);
+               /* NOTE: hope to use 'self' keyword here but works bad so here use __CLASS__ macro. */
+               array_walk($tables, array(__CLASS__, 'dump_table'));
+               if ( $gzip )
+               {
+                       $Size = ob_get_length();
+                       $Crc = crc32(ob_get_contents());
+                       $contents = gzcompress(ob_get_contents());
+                       ob_end_clean();
+                       echo "\x1f\x8b\x08\x00\x00\x00\x00\x00" . substr($contents, 0, strlen($contents) - 4)
+                       . self::gzip_print_four_characters($Crc) . self::gzip_print_four_characters($Size);
+               }
+               exit;
+       }
+       /**
+        * Backup::dump_table()
+        * Creates a dump for a single table
+        * ($tablename and $key are filled in by array_walk)
+        *
+        * @static
+        * @param       string  $tablename
+        * @param       string  $key
+        */
+       static private function dump_table($tablename, $key)
+       {
+               echo "/*\n";
+               echo " * TABLE: " . $tablename . "\n";
+               echo " */\n";
+               // dump table structure
+               self::dump_structure($tablename);
+               // dump table contents
+               self::dump_contents($tablename);
+               return;
+       }
+       /**
+        * Backup::dump_structure()
+        * Creates a dump of the table structure for one table
+        *
+        * @static
+        * @param       string  $tablename
+        * @return      void
+        *
+        */
+       static private function dump_structure($tablename)
+       {
+               // add command to drop table on restore
+               echo "DROP TABLE IF EXISTS {$tablename};\n\n";
+               $result = DB::getRow("SHOW CREATE TABLE {$tablename}");
+               echo $result['Create Table'];
+               echo ";\n\n";
+               return;
+       }
+       /**
+        * Backup::get_field_names()
+        * Returns the field named for the given table in the
+        * following format:
+        * (column1, column2, ..., columnn)
+        *
+        * @static
+        * @param       resource        $result
+        * @param       integer $num_fields
+        * @return      string
+        */
+       static private function get_field_names($result, $num_fields)
+       {
+               $fields = array();
+               for ( $j = 0; $j < $num_fields; $j++ )
+               {
+                       $col = $result->getColumnMeta($j);
+                       $fields[] = $col['name'];
+               }
+               return '(' . implode(', ', $fields) . ')';
+       }
+       /**
+        * Backup::dump_contents()
+        * Creates a dump of the table content for one table
+        *
+        * @static
+        * @param       string  $tablename
+        * @return      void
+        *
+        */
+       static private function dump_contents($tablename)
+       {
+               /*
+                * Grab the data from the table.
+               */
+               $result = DB::getResult("SELECT * FROM $tablename");
+               if ( $result->rowCount() > 0 )
+               {
+                       echo "\n";
+                       echo "/*\n";
+                       echo " * Table Data for {$tablename}\n";
+                       echo " */\n";
+               }
+               $num_fields = $result->columnCount();
+               /*
+                * Compose fieldname list
+               */
+               $tablename_list = self::get_field_names($result, $num_fields);
+               /*
+                * Loop through the resulting rows and build the sql statement.
+               */
+               foreach ( $result as $row )
+               {
+                       // Start building the SQL statement.
+                       echo 'INSERT INTO ' . $tablename . ' ' . $tablename_list . ' VALUES(';
+                               
+                       // Loop through the rows and fill in data for each column
+                       for ( $j = 0; $j < $num_fields; $j++ )
+                       {
+                               if ( !isset($row[$j]) )
+                               {
+                                       // no data for column
+                                       echo ' NULL';
+                               }
+                               elseif ( $row[$j] != '' )
+                               {
+                                       // data
+                                       echo ' ' . DB::quoteValue($row[$j]);
+                               }
+                               else
+                               {
+                                       // empty column (!= no data!)
+                                       echo "''";
+                               }
+                               // only add comma when not last column
+                               if ( $j != ($num_fields - 1) )
+                               {
+                                       echo ',';
+                               }
+                       }
+                       echo ");\n";
+               }
+               echo "\n";
+               return;
+       }
+       /**
+        * Backup::gzip_print_four_characters()
+        *
+        * @static
+        * @param       integer $val
+        * @return      integer
+        */
+       static private function gzip_print_four_characters($Val)
+       {
+               for ( $i = 0; $i < 4; $i ++ )
+               {
+                       $return .= chr($Val % 256);
+                       $Val = floor($Val / 256);
+               }
+               return $return;
+       }
+       /**
+        * Backup::do_restore()
+        * Restores a database backup
+        *
+        * NOTE: this remains not-static for compatibility
+        *
+        * @param       void
+        * @return      void
+        */
+       public function do_restore()
+       {
+               $uploadInfo = postFileInfo('backup_file');
+               // first of all: get uploaded file:
+               if ( array_key_exists('name', $uploadInfo) && empty($uploadInfo['name']) )
+               {
+                       return 'No file uploaded';
+               }
+               if ( !is_uploaded_file($uploadInfo['tmp_name']) )
+               {
+                       return 'No file uploaded';
+               }
+               $backup_file_name = $uploadInfo['name'];
+               $backup_file_tmpname = $uploadInfo['tmp_name'];
+               $backup_file_type = $uploadInfo['type'];
+               if ( !file_exists($backup_file_tmpname) )
+               {
+                       return 'File Upload Error';
+               }
+               if ( !preg_match("#^(text/[a-zA-Z]+)|(application/(x\-)?gzip(\-compressed)?)|(application/octet-stream)$#i", $backup_file_type) )
+               {
+                       return 'The uploaded file is not of the correct type';
+               }
+               $gzip = 0;
+               if ( preg_match("#\.gz#i", $backup_file_name) )
+               {
+                       $gzip = 1;
+               }
+               if ( !extension_loaded("zlib") && $gzip )
+               {
+                       return 'Cannot decompress gzipped backup (zlib package not installed)';
+               }
+               // get sql query according to gzip setting (either decompress, or not)
+               $contents = self::get_contents($backup_file_tmpname, $gzip);
+               if ( $contents == '' )
+               {
+                       return 'Cannot get contents from this file.';
+               }
+               /* detect lines */
+               $lines = preg_split('/[\r\n]/', $contents);
+               if( $lines === $contents )
+               {
+                       return 'Cannot parse contents from this file';
+               }
+               /* get sql statements from each lines */
+               $queries = self::get_queries($lines);
+               if ( $queries === array() )
+               {
+                       return "Cannot get SQL queries from this file.";
+               }
+               /* execute sql statements */
+               foreach ( $queries as $query )
+               {
+                       if ( DB::execute($query) === FALSE )
+                       {
+                               $error = DB::getError();
+                               debug('SQL Error: ' . $error[2]);
+                               break;
+                       }
+                       continue;
+               }
+               return;
+       }
+       static private function get_contents($temporary_name, $gzip = 0)
+       {
+               $contents = '';
+               if ( $gzip )
+               {
+                       // decompress and read
+                       $gz_ptr = gzopen($temporary_name, 'rb');
+                       while ( !gzeof($gz_ptr) )
+                       {
+                               $contents .= gzgets($gz_ptr, 100000);
+                       }
+               }
+               else
+               {
+                       // just read
+                       $fsize = filesize($temporary_name);
+                       if ( $fsize > 0 )
+                       {
+                               $contents = fread(fopen($temporary_name, 'r'), $fsize);
+                       }
+               }
+               return $contents;
+       }
+       static private function get_queries($lines)
+       {
+               $query = '';
+               $queries = array();
+               foreach ( $lines as $line )
+               {
+                       $line = trim($line);
+                       if ( !$line || $line[0] == '#' || preg_match('#^[\s|/]?\*#', $line) )
+                       {
+                               continue;
+                       }
+                       if ( preg_match('/^(.*);$/', $line, $matches) === 0 )
+                       {
+                               $query .= $line;
+                       }
+                       else
+                       {
+                               $query .= $matches[1];
+                               $queries[] = $query;
+                               $query = '';
+                       }
+                       continue;
+               }
+               return $queries;
+       }
++>>>>>>> skinnable-master
  }
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2009 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2009 The Nucleus Group\r
 + * @version $Id: globalfunctions.php 1856 2012-05-18 09:30:16Z sakamocchi $
 + */\r
 +\r
 +/* needed if we include globalfunctions from install.php */\r
 +global $nucleus, $CONF, $DIR_LIBS, $DIR_LOCALES, $manager, $member, $MYSQL_HANDLER, $StartTime;
 +
 +/* just for benchmark tag */
 +$StartTime = microtime(TRUE);
 +\r
 +$nucleus['version'] = 'v4.00 SVN';\r
 +$nucleus['codename'] = '';\r
 +\r
 +/*\r
 + * make sure there's no unnecessary escaping:\r
 + * set_magic_quotes_runtime(0);\r
 + */\r
 +if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
 +{\r
 +      ini_set('magic_quotes_runtime', '0');\r
 +}\r
 +\r
 +/* check and die if someone is trying to override internal globals (when register_globals turn on) */\r
 +checkVars(array('nucleus', 'CONF', 'DIR_LIBS',
 +'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE',
 +'DIR_LOCALES', 'DIR_PLUGINS',
 +'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS',
 +'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS',
 +'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));
 +\r
 +if ( !isset($CONF) )\r
 +{\r
 +      $CONF = array();\r
 +}\r
 +\r
 +/* debug mode */\r
 +if ( array_key_exists('debug', $CONF) && $CONF['debug'] )\r
 +{\r
 +      /* report all errors! */\r
 +      error_reporting(E_ALL);\r
 +}\r
 +else\r
 +{\r
 +      ini_set('display_errors','0');\r
 +      error_reporting(E_ERROR | E_WARNING | E_PARSE);\r
 +}\r
 +\r
 +/*\r
 + * alertOnHeadersSent\r
 + *  Displays an error when visiting a public Nucleus page and headers have\r
 + *  been sent out to early. This usually indicates an error in either a\r
 + *  configuration file or a translation file, and could cause Nucleus to\r
 + *  malfunction\r
 + */\r
 +if ( !array_key_exists('alertOnHeadersSent', $CONF) )\r
 +{\r
 +      $CONF['alertOnHeadersSent'] = 1;\r
 +}\r
 +\r
 +/*\r
 + * alertOnSecurityRisk\r
 + * Displays an error only when visiting the admin area, and when one or\r
 + *  more of the installation files (install.php, install.sql, upgrades/\r
 + *  directory) are still on the server.\r
 + */\r
 +if ( !array_key_exists('alertOnSecurityRisk', $CONF) )\r
 +{\r
 +      $CONF['alertOnSecurityRisk'] = 1;\r
 +}\r
 +\r
 +/*\r
 + * Set these to 1 to allow viewing of future items or draft items\r
 + * Should really never do this, but can be useful for some plugins that might need to\r
 + * Could cause some other issues if you use future posts otr drafts\r
 + * So use with care\r
 + */\r
 +$CONF['allowDrafts'] = 0;\r
 +$CONF['allowFuture'] = 0;\r
 +\r
 +if ( getNucleusPatchLevel() > 0 )\r
 +{\r
 +      $nucleus['version'] .= '/' . getNucleusPatchLevel();\r
 +}\r
 +\r
 +/* Avoid notices */\r
 +if ( !array_key_exists('installscript', $CONF) || empty($CONF['installscript']) )\r
 +{\r
 +      $CONF['installscript'] = 0;\r
 +}\r
 +if ( !array_key_exists('UsingAdminArea', $CONF) )\r
 +{\r
 +      $CONF['UsingAdminArea'] = 0;\r
 +}\r
 +\r
 +if ( !headers_sent() )\r
 +{\r
 +      header('Generator: Nucleus CMS ' . $nucleus['version']);\r
 +}\r
 +\r
 +\r
 +/* TODO: This is for compatibility since 4.0, should be obsoleted at future release. */\r
 +if ( !isset($DIR_LOCALES) )\r
 +{\r
 +      $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';\r
 +}\r
 +global $DIR_LANG;\r
 +if ( !isset($DIR_LANG) )\r
 +{\r
 +      $DIR_LANG = $DIR_LOCALES;\r
 +}\r
 +\r
 +/* load and initialize i18n class */\r
 +if (!class_exists('i18n', FALSE))\r
 +{\r
 +      include($DIR_LIBS . 'i18n.php');\r
 +}\r
 +if ( !i18n::init('UTF-8', $DIR_LOCALES) )\r
 +{\r
 +      exit('Fail to initialize i18n class.');\r
 +}\r
 +\r
 +/* TODO: This is just for compatibility since 4.0, should be obsoleted at future release. */\r
 +define('_CHARSET', i18n::get_current_charset());\r
 +\r
 +\r
 +/*\r
 + * NOTE: Since 4.0 release, Entity class becomes to be important class\r
 + *  with some wrapper functions for htmlspechalchars/htmlentity PHP's built-in function\r
 + */\r
 +include($DIR_LIBS . 'ENTITY.php');\r
 +\r
 +/* we will use postVar, getVar, ... methods instead of $_GET, $_POST ... */\r
 +if ( $CONF['installscript'] != 1 )\r
 +{\r
 +      /* vars were already included in install.php */\r
 +      include_once($DIR_LIBS . 'vars4.1.0.php');\r
 +      \r
 +      /* added for 4.0 DB::* wrapper and compatibility sql_* */\r
 +      include_once($DIR_LIBS . 'sql/sql.php');\r
 +}\r
 +\r
 +/* include core classes that are needed for login & plugin handling */\r
 +include($DIR_LIBS . 'MEMBER.php');\r
 +include($DIR_LIBS . 'ACTIONLOG.php');\r
 +include($DIR_LIBS . 'MANAGER.php');\r
 +include($DIR_LIBS . 'PLUGIN.php');\r
 +\r
 +$manager =& MANAGER::instance();\r
 +\r
 +/* only needed when updating logs */\r
 +if ( $CONF['UsingAdminArea'] )\r
 +{\r
 +      /* XML-RPC client classes */\r
 +      include($DIR_LIBS . 'xmlrpc.inc.php');\r
 +      include($DIR_LIBS . 'ADMIN.php');\r
 +}\r
 +\r
 +\r
 +/* connect to database */\r
 +if ( !isset($MYSQL_HANDLER) )\r
 +{\r
 +      $MYSQL_HANDLER = array('mysql','');\r
 +}\r
 +if ( $MYSQL_HANDLER[0] == '' )\r
 +{\r
 +      $MYSQL_HANDLER[0] = 'mysql';\r
 +}\r
 +DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
 +\r
 +\r
 +/* force locale or charset */\r
 +$locale = '';\r
 +$charset = i18n::get_current_charset();\r
 +\r
 +$data = array(\r
 +      'locale'        => &$locale,\r
 +      'charset'       => &$charset\r
 +);\r
 +$manager->notify('ForceLocale', $data);\r
 +\r
 +if ( $data['locale'] !== '' )\r
 +{\r
 +      i18n::set_forced_locale($data['locale']);\r
 +}\r
 +if ( $data['charset'] !== '' )\r
 +{\r
 +      i18n::set_forced_charset($data['charset']);\r
 +}\r
 +unset($locale);\r
 +unset($charset);\r
 +\r
 +\r
 +/* convert forced charset to current charset */\r
 +if ( i18n::get_forced_charset() != i18n::get_current_charset() )\r
 +{\r
 +      $_POST          = i18n::convert_array($_POST, i18n::get_forced_charset());\r
 +      $_GET           = i18n::convert_array($_GET, i18n::get_forced_charset());\r
 +      $_REQUEST       = i18n::convert_array($_REQUEST, i18n::get_forced_charset());\r
 +      $_COOKIE        = i18n::convert_array($_COOKIE, i18n::get_forced_charset());\r
 +      $_FILES         = i18n::convert_array($_FILES, i18n::get_forced_charset());\r
 +      \r
 +      if ( session_id() !== '' )\r
 +      {\r
 +              $_SESSION = i18n::convert_array($_SESSION, i18n::get_forced_charset());\r
 +      }\r
 +}\r
 +\r
 +\r
 +/* sanitize option */\r
 +$bLoggingSanitizedResult = 0;\r
 +$bSanitizeAndContinue = 0;\r
 +$orgRequestURI = serverVar('REQUEST_URI');\r
 +sanitizeParams();\r
 +\r
 +/* logs sanitized result if need */\r
 +if ( $orgRequestURI !== serverVar('REQUEST_URI') )\r
 +{\r
 +      $msg = "Sanitized [" . serverVar('REMOTE_ADDR') . "] ";\r
 +      $msg .= $orgRequestURI . " -> " . serverVar('REQUEST_URI');\r
 +      if ( $bLoggingSanitizedResult )\r
 +      {\r
 +              addToLog(WARNING, $msg);\r
 +      }\r
 +      if ( !$bSanitizeAndContinue )\r
 +      {\r
 +              die("");\r
 +      }\r
 +}\r
 +\r
 +/* get all variables that can come from the request and put them in the global scope */\r
 +$blogid               = requestVar('blogid');\r
 +$itemid               = intRequestVar('itemid');\r
 +$catid                = intRequestVar('catid');\r
 +$skinid               = requestVar('skinid');\r
 +$memberid     = requestVar('memberid');\r
 +$archivelist = requestVar('archivelist');\r
 +$imagepopup   = requestVar('imagepopup');\r
 +$archive      = requestVar('archive');\r
 +$query                = requestVar('query');\r
 +$highlight    = requestVar('highlight');\r
 +$amount               = requestVar('amount');\r
 +$action               = requestVar('action');\r
 +$nextaction   = requestVar('nextaction');\r
 +$maxresults   = requestVar('maxresults');\r
 +$startpos     = intRequestVar('startpos');\r
 +$errormessage = '';\r
 +$error                = '';\r
 +$special      = requestVar('special');\r
 +\r
 +\r
 +/* read config */\r
 +getConfig();\r
 +\r
 +\r
 +/* Properly set $CONF['Self'] and others if it's not set...\r
 + * usually when we are access from admin menu\r
 + */\r
 +if ( !array_key_exists('Self', $CONF) )\r
 +{\r
 +      $CONF['Self'] = $CONF['IndexURL'];\r
 +      /* strip trailing */\r
 +      if ( $CONF['Self'][i18n::strlen($CONF['Self']) -1] == "/" )\r
 +      {\r
 +              $CONF['Self'] = i18n::substr($CONF['Self'], 0, i18n::strlen($CONF['Self']) -1);\r
 +      }\r
 +}\r
 +\r
 +$CONF['ItemURL']              = $CONF['Self'];\r
 +$CONF['ArchiveURL']           = $CONF['Self'];\r
 +$CONF['ArchiveListURL']       = $CONF['Self'];\r
 +$CONF['MemberURL']            = $CONF['Self'];\r
 +$CONF['SearchURL']            = $CONF['Self'];\r
 +$CONF['BlogURL']              = $CONF['Self'];\r
 +$CONF['CategoryURL']  = $CONF['Self'];\r
 +\r
 +/* automatically use simpler toolbar for mozilla */\r
 +if ( ($CONF['DisableJsTools'] == 0)\r
 +   && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Mozilla/5.0') !== FALSE\r
 +   && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Gecko') !== FALSE )\r
 +{\r
 +      $CONF['DisableJsTools'] = 2;\r
 +}\r
 +\r
 +/* login processing */
 +$member = new Member();\r
 +\r
 +if ( $action == 'login' )\r
 +{\r
 +      $login = postVar('login');\r
 +      $password = postVar('password');\r
 +      $shared = intPostVar('shared');\r
 +      $member->login($login, $password, $shared);\r
 +}\r
 +elseif ( ($action == 'logout') )\r
 +{\r
 +      $member->logout();\r
 +}\r
 +else\r
 +{\r
 +      $member->cookielogin();\r
 +}\r
 +\r
 +\r
 +/* TODO: This is for backward compatibility, should be obsoleted near future. */\r
 +if ( !preg_match('#^(.+)_(.+)_(.+)$#', $CONF['Locale'])\r
 +  && ($CONF['Locale'] = i18n::convert_old_language_file_name_to_locale($CONF['Locale'])) === FALSE )\r
 +{\r
 +      $CONF['Locale'] = 'en_Latn_US';\r
 +}\r
 +if ( !array_key_exists('Language', $CONF) )\r
 +{\r
 +      $CONF['Language'] = i18n::convert_locale_to_old_language_file_name($CONF['Locale']);\r
 +}\r
 +$locale = $CONF['Locale'];\r
 +\r
 +\r
 +/* NOTE: include translation file and set locale */\r
 +if ( $member->isLoggedIn() )\r
 +{\r
 +      if ( $member->getLocale() )\r
 +      {\r
 +              $locale = $member->getLocale();\r
 +      }\r
 +}\r
 +else\r
 +{\r
 +      if ( i18n::get_forced_locale() !== '' )\r
 +      {\r
 +              $locale = i18n::get_forced_locale();\r
 +      }\r
 +}\r
 +include_translation($locale);\r
 +i18n::set_current_locale($locale);\r
 +\r
 +\r
 +/* login completed */\r
 +$manager->notify('PostAuthentication', array('loggedIn' => $member->isLoggedIn() ) );\r
 +\r
 +/* next action */\r
 +if ( $member->isLoggedIn() && $nextaction )\r
 +{\r
 +      $action = $nextaction;\r
 +}\r
 +\r
 +/* first, let's see if the site is disabled or not. always allow admin area access. */\r
 +if ( $CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea'] )\r
 +{\r
 +      redirect($CONF['DisableSiteURL']);\r
 +      exit;\r
 +}\r
 +\r
 +/* load other classes */\r
 +include($DIR_LIBS . 'PARSER.php');\r
 +include($DIR_LIBS . 'SKIN.php');\r
 +include($DIR_LIBS . 'TEMPLATE.php');\r
 +include($DIR_LIBS . 'BLOG.php');\r
 +include($DIR_LIBS . 'BODYACTIONS.php');\r
 +include($DIR_LIBS . 'COMMENTS.php');\r
 +include($DIR_LIBS . 'COMMENT.php');\r
 +include($DIR_LIBS . 'NOTIFICATION.php');\r
 +include($DIR_LIBS . 'BAN.php');\r
 +include($DIR_LIBS . 'PAGEFACTORY.php');\r
 +include($DIR_LIBS . 'SEARCH.php');\r
 +include($DIR_LIBS . 'LINK.php');\r
 +\r
 +/* set lastVisit cookie (if allowed) */\r
 +if ( !headers_sent() )\r
 +{\r
 +      if ( $CONF['LastVisit'] )\r
 +      {\r
 +              setcookie($CONF['CookiePrefix'] . 'lastVisit', time(), time() + 2592000, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +      }\r
 +      else\r
 +      {\r
 +              setcookie($CONF['CookiePrefix'] . 'lastVisit', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);\r
 +      }\r
 +}\r
 +\r
 +if ( !defined('_ARCHIVETYPE_MONTH') )\r
 +{\r
 +      define('_ARCHIVETYPE_DAY', 'day');\r
 +      define('_ARCHIVETYPE_MONTH', 'month');\r
 +      define('_ARCHIVETYPE_YEAR', 'year');\r
 +}\r
 +\r
 +/* for path resolving */
 +$virtualpath = getVar('virtualpath');
 +if ( getVar('virtualpath') == '' )
 +                                      {\r
 +      $virtualpath = serverVar('PATH_INFO');
 +                                      }\r
 +                              \r
 +/*
 + * switch URLMode back to normal when $CONF['Self'] ends in .php
 + * this avoids urls like index.php/item/13/index.php/item/15
 + */
 +if ( !array_key_exists('URLMode', $CONF) || ($CONF['URLMode'] != 'pathinfo') )
 +                                      {\r
 +      $CONF['URLMode'] = 'normal';
 +                                      }\r
 +else
 +                                      {\r
 +      if ( i18n::substr($CONF['Self'], i18n::strlen($CONF['Self']) - 4) != '.php' )
 +                                      {\r
 +              decodePathInfo($virtualpath);
 +      }\r
 +}\r
 +\r
 +/*\r
 + * PostParseURL is a place to cleanup any of the path-related global variables before the selector function is run.\r
 + * It has 2 values in the data in case the original virtualpath is needed, but most the use will be in tweaking\r
 + * global variables to clean up (scrub out catid or add catid) or to set someother global variable based on\r
 + * the values of something like catid or itemid\r
 + * New in 3.60\r
 + */\r
 +$data = array(\r
 +      'type' => basename(serverVar('SCRIPT_NAME')),\r
 +      'info' => $virtualpath\r
 +);\r
 +$manager->notify('PostParseURL', $data);\r
 +\r
 +/*\r
 + * NOTE: Here is the end of initialization\r
 + */\r
 +\r
 +/**\r
 + * include_libs()\r
 + * This function includes or requires the specified library file\r
 + * \r
 + * @param     string  $file\r
 + * @param     boolean $once use the _once() version\r
 + * @param     boolean $require use require() instead of include()\r
 + * @return    void\r
 + */\r
 +function include_libs($file, $once = TRUE, $require = TRUE)\r
 +{\r
 +      global $DIR_LIBS;\r
 +      \r
 +      // $DIR_LIBS isn't a directory\r
 +      if ( !is_dir($DIR_LIBS) )\r
 +      {\r
 +              exit;\r
 +      }\r
 +      \r
 +      $lib_path = $DIR_LIBS . $file;\r
 +      \r
 +      if ( $once && $require )\r
 +      {\r
 +              require_once($lib_path);\r
 +      }\r
 +      else if ( $once && !$require )\r
 +      {\r
 +              include_once($lib_path);\r
 +      }\r
 +      else if ( $require )\r
 +      {\r
 +              require($lib_path);\r
 +      }\r
 +      else\r
 +      {\r
 +              include($lib_path);\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * include_plugins()\r
 + * This function includes or requires the specified plugin file\r
 + * \r
 + * @param     string  $file\r
 + * @param     boolean $once use the _once() version\r
 + * @param     boolean $require use require() instead of include()\r
 + * @return    \r
 + */\r
 +function include_plugins($file, $once = TRUE, $require = TRUE)\r
 +{\r
 +      global $DIR_PLUGINS;\r
 +      \r
 +      // begin if: $DIR_LIBS isn't a directory\r
 +      if ( !is_dir($DIR_PLUGINS) )\r
 +      {\r
 +              exit;\r
 +      }\r
 +      \r
 +      $plugin_path = $DIR_PLUGINS . $file;\r
 +      \r
 +      // begin if: \r
 +      if ( $once && $require )\r
 +      {\r
 +              require_once($plugin_path);\r
 +      }\r
 +      else if ( $once && !$require )\r
 +      {\r
 +              include_once($plugin_path);\r
 +      }\r
 +      elseif ( $require )\r
 +      {\r
 +              require($plugin_path);\r
 +      }\r
 +      else\r
 +      {\r
 +              include($plugin_path);\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * include_translation()\r
 + * This function decide which locale is used and include translation\r
 + * \r
 + * @param     string  &$locale        locale name referring to 'language tags' defined in RFC 5646\r
 + * @return    void\r
 + */\r
 +function include_translation(&$locale)\r
 +{\r
 +      global $DIR_LOCALES;\r
 +      \r
 +      $translation_file = $DIR_LOCALES . $locale . '.' . i18n::get_current_charset() . '.php';\r
 +      if ( !file_exists($translation_file) )\r
 +      {\r
 +              $locale = 'en_Latn_US';\r
 +              $translation_file = $DIR_LOCALES . 'en_Latn_US.ISO-8859-1.php';\r
 +      }\r
 +      include($translation_file);\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * intPostVar()\r
 + * This function returns the integer value of $_POST for the variable $name\r
 + * \r
 + * @param     string  $name   field to get the integer value of\r
 + * @return    integer\r
 + */\r
 +function intPostVar($name)\r
 +{\r
 +      return (integer) postVar($name);\r
 +}\r
 +\r
 +\r
 +/**\r
 + * intGetVar()\r
 + * This function returns the integer value of $_GET for the variable $name\r
 + * \r
 + * @param     string  $name   field to get the integer value of\r
 + * @return    integer\r
 + */\r
 +function intGetVar($name)\r
 +{\r
 +      return (integer) getVar($name);\r
 +}\r
 +\r
 +\r
 +/**\r
 + * intRequestVar()\r
 + * This function returns the integer value of $_REQUEST for the variable $name. Also checks $_GET and $_POST if not found in $_REQUEST\r
 + * \r
 + * @param string $name field to get the integer value of\r
 + * @return int\r
 + */\r
 +function intRequestVar($name)\r
 +{\r
 +      return (integer) requestVar($name);\r
 +}\r
 +\r
 +\r
 +/**\r
 + * intCookieVar()\r
 + * This function returns the integer value of $_COOKIE for the variable $name\r
 + * \r
 + * @param     string  $name   field to get the integer value of\r
 + * @return    integer\r
 + */\r
 +function intCookieVar($name)\r
 +{\r
 +      return (integer) cookieVar($name);\r
 +}\r
 +\r
 +/**\r
 + * getNucleusVersion()\r
 + * This function returns the current Nucleus version (100 = 1.00, 101 = 1.01, etc...)\r
 + * \r
 + * @param     void\r
 + * @return    integer\r
 + */\r
 +function getNucleusVersion()\r
 +{\r
 +      return 400;\r
 +}\r
 +\r
 +/**\r
 + * getNucleusPatchLevel()\r
 + * TODO: Better description of this function.\r
 + *\r
 + * Power users can install patches in between nucleus releases. These patches\r
 + * usually add new functionality in the plugin API and allow those to\r
 + * be tested without having to install CVS.\r
 + *\r
 + *@param      void\r
 + * @return    integer\r
 + */\r
 +function getNucleusPatchLevel()\r
 +{\r
 +      return 0;\r
 +}\r
 +\r
 +/**\r
 + * getLatestVersion()\r
 + * This function returns the latest Nucleus version available for download from nucleuscms.org or FALSE if unable to attain data\r
 + * Format will be major.minor/patachlevel e.g. 3.41 or 3.41/02\r
 + * \r
 + * @param     void\r
 + * @return    mixed\r
 + */\r
 +function getLatestVersion()\r
 +{\r
 +      // begin if: cURL is not available in this PHP installation\r
 +      if ( !function_exists('curl_init') )\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +      \r
 +      $curl = curl_init();\r
 +      $timeout = 5;\r
 +      \r
 +      curl_setopt ($curl, CURLOPT_URL, 'http://nucleuscms.org/version_check.php');\r
 +      curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);\r
 +      curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);\r
 +      \r
 +      $return = curl_exec($curl);\r
 +      \r
 +      curl_close($curl);\r
 +      \r
 +      return $return;\r
 +}\r
 +\r
 +/**\r
 + * sql_table()\r
 + * This function returns a Nucleus table name with the appropriate prefix\r
 + * @param string $name\r
 + * @return string\r
 + */\r
 +function sql_table($name)\r
 +{\r
 +      global $MYSQL_PREFIX;\r
 +      \r
 +      // begin if: no MySQL prefix\r
 +      if ( empty($MYSQL_PREFIX) )\r
 +      {\r
 +              return 'nucleus_' . $name;\r
 +      }\r
 +      // else: use MySQL prefix\r
 +      else\r
 +      {\r
 +              return $MYSQL_PREFIX . 'nucleus_' . $name;\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * sendContentType()\r
 + * This function sends the Content-Type header if headers have not already been sent\r
 + * It also determines if the browser can accept application/xhtml+xml and sends it only to those that can.\r
 + * \r
 + * if content type is application/xhtml+xml, only send it to browsers\r
 + * that can handle it (IE6 cannot). Otherwise, send text/html\r
 + *\r
 + * v2.5:\r
 + * For admin area pages, keep sending text/html (unless it's a debug version)\r
 + * application/xhtml+xml still causes too much problems with the javascript implementations\r
 + *\r
 + * v3.3:\r
 + * ($CONF['UsingAdminArea'] && !$CONF['debug']) gets removed,\r
 + * application/xhtml+xml seems to be working, so we're going to use it if we can.\r
 + * \r
 + * @param     string  $content_type   MIME media type registered to IANA, http://www.iana.org/assignments/media-types/index.html\r
 + * @param     string  $page_type              \r
 + * @param     string  $charset                Deprecated. This has no meaning.\r
 + * @return    void\r
 + * \r
 + */\r
 +function sendContentType($content_type, $page_type = '', $charset = '')\r
 +{\r
 +      global $manager, $CONF;\r
 +      \r
 +      if ( headers_sent() )\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      /* NOTE: MIME Media Type */\r
 +      if ( ($content_type == 'application/xhtml+xml')\r
 +              && (!stristr(serverVar('HTTP_ACCEPT'), 'application/xhtml+xml') ) )\r
 +      {\r
 +              $content_type = 'text/html';\r
 +      }\r
 +      \r
 +      /* NOTE: generate event */\r
 +      $data = array(\r
 +              'pageType'              =>  $page_type,\r
 +              'contentType'   => &$content_type\r
 +      );\r
 +      $manager->notify('PreSendContentType', $data);\r
 +      \r
 +      /* NOTE: confirm MIME Media Type */\r
 +      $content_type = preg_replace('#[^a-zA-Z0-9-+./]#', '', $content_type);\r
 +      \r
 +      /* NOTE: confirm character set */\r
 +      $charset = i18n::get_current_charset();\r
 +      if ( i18n::get_forced_charset() !== '' )\r
 +      {\r
 +              $charset = i18n::get_forced_charset();\r
 +      }\r
 +      \r
 +      /* NOTE: send HTTP 1.1 header */\r
 +      header("Content-Type: {$content_type}; charset={$charset}");\r
 +      \r
 +      /* NOTE: set handler for translating character set */\r
 +      if ( $charset != i18n::get_current_charset() )\r
 +      {\r
 +              ob_start(array('i18n', 'convert_handler'));\r
 +      }\r
 +      \r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * parseHighlight()\r
 + * This function parses a query into an array of expressions that can be passed on to the highlight method\r
 + * @param     string  $query\r
 + * @return    void\r
 + */\r
 +function parseHighlight($query)\r
 +{\r
 +      // TODO: add more intelligent splitting logic\r
 +      \r
 +      // get rid of quotes\r
 +      $query = preg_replace('/\'|"/', '', $query);\r
 +      \r
 +      if ( !$query )\r
 +      {\r
 +              return array();\r
 +      }\r
 +      \r
 +      $aHighlight = preg_split('# #', $query);\r
 +      \r
 +      for ( $i = 0; $i < count($aHighlight); $i++ )\r
 +      {\r
 +              $aHighlight[$i] = trim($aHighlight[$i]);\r
 +              \r
 +              if ( i18n::strlen($aHighlight[$i]) < 3 )\r
 +              {\r
 +                      unset($aHighlight[$i]);\r
 +              }\r
 +      }\r
 +      \r
 +      if ( count($aHighlight) == 1 )\r
 +      {\r
 +              return $aHighlight[0];\r
 +      }\r
 +      else\r
 +      {\r
 +              return $aHighlight;\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * getConfig()\r
 + * \r
 + * @param     void\r
 + * @return    void\r
 + */\r
 +function getConfig()\r
 +{\r
 +      global $CONF;\r
 +      \r
 +      $query = sprintf('SELECT * FROM %s', sql_table('config'));\r
 +      $res = DB::getResult($query);\r
 +      \r
 +      foreach ( $res as $row )\r
 +      {\r
 +              $CONF[$row['name']] = $row['value'];\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * This function gets the blog ID from the blog name\r
 + * @param string $name\r
 + * @return\r
 + */\r
 +function getBlogIDFromName($name)\r
 +{\r
 +      $query = sprintf('SELECT bnumber AS result FROM %s WHERE bshortname=%s', sql_table('blog'), DB::quoteValue($name));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +/**\r
 + * This function gets the blog name from the blog ID\r
 + * @param int $id\r
 + * @return object\r
 + */\r
 +function getBlogNameFromID($id)\r
 +{\r
 +      $query = sprintf('SELECT bname AS result FROM %s WHERE bnumber=%d', sql_table('blog'), intval($id));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +/**\r
 + * This function gets the blog ID from the item ID\r
 + * @param int $item_id\r
 + * @return object\r
 + */\r
 +function getBlogIDFromItemID($item_id)\r
 +{\r
 +      $query = sprintf('SELECT iblog AS result FROM %s WHERE inumber=%d', sql_table('item'), intval($item_id));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +/**\r
 + * This function gets the blog ID from the comment ID\r
 + * @param int $comment_id\r
 + * @return object\r
 + */\r
 +function getBlogIDFromCommentID($comment_id)\r
 +{\r
 +      $query = sprintf('SELECT cblog AS result FROM %s WHERE cnumber=%d', sql_table('comment'), intval($comment_id));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +/**\r
 + * This function gets the blog ID from the category ID\r
 + * @param int $category_id\r
 + * @return object\r
 + */\r
 +function getBlogIDFromCatID($category_id)\r
 +{\r
 +      $query = sprintf('SELECT cblog AS result FROM %s WHERE catid=%d', sql_table('category'), intval($category_id));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +/**\r
 + * This function gets the category ID from the category name\r
 + * @param int $name\r
 + * @return object\r
 + */\r
 +function getCatIDFromName($name)\r
 +{\r
 +      $query = sprintf('SELECT catid AS result FROM %s WHERE cname=%s', sql_table('category'), DB::quoteValue($name));\r
 +      return DB::getValue($query);\r
 +}\r
 +\r
 +\r
 +/**\r
 + * functions to be used in index.php to select something\r
 + */\r
 +function selectBlog($shortname)\r
 +{\r
 +      global $blogid, $archivelist;\r
 +      $blogid = getBlogIDFromName($shortname);\r
 +      \r
 +      // also force archivelist variable, if it is set\r
 +      if ( $archivelist )\r
 +      {\r
 +              $archivelist = $blogid;\r
 +      }\r
 +      return;\r
 +}\r
 +function selectSkin($skinname)\r
 +{\r
 +      global $skinid;\r
 +      $skinid = SKIN::getIdFromName($skinname);\r
 +      return;\r
 +}\r
 +function selectCategory($cat)\r
 +{\r
 +      global $catid;\r
 +      if ( is_numeric($cat) )\r
 +      {\r
 +              $catid = (integer) $cat;\r
 +      }\r
 +      else\r
 +      {\r
 +              $catid = getCatIDFromName($cat);\r
 +      }\r
 +      return;\r
 +}\r
 +function selectItem($id)\r
 +{\r
 +      global $itemid;\r
 +      $itemid = (integer) $id;\r
 +      return;\r
 +}\r
 +function selectSpecialSkinType($id)\r
 +{\r
 +      global $special;\r
 +      $special = strtolower($id);\r
 +      return;\r
 +}\r
 +function selector()\r
 +{\r
 +      global $archive, $archivelist, $archivenext, $archivenextexists, $archiveprev, $archiveprevexists, $archivetype;\r
 +      global $blog, $blogid;\r
 +      global $catid;\r
 +      global $itemid, $itemidnext, $itemidprev, $itemtitlenext, $itemtitleprev;\r
 +      global $CONF, $DIR_LIBS, $amount, $errormessage, $imagepopup;\r
 +      global $manager, $maxresults, $query;\r
 +      global $member, $memberid, $memberinfo;\r
 +      global $skinid, $skinpart, $special;\r
 +      \r
 +      $actionNames = array('addcomment', 'sendmessage', 'createaccount', 'forgotpassword', 'votepositive', 'votenegative', 'plugin');\r
 +      $action = requestVar('action');\r
 +      \r
 +      if ( in_array($action, $actionNames) )\r
 +      {\r
 +              include_once($DIR_LIBS . 'ACTION.php');\r
 +              $a = new Action();\r
 +              $errorInfo = $a->doAction($action);\r
 +              \r
 +              if ( $errorInfo )\r
 +              {\r
 +                      $errormessage = $errorInfo['message'];\r
 +              }\r
 +      }\r
 +      \r
 +      // show error when headers already sent out\r
 +      if ( headers_sent() && $CONF['alertOnHeadersSent'] )\r
 +      {\r
 +              // try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)\r
 +              if ( function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=') )\r
 +              {\r
 +                      headers_sent($hsFile, $hsLine);\r
 +                      $extraInfo = ' in <code>' . $hsFile . '</code> line <code>' . $hsLine . '</code>';\r
 +              }\r
 +              else\r
 +              {\r
 +                      $extraInfo = '';\r
 +              }\r
 +              \r
 +              startUpError(\r
 +                 "<p>The page headers have already been sent out{$extraInfo}. This could cause Nucleus not to work in the expected way.</p>"\r
 +               . "<p>Usually, this is caused by spaces or newlines at the end of the <code>config.php</code> file, "\r
 +               . "at the end of the translation file or at the end of a plugin file.</p>"\r
 +               . "<p>Please check this and try again.</p>"\r
 +               . "<p>If you don't want to see this error message again, without solving the problem, "\r
 +               . "set <code>{$CONF['alertOnHeadersSent']}</code> in <code>globalfunctions.php</code> to <code>0</code></p>"\r
 +               . "Page headers already sent"\r
 +              );\r
 +              exit;\r
 +      }\r
 +      \r
 +      // make is so ?archivelist without blogname or blogid shows the archivelist\r
 +      // for the default weblog\r
 +      if ( serverVar('QUERY_STRING') == 'archivelist' )\r
 +      {\r
 +              $archivelist = $CONF['DefaultBlog'];\r
 +      }\r
 +      \r
 +      // now decide which type of skin we need\r
 +      if ( $itemid )\r
 +      {\r
 +              // itemid given -> only show that item\r
 +              $type = 'item';\r
 +              \r
 +              if ( !$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts'])) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHITEM);\r
 +              }\r
 +              \r
 +              // 1. get timestamp, blogid and catid for item\r
 +              $query = 'SELECT itime, iblog, icat FROM %s WHERE inumber=%d';\r
 +              $query = sprintf($query, sql_table('item'), intval($itemid));\r
 +              $row = DB::getRow($query);\r
 +              \r
 +              // if a different blog id has been set through the request or selectBlog(),\r
 +              // deny access\r
 +              \r
 +              if ( $blogid && (intval($blogid) != $row['iblog']) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHITEM);\r
 +              }\r
 +              \r
 +              // if a category has been selected which doesn't match the item, ignore the\r
 +              // category. #85\r
 +              if ( ($catid != 0) && ($catid != $row['icat']) )\r
 +              {\r
 +                      $catid = 0;\r
 +              }\r
 +              \r
 +              $blogid = $row['iblog'];\r
 +              $timestamp = strtotime($row['itime']);\r
 +              \r
 +              $b =& $manager->getBlog($blogid);\r
 +              \r
 +              if ( !$b->isValidCategory($catid) )\r
 +              {\r
 +                      $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d ORDER BY itime DESC LIMIT 1";\r
 +                      $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid));\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime DESC LIMIT 1";\r
 +                      $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid), intval($catid));\r
 +              }\r
 +              $row = DB::getRow($query);\r
 +              \r
 +              if ( $row )\r
 +              {\r
 +                      $itemidprev = $row['inumber'];\r
 +                      $itemtitleprev = $row['ititle'];\r
 +              }\r
 +              \r
 +              // get next itemid and title\r
 +              if ( !$b->isValidCategory($catid) )\r
 +              {\r
 +                      $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d ORDER BY itime ASC LIMIT 1";\r
 +                      $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid));\r
 +              }\r
 +              else\r
 +              {\r
 +                      $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime ASC LIMIT 1";\r
 +                      $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid), intval($catid));\r
 +              }\r
 +              $row = DB::getRow($query);\r
 +              \r
 +              if ( $row )\r
 +              {\r
 +                      $itemidnext = $row['inumber'];\r
 +                      $itemtitlenext = $row['ititle'];\r
 +              }\r
 +      }\r
 +      elseif ( $archive )\r
 +      {\r
 +              // show archive\r
 +              $type = 'archive';\r
 +              \r
 +              // sql queries for the timestamp of the first and the last published item\r
 +              $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime ASC', sql_table('item'));\r
 +              $first_timestamp = DB::getValue($query);\r
 +              $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime DESC', sql_table('item'));\r
 +              $last_timestamp = DB::getValue($query);\r
 +              \r
 +              sscanf($archive, '%d-%d-%d', $y, $m, $d);\r
 +              \r
 +              if ( $d != 0 )\r
 +              {\r
 +                      $archivetype = _ARCHIVETYPE_DAY;\r
 +                      $t = mktime(0, 0, 0, $m, $d, $y);\r
 +                      // one day has 24 * 60 * 60 = 86400 seconds\r
 +                      $archiveprev = i18n::formatted_datetime('%Y-%m-%d', $t - 86400 );\r
 +                      // check for published items\r
 +                      if ( $t > $first_timestamp )\r
 +                      {\r
 +                              $archiveprevexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archiveprevexists = false;\r
 +                      }\r
 +                      \r
 +                      // one day later\r
 +                      $t += 86400;\r
 +                      $archivenext = i18n::formatted_datetime('%Y-%m-%d', $t);\r
 +                      if ( $t < $last_timestamp )\r
 +                      {\r
 +                              $archivenextexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archivenextexists = false;\r
 +                      }\r
 +              }\r
 +              elseif ( $m == 0 )\r
 +              {\r
 +                      $archivetype = _ARCHIVETYPE_YEAR;\r
 +                      $t = mktime(0, 0, 0, 12, 31, $y - 1);\r
 +                      // one day before is in the previous year\r
 +                      $archiveprev = i18n::formatted_datetime('%Y', $t);\r
 +                      if ( $t > $first_timestamp )\r
 +                      {\r
 +                              $archiveprevexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archiveprevexists = false;\r
 +                      }\r
 +\r
 +                      // timestamp for the next year\r
 +                      $t = mktime(0, 0, 0, 1, 1, $y + 1);\r
 +                      $archivenext = i18n::formatted_datetime('%Y', $t);\r
 +                      if ( $t < $last_timestamp )\r
 +                      {\r
 +                              $archivenextexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archivenextexists = false;\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      $archivetype = _ARCHIVETYPE_MONTH;\r
 +                      $t = mktime(0, 0, 0, $m, 1, $y);\r
 +                      // one day before is in the previous month\r
 +                      $archiveprev = i18n::formatted_datetime('%Y-%m', $t - 86400);\r
 +                      if ( $t > $first_timestamp )\r
 +                      {\r
 +                              $archiveprevexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archiveprevexists = false;\r
 +                      }\r
 +                      \r
 +                      // timestamp for the next month\r
 +                      $t = mktime(0, 0, 0, $m+1, 1, $y);\r
 +                      $archivenext = i18n::formatted_datetime('%Y-%m', $t);\r
 +                      if ( $t < $last_timestamp )\r
 +                      {\r
 +                              $archivenextexists = true;\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $archivenextexists = false;\r
 +                      }\r
 +              }\r
 +      }\r
 +      elseif ( $archivelist )\r
 +      {\r
 +              $type = 'archivelist';\r
 +              \r
 +              if ( is_numeric($archivelist) )\r
 +              {\r
 +                      $blogid = intVal($archivelist);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $blogid = getBlogIDFromName($archivelist);\r
 +              }\r
 +      \r
 +              if ( !$blogid )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHBLOG);\r
 +              }\r
 +      }\r
 +      elseif ( $query )\r
 +      {\r
 +              global $startpos;\r
 +              $type = 'search';\r
 +              $query = stripslashes($query);\r
 +              \r
 +              if ( is_numeric($blogid) )\r
 +              {\r
 +                      $blogid = intVal($blogid);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $blogid = getBlogIDFromName($blogid);\r
 +              }\r
 +              \r
 +              if ( !$blogid )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHBLOG);\r
 +              }\r
 +      }\r
 +      elseif ( $memberid )\r
 +      {\r
 +              $type = 'member';\r
 +              \r
 +              if ( !Member::existsID($memberid) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHMEMBER);\r
 +              }\r
 +              $memberinfo = $manager->getMember($memberid);\r
 +      }\r
 +      elseif ( $imagepopup )\r
 +      {\r
 +              // media object (images etc.)\r
 +              $type = 'imagepopup';\r
 +              \r
 +              // TODO: check if media-object exists\r
 +              // TODO: set some vars?\r
 +      }\r
 +      else\r
 +      {\r
 +              // show regular index page\r
 +              global $startpos;\r
 +              $type = 'index';\r
 +      }\r
 +      \r
 +      // any type of skin with catid\r
 +      if ( $catid && !$blogid )\r
 +      {\r
 +              $blogid = getBlogIDFromCatID($catid);\r
 +      }\r
 +      \r
 +      // decide which blog should be displayed\r
 +      if ( !$blogid )\r
 +      {\r
 +              $blogid = $CONF['DefaultBlog'];\r
 +      }\r
 +      \r
 +      $b =& $manager->getBlog($blogid);\r
 +      $blog = $b; // references can't be placed in global variables?\r
 +      \r
 +      if ( !$blog->isValid )\r
 +      {\r
 +              doError(_ERROR_NOSUCHBLOG);\r
 +      }\r
 +      \r
 +      // set catid if necessary\r
 +      if ( $catid )\r
 +      {\r
 +              // check if the category is valid\r
 +              if ( !$blog->isValidCategory($catid) )\r
 +              {\r
 +                      doError(_ERROR_NOSUCHCATEGORY);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $blog->setSelectedCategory($catid);\r
 +              }\r
 +      }\r
 +      \r
 +      if ( !$skinid )\r
 +      {\r
 +              $skinid = $blog->getDefaultSkin();\r
 +      }\r
 +      \r
 +      if ( !empty($special) && isValidShortName($special) )\r
 +      {\r
 +              $type = strtolower($special);\r
 +      }\r
 +      \r
 +      $skin = new SKIN($skinid);\r
 +      \r
 +      if ( !$skin->isValid() )\r
 +      {\r
 +              doError(_ERROR_NOSUCHSKIN);\r
 +      }\r
 +      \r
 +      // set global skinpart variable so can determine quickly what is being parsed from any plugin or phpinclude\r
 +      $skinpart = $type;\r
 +      \r
 +      // parse the skin\r
 +      $skin->parse($type);\r
 +      \r
 +      // check to see we should throw JustPosted event\r
 +      $blog->checkJustPosted();\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * doError()\r
 + * Show error skin with given message. An optional skin-object to use can be given\r
 + * \r
 + * @param     string  $msg\r
 + * @param     string  $skin\r
 + * @return    void\r
 + */\r
 +function doError($msg, $skin = '')\r
 +{\r
 +      global $errormessage, $CONF, $skinid, $blogid, $manager;\r
 +      \r
 +      if ( $skin == '' )\r
 +      {\r
 +              if ( Skin::existsID($skinid) )\r
 +              {\r
 +                      $id = $skinid;\r
 +              }\r
 +              elseif ( $manager->existsBlogID($blogid) )\r
 +              {\r
 +                      $blog =& $manager->getBlog($blogid);\r
 +                      $id = $blog->getDefaultSkin();\r
 +              }\r
 +              elseif ($CONF['DefaultBlog'] )\r
 +              {\r
 +                      $blog =& $manager->getBlog($CONF['DefaultBlog']);\r
 +                      $id = $blog->getDefaultSkin();\r
 +              }\r
 +              else\r
 +              {\r
 +                      // this statement should actually never be executed\r
 +                      $id = $CONF['BaseSkin'];\r
 +              }\r
 +              $skin = new Skin($id);\r
 +      }\r
 +      \r
 +      $errormessage = $msg;\r
 +      $skin->parse('error');\r
 +      return;
 +}\r
 +\r
 +/**\r
 + * Errors before the database connection has been made\r
 + * \r
 + * @param     string  $msg    message to notify\r
 + * @param     string  $title  page title\r
 + * @return    void\r
 + */\r
 +function startUpError($msg, $title)\r
 +{\r
 +      header('Content-Type: text/xml; charset=' . i18n::get_current_charset());\r
 +      echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";\r
 +      echo "<head>\n";\r
 +      echo "<title>{$title}</title></head>\n";\r
 +      echo "<body>\n";\r
 +      echo "<h1>{$title}</h1>\n";\r
 +      echo $msg;\r
 +      echo "</body>\n";\r
 +      echo "</html>\n";\r
 +      exit;\r
 +}\r
 +\r
 +function isValidShortName($name)\r
 +{\r
 +      return preg_match('#^[a-z0-9]+$#i', $name);\r
 +}\r
 +function isValidDisplayName($name)\r
 +{\r
 +      return preg_match('#^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$#i', $name);\r
 +}\r
 +function isValidCategoryName($name)\r
 +{\r
 +      return 1;\r
 +}\r
 +function isValidTemplateName($name)\r
 +{\r
 +      return preg_match('#^[a-z0-9/_\-]+$#i', $name);\r
 +}\r
 +function isValidSkinName($name)\r
 +{\r
 +      return preg_match('#^[a-z0-9/_\-]+$#i', $name);\r
 +}\r
 +\r
 +// add and remove linebreaks\r
 +function addBreaks($var)\r
 +{\r
 +      return nl2br($var);\r
 +}\r
 +function removeBreaks($var)\r
 +{\r
 +      return preg_replace("/<br \/>([\r\n])/", "$1", $var);\r
 +}\r
 +\r
 +/**\r
 + * parseFile()\r
 + * \r
 + * @param     string  $filename\r
 + * @param     string  $includeMode\r
 + * @param     string  $includePrefix\r
 + * @return    void\r
 + */\r
 +function parseFile($filename, $includeMode = 'normal', $includePrefix = '')\r
 +{\r
 +      global $skinid;\r
 +      \r
 +      if ( !$skinid || !existsID($skinid) )\r
 +      {\r
 +              $skin = new Skin($CONF['BaseSkin']);\r
 +      }\r
 +      else\r
 +      {\r
 +              $skin = new Skin($skinid);\r
 +      }\r
 +      \r
 +      $oldIncludeMode = Parser::getProperty('IncludeMode');\r
 +      $oldIncludePrefix = Parser::getProperty('IncludePrefix');\r
 +      \r
 +      $skin->parse('fileparse', $filename);\r
 +      \r
 +      Parser::setProperty('IncludeMode', $oldIncludeMode);\r
 +      Parser::setProperty('IncludePrefix', $oldIncludePrefix);\r
 +      \r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * debug()\r
 + * Outputs a debug message\r
 + * \r
 + * @param     string  $msg\r
 + * @return    void\r
 + */\r
 +function debug($msg)\r
 +{\r
 +      echo '<p><b>' . $msg . "</b></p>\n";\r
 +      return;\r
 +}\r
 +\r
 +// shows a link to help file\r
 +function help($id)\r
 +{\r
 +      echo helpHtml($id);\r
 +      return;\r
 +}\r
 +function helpHtml($id)\r
 +{\r
 +      global $CONF;\r
 +      return helplink($id) . '<img src="' . $CONF['AdminURL'] . 'documentation/icon-help.gif" width="15" height="15" alt="' . _HELP_TT . '" title="' . _HELP_TT . '" /></a>';\r
 +}\r
 +function helplink($id)\r
 +{\r
 +      global $CONF;\r
 +      return '<a href="' . $CONF['AdminURL'] . 'documentation/help.html#'. $id . '" onclick="if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);">';\r
 +}\r
 +\r
 +/**\r
 + * includephp()\r
 + * Includes a PHP file. This method can be called while parsing templates and skins\r
 + * \r
 + * @param     string  $filename       name of file to parse\r
 + * @return    void\r
 + */\r
 +function includephp($filename)\r
 +{\r
 +      // make predefined variables global, so most simple scripts can be used here\r
 +      \r
 +      // apache (names taken from PHP doc)\r
 +      global $GATEWAY_INTERFACE, $SERVER_NAME, $SERVER_SOFTWARE, $SERVER_PROTOCOL;\r
 +      global $REQUEST_METHOD, $QUERY_STRING, $DOCUMENT_ROOT, $HTTP_ACCEPT;\r
 +      global $HTTP_ACCEPT_CHARSET, $HTTP_ACCEPT_ENCODING, $HTTP_ACCEPT_LANGUAGE;\r
 +      global $HTTP_CONNECTION, $HTTP_HOST, $HTTP_REFERER, $HTTP_USER_AGENT;\r
 +      global $REMOTE_ADDR, $REMOTE_PORT, $SCRIPT_FILENAME, $SERVER_ADMIN;\r
 +      global $SERVER_PORT, $SERVER_SIGNATURE, $PATH_TRANSLATED, $SCRIPT_NAME;\r
 +      global $REQUEST_URI;\r
 +      \r
 +      // php (taken from PHP doc)\r
 +      global $argv, $argc, $PHP_SELF, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS;\r
 +      global $HTTP_POST_FILES, $HTTP_ENV_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS;\r
 +      \r
 +      // other\r
 +      global $PATH_INFO, $HTTPS, $HTTP_RAW_POST_DATA, $HTTP_X_FORWARDED_FOR;\r
 +      \r
 +      if ( @file_exists($filename) )\r
 +      {\r
 +              include($filename);\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * Checks if a certain plugin exists\r
 + * @param     string  $plug   name of plugin\r
 + * @return    boolean exists or not\r
 + */\r
 +function checkPlugin($name)\r
 +{\r
 +      global $DIR_PLUGINS;\r
 +      return file_exists($DIR_PLUGINS . preg_replace('#[\\\\|/]#', '', $name) . '.php');\r
 +}\r
 +\r
 +/**\r
 + * alterQueryStr()\r
 + * \r
 + * @param     string  $querystr       querystring to alter (e.g. foo=1&bar=2&x=y)\r
 + * @param     string  $param  name of parameter to change (e.g. 'foo')\r
 + * @param     string  $value  New value for that parameter (e.g. 3)\r
 + * @return    string  altered query string (for the examples above: foo=3&bar=2&x=y)\r
 + */\r
 +function alterQueryStr($querystr, $param, $value)\r
 +{\r
 +      $vars = preg_split('#&#', $querystr);\r
 +      $set = FALSE;\r
 +      \r
 +      for ( $i = 0; $i < count($vars); $i++ )\r
 +      {\r
 +              $v = preg_split('#=#', $vars[$i]);\r
 +              \r
 +              if ( $v[0] == $param )\r
 +              {\r
 +                      $v[1] = $value;\r
 +                      $vars[$i] = implode('=', $v);\r
 +                      $set = true;\r
 +                      break;\r
 +              }\r
 +      }\r
 +      if ( !$set )\r
 +      {\r
 +              $vars[] = "{$param}={$value}";\r
 +      }\r
 +      return ltrim(implode('&', $vars), '&');\r
 +}\r
 +\r
 +/**\r
 + * passVar()\r
 + * passes one variable as hidden input field (multiple fields for arrays)\r
 + * @see passRequestVars in varsx.x.x.php\r
 + * \r
 + * @param     string  $key\r
 + * @param     string  $value\r
 + * @return    void\r
 + */\r
 +function passVar($key, $value)\r
 +{\r
 +      // array ?\r
 +      if ( is_array($value) )\r
 +      {\r
 +              for ( $i = 0; $i < sizeof($value); $i++ )\r
 +              {\r
 +                      passVar($key . '[' . $i . ']', $value[$i]);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      // other values: do stripslashes if needed\r
 +      echo '<input type="hidden" name="' . Entity::hsc($key) . '" value="' . Entity::hsc(undoMagic($value)) . '" />' . "\n";\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * checkVars()\r
 + * \r
 + * @param     string  $variables\r
 + * @return    void\r
 + */\r
 +function checkVars($variables)\r
 +{\r
 +      foreach ( $variables as $variable )\r
 +      {\r
 +              if ( array_key_exists($variable, $_GET)\r
 +                || array_key_exists($variable, $_POST)\r
 +                || array_key_exists($variable, $_COOKIE)\r
 +                || array_key_exists($variable, $_ENV)\r
 +                || (session_id() !== '' && array_key_exists($variable, $_SESSION))\r
 +                || array_key_exists($variable, $_FILES) )\r
 +              {\r
 +                      die('Sorry. An error occurred.');\r
 +              }\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * sanitizeParams()\r
 + * Sanitize parameters such as $_GET and $_SERVER['REQUEST_URI'] etc.\r
 + * to avoid XSS.\r
 + * \r
 + * @param     void\r
 + * @return    void\r
 + */\r
 +function sanitizeParams()\r
 +{\r
 +      $array = array();\r
 +      $str = '';\r
 +      $frontParam = '';\r
 +      \r
 +      // REQUEST_URI of $_SERVER\r
 +      $str =& $_SERVER["REQUEST_URI"];\r
 +      serverStringToArray($str, $array, $frontParam);\r
 +      sanitizeArray($array);\r
 +      arrayToServerString($array, $frontParam, $str);\r
 +      \r
 +      // QUERY_STRING of $_SERVER\r
 +      $str =& $_SERVER["QUERY_STRING"];\r
 +      serverStringToArray($str, $array, $frontParam);\r
 +      sanitizeArray($array);\r
 +      arrayToServerString($array, $frontParam, $str);\r
 +      \r
 +      // $_GET\r
 +      convArrayForSanitizing($_GET, $array);\r
 +      sanitizeArray($array);\r
 +      revertArrayForSanitizing($array, $_GET);\r
 +      \r
 +      // $_REQUEST (only GET param)\r
 +      convArrayForSanitizing($_REQUEST, $array);\r
 +      sanitizeArray($array);\r
 +      revertArrayForSanitizing($array, $_REQUEST);\r
 +      \r
 +      return;\r
 +}\r
 +\r
 +function _addInputTags(&$keys,$prefix='')\r
 +{\r
 +      foreach ( $keys as $key=>$value )\r
 +      {\r
 +              if ( $prefix )\r
 +              {\r
 +                      $key=$prefix.'['.$key.']';\r
 +              }\r
 +              if ( is_array($value) )\r
 +              {\r
 +                      _addInputTags($value,$key);\r
 +              }\r
 +              else\r
 +              {\r
 +                      if ( get_magic_quotes_gpc() )\r
 +                              {$value=stripslashes($value);\r
 +                      }\r
 +                      if ( $key == 'ticket' )\r
 +                      {\r
 +                              continue;\r
 +                      }\r
 +                      echo '<input type="hidden" name="'.Entity::hsc($key).\r
 +                           '" value="'.Entity::hsc($value).'" />'."\n";\r
 +              }\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * serverStringToArray()\r
 + * Convert the server string such as $_SERVER['REQUEST_URI']\r
 + * to arry like arry['blogid']=1 and array['page']=2 etc.\r
 + * \r
 + * @param     string   $uri                           string\r
 + * @param     string  &$query_elements        elements of query according to application/x-www-form-urlencoded\r
 + * @param     string  &$hier_part                     hierarchical part includes path\r
 + * \r
 + * NOTE:\r
 + * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax\r
 + * 3.  Syntax Components\r
 + * http://www.ietf.org/rfc/rfc3986.txt\r
 + * \r
 + * Hypertext Markup Language - 2.0\r
 + * 8.2.1. The form-urlencoded Media Type\r
 + * http://tools.ietf.org/html/rfc1866#section-8.2.1\r
 + * \r
 + * $_SERVER > Language Reference > Predefined Variables > PHP Manual\r
 + * http://www.php.net/manual/en/reserved.variables.server.php\r
 + */\r
 +function serverStringToArray($uri, &$query_elements, &$hier_part)\r
 +{\r
 +      // init param\r
 +      $query_elements = array();\r
 +      $hier_part = "";\r
 +      \r
 +      // split hierarchical part, e.g. /index.php, query and fragment, e.g. blogid=1&page=2#section1\r
 +      if ( i18n::strpos($uri, "?") > 0 )\r
 +      {\r
 +              list($hier_part, $query_and_fragment) = preg_split("#\?#", $uri, 2);\r
 +      }\r
 +      else\r
 +      {\r
 +              $query_and_fragment = $uri;\r
 +              $hier_part = '';\r
 +      }\r
 +      \r
 +      // If there is no query like blogid=1&page=2, return\r
 +      if ( i18n::strpos($uri, "=") == FALSE && !i18n::strlen($hier_part) )\r
 +      {\r
 +              $hier_part = $uri;\r
 +              return;\r
 +      }\r
 +      \r
 +      $query_elements = preg_split("#&#", $query_and_fragment);\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * arrayToServerString()\r
 + * Convert array like array['blogid'] to server string\r
 + * such as $_SERVER['REQUEST_URI']\r
 + * \r
 + * @param     array    $query_elements        elements of query according to application/x-www-form-urlencoded\r
 + * @param     string   $hier_part                     hier-part defined in RFC3986\r
 + * @param     string  &$uri                           return value\r
 + * @return    void\r
 + * \r
 + * NOTE:\r
 + * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax\r
 + * 3.  Syntax Components\r
 + * http://www.ietf.org/rfc/rfc3986.txt\r
 + * \r
 + * Hypertext Markup Language - 2.0\r
 + * 8.2.1. The form-urlencoded Media Type\r
 + * http://tools.ietf.org/html/rfc1866#section-8.2.1\r
 + * \r
 + * $_SERVER > Language Reference > Predefined Variables > PHP Manual\r
 + * http://www.php.net/manual/en/reserved.variables.server.php\r
 + */\r
 +function arrayToServerString($query_elements, $hier_part, &$uri)\r
 +{\r
 +      if ( i18n::strpos($uri, "?") !== FALSE )\r
 +      {\r
 +              $uri = $hier_part . "?";\r
 +      }\r
 +      else\r
 +      {\r
 +              $uri = $hier_part;\r
 +      }\r
 +      if ( count($query_elements) > 0 )\r
 +      {\r
 +              $uri .= implode("&", $query_elements);\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * sanitizeArray()\r
 + * Sanitize array parameters.\r
 + * This function checks both key and value.\r
 + * - check key if it inclues " (double quote),  remove from array\r
 + * - check value if it includes \ (escape sequece), remove remaining string\r
 + * \r
 + * @param     array   &$array elements of query according to application/x-www-form-urlencoded\r
 + * @return    void\r
 + */\r
 +function sanitizeArray(&$array)\r
 +{\r
 +      $excludeListForSanitization = array('query');\r
 +      \r
 +      foreach ( $array as $k => $v )\r
 +      {\r
 +              // split to key and value\r
 +              list($key, $val) = preg_split("#=#", $v, 2);\r
 +              if ( !isset($val) )\r
 +              {\r
 +                      continue;\r
 +              }\r
 +              \r
 +              // when magic quotes is on, need to use stripslashes,\r
 +              // and then addslashes\r
 +              if ( get_magic_quotes_gpc() )\r
 +              {\r
 +                      $val = stripslashes($val);\r
 +              }\r
 +              \r
 +              // note that we must use addslashes here because this function is called before the db connection is made\r
 +              // and sql_real_escape_string needs a db connection\r
 +              $val = addslashes($val);\r
 +              \r
 +              // if $key is included in exclude list, skip this param\r
 +              if ( !in_array($key, $excludeListForSanitization) )\r
 +              {\r
 +                      // check value\r
 +                      if ( i18n::strpos($val, '\\') > 0 )\r
 +                      {\r
 +                              list($val, $tmp) = preg_split('#\\\\#', $val);\r
 +                      }\r
 +                      \r
 +                      // remove control code etc.\r
 +                      $val = strtr($val, "\0\r\n<>'\"", "       ");\r
 +                      \r
 +                      // check key\r
 +                      if ( preg_match('#\"#', $key) > 0 )\r
 +                      {\r
 +                              unset($array[$k]);\r
 +                              continue;\r
 +                      }\r
 +                      \r
 +                      // set sanitized info\r
 +                      $array[$k] = sprintf("%s=%s", $key, $val);\r
 +              }\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * convArrayForSanitizing()\r
 + * Convert array for sanitizeArray function\r
 + * \r
 + * @param     string  $src    array to be sanitized\r
 + * @param     array   &$array array to be temporarily stored\r
 + * @return    void\r
 + */\r
 +function convArrayForSanitizing($src, &$array)\r
 +{\r
 +      $array = array();\r
 +      foreach ( $src as $key => $val )\r
 +      {\r
 +              if ( !key_exists($key, $_GET) )\r
 +              {\r
 +                      continue;\r
 +              }\r
 +              $array[] = sprintf("%s=%s", $key, $val);\r
 +              continue;\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
 + * revertArrayForSanitizing()\r
 + * Revert array after sanitizeArray function\r
 + * \r
 + * @param     array   $array  element of query according to application/x-www-form-urlencoded\r
 + * @param     array   &$dst   combination of key and value\r
 + * @return    void\r
 + */\r
 +function revertArrayForSanitizing($array, &$dst)\r
 +{\r
 +      foreach ( $array as $v )\r
 +      {\r
 +              list($key, $val) = preg_split("#=#", $v, 2);\r
 +              $dst[$key] = $val;\r
 +              continue;\r
 +      }\r
 +      return;\r
 +}\r
 +\r
 +/**\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: globalfunctions.php 1886 2012-06-17 08:27:27Z sakamocchi $
+  */
+ /* needed if we include globalfunctions from install.php */
+ global $nucleus, $CONF, $DIR_LIBS, $DIR_LOCALES, $manager, $member, $MYSQL_HANDLER, $StartTime;
+ /* just for benchmark tag */
+ $StartTime = microtime(TRUE);
+ $nucleus['version'] = 'v4.00 SVN';
+ $nucleus['codename'] = '';
+ /*
+  * make sure there's no unnecessary escaping:
+  * set_magic_quotes_runtime(0);
+  */
+ if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+ {
+       ini_set('magic_quotes_runtime', '0');
+ }
+ /* check and die if someone is trying to override internal globals (when register_globals turn on) */
+ checkVars(array('nucleus', 'CONF', 'DIR_LIBS',
+ 'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE',
+ 'DIR_LOCALES', 'DIR_PLUGINS',
+ 'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS',
+ 'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS',
+ 'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));
+ if ( !isset($CONF) )
+ {
+       $CONF = array();
+ }
+ /* debug mode */
+ if ( array_key_exists('debug', $CONF) && $CONF['debug'] )
+ {
+       /* report all errors! */
+       error_reporting(E_ALL | E_STRICT);
+ }
+ else
+ {
+       ini_set('display_errors','0');
+       error_reporting(E_ERROR | E_WARNING | E_PARSE);
+ }
+ /*
+  * alertOnHeadersSent
+  *  Displays an error when visiting a public Nucleus page and headers have
+  *  been sent out to early. This usually indicates an error in either a
+  *  configuration file or a translation file, and could cause Nucleus to
+  *  malfunction
+  */
+ if ( !array_key_exists('alertOnHeadersSent', $CONF) )
+ {
+       $CONF['alertOnHeadersSent'] = 1;
+ }
+ /*
+  * alertOnSecurityRisk
+  * Displays an error only when visiting the admin area, and when one or
+  *  more of the installation files (install.php, install.sql, upgrades/
+  *  directory) are still on the server.
+  */
+ if ( !array_key_exists('alertOnSecurityRisk', $CONF) )
+ {
+       $CONF['alertOnSecurityRisk'] = 1;
+ }
+ /*
+  * Set these to 1 to allow viewing of future items or draft items
+  * Should really never do this, but can be useful for some plugins that might need to
+  * Could cause some other issues if you use future posts otr drafts
+  * So use with care
+  */
+ $CONF['allowDrafts'] = 0;
+ $CONF['allowFuture'] = 0;
+ if ( getNucleusPatchLevel() > 0 )
+ {
+       $nucleus['version'] .= '/' . getNucleusPatchLevel();
+ }
+ /* Avoid notices */
+ if ( !array_key_exists('installscript', $CONF) || empty($CONF['installscript']) )
+ {
+       $CONF['installscript'] = 0;
+ }
+ if ( !array_key_exists('UsingAdminArea', $CONF) )
+ {
+       $CONF['UsingAdminArea'] = 0;
+ }
+ if ( !headers_sent() )
+ {
+       header('Generator: Nucleus CMS ' . $nucleus['version']);
+ }
+ /* TODO: This is for compatibility since 4.0, should be obsoleted at future release. */
+ if ( !isset($DIR_LOCALES) )
+ {
+       $DIR_LOCALES = $DIR_NUCLEUS . 'locales/';
+ }
+ global $DIR_LANG;
+ if ( !isset($DIR_LANG) )
+ {
+       $DIR_LANG = $DIR_LOCALES;
+ }
+ /* load and initialize i18n class */
+ if (!class_exists('i18n', FALSE))
+ {
+       include($DIR_LIBS . 'i18n.php');
+ }
+ if ( !i18n::init('UTF-8', $DIR_LOCALES) )
+ {
+       exit('Fail to initialize i18n class.');
+ }
+ /* TODO: This is just for compatibility since 4.0, should be obsoleted at future release. */
+ define('_CHARSET', i18n::get_current_charset());
+ /*
+  * NOTE: Since 4.0 release, Entity class becomes to be important class
+  *  with some wrapper functions for htmlspechalchars/htmlentity PHP's built-in function
+  */
+ include($DIR_LIBS . 'ENTITY.php');
+ /* we will use postVar, getVar, ... methods instead of $_GET, $_POST ... */
+ if ( $CONF['installscript'] != 1 )
+ {
+       /* vars were already included in install.php */
+       include_once($DIR_LIBS . 'vars4.1.0.php');
+       
+       /* added for 4.0 DB::* wrapper and compatibility sql_* */
+       include_once($DIR_LIBS . 'sql/sql.php');
+ }
+ /* include core classes that are needed for login & plugin handling */
+ include($DIR_LIBS . 'MEMBER.php');
+ include($DIR_LIBS . 'ACTIONLOG.php');
+ include($DIR_LIBS . 'MANAGER.php');
+ include($DIR_LIBS . 'PLUGIN.php');
+ $manager =& MANAGER::instance();
+ /* only needed when updating logs */
+ if ( $CONF['UsingAdminArea'] )
+ {
+       /* XML-RPC client classes */
+       include($DIR_LIBS . 'xmlrpc.inc.php');
+       include($DIR_LIBS . 'ADMIN.php');
+ }
+ /* connect to database */
+ if ( !isset($MYSQL_HANDLER) )
+ {
+       $MYSQL_HANDLER = array('mysql','');
+ }
+ if ( $MYSQL_HANDLER[0] == '' )
+ {
+       $MYSQL_HANDLER[0] = 'mysql';
+ }
+ DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);
+ /* force locale or charset */
+ $locale = '';
+ $charset = i18n::get_current_charset();
+ $data = array(
+       'locale'        => &$locale,
+       'charset'       => &$charset
+ );
+ $manager->notify('ForceLocale', $data);
+ if ( $data['locale'] !== '' )
+ {
+       i18n::set_forced_locale($data['locale']);
+ }
+ if ( $data['charset'] !== '' )
+ {
+       i18n::set_forced_charset($data['charset']);
+ }
+ unset($locale);
+ unset($charset);
+ /* convert forced charset to current charset */
+ if ( i18n::get_forced_charset() != i18n::get_current_charset() )
+ {
+       $_POST          = i18n::convert_array($_POST, i18n::get_forced_charset());
+       $_GET           = i18n::convert_array($_GET, i18n::get_forced_charset());
+       $_REQUEST       = i18n::convert_array($_REQUEST, i18n::get_forced_charset());
+       $_COOKIE        = i18n::convert_array($_COOKIE, i18n::get_forced_charset());
+       $_FILES         = i18n::convert_array($_FILES, i18n::get_forced_charset());
+       
+       if ( session_id() !== '' )
+       {
+               $_SESSION = i18n::convert_array($_SESSION, i18n::get_forced_charset());
+       }
+ }
+ /* sanitize option */
+ $bLoggingSanitizedResult = 0;
+ $bSanitizeAndContinue = 0;
+ $orgRequestURI = serverVar('REQUEST_URI');
+ sanitizeParams();
+ /* logs sanitized result if need */
+ if ( $orgRequestURI !== serverVar('REQUEST_URI') )
+ {
+       $msg = "Sanitized [" . serverVar('REMOTE_ADDR') . "] ";
+       $msg .= $orgRequestURI . " -> " . serverVar('REQUEST_URI');
+       if ( $bLoggingSanitizedResult )
+       {
+               addToLog(WARNING, $msg);
+       }
+       if ( !$bSanitizeAndContinue )
+       {
+               die("");
+       }
+ }
+ /* get all variables that can come from the request and put them in the global scope */
+ $blogid               = requestVar('blogid');
+ $itemid               = intRequestVar('itemid');
+ $catid                = intRequestVar('catid');
+ $skinid               = requestVar('skinid');
+ $memberid     = requestVar('memberid');
+ $archivelist = requestVar('archivelist');
+ $imagepopup   = requestVar('imagepopup');
+ $archive      = requestVar('archive');
+ $query                = requestVar('query');
+ $highlight    = requestVar('highlight');
+ $amount               = requestVar('amount');
+ $action               = requestVar('action');
+ $nextaction   = requestVar('nextaction');
+ $maxresults   = requestVar('maxresults');
+ $startpos     = intRequestVar('startpos');
+ $errormessage = '';
+ $error                = '';
+ $special      = requestVar('special');
+ /* read config */
+ getConfig();
+ /* Properly set $CONF['Self'] and others if it's not set...
+  * usually when we are access from admin menu
+  */
+ if ( !array_key_exists('Self', $CONF) )
+ {
+       $CONF['Self'] = $CONF['IndexURL'];
+       /* strip trailing */
+       if ( $CONF['Self'][i18n::strlen($CONF['Self']) -1] == "/" )
+       {
+               $CONF['Self'] = i18n::substr($CONF['Self'], 0, i18n::strlen($CONF['Self']) -1);
+       }
+ }
+ $CONF['ItemURL']              = $CONF['Self'];
+ $CONF['ArchiveURL']           = $CONF['Self'];
+ $CONF['ArchiveListURL']       = $CONF['Self'];
+ $CONF['MemberURL']            = $CONF['Self'];
+ $CONF['SearchURL']            = $CONF['Self'];
+ $CONF['BlogURL']              = $CONF['Self'];
+ $CONF['CategoryURL']  = $CONF['Self'];
+ /* automatically use simpler toolbar for mozilla */
+ if ( ($CONF['DisableJsTools'] == 0)
+    && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Mozilla/5.0') !== FALSE
+    && i18n::strpos(serverVar('HTTP_USER_AGENT'), 'Gecko') !== FALSE )
+ {
+       $CONF['DisableJsTools'] = 2;
+ }
+ /* login processing */
+ $member = new Member();
+ if ( $action == 'login' )
+ {
+       $login = postVar('login');
+       $password = postVar('password');
+       $shared = intPostVar('shared');
+       $member->login($login, $password, $shared);
+ }
+ elseif ( ($action == 'logout') )
+ {
+       $member->logout();
+ }
+ else
+ {
+       $member->cookielogin();
+ }
+ /* TODO: This is for backward compatibility, should be obsoleted near future. */
+ if ( !preg_match('#^(.+)_(.+)_(.+)$#', $CONF['Locale'])
+   && ($CONF['Locale'] = i18n::convert_old_language_file_name_to_locale($CONF['Locale'])) === FALSE )
+ {
+       $CONF['Locale'] = 'en_Latn_US';
+ }
+ if ( !array_key_exists('Language', $CONF) )
+ {
+       $CONF['Language'] = i18n::convert_locale_to_old_language_file_name($CONF['Locale']);
+ }
+ $locale = $CONF['Locale'];
+ /* NOTE: include translation file and set locale */
+ if ( $member->isLoggedIn() )
+ {
+       if ( $member->getLocale() )
+       {
+               $locale = $member->getLocale();
+       }
+ }
+ else
+ {
+       if ( i18n::get_forced_locale() !== '' )
+       {
+               $locale = i18n::get_forced_locale();
+       }
+ }
+ include_translation($locale);
+ i18n::set_current_locale($locale);
+ /* login completed */
+ $data = array('loggedIn' => $member->isLoggedIn());
+ $manager->notify('PostAuthentication', $data);
+ /* next action */
+ if ( $member->isLoggedIn() && $nextaction )
+ {
+       $action = $nextaction;
+ }
+ /* first, let's see if the site is disabled or not. always allow admin area access. */
+ if ( $CONF['DisableSite'] && !$member->isAdmin() && !$CONF['UsingAdminArea'] )
+ {
+       redirect($CONF['DisableSiteURL']);
+       exit;
+ }
+ /* load other classes */
+ include($DIR_LIBS . 'PARSER.php');
+ include($DIR_LIBS . 'SKIN.php');
+ include($DIR_LIBS . 'TEMPLATE.php');
+ include($DIR_LIBS . 'BLOG.php');
+ include($DIR_LIBS . 'BODYACTIONS.php');
+ include($DIR_LIBS . 'COMMENTS.php');
+ include($DIR_LIBS . 'COMMENT.php');
+ include($DIR_LIBS . 'NOTIFICATION.php');
+ include($DIR_LIBS . 'BAN.php');
+ include($DIR_LIBS . 'SEARCH.php');
+ include($DIR_LIBS . 'LINK.php');
+ /* set lastVisit cookie (if allowed) */
+ if ( !headers_sent() )
+ {
+       if ( $CONF['LastVisit'] )
+       {
+               setcookie($CONF['CookiePrefix'] . 'lastVisit', time(), time() + 2592000, $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+       }
+       else
+       {
+               setcookie($CONF['CookiePrefix'] . 'lastVisit', '', (time() - 2592000), $CONF['CookiePath'], $CONF['CookieDomain'], $CONF['CookieSecure']);
+       }
+ }
+ /* for path resolving */
+ $virtualpath = getVar('virtualpath');
+ if ( getVar('virtualpath') == '' )
+ {
+       $virtualpath = serverVar('PATH_INFO');
+ }
+ /*
+  * switch URLMode back to normal when $CONF['Self'] ends in .php
+  * this avoids urls like index.php/item/13/index.php/item/15
+  */
+ if ( !array_key_exists('URLMode', $CONF) || ($CONF['URLMode'] != 'pathinfo') )
+ {
+       $CONF['URLMode'] = 'normal';
+ }
+ else
+ {
+       if ( i18n::substr($CONF['Self'], i18n::strlen($CONF['Self']) - 4) != '.php' )
+       {
+               decodePathInfo($virtualpath);
+       }
+ }
+ /*
+  * PostParseURL is a place to cleanup any of the path-related global variables before the selector function is run.
+  * It has 2 values in the data in case the original virtualpath is needed, but most the use will be in tweaking
+  * global variables to clean up (scrub out catid or add catid) or to set someother global variable based on
+  * the values of something like catid or itemid
+  * New in 3.60
+  */
+ $data = array(
+       'type' => basename(serverVar('SCRIPT_NAME')),
+       'info' => $virtualpath
+ );
+ $manager->notify('PostParseURL', $data);
+ /*
+  * NOTE: Here is the end of initialization
+  */
+ /**
+  * include_libs()
+  * This function includes or requires the specified library file
+  * 
+  * @param     string  $file
+  * @param     boolean $once use the _once() version
+  * @param     boolean $require use require() instead of include()
+  * @return    void
+  */
+ function include_libs($file, $once = TRUE, $require = TRUE)
+ {
+       global $DIR_LIBS;
+       
+       // $DIR_LIBS isn't a directory
+       if ( !is_dir($DIR_LIBS) )
+       {
+               exit;
+       }
+       
+       $lib_path = $DIR_LIBS . $file;
+       
+       if ( $once && $require )
+       {
+               require_once($lib_path);
+       }
+       else if ( $once && !$require )
+       {
+               include_once($lib_path);
+       }
+       else if ( $require )
+       {
+               require($lib_path);
+       }
+       else
+       {
+               include($lib_path);
+       }
+       return;
+ }
+ /**
+  * include_plugins()
+  * This function includes or requires the specified plugin file
+  * 
+  * @param     string  $file
+  * @param     boolean $once use the _once() version
+  * @param     boolean $require use require() instead of include()
+  * @return    
+  */
+ function include_plugins($file, $once = TRUE, $require = TRUE)
+ {
+       global $DIR_PLUGINS;
+       
+       // begin if: $DIR_LIBS isn't a directory
+       if ( !is_dir($DIR_PLUGINS) )
+       {
+               exit;
+       }
+       
+       $plugin_path = $DIR_PLUGINS . $file;
+       
+       // begin if: 
+       if ( $once && $require )
+       {
+               require_once($plugin_path);
+       }
+       else if ( $once && !$require )
+       {
+               include_once($plugin_path);
+       }
+       elseif ( $require )
+       {
+               require($plugin_path);
+       }
+       else
+       {
+               include($plugin_path);
+       }
+       return;
+ }
+ /**
+  * include_translation()
+  * This function decide which locale is used and include translation
+  * 
+  * @param     string  &$locale        locale name referring to 'language tags' defined in RFC 5646
+  * @return    void
+  */
+ function include_translation(&$locale)
+ {
+       global $DIR_LOCALES;
+       
+       $translation_file = $DIR_LOCALES . $locale . '.' . i18n::get_current_charset() . '.php';
+       if ( !file_exists($translation_file) )
+       {
+               $locale = 'en_Latn_US';
+               $translation_file = $DIR_LOCALES . 'en_Latn_US.ISO-8859-1.php';
+       }
+       include($translation_file);
+       
+       /*
+        * NOTE:
+        * PHP is written by C and utilize C library, whose APIs are defined in POSIX.
+        * 
+        * setlocale() is one of APIs of C library.
+        * but the argument value for setlocale() depends on each implements
+        * 
+        * The latest POSIX standard:
+        * The Open Group Base Specifications Issue 7
+        * IEEE Std 1003.1™-2008
+        * http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html
+        * 
+        * Microsoft's operating system uses their own implementation
+        *  Language Strings
+        *   http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.110%29.aspx
+        *  Country/Region Strings
+        *   http://msdn.microsoft.com/en-us/library/cdax410z%28v=vs.110%29.aspx
+        * 
+        * Linux and Unix (in this meaning, Apple's OS X derives from UNIX) uses ISO standard.
+        *  two characters language tag (ISO 639-1)
+        *  two characters region and country lag (ISO 3166-1 alpha-1)
+        * 
+        */
+       if ( PHP_OS == "WIN32" || PHP_OS == "WINNT" )
+       {
+               /* LOCALE_IN_WINDOWS is defined in each translation files */
+               setlocale(LC_ALL, _LOCALE_IN_WINDOWS);
+       }
+       else
+       {
+               setlocale(LC_ALL, preg_replace('#(.+)_(.+)_(.+)#', '$1-$3', $locale));
+       }
+       return;
+ }
+ /**
+  * intPostVar()
+  * This function returns the integer value of $_POST for the variable $name
+  * 
+  * @param     string  $name   field to get the integer value of
+  * @return    integer
+  */
+ function intPostVar($name)
+ {
+       return (integer) postVar($name);
+ }
+ /**
+  * intGetVar()
+  * This function returns the integer value of $_GET for the variable $name
+  * 
+  * @param     string  $name   field to get the integer value of
+  * @return    integer
+  */
+ function intGetVar($name)
+ {
+       return (integer) getVar($name);
+ }
+ /**
+  * intRequestVar()
+  * This function returns the integer value of $_REQUEST for the variable $name. Also checks $_GET and $_POST if not found in $_REQUEST
+  * 
+  * @param string $name field to get the integer value of
+  * @return int
+  */
+ function intRequestVar($name)
+ {
+       return (integer) requestVar($name);
+ }
+ /**
+  * intCookieVar()
+  * This function returns the integer value of $_COOKIE for the variable $name
+  * 
+  * @param     string  $name   field to get the integer value of
+  * @return    integer
+  */
+ function intCookieVar($name)
+ {
+       return (integer) cookieVar($name);
+ }
+ /**
+  * getNucleusVersion()
+  * This function returns the current Nucleus version (100 = 1.00, 101 = 1.01, etc...)
+  * 
+  * @param     void
+  * @return    integer
+  */
+ function getNucleusVersion()
+ {
+       return 400;
+ }
+ /**
+  * getNucleusPatchLevel()
+  * TODO: Better description of this function.
+  *
+  * Power users can install patches in between nucleus releases. These patches
+  * usually add new functionality in the plugin API and allow those to
+  * be tested without having to install CVS.
+  *
+  *@param      void
+  * @return    integer
+  */
+ function getNucleusPatchLevel()
+ {
+       return 0;
+ }
+ /**
+  * getLatestVersion()
+  * This function returns the latest Nucleus version available for download from nucleuscms.org or FALSE if unable to attain data
+  * Format will be major.minor/patachlevel e.g. 3.41 or 3.41/02
+  * 
+  * @param     void
+  * @return    mixed
+  */
+ function getLatestVersion()
+ {
+       // begin if: cURL is not available in this PHP installation
+       if ( !function_exists('curl_init') )
+       {
+               return FALSE;
+       }
+       
+       $curl = curl_init();
+       $timeout = 5;
+       
+       curl_setopt ($curl, CURLOPT_URL, 'http://nucleuscms.org/version_check.php');
+       curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
+       curl_setopt ($curl, CURLOPT_CONNECTTIMEOUT, $timeout);
+       
+       $return = curl_exec($curl);
+       
+       curl_close($curl);
+       
+       return $return;
+ }
+ /**
+  * sql_table()
+  * This function returns a Nucleus table name with the appropriate prefix
+  * @param string $name
+  * @return string
+  */
+ function sql_table($name)
+ {
+       global $MYSQL_PREFIX;
+       
+       // begin if: no MySQL prefix
+       if ( empty($MYSQL_PREFIX) )
+       {
+               return 'nucleus_' . $name;
+       }
+       // else: use MySQL prefix
+       else
+       {
+               return $MYSQL_PREFIX . 'nucleus_' . $name;
+       }
+       return;
+ }
+ /**
+  * sendContentType()
+  * This function sends the Content-Type header if headers have not already been sent
+  * It also determines if the browser can accept application/xhtml+xml and sends it only to those that can.
+  * 
+  * if content type is application/xhtml+xml, only send it to browsers
+  * that can handle it (IE6 cannot). Otherwise, send text/html
+  *
+  * v2.5:
+  * For admin area pages, keep sending text/html (unless it's a debug version)
+  * application/xhtml+xml still causes too much problems with the javascript implementations
+  *
+  * v3.3:
+  * ($CONF['UsingAdminArea'] && !$CONF['debug']) gets removed,
+  * application/xhtml+xml seems to be working, so we're going to use it if we can.
+  * 
+  * @param     string  $content_type   MIME media type registered to IANA, http://www.iana.org/assignments/media-types/index.html
+  * @param     string  $page_type              
+  * @param     string  $charset                Deprecated. This has no meaning.
+  * @return    void
+  * 
+  */
+ function sendContentType($content_type, $page_type = '', $charset = '')
+ {
+       global $manager, $CONF;
+       
+       if ( headers_sent() )
+       {
+               return;
+       }
+       
+       /* NOTE: MIME Media Type */
+       if ( ($content_type == 'application/xhtml+xml')
+               && (!stristr(serverVar('HTTP_ACCEPT'), 'application/xhtml+xml') ) )
+       {
+               $content_type = 'text/html';
+       }
+       
+       /* NOTE: generate event */
+       $data = array(
+               'pageType'              =>  $page_type,
+               'contentType'   => &$content_type
+       );
+       $manager->notify('PreSendContentType', $data);
+       
+       /* NOTE: confirm MIME Media Type */
+       $content_type = preg_replace('#[^a-zA-Z0-9-+./]#', '', $content_type);
+       
+       /* NOTE: confirm character set */
+       $charset = i18n::get_current_charset();
+       if ( i18n::get_forced_charset() !== '' )
+       {
+               $charset = i18n::get_forced_charset();
+       }
+       
+       /* NOTE: send HTTP 1.1 header */
+       header("Content-Type: {$content_type}; charset={$charset}");
+       
+       /* NOTE: set handler for translating character set */
+       if ( $charset != i18n::get_current_charset() )
+       {
+               ob_start(array('i18n', 'convert_handler'));
+       }
+       
+       return;
+ }
+ /**
+  * parseHighlight()
+  * This function parses a query into an array of expressions that can be passed on to the highlight method
+  * @param     string  $query
+  * @return    void
+  */
+ function parseHighlight($query)
+ {
+       // TODO: add more intelligent splitting logic
+       
+       // get rid of quotes
+       $query = preg_replace('/\'|"/', '', $query);
+       
+       if ( !$query )
+       {
+               return array();
+       }
+       
+       $aHighlight = preg_split('# #', $query);
+       
+       for ( $i = 0; $i < count($aHighlight); $i++ )
+       {
+               $aHighlight[$i] = trim($aHighlight[$i]);
+               
+               if ( i18n::strlen($aHighlight[$i]) < 3 )
+               {
+                       unset($aHighlight[$i]);
+               }
+       }
+       
+       if ( count($aHighlight) == 1 )
+       {
+               return $aHighlight[0];
+       }
+       else
+       {
+               return $aHighlight;
+       }
+       return;
+ }
+ /**
+  * getConfig()
+  * 
+  * @param     void
+  * @return    void
+  */
+ function getConfig()
+ {
+       global $CONF;
+       
+       $query = sprintf('SELECT * FROM %s', sql_table('config'));
+       $res = DB::getResult($query);
+       
+       foreach ( $res as $row )
+       {
+               $CONF[$row['name']] = $row['value'];
+       }
+       return;
+ }
+ /**
+  * This function gets the blog ID from the blog name
+  * @param string $name
+  * @return
+  */
+ function getBlogIDFromName($name)
+ {
+       $query = sprintf('SELECT bnumber AS result FROM %s WHERE bshortname=%s', sql_table('blog'), DB::quoteValue($name));
+       return DB::getValue($query);
+ }
+ /**
+  * This function gets the blog name from the blog ID
+  * @param int $id
+  * @return object
+  */
+ function getBlogNameFromID($id)
+ {
+       $query = sprintf('SELECT bname AS result FROM %s WHERE bnumber=%d', sql_table('blog'), intval($id));
+       return DB::getValue($query);
+ }
+ /**
+  * This function gets the blog ID from the item ID
+  * @param int $item_id
+  * @return object
+  */
+ function getBlogIDFromItemID($item_id)
+ {
+       $query = sprintf('SELECT iblog AS result FROM %s WHERE inumber=%d', sql_table('item'), intval($item_id));
+       return DB::getValue($query);
+ }
+ /**
+  * This function gets the blog ID from the comment ID
+  * @param int $comment_id
+  * @return object
+  */
+ function getBlogIDFromCommentID($comment_id)
+ {
+       $query = sprintf('SELECT cblog AS result FROM %s WHERE cnumber=%d', sql_table('comment'), intval($comment_id));
+       return DB::getValue($query);
+ }
+ /**
+  * This function gets the blog ID from the category ID
+  * @param int $category_id
+  * @return object
+  */
+ function getBlogIDFromCatID($category_id)
+ {
+       $query = sprintf('SELECT cblog AS result FROM %s WHERE catid=%d', sql_table('category'), intval($category_id));
+       return DB::getValue($query);
+ }
+ /**
+  * This function gets the category ID from the category name
+  * @param int $name
+  * @return object
+  */
+ function getCatIDFromName($name)
+ {
+       $query = sprintf('SELECT catid AS result FROM %s WHERE cname=%s', sql_table('category'), DB::quoteValue($name));
+       return DB::getValue($query);
+ }
+ /**
+  * functions to be used in index.php to select something
+  */
+ function selectBlog($shortname)
+ {
+       global $blogid, $archivelist;
+       $blogid = getBlogIDFromName($shortname);
+       
+       // also force archivelist variable, if it is set
+       if ( $archivelist )
+       {
+               $archivelist = $blogid;
+       }
+       return;
+ }
+ function selectSkin($skinname)
+ {
+       global $skinid;
+       $skinid = SKIN::getIdFromName($skinname);
+       return;
+ }
+ function selectCategory($cat)
+ {
+       global $catid;
+       if ( is_numeric($cat) )
+       {
+               $catid = (integer) $cat;
+       }
+       else
+       {
+               $catid = getCatIDFromName($cat);
+       }
+       return;
+ }
+ function selectItem($id)
+ {
+       global $itemid;
+       $itemid = (integer) $id;
+       return;
+ }
+ function selectSpecialSkinType($id)
+ {
+       global $special;
+       $special = strtolower($id);
+       return;
+ }
+ function selector()
+ {
+       global $archive, $archivelist, $archivenext, $archivenextexists, $archiveprev, $archiveprevexists, $archivetype;
+       global $blog, $blogid;
+       global $catid;
+       global $itemid, $itemidnext, $itemidprev, $itemtitlenext, $itemtitleprev;
+       global $CONF, $DIR_LIBS, $amount, $errormessage, $imagepopup;
+       global $manager, $maxresults, $query;
+       global $member, $memberid, $memberinfo;
+       global $skinid, $skinpart, $special;
+       
+       $actionNames = array('addcomment', 'sendmessage', 'createaccount', 'forgotpassword', 'votepositive', 'votenegative', 'plugin');
+       $action = requestVar('action');
+       
+       if ( in_array($action, $actionNames) )
+       {
+               include_once($DIR_LIBS . 'ACTION.php');
+               $a = new Action();
+               $errorInfo = $a->doAction($action);
+               
+               if ( $errorInfo )
+               {
+                       $errormessage = $errorInfo['message'];
+               }
+       }
+       
+       // show error when headers already sent out
+       if ( headers_sent() && $CONF['alertOnHeadersSent'] )
+       {
+               // try to get line number/filename (extra headers_sent params only exists in PHP 4.3+)
+               if ( function_exists('version_compare') && version_compare('4.3.0', phpversion(), '<=') )
+               {
+                       headers_sent($hsFile, $hsLine);
+                       $extraInfo = ' in <code>' . $hsFile . '</code> line <code>' . $hsLine . '</code>';
+               }
+               else
+               {
+                       $extraInfo = '';
+               }
+               
+               startUpError(
+                  "<p>The page headers have already been sent out{$extraInfo}. This could cause Nucleus not to work in the expected way.</p>"
+                . "<p>Usually, this is caused by spaces or newlines at the end of the <code>config.php</code> file, "
+                . "at the end of the translation file or at the end of a plugin file.</p>"
+                . "<p>Please check this and try again.</p>"
+                . "<p>If you don't want to see this error message again, without solving the problem, "
+                . "set <code>{$CONF['alertOnHeadersSent']}</code> in <code>globalfunctions.php</code> to <code>0</code></p>"
+                . "Page headers already sent"
+               );
+               exit;
+       }
+       
+       // make is so ?archivelist without blogname or blogid shows the archivelist
+       // for the default weblog
+       if ( serverVar('QUERY_STRING') == 'archivelist' )
+       {
+               $archivelist = $CONF['DefaultBlog'];
+       }
+       
+       // now decide which type of skin we need
+       if ( $itemid )
+       {
+               // itemid given -> only show that item
+               $type = 'item';
+               
+               if ( !$manager->existsItem($itemid,intval($CONF['allowFuture']),intval($CONF['allowDrafts'])) )
+               {
+                       doError(_ERROR_NOSUCHITEM);
+                       return;
+               }
+               
+               // 1. get timestamp, blogid and catid for item
+               $query = 'SELECT itime, iblog, icat FROM %s WHERE inumber=%d';
+               $query = sprintf($query, sql_table('item'), intval($itemid));
+               $row = DB::getRow($query);
+               
+               // if a different blog id has been set through the request or selectBlog(),
+               // deny access
+               
+               if ( $blogid && (intval($blogid) != $row['iblog']) )
+               {
+                       doError(_ERROR_NOSUCHITEM);
+                       return;
+               }
+               
+               // if a category has been selected which doesn't match the item, ignore the
+               // category. #85
+               if ( ($catid != 0) && ($catid != $row['icat']) )
+               {
+                       $catid = 0;
+               }
+               
+               $blogid = $row['iblog'];
+               $timestamp = strtotime($row['itime']);
+               
+               $b =& $manager->getBlog($blogid);
+               
+               if ( !$b->isValidCategory($catid) )
+               {
+                       $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d ORDER BY itime DESC LIMIT 1";
+                       $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid));
+               }
+               else
+               {
+                       $query = "SELECT inumber, ititle FROM %s WHERE itime<%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime DESC LIMIT 1";
+                       $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), intval($blogid), intval($catid));
+               }
+               $row = DB::getRow($query);
+               
+               if ( $row )
+               {
+                       $itemidprev = $row['inumber'];
+                       $itemtitleprev = $row['ititle'];
+               }
+               
+               // get next itemid and title
+               if ( !$b->isValidCategory($catid) )
+               {
+                       $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d ORDER BY itime ASC LIMIT 1";
+                       $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid));
+               }
+               else
+               {
+                       $query = "SELECT inumber, ititle FROM %s WHERE itime>%s AND itime<=%s AND idraft=0 AND iblog=%d AND icat=%d ORDER BY itime ASC LIMIT 1";
+                       $query = sprintf($query, sql_table('item'), DB::formatDateTime($timestamp), DB::formatDateTime($b->getCorrectTime()), intval($blogid), intval($catid));
+               }
+               $row = DB::getRow($query);
+               
+               if ( $row )
+               {
+                       $itemidnext = $row['inumber'];
+                       $itemtitlenext = $row['ititle'];
+               }
+       }
+       elseif ( $archive )
+       {
+               // show archive
+               $type = 'archive';
+               
+               // sql queries for the timestamp of the first and the last published item
+               $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime ASC', sql_table('item'));
+               $first_timestamp = DB::getValue($query);
+               $query = sprintf('SELECT UNIX_TIMESTAMP(itime) as result FROM %s WHERE idraft=0 ORDER BY itime DESC', sql_table('item'));
+               $last_timestamp = DB::getValue($query);
+               
+               sscanf($archive, '%d-%d-%d', $y, $m, $d);
+               
+               if ( $d != 0 )
+               {
+                       $archivetype = _LABEL_DAY_UNIT;
+                       $t = mktime(0, 0, 0, $m, $d, $y);
+                       // one day has 24 * 60 * 60 = 86400 seconds
+                       $archiveprev = i18n::formatted_datetime('%Y-%m-%d', $t - 86400 );
+                       // check for published items
+                       if ( $t > $first_timestamp )
+                       {
+                               $archiveprevexists = true;
+                       }
+                       else
+                       {
+                               $archiveprevexists = false;
+                       }
+                       
+                       // one day later
+                       $t += 86400;
+                       $archivenext = i18n::formatted_datetime('%Y-%m-%d', $t);
+                       if ( $t < $last_timestamp )
+                       {
+                               $archivenextexists = true;
+                       }
+                       else
+                       {
+                               $archivenextexists = false;
+                       }
+               }
+               elseif ( $m == 0 )
+               {
+                       $archivetype = _LABEL_YEAR_UNIT;
+                       $t = mktime(0, 0, 0, 12, 31, $y - 1);
+                       // one day before is in the previous year
+                       $archiveprev = i18n::formatted_datetime('%Y', $t);
+                       if ( $t > $first_timestamp )
+                       {
+                               $archiveprevexists = true;
+                       }
+                       else
+                       {
+                               $archiveprevexists = false;
+                       }
+                       // timestamp for the next year
+                       $t = mktime(0, 0, 0, 1, 1, $y + 1);
+                       $archivenext = i18n::formatted_datetime('%Y', $t);
+                       if ( $t < $last_timestamp )
+                       {
+                               $archivenextexists = true;
+                       }
+                       else
+                       {
+                               $archivenextexists = false;
+                       }
+               }
+               else
+               {
+                       $archivetype = _LABEL_MONTH_UNIT;
+                       $t = mktime(0, 0, 0, $m, 1, $y);
+                       // one day before is in the previous month
+                       $archiveprev = i18n::formatted_datetime('%Y-%m', $t - 86400);
+                       if ( $t > $first_timestamp )
+                       {
+                               $archiveprevexists = true;
+                       }
+                       else
+                       {
+                               $archiveprevexists = false;
+                       }
+                       
+                       // timestamp for the next month
+                       $t = mktime(0, 0, 0, $m+1, 1, $y);
+                       $archivenext = i18n::formatted_datetime('%Y-%m', $t);
+                       if ( $t < $last_timestamp )
+                       {
+                               $archivenextexists = true;
+                       }
+                       else
+                       {
+                               $archivenextexists = false;
+                       }
+               }
+       }
+       elseif ( $archivelist )
+       {
+               $type = 'archivelist';
+               
+               if ( is_numeric($archivelist) )
+               {
+                       $blogid = intVal($archivelist);
+               }
+               else
+               {
+                       $blogid = getBlogIDFromName($archivelist);
+               }
+       
+               if ( !$blogid )
+               {
+                       doError(_ERROR_NOSUCHBLOG);
+                       return;
+               }
+       }
+       elseif ( $query )
+       {
+               global $startpos;
+               $type = 'search';
+               $query = stripslashes($query);
+               
+               if ( is_numeric($blogid) )
+               {
+                       $blogid = intVal($blogid);
+               }
+               else
+               {
+                       $blogid = getBlogIDFromName($blogid);
+               }
+               
+               if ( !$blogid )
+               {
+                       doError(_ERROR_NOSUCHBLOG);
+                       return;
+               }
+       }
+       elseif ( $memberid )
+       {
+               $type = 'member';
+               
+               if ( !Member::existsID($memberid) )
+               {
+                       doError(_ERROR_NOSUCHMEMBER);
+                       return;
+               }
+               $memberinfo = $manager->getMember($memberid);
+       }
+       elseif ( $imagepopup )
+       {
+               // media object (images etc.)
+               $type = 'imagepopup';
+               
+               // TODO: check if media-object exists
+               // TODO: set some vars?
+       }
+       else
+       {
+               // show regular index page
+               global $startpos;
+               $type = 'index';
+       }
+       
+       // any type of skin with catid
+       if ( $catid && !$blogid )
+       {
+               $blogid = getBlogIDFromCatID($catid);
+       }
+       
+       // decide which blog should be displayed
+       if ( !$blogid )
+       {
+               $blogid = $CONF['DefaultBlog'];
+       }
+       
+       $b =& $manager->getBlog($blogid);
+       $blog = $b; // references can't be placed in global variables?
+       
+       if ( !$blog->isValid )
+       {
+               doError(_ERROR_NOSUCHBLOG);
+               return;
+       }
+       
+       // set catid if necessary
+       if ( $catid )
+       {
+               // check if the category is valid
+               if ( !$blog->isValidCategory($catid) )
+               {
+                       doError(_ERROR_NOSUCHCATEGORY);
+                       return;
+               }
+               else
+               {
+                       $blog->setSelectedCategory($catid);
+               }
+       }
+       
+       if ( !$skinid )
+       {
+               $skinid = $blog->getDefaultSkin();
+       }
+       
+       if ( !empty($special) && isValidShortName($special) )
+       {
+               $type = strtolower($special);
+       }
+       
+       $skin =& $manager->getSkin($skinid);
+       
+       if ( !$skin->isValid() )
+       {
+               doError(_ERROR_NOSUCHSKIN);
+               return;
+       }
+       
+       // set global skinpart variable so can determine quickly what is being parsed from any plugin or phpinclude
+       $skinpart = $type;
+       
+       // parse the skin
+       $skin->parse($type);
+       
+       // check to see we should throw JustPosted event
+       $blog->checkJustPosted();
+       return;
+ }
+ /**
+  * doError()
+  * Show error skin with given message. An optional skin-object to use can be given
+  * 
+  * @param     string  $msg
+  * @param     string  $skin
+  * @return    void
+  */
+ function doError($msg, $skin = '')
+ {
+       global $errormessage, $CONF, $skinid, $blogid, $manager;
+       
+       if ( $skin == '' )
+       {
+               if ( Skin::existsID($skinid) )
+               {
+                       $id = $skinid;
+               }
+               elseif ( $manager->existsBlogID($blogid) )
+               {
+                       $blog =& $manager->getBlog($blogid);
+                       $id = $blog->getDefaultSkin();
+               }
+               elseif ($CONF['DefaultBlog'] )
+               {
+                       $blog =& $manager->getBlog($CONF['DefaultBlog']);
+                       $id = $blog->getDefaultSkin();
+               }
+               else
+               {
+                       // this statement should actually never be executed
+                       $id = $CONF['BaseSkin'];
+               }
+               $skin =& $manager->getSkin($id);
+       }
+       
+       $errormessage = $msg;
+       $skin->parse('error');
+       return;
+ }
+ /**
+  * Errors before the database connection has been made
+  * 
+  * @param     string  $msg    message to notify
+  * @param     string  $title  page title
+  * @return    void
+  */
+ function startUpError($msg, $title)
+ {
+       header('Content-Type: text/xml; charset=' . i18n::get_current_charset());
+       echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
+       echo "<head>\n";
+       echo "<title>{$title}</title></head>\n";
+       echo "<body>\n";
+       echo "<h1>{$title}</h1>\n";
+       echo $msg;
+       echo "</body>\n";
+       echo "</html>\n";
+       exit;
+ }
+ function isValidShortName($name)
+ {
+       return preg_match('#^[a-z0-9]+$#i', $name);
+ }
+ function isValidDisplayName($name)
+ {
+       return preg_match('#^[a-z0-9]+[a-z0-9 ]*[a-z0-9]+$#i', $name);
+ }
+ function isValidCategoryName($name)
+ {
+       return 1;
+ }
+ function isValidTemplateName($name)
+ {
+       return preg_match('#^[a-z0-9/_\-]+$#i', $name);
+ }
+ function isValidSkinName($name)
+ {
+       return preg_match('#^[a-z0-9/_\-]+$#i', $name);
+ }
+ // add and remove linebreaks
+ function addBreaks($var)
+ {
+       return nl2br($var);
+ }
+ function removeBreaks($var)
+ {
+       return preg_replace("/<br \/>([\r\n])/", "$1", $var);
+ }
+ /**
+  * parseFile()
+  * 
+  * @param     string  $filename
+  * @param     string  $includeMode
+  * @param     string  $includePrefix
+  * @return    void
+  */
+ function parseFile($filename, $includeMode = 'normal', $includePrefix = '')
+ {
+       global $manager, $skinid;
+       
+       if ( !$skinid || !existsID($skinid) )
+       {
+               $skin =& $manager->getSkin($CONF['BaseSkin']);
+       }
+       else
+       {
+               $skin =& $manager->getSkin($skinid);
+       }
+       
+       $oldIncludeMode = Parser::getProperty('IncludeMode');
+       $oldIncludePrefix = Parser::getProperty('IncludePrefix');
+       
+       $skin->parse('fileparse', $filename);
+       
+       Parser::setProperty('IncludeMode', $oldIncludeMode);
+       Parser::setProperty('IncludePrefix', $oldIncludePrefix);
+       
+       return;
+ }
+ /**
+  * debug()
+  * Outputs a debug message
+  * 
+  * @param     string  $msg
+  * @return    void
+  */
+ function debug($msg)
+ {
+       echo '<p><b>' . $msg . "</b></p>\n";
+       return;
+ }
+ // shows a link to help file
+ function help($id)
+ {
+       echo helpHtml($id);
+       return;
+ }
+ function helpHtml($id)
+ {
+       global $CONF;
+       return helplink($id) . '<img src="' . $CONF['AdminURL'] . 'documentation/icon-help.gif" width="15" height="15" alt="' . _HELP_TT . '" title="' . _HELP_TT . '" /></a>';
+ }
+ function helplink($id)
+ {
+       global $CONF;
+       return '<a href="' . $CONF['AdminURL'] . 'documentation/help.html#'. $id . '" onclick="if (event &amp;&amp; event.preventDefault) event.preventDefault(); return help(this.href);">';
+ }
+ /**
+  * includephp()
+  * Includes a PHP file. This method can be called while parsing templates and skins
+  * 
+  * @param     string  $filename       name of file to parse
+  * @return    void
+  */
+ function includephp($filename)
+ {
+       // make predefined variables global, so most simple scripts can be used here
+       
+       // apache (names taken from PHP doc)
+       global $GATEWAY_INTERFACE, $SERVER_NAME, $SERVER_SOFTWARE, $SERVER_PROTOCOL;
+       global $REQUEST_METHOD, $QUERY_STRING, $DOCUMENT_ROOT, $HTTP_ACCEPT;
+       global $HTTP_ACCEPT_CHARSET, $HTTP_ACCEPT_ENCODING, $HTTP_ACCEPT_LANGUAGE;
+       global $HTTP_CONNECTION, $HTTP_HOST, $HTTP_REFERER, $HTTP_USER_AGENT;
+       global $REMOTE_ADDR, $REMOTE_PORT, $SCRIPT_FILENAME, $SERVER_ADMIN;
+       global $SERVER_PORT, $SERVER_SIGNATURE, $PATH_TRANSLATED, $SCRIPT_NAME;
+       global $REQUEST_URI;
+       
+       // php (taken from PHP doc)
+       global $argv, $argc, $PHP_SELF, $HTTP_COOKIE_VARS, $HTTP_GET_VARS, $HTTP_POST_VARS;
+       global $HTTP_POST_FILES, $HTTP_ENV_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS;
+       
+       // other
+       global $PATH_INFO, $HTTPS, $HTTP_RAW_POST_DATA, $HTTP_X_FORWARDED_FOR;
+       
+       if ( @file_exists($filename) )
+       {
+               include($filename);
+       }
+       return;
+ }
+ /**
+  * Checks if a certain plugin exists
+  * @param     string  $plug   name of plugin
+  * @return    boolean exists or not
+  */
+ function checkPlugin($name)
+ {
+       global $DIR_PLUGINS;
+       return file_exists($DIR_PLUGINS . preg_replace('#[\\\\|/]#', '', $name) . '.php');
+ }
+ /**
+  * alterQueryStr()
+  * 
+  * @param     string  $querystr       querystring to alter (e.g. foo=1&bar=2&x=y)
+  * @param     string  $param  name of parameter to change (e.g. 'foo')
+  * @param     string  $value  New value for that parameter (e.g. 3)
+  * @return    string  altered query string (for the examples above: foo=3&bar=2&x=y)
+  */
+ function alterQueryStr($querystr, $param, $value)
+ {
+       $vars = preg_split('#&#', $querystr);
+       $set = FALSE;
+       
+       for ( $i = 0; $i < count($vars); $i++ )
+       {
+               $v = preg_split('#=#', $vars[$i]);
+               
+               if ( $v[0] == $param )
+               {
+                       $v[1] = $value;
+                       $vars[$i] = implode('=', $v);
+                       $set = true;
+                       break;
+               }
+       }
+       if ( !$set )
+       {
+               $vars[] = "{$param}={$value}";
+       }
+       return ltrim(implode('&', $vars), '&');
+ }
+ /**
+  * passVar()
+  * passes one variable as hidden input field (multiple fields for arrays)
+  * @see passRequestVars in varsx.x.x.php
+  * 
+  * @param     string  $key
+  * @param     string  $value
+  * @return    void
+  */
+ function passVar($key, $value)
+ {
+       // array ?
+       if ( is_array($value) )
+       {
+               for ( $i = 0; $i < sizeof($value); $i++ )
+               {
+                       passVar($key . '[' . $i . ']', $value[$i]);
+               }
+               return;
+       }
+       
+       // other values: do stripslashes if needed
+       echo '<input type="hidden" name="' . Entity::hsc($key) . '" value="' . Entity::hsc(undoMagic($value)) . '" />' . "\n";
+       return;
+ }
+ /**
+  * checkVars()
+  * 
+  * @param     string  $variables
+  * @return    void
+  */
+ function checkVars($variables)
+ {
+       foreach ( $variables as $variable )
+       {
+               if ( array_key_exists($variable, $_GET)
+                 || array_key_exists($variable, $_POST)
+                 || array_key_exists($variable, $_COOKIE)
+                 || array_key_exists($variable, $_ENV)
+                 || (session_id() !== '' && array_key_exists($variable, $_SESSION))
+                 || array_key_exists($variable, $_FILES) )
+               {
+                       die('Sorry. An error occurred.');
+               }
+       }
+       return;
+ }
+ /**
+  * sanitizeParams()
+  * Sanitize parameters such as $_GET and $_SERVER['REQUEST_URI'] etc.
+  * to avoid XSS.
+  * 
+  * @param     void
+  * @return    void
+  */
+ function sanitizeParams()
+ {
+       $array = array();
+       $str = '';
+       $frontParam = '';
+       
+       // REQUEST_URI of $_SERVER
+       $str =& $_SERVER["REQUEST_URI"];
+       serverStringToArray($str, $array, $frontParam);
+       sanitizeArray($array);
+       arrayToServerString($array, $frontParam, $str);
+       
+       // QUERY_STRING of $_SERVER
+       $str =& $_SERVER["QUERY_STRING"];
+       serverStringToArray($str, $array, $frontParam);
+       sanitizeArray($array);
+       arrayToServerString($array, $frontParam, $str);
+       
+       // $_GET
+       convArrayForSanitizing($_GET, $array);
+       sanitizeArray($array);
+       revertArrayForSanitizing($array, $_GET);
+       
+       // $_REQUEST (only GET param)
+       convArrayForSanitizing($_REQUEST, $array);
+       sanitizeArray($array);
+       revertArrayForSanitizing($array, $_REQUEST);
+       
+       return;
+ }
+ function _addInputTags(&$keys,$prefix='')
+ {
+       foreach ( $keys as $key=>$value )
+       {
+               if ( $prefix )
+               {
+                       $key=$prefix.'['.$key.']';
+               }
+               if ( is_array($value) )
+               {
+                       _addInputTags($value,$key);
+               }
+               else
+               {
+                       if ( get_magic_quotes_gpc() )
+                               {$value=stripslashes($value);
+                       }
+                       if ( $key == 'ticket' )
+                       {
+                               continue;
+                       }
+                       echo '<input type="hidden" name="'.Entity::hsc($key).
+                            '" value="'.Entity::hsc($value).'" />'."\n";
+               }
+       }
+       return;
+ }
+ /**
+  * serverStringToArray()
+  * Convert the server string such as $_SERVER['REQUEST_URI']
+  * to arry like arry['blogid']=1 and array['page']=2 etc.
+  * 
+  * @param     string   $uri                           string
+  * @param     string  &$query_elements        elements of query according to application/x-www-form-urlencoded
+  * @param     string  &$hier_part                     hierarchical part includes path
+  * 
+  * NOTE:
+  * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax
+  * 3.  Syntax Components
+  * http://www.ietf.org/rfc/rfc3986.txt
+  * 
+  * Hypertext Markup Language - 2.0
+  * 8.2.1. The form-urlencoded Media Type
+  * http://tools.ietf.org/html/rfc1866#section-8.2.1
+  * 
+  * $_SERVER > Language Reference > Predefined Variables > PHP Manual
+  * http://www.php.net/manual/en/reserved.variables.server.php
+  */
+ function serverStringToArray($uri, &$query_elements, &$hier_part)
+ {
+       // init param
+       $query_elements = array();
+       $hier_part = "";
+       
+       // split hierarchical part, e.g. /index.php, query and fragment, e.g. blogid=1&page=2#section1
+       if ( i18n::strpos($uri, "?") > 0 )
+       {
+               list($hier_part, $query_and_fragment) = preg_split("#\?#", $uri, 2);
+       }
+       else
+       {
+               $query_and_fragment = $uri;
+               $hier_part = '';
+       }
+       
+       // If there is no query like blogid=1&page=2, return
+       if ( i18n::strpos($uri, "=") == FALSE && !i18n::strlen($hier_part) )
+       {
+               $hier_part = $uri;
+               return;
+       }
+       
+       $query_elements = preg_split("#&#", $query_and_fragment);
+       return;
+ }
+ /**
+  * arrayToServerString()
+  * Convert array like array['blogid'] to server string
+  * such as $_SERVER['REQUEST_URI']
+  * 
+  * @param     array    $query_elements        elements of query according to application/x-www-form-urlencoded
+  * @param     string   $hier_part                     hier-part defined in RFC3986
+  * @param     string  &$uri                           return value
+  * @return    void
+  * 
+  * NOTE:
+  * RFC 3986: Uniform Resource Identifiers (URI): Generic Syntax
+  * 3.  Syntax Components
+  * http://www.ietf.org/rfc/rfc3986.txt
+  * 
+  * Hypertext Markup Language - 2.0
+  * 8.2.1. The form-urlencoded Media Type
+  * http://tools.ietf.org/html/rfc1866#section-8.2.1
+  * 
+  * $_SERVER > Language Reference > Predefined Variables > PHP Manual
+  * http://www.php.net/manual/en/reserved.variables.server.php
+  */
+ function arrayToServerString($query_elements, $hier_part, &$uri)
+ {
+       if ( i18n::strpos($uri, "?") !== FALSE )
+       {
+               $uri = $hier_part . "?";
+       }
+       else
+       {
+               $uri = $hier_part;
+       }
+       if ( count($query_elements) > 0 )
+       {
+               $uri .= implode("&", $query_elements);
+       }
+       return;
+ }
+ /**
+  * sanitizeArray()
+  * Sanitize array parameters.
+  * This function checks both key and value.
+  * - check key if it inclues " (double quote),  remove from array
+  * - check value if it includes \ (escape sequece), remove remaining string
+  * 
+  * @param     array   &$array elements of query according to application/x-www-form-urlencoded
+  * @return    void
+  */
+ function sanitizeArray(&$array)
+ {
+       $excludeListForSanitization = array('query');
+       
+       foreach ( $array as $k => $v )
+       {
+               // split to key and value
+               list($key, $val) = preg_split("#=#", $v, 2);
+               if ( !isset($val) )
+               {
+                       continue;
+               }
+               
+               // when magic quotes is on, need to use stripslashes,
+               // and then addslashes
+               if ( get_magic_quotes_gpc() )
+               {
+                       $val = stripslashes($val);
+               }
+               
+               // note that we must use addslashes here because this function is called before the db connection is made
+               // and sql_real_escape_string needs a db connection
+               $val = addslashes($val);
+               
+               // if $key is included in exclude list, skip this param
+               if ( !in_array($key, $excludeListForSanitization) )
+               {
+                       // check value
+                       if ( i18n::strpos($val, '\\') > 0 )
+                       {
+                               list($val, $tmp) = preg_split('#\\\\#', $val);
+                       }
+                       
+                       // remove control code etc.
+                       $val = strtr($val, "\0\r\n<>'\"", "       ");
+                       
+                       // check key
+                       if ( preg_match('#\"#', $key) > 0 )
+                       {
+                               unset($array[$k]);
+                               continue;
+                       }
+                       
+                       // set sanitized info
+                       $array[$k] = sprintf("%s=%s", $key, $val);
+               }
+       }
+       return;
+ }
+ /**
+  * convArrayForSanitizing()
+  * Convert array for sanitizeArray function
+  * 
+  * @param     string  $src    array to be sanitized
+  * @param     array   &$array array to be temporarily stored
+  * @return    void
+  */
+ function convArrayForSanitizing($src, &$array)
+ {
+       $array = array();
+       foreach ( $src as $key => $val )
+       {
+               if ( !key_exists($key, $_GET) )
+               {
+                       continue;
+               }
+               $array[] = sprintf("%s=%s", $key, $val);
+               continue;
+       }
+       return;
+ }
+ /**
+  * revertArrayForSanitizing()
+  * Revert array after sanitizeArray function
+  * 
+  * @param     array   $array  element of query according to application/x-www-form-urlencoded
+  * @param     array   &$dst   combination of key and value
+  * @return    void
+  */
+ function revertArrayForSanitizing($array, &$dst)
+ {
+       foreach ( $array as $v )
+       {
+               list($key, $val) = preg_split("#=#", $v, 2);
+               $dst[$key] = $val;
+               continue;
+       }
+       return;
+ }
+ /**
++>>>>>>> skinnable-master
   * decodePathInfo()
   * 
   * @param     string  $virtualpath
@@@ -1948,399 -1978,399 +3787,798 @@@ function decodePathInfo($virtualpath
  
  
  /**
++<<<<<<< HEAD
 + * redirect()\r
 + * Stops processing the request and redirects to the given URL.\r
 + * - no actual contents should have been sent to the output yet\r
 + * - the URL will be stripped of illegal or dangerous characters\r
 + * \r
 + * @param     string  $uri\r
 + * @return    void\r
 + */\r
 +function redirect($url)\r
 +{\r
 +      $url = preg_replace('#[^a-z0-9-~+_.?\#=&;,/:@%*]#i', '', $url);\r
 +      header('Location: ' . $url);\r
 +      exit;\r
 +}\r
 +\r
 +/**\r
 + * getBookmarklet()\r
 + * Returns the Javascript code for a bookmarklet that works on most modern browsers\r
 + * \r
 + * @param     integer $blogid ID for weblog\r
 + * @return    script to call Bookmarklet\r
 + */\r
 +function getBookmarklet($blogid, $width=600,  $height=500)\r
 +{\r
 +      global $CONF;\r
 +      \r
 +      $script = "Q='';"\r
 +              . "x=document;"\r
 +              . "y=window;"\r
 +              . "if ( x.selection )"\r
 +              . "{"\r
 +              . " Q=x.selection.createRange().text;"\r
 +              . "}"\r
 +              . "else if ( y.getSelection )"\r
 +              . "{"\r
 +              . " Q=y.getSelection();"\r
 +              . "}"\r
 +              . "else if ( x.getSelection )"\r
 +              . "{"\r
 +              . " Q=x.getSelection();"\r
 +              . "}"\r
 +              . "wingm = window.open('{$CONF['AdminURL']}bookmarklet.php?blogid={$blogid}"\r
 +              . " &logtext=' + encodeURIComponent(Q) +"\r
 +              . " '&loglink=' + encodeURIComponent(x.location.href) +"\r
 +              . " '&loglinktitle=' + encodeURIComponent(x.title),"\r
 +              . " 'nucleusbm',"\r
 +              . " 'scrollbars=yes,width={$width},height={$height},left=10,top=10,status=yes,resizable=yes');"\r
 +              . "wingm.focus();";\r
 +      \r
 +      return $script;\r
 +}\r
 +\r
 +/**\r
 + * cleanFileName()\r
 + * cleans filename of uploaded file for writing to file system\r
 + *\r
 + * @param     string  $str\r
 + * @return    string  $cleaned filename ready for use\r
 + */\r
 +function cleanFileName($str)\r
 +{\r
 +      $str = strtolower($str);\r
 +      $ext_point = i18n::strrpos($str,".");\r
 +      if ( $ext_point === FALSE )\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +      $ext = i18n::substr($str,$ext_point,i18n::strlen($str));\r
 +      $str = i18n::substr($str,0,$ext_point);\r
 +      \r
 +      return preg_replace("#[^a-z0-9-]#", "_", $str) . $ext;\r
 +}\r
 +\r
 +/**\r
 + * use Notification class instead of this\r
 + * Deprecated since 4.0:\r
 + */\r
 +function getMailFooter()\r
 +{\r
 +      NOTIFICATION::get_mail_footer();\r
 +}\r
 +function isValidMailAddress($address)\r
 +{\r
 +      return NOTIFICATION::address_validation($address);\r
 +}\r
 +/**\r
 + * use Entity class instead of this\r
 + * Deprecated since 4.0:\r
 + */\r
 +function highlight($text, $expression, $highlight)\r
 +{\r
 +      return Entity::highlight($text, $expression, $highlight);\r
 +}\r
 +function shorten($string, $maxlength, $suffix)\r
 +{\r
 +      return Entity::shorten($string, $maxlength, $suffix);\r
 +}\r
 +function stringStripTags ($string)\r
 +{\r
 +      return Entity::strip_tags($string);\r
 +}\r
 +function toAscii($string)\r
 +{\r
 +      return Entity::anchor_footnoting($string);\r
 +}\r
 +function stringToAttribute ($string)\r
 +{\r
 +      return Entity::hsc($string);\r
 +}\r
 +function stringToXML ($string)\r
 +{\r
 +      return Entity::hen($string);\r
 +}\r
 +function encode_desc($data)\r
 +{\r
 +      return Entity::hen($data);\r
 +}\r
 +/**\r
 + * Centralisation of the functions that deals with locales\r
 + * This functions is based on the old way to deal with languages\r
 + * Deprecated since 4.0:\r
 + */\r
 +function getLanguageName()\r
 +{\r
 +      if( ($language = i18n::convert_locale_to_old_language_file_name(i18n::get_current_locale())) === FALSE )\r
 +      {\r
 +              $language ='english';\r
 +      }\r
 +      return $language;\r
 +}\r
 +function selectLanguage($language)\r
 +{\r
 +      global $DIR_LANG;\r
 +      include($DIR_LANG . preg_replace('#[\\\\|/]#', '', $language) . '.php');\r
 +      return;\r
 +}\r
 +/**\r
 + * use i18n class instead of these\r
 + * Deprecated since 4.0\r
 + */\r
 +function checkLanguage($lang)\r
 +{\r
 +      return ( preg_match('#^(.+)_(.+)_(.+)$#', $lang)\r
 +        || i18n::convert_old_language_file_name_to_locale($lang) );\r
 +}\r
 +function formatDate($format, $timestamp, $default_format, &$blog)\r
 +{\r
 +      $offset = date('Z', $timestamp);\r
 +      if ( $blog )\r
 +      {\r
 +              $offset += $blog->getTimeOffset() * 3600;\r
 +      }\r
 +      return i18n::formatted_datetime($format, $timestamp, $offset, $default_format);\r
 +}\r
 +\r
 +/**\r
 + * use DB class instead of these\r
 + * Deprecated since 4.0\r
 + */\r
 +function quickQuery($query)\r
 +{\r
 +      $row = DB::getRow($query);\r
 +      return $row['result'];\r
 +}\r
 +function mysqldate($timestamp)\r
 +{\r
 +      return DB::formatDateTime($timestamp);\r
 + }\r
 +/**\r
 + * Centralisation of the functions that generate links\r
 + * Deprecated since 4.0:\r
 + * Please use Link::FunctionName(...) instead\r
 + */\r
 +function createItemLink($itemid, $extra = '')\r
 +{\r
 +      return Link::create_item_link($itemid, $extra);\r
 +}\r
 +function createMemberLink($memberid, $extra = '')\r
 +{\r
 +      return Link::create_member_link($memberid, $extra);\r
 +}\r
 +function createCategoryLink($catid, $extra = '')\r
 +{\r
 +      return Link::create_category_link($catid, $extra);\r
 +}\r
 +function createArchiveListLink($blogid = '', $extra = '')\r
 +{\r
 +      return Link::create_archivelist_link($blogid, $extra);\r
 +}\r
 +function createArchiveLink($blogid, $archive, $extra = '')\r
 +{\r
 +      return Link::create_archive_link($blogid, $archive, $extra);\r
 +}\r
 +function createBlogidLink($blogid, $params = '')\r
 +{\r
 +      return Link::create_blogid_link($blogid, $params = '');\r
 +}\r
 +function createLink($type, $params)\r
 +{\r
 +      return Link::create_link($type, $params);\r
 +}\r
 +function createBlogLink($url, $params)\r
 +{\r
 +      return Link::create_blog_link($url, $params);\r
 +}\r
 +/**\r
 + * use ActionLog class instead of this\r
 + * Deprecated since 4.0\r
 + */\r
 +function addToLog($level, $msg)\r
 +{\r
 +      ActionLog::add($level, $msg);\r
 +}\r
 +/**\r
 + * use PHP's implement\r
 + * Deprecated since 4.0\r
 + */\r
 +function ifset(&$var)\r
 +{\r
 +      if ( isset($var) )\r
 +      {\r
 +              return $var;\r
 +      }\r
 +      \r
 +      return NULL;\r
 +}\r
 +/**\r
 + * use Manager::getPluginNameFromPid() instead of this\r
 + * Deprecated since 4.0\r
 + */\r
 +function getPluginNameFromPid($pid)\r
 +{\r
 +      global $manager;\r
 +      return $manager->getPluginNameFromPid($pid);\r
 +}\r
 +/**\r
 + * use Manager::numberOfEventSubscribers() instead of this\r
 + * Deprecated since 4.0\r
 + */\r
 +function numberOfEventSubscribers($event)\r
 +{\r
 +      global $manager;\r
 +      return $manager->getNumberOfSubscribers($event);\r
 +}\r
 +\r
 +/**\r
 + * PluginAdmin has already the alternative implement\r
 + * Deprecated since 4.0\r
 + */\r
 +function ticketForPlugin()\r
 +{\r
 +      global $CONF, $DIR_LIBS, $DIR_LOCALES, $DIR_PLUGINS, $manager, $member, $ticketforplugin;\r
 +      \r
 +      /* initialize */\r
 +      $ticketforplugin = array();\r
 +      $ticketforplugin['ticket'] = FALSE;\r
 +      \r
 +      /* Check if using plugin's php file. */\r
 +      $p_translated = serverVar('SCRIPT_FILENAME');\r
 +      \r
 +      if (!file_exists($p_translated) )\r
 +      {\r
 +              header("HTTP/1.0 404 Not Found");\r
 +              exit('');\r
 +      }\r
 +      \r
 +      // check whether this is plugin or not\r
 +      $p_translated = str_replace('\\', '/', $p_translated);\r
 +      $d_plugins = str_replace('\\', '/', $DIR_PLUGINS);\r
 +      if ( i18n::strpos($p_translated, $d_plugins) !== 0 )\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      // Solve the plugin php file or admin directory\r
 +      $phppath = i18n::substr($p_translated, i18n::strlen($d_plugins) );\r
 +      // Remove the first "/" if exists.\r
 +      $phppath = preg_replace('#^/#', '', $phppath);\r
 +      // Remove the first "NP_" and the last ".php" if exists.\r
 +      $path = preg_replace('#^NP_(.*)\.php$#', '$1', $phppath);\r
 +      // Remove the "/" and beyond.\r
 +      $path = preg_replace('#^([^/]*)/(.*)$#', '$1', $path);\r
 +      \r
 +      // Solve the plugin name.\r
 +      $plugins = array();\r
 +      $query = sprintf('SELECT pfile FROM %s;', sql_table('plugin'));\r
 +      $res = DB::getResult($query);\r
 +      \r
 +      foreach ( $res as $row )\r
 +      {\r
 +              $name = i18n::substr($row['pfile'], 3);\r
 +              $plugins[strtolower($name)] = $name;\r
 +      }\r
 +      \r
 +      $res->closeCursor();\r
 +      \r
 +      if ( !array_key_exists($path, $plugins) )\r
 +      {\r
 +              header("HTTP/1.0 404 Not Found");\r
 +              exit('');\r
 +      }\r
 +      else\r
 +      {\r
 +              $plugin_name = $plugins[$path];\r
 +      }\r
 +      \r
 +      /* Return if not index.php */\r
 +      if ( ($phppath != strtolower($plugin_name) . '/')\r
 +        && ($phppath != strtolower($plugin_name) . '/index.php') )\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      /* Exit if not logged in. */\r
 +      if ( !$member->isLoggedIn() )\r
 +      {\r
 +              exit('You aren\'t logged in.');\r
 +      }\r
 +      \r
 +      /* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */\r
 +      if ( $file = @file($p_translated) )\r
 +      {\r
 +              $prevline = '';\r
 +              \r
 +              foreach($file as $line)\r
 +              {\r
 +                      if (preg_match('#[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]#i', $prevline . $line) )\r
 +                      {\r
 +                              return;\r
 +                      }\r
 +                      \r
 +                      $prevline = $line;\r
 +              }\r
 +      }\r
 +      \r
 +      /* Show a form if not valid ticket */\r
 +      if ( (i18n::strpos(serverVar('REQUEST_URI'), '?') !== FALSE\r
 +        || serverVar('QUERY_STRING')\r
 +        || strtoupper(serverVar('REQUEST_METHOD') ) == 'POST')\r
 +        && !$manager->checkTicket() )\r
 +      {\r
 +              $oPluginAdmin = new PluginAdmin($plugin_name);\r
 +              $oPluginAdmin->start();\r
 +              \r
 +              echo '<p>' . _ERROR_BADTICKET . "</p>\n";\r
 +              \r
 +              // Resolve URI and QUERY_STRING\r
 +              if ($uri = serverVar('REQUEST_URI') )\r
 +              {\r
 +                      list($uri, $qstring) = preg_split('#\?#', $uri);\r
 +              }\r
 +              else\r
 +              {\r
 +                      if ( !($uri = serverVar('PHP_SELF') ) )\r
 +                      {\r
 +                              $uri = serverVar('SCRIPT_NAME');\r
 +                      }\r
 +                      $qstring = serverVar('QUERY_STRING');\r
 +              }\r
 +              if ($qstring)\r
 +              {\r
 +                      $qstring = '?' . $qstring;\r
 +              }\r
 +              \r
 +              echo '<p>' . _SETTINGS_UPDATE . ' : ' . _QMENU_PLUGINS . ' <span style="color:red;">' . Entity::hsc($plugin_name) . "</span> ?</p>\n";\r
 +              \r
 +              switch(strtoupper(serverVar('REQUEST_METHOD') ) )\r
 +              {\r
 +                      case 'POST':\r
 +                              echo '<form method="POST" action="'.Entity::hsc($uri.$qstring).'">';\r
 +                              $manager->addTicketHidden();\r
 +                              _addInputTags($_POST);\r
 +                              break;\r
 +                      \r
 +                      case 'GET':\r
 +                              echo '<form method="GET" action="'.Entity::hsc($uri).'">';\r
 +                              $manager->addTicketHidden();\r
 +                              _addInputTags($_GET);\r
 +                      \r
 +                      default:\r
 +                              break;\r
 +              }\r
 +              \r
 +              echo '<input type="submit" value="' . _YES . '" />&nbsp;&nbsp;&nbsp;&nbsp;';\r
 +              echo '<input type="button" value="' . _NO . '" onclick="history.back(); return false;" />';\r
 +              echo "</form>\n";\r
 +              \r
 +              $oPluginAdmin->end();\r
 +              exit;\r
 +      }\r
 +      \r
 +      /* Create new ticket */\r
 +      $ticket=$manager->addTicketToUrl('');\r
 +      $ticketforplugin['ticket'] = preg_split($ticket, i18n::strpos($ticket, 'ticket=') + 7);\r
 +      return;\r
 +}\r
++=======
+  * redirect()
+  * Stops processing the request and redirects to the given URL.
+  * - no actual contents should have been sent to the output yet
+  * - the URL will be stripped of illegal or dangerous characters
+  * 
+  * @param     string  $uri
+  * @return    void
+  */
+ function redirect($url)
+ {
+       $url = preg_replace('#[^a-z0-9-~+_.?\#=&;,/:@%*]#i', '', $url);
+       header('Location: ' . $url);
+       exit;
+ }
+ /**
+  * getBookmarklet()
+  * Returns the Javascript code for a bookmarklet that works on most modern browsers
+  * 
+  * @param     integer $blogid ID for weblog
+  * @return    script to call Bookmarklet
+  */
+ function getBookmarklet($blogid, $width=600,  $height=500)
+ {
+       global $CONF;
+       
+       $script = "Q='';"
+               . "x=document;"
+               . "y=window;"
+               . "if ( x.selection )"
+               . "{"
+               . " Q=x.selection.createRange().text;"
+               . "}"
+               . "else if ( y.getSelection )"
+               . "{"
+               . " Q=y.getSelection();"
+               . "}"
+               . "else if ( x.getSelection )"
+               . "{"
+               . " Q=x.getSelection();"
+               . "}"
+               . "wingm = window.open('{$CONF['AdminURL']}bookmarklet.php?blogid={$blogid}"
+               . " &logtext=' + encodeURIComponent(Q) +"
+               . " '&loglink=' + encodeURIComponent(x.location.href) +"
+               . " '&loglinktitle=' + encodeURIComponent(x.title),"
+               . " 'nucleusbm',"
+               . " 'scrollbars=yes,width={$width},height={$height},left=10,top=10,status=yes,resizable=yes');"
+               . "wingm.focus();";
+       
+       return $script;
+ }
+ /**
+  * cleanFileName()
+  * cleans filename of uploaded file for writing to file system
+  *
+  * @param     string  $str
+  * @return    string  $cleaned filename ready for use
+  */
+ function cleanFileName($str)
+ {
+       $str = strtolower($str);
+       $ext_point = i18n::strrpos($str,".");
+       if ( $ext_point === FALSE )
+       {
+               return FALSE;
+       }
+       $ext = i18n::substr($str,$ext_point,i18n::strlen($str));
+       $str = i18n::substr($str,0,$ext_point);
+       
+       return preg_replace("#[^a-z0-9-]#", "_", $str) . $ext;
+ }
+ /**
+  * use Notification class instead of this
+  * Deprecated since 4.0:
+  */
+ function getMailFooter()
+ {
+       NOTIFICATION::get_mail_footer();
+ }
+ function isValidMailAddress($address)
+ {
+       return NOTIFICATION::address_validation($address);
+ }
+ /**
+  * use Entity class instead of this
+  * Deprecated since 4.0:
+  */
+ function highlight($text, $expression, $highlight)
+ {
+       return Entity::highlight($text, $expression, $highlight);
+ }
+ function shorten($string, $maxlength, $suffix)
+ {
+       return Entity::shorten($string, $maxlength, $suffix);
+ }
+ function stringStripTags ($string)
+ {
+       return Entity::strip_tags($string);
+ }
+ function toAscii($string)
+ {
+       return Entity::anchor_footnoting($string);
+ }
+ function stringToAttribute ($string)
+ {
+       return Entity::hsc($string);
+ }
+ function stringToXML ($string)
+ {
+       return Entity::hen($string);
+ }
+ function encode_desc($data)
+ {
+       return Entity::hen($data);
+ }
+ /**
+  * Centralisation of the functions that deals with locales
+  * This functions is based on the old way to deal with languages
+  * Deprecated since 4.0:
+  */
+ function getLanguageName()
+ {
+       if( ($language = i18n::convert_locale_to_old_language_file_name(i18n::get_current_locale())) === FALSE )
+       {
+               $language ='english';
+       }
+       return $language;
+ }
+ function selectLanguage($language)
+ {
+       global $DIR_LANG;
+       include($DIR_LANG . preg_replace('#[\\\\|/]#', '', $language) . '.php');
+       return;
+ }
+ /**
+  * use i18n class instead of these
+  * Deprecated since 4.0
+  */
+ function checkLanguage($lang)
+ {
+       return ( preg_match('#^(.+)_(.+)_(.+)$#', $lang)
+         || i18n::convert_old_language_file_name_to_locale($lang) );
+ }
+ function formatDate($format, $timestamp, $default_format, &$blog)
+ {
+       $offset = date('Z', $timestamp);
+       if ( $blog )
+       {
+               $offset += $blog->getTimeOffset() * 3600;
+       }
+       return i18n::formatted_datetime($format, $timestamp, $offset, $default_format);
+ }
+ /**
+  * use DB class instead of these
+  * Deprecated since 4.0
+  */
+ function quickQuery($query)
+ {
+       $row = DB::getRow($query);
+       return $row['result'];
+ }
+ function mysqldate($timestamp)
+ {
+       return DB::formatDateTime($timestamp);
+  }
+ /**
+  * Centralisation of the functions that generate links
+  * Deprecated since 4.0:
+  * Please use Link::FunctionName(...) instead
+  */
+ function createItemLink($itemid, $extra = '')
+ {
+       return Link::create_item_link($itemid, $extra);
+ }
+ function createMemberLink($memberid, $extra = '')
+ {
+       return Link::create_member_link($memberid, $extra);
+ }
+ function createCategoryLink($catid, $extra = '')
+ {
+       return Link::create_category_link($catid, $extra);
+ }
+ function createArchiveListLink($blogid = '', $extra = '')
+ {
+       return Link::create_archivelist_link($blogid, $extra);
+ }
+ function createArchiveLink($blogid, $archive, $extra = '')
+ {
+       return Link::create_archive_link($blogid, $archive, $extra);
+ }
+ function createBlogidLink($blogid, $params = '')
+ {
+       return Link::create_blogid_link($blogid, $params = '');
+ }
+ function createLink($type, $params)
+ {
+       return Link::create_link($type, $params);
+ }
+ function createBlogLink($url, $params)
+ {
+       return Link::create_blog_link($url, $params);
+ }
+ /**
+  * use ActionLog class instead of this
+  * Deprecated since 4.0
+  */
+ function addToLog($level, $msg)
+ {
+       ActionLog::add($level, $msg);
+ }
+ /**
+  * use PHP's implement
+  * Deprecated since 4.0
+  */
+ function ifset(&$var)
+ {
+       if ( isset($var) )
+       {
+               return $var;
+       }
+       
+       return NULL;
+ }
+ /**
+  * use Manager::getPluginNameFromPid() instead of this
+  * Deprecated since 4.0
+  */
+ function getPluginNameFromPid($pid)
+ {
+       global $manager;
+       return $manager->getPluginNameFromPid($pid);
+ }
+ /**
+  * use Manager::numberOfEventSubscribers() instead of this
+  * Deprecated since 4.0
+  */
+ function numberOfEventSubscribers($event)
+ {
+       global $manager;
+       return $manager->getNumberOfSubscribers($event);
+ }
+ /**
+  * PluginAdmin has already the alternative implement
+  * Deprecated since 4.0
+  */
+ function ticketForPlugin()
+ {
+       global $CONF, $DIR_LIBS, $DIR_LOCALES, $DIR_PLUGINS, $manager, $member, $ticketforplugin;
+       
+       /* initialize */
+       $ticketforplugin = array();
+       $ticketforplugin['ticket'] = FALSE;
+       
+       /* Check if using plugin's php file. */
+       $p_translated = serverVar('SCRIPT_FILENAME');
+       
+       if (!file_exists($p_translated) )
+       {
+               header("HTTP/1.0 404 Not Found");
+               exit('');
+       }
+       
+       // check whether this is plugin or not
+       $p_translated = str_replace('\\', '/', $p_translated);
+       $d_plugins = str_replace('\\', '/', $DIR_PLUGINS);
+       if ( i18n::strpos($p_translated, $d_plugins) !== 0 )
+       {
+               return;
+       }
+       
+       // Solve the plugin php file or admin directory
+       $phppath = i18n::substr($p_translated, i18n::strlen($d_plugins) );
+       // Remove the first "/" if exists.
+       $phppath = preg_replace('#^/#', '', $phppath);
+       // Remove the first "NP_" and the last ".php" if exists.
+       $path = preg_replace('#^NP_(.*)\.php$#', '$1', $phppath);
+       // Remove the "/" and beyond.
+       $path = preg_replace('#^([^/]*)/(.*)$#', '$1', $path);
+       
+       // Solve the plugin name.
+       $plugins = array();
+       $query = sprintf('SELECT pfile FROM %s;', sql_table('plugin'));
+       $res = DB::getResult($query);
+       
+       foreach ( $res as $row )
+       {
+               $name = i18n::substr($row['pfile'], 3);
+               $plugins[strtolower($name)] = $name;
+       }
+       
+       $res->closeCursor();
+       
+       if ( !array_key_exists($path, $plugins) )
+       {
+               header("HTTP/1.0 404 Not Found");
+               exit('');
+       }
+       else
+       {
+               $plugin_name = $plugins[$path];
+       }
+       
+       /* Return if not index.php */
+       if ( ($phppath != strtolower($plugin_name) . '/')
+         && ($phppath != strtolower($plugin_name) . '/index.php') )
+       {
+               return;
+       }
+       
+       /* Exit if not logged in. */
+       if ( !$member->isLoggedIn() )
+       {
+               exit('You aren\'t logged in.');
+       }
+       
+       /* Check if this feature is needed (ie, if "$manager->checkTicket()" is not included in the script). */
+       if ( $file = @file($p_translated) )
+       {
+               $prevline = '';
+               
+               foreach($file as $line)
+               {
+                       if (preg_match('#[\$]manager([\s]*)[\-]>([\s]*)checkTicket([\s]*)[\(]#i', $prevline . $line) )
+                       {
+                               return;
+                       }
+                       
+                       $prevline = $line;
+               }
+       }
+       
+       /* Show a form if not valid ticket */
+       if ( (i18n::strpos(serverVar('REQUEST_URI'), '?') !== FALSE
+         || serverVar('QUERY_STRING')
+         || strtoupper(serverVar('REQUEST_METHOD') ) == 'POST')
+         && !$manager->checkTicket() )
+       {
+               $oPluginAdmin = new PluginAdmin($plugin_name);
+               $oPluginAdmin->start();
+               
+               echo '<p>' . _ERROR_BADTICKET . "</p>\n";
+               
+               // Resolve URI and QUERY_STRING
+               if ($uri = serverVar('REQUEST_URI') )
+               {
+                       list($uri, $qstring) = preg_split('#\?#', $uri);
+               }
+               else
+               {
+                       if ( !($uri = serverVar('PHP_SELF') ) )
+                       {
+                               $uri = serverVar('SCRIPT_NAME');
+                       }
+                       $qstring = serverVar('QUERY_STRING');
+               }
+               if ($qstring)
+               {
+                       $qstring = '?' . $qstring;
+               }
+               
+               echo '<p>' . _SETTINGS_UPDATE . ' : ' . _QMENU_PLUGINS . ' <span style="color:red;">' . Entity::hsc($plugin_name) . "</span> ?</p>\n";
+               
+               switch(strtoupper(serverVar('REQUEST_METHOD') ) )
+               {
+                       case 'POST':
+                               echo '<form method="POST" action="'.Entity::hsc($uri.$qstring).'">';
+                               $manager->addTicketHidden();
+                               _addInputTags($_POST);
+                               break;
+                       
+                       case 'GET':
+                               echo '<form method="GET" action="'.Entity::hsc($uri).'">';
+                               $manager->addTicketHidden();
+                               _addInputTags($_GET);
+                       
+                       default:
+                               break;
+               }
+               
+               echo '<input type="submit" value="' . _YES . '" />&nbsp;&nbsp;&nbsp;&nbsp;';
+               echo '<input type="button" value="' . _NO . '" onclick="history.back(); return false;" />';
+               echo "</form>\n";
+               
+               $oPluginAdmin->end();
+               exit;
+       }
+       
+       /* Create new ticket */
+       $ticket=$manager->addTicketToUrl('');
+       $ticketforplugin['ticket'] = preg_split($ticket, i18n::strpos($ticket, 'ticket=') + 7);
+       return;
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/**\r
 + * i18n class for Nucleus CMS\r
 + * written by Takashi Sakamoto as of Feb 03, 2012\r
 + * \r
 + * This includes wrapper functions of iconv and mbstring\r
 + * for multibyte processing and includes parameters related to locale.\r
 + * \r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2011 The Nucleus Group\r
 + * @version $Id: i18n.php 1678 2012-02-26 07:31:36Z sakamocchi $\r
 + */\r
 +class i18n\r
 +{\r
 +      static private $mode = FALSE;\r
 +      \r
 +      static private $current_charset = '';\r
 +      static private $current_language = '';\r
 +      static private $current_script = '';\r
 +      static private $current_region = '';\r
 +      \r
 +      static private $locale_list = array();\r
 +      static private $timezone = 'UTC';\r
 +      \r
 +      static private $forced_charset = '';\r
 +      static private $forced_language = '';\r
 +      static private $forced_script = '';\r
 +      static private $forced_region = '';\r
 +      \r
 +      /**\r
 +       * i18n::init\r
 +       * Initializing i18n class\r
 +       * \r
 +       * @static\r
 +       * @param       string  $charset        character set\r
 +       * @return      boolean \r
 +       */\r
 +      static public function init($charset, $dir)\r
 +      {\r
 +              /* i18n is already initialized */\r
 +              if ( self::$mode )\r
 +              {\r
 +                      return TRUE;\r
 +              }\r
 +              \r
 +              /* make locale list in this Nucleus CMS */\r
 +              if ( ($handle = opendir($dir)) === FALSE )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              while ($filename = readdir($handle))\r
 +              {\r
 +                      if (preg_match("#^(.+_.+_.+)\.{$charset}\.php$#", $filename, $matches) )\r
 +                      {\r
 +                              if ( !in_array($matches[1], self::$locale_list) )\r
 +                              {\r
 +                                      self::$locale_list[] = $matches[1];\r
 +                              }\r
 +                      }\r
 +              }\r
 +              closedir($handle);\r
 +              \r
 +              /* set i18n backend and validate character set */\r
 +              if ( extension_loaded('iconv') )\r
 +              {\r
 +                      /* this is just for checking the charset. */\r
 +                      if ( iconv_set_encoding('internal_encoding', $charset)\r
 +                       && iconv_set_encoding('output_encoding', $charset)\r
 +                       && iconv_set_encoding('internal_encoding', $charset) )\r
 +                      {\r
 +                              self::$current_charset = $charset;\r
 +                              self::$mode = 'iconv';\r
 +                      }\r
 +              }\r
 +              else if ( extension_loaded('mbstring') )\r
 +              {\r
 +                      /* this is just for checking the charset. */\r
 +                      if ( mb_http_output($charset)\r
 +                       && mb_internal_encoding($charset)\r
 +                       && mb_regex_encoding($charset) )\r
 +                      {\r
 +                              self::$current_charset = $charset;\r
 +                              self::$mode = 'mbstring';\r
 +                      }\r
 +              }\r
 +              \r
 +              return TRUE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_available_locale_list\r
 +       * return available locale list with current charset\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      array   available locale list\r
 +       */\r
 +      static public function get_available_locale_list()\r
 +      {\r
 +              return self::$locale_list;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_current_charset\r
 +       * return current charset\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      string  $charset        current character set\r
 +       */\r
 +      static public function get_current_charset()\r
 +      {\r
 +              return self::$current_charset;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::set_locale\r
 +       * Set current locale\r
 +       * \r
 +       * NOTE:\r
 +       * naming rule is "$language_$script_$region.$charset.php", refer to RFC 5646.\r
 +       * @link http://www.ietf.org/rfc/rfc5646.txt\r
 +       * @see 2.  The Language Tag\r
 +       * \r
 +       * @static\r
 +       * @param       string  $locale\r
 +       * @return      bool    TRUE/FALSE\r
 +       * \r
 +       */\r
 +      static public function set_current_locale($locale)\r
 +      {\r
 +              if ( preg_match('#^(.+)_(.+)_(.+)$#', $locale, $match) )\r
 +              {\r
 +                      self::$current_language = $match[1];\r
 +                      self::$current_script   = $match[2];\r
 +                      self::$current_region   = $match[3];\r
 +                      return TRUE;\r
 +              }\r
 +              return FALSE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_locale\r
 +       * Get current locale\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      $locale\r
 +       */\r
 +      static public function get_current_locale()\r
 +      {\r
 +              $elements = array(self::$current_language, self::$current_script, self::$current_region);\r
 +              return implode('_', $elements);\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::set_forced_locale()\r
 +       * Set forced locale\r
 +       * \r
 +       * @static\r
 +       * @param       string  $forced_locale\r
 +       * @return      bool    TRUE/FALSE\r
 +       * \r
 +       */\r
 +      static public function set_forced_locale($forced_locale)\r
 +      {\r
 +              if ( preg_match('#^(.+)_(.+)_(.+)$#', $forced_locale, $match) )\r
 +              {\r
 +                      self::$forced_language  = $match[1];\r
 +                      self::$forced_script    = $match[2];\r
 +                      self::$forced_region    = $match[3];\r
 +                      return TRUE;\r
 +              }\r
 +              return FALSE;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_forced_locale\r
 +       * Get forced locale\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      $forced_locale\r
 +       */\r
 +      static public function get_forced_locale()\r
 +      {\r
 +              if ( !self::$forced_language )\r
 +              {\r
 +                      return '';\r
 +              }\r
 +              \r
 +              $elements = array(self::$forced_language, self::$forced_script, self::$forced_region);\r
 +              return implode('_', $elements);\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::set_forced_charset\r
 +       * return forced charset\r
 +       * \r
 +       * @static\r
 +       * @param       void    $charset        forced character set\r
 +       * @return      void\r
 +       */\r
 +      static public function set_forced_charset($forced_charset)\r
 +      {\r
 +              self::$forced_charset = $forced_charset;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_forced_charset\r
 +       * return forced charset\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      string  $charset        forced character set\r
 +       */\r
 +      static public function get_forced_charset()\r
 +      {\r
 +              return self::$forced_charset;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::confirm_default_date_timezone\r
 +       * to avoid E_NOTICE or E_WARNING generated when every calling to a date/time function.\r
 +       * \r
 +       * NOTE:\r
 +       * Some private servers are lack of its timezone setting\r
 +       * http://www.php.net/manual/en/function.date-default-timezone-set.php\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      void\r
 +       */\r
 +      static public function confirm_default_date_timezone()\r
 +      {\r
 +              if ( function_exists('date_default_timezone_get') \r
 +               && FALSE !== ($timezone = @date_default_timezone_get()))\r
 +              {\r
 +                      self::$timezone = $timezone;\r
 +              }\r
 +              if (function_exists('date_default_timezone_set')) {\r
 +                       @date_default_timezone_set(self::$timezone);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::get_current_date_timezone()\r
 +       * get current timezone\r
 +       * \r
 +       * @static\r
 +       * @param       void\r
 +       * @return      $timezone\r
 +       */\r
 +      static public function get_date_timezone()\r
 +      {\r
 +              return self::$timezone;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::convert\r
 +       * character set converter\r
 +       * \r
 +       * @static\r
 +       * @param       string  $string target string binary\r
 +       * @param       string  $from   original character set encoding\r
 +       * @param       string  $to     target character set encoding\r
 +       * @return      string  converted string\r
 +       */\r
 +      static public function convert($string, $from, $to='')\r
 +      {\r
 +              if ( $to == '' )\r
 +              {\r
 +                      $to = self::$current_charset;\r
 +              }\r
 +              \r
 +              if ( $from == $to )\r
 +              {\r
 +                      /* do nothing */\r
 +              }\r
 +              else if ( self::$mode == 'iconv' )\r
 +              {\r
 +                      $string = iconv($from, $to.'//TRANSLIT', $string);\r
 +              }\r
 +              else if ( self::$mode == 'mbstring' )\r
 +              {\r
 +                      $string = mb_convert_encoding($string, $to, $from);\r
 +              }\r
 +              return (string) $string;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::convert_handler\r
 +       * callable handler for character set converter\r
 +       * \r
 +       * @static\r
 +       * @param       string  $string target string binary\r
 +       * @return      void\r
 +       */\r
 +      static public function convert_handler($string)\r
 +      {\r
 +              return self::convert($string, self::$current_charset, self::$forced_charset);\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::convert_array\r
 +       * recursively converting array\r
 +       * \r
 +       * @static\r
 +       * @param       array   $array  array to convert\r
 +       * @return      void\r
 +       */\r
 +      static public function convert_array($array, $from, $to='')\r
 +      {\r
 +              if ( !is_array($array) )\r
 +              {\r
 +                      $array = self::convert($array, $from, $to);\r
 +              }\r
 +              else\r
 +              {\r
 +                      foreach ( $array as $key => $value )\r
 +                      {\r
 +                              if ( !is_array($value) )\r
 +                              {\r
 +                                      $array[$key] = self::convert($value, $from, $to);\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      self::convert_array($array[$key]);\r
 +                              }\r
 +                      }\r
 +              }\r
 +              \r
 +              return $array;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::strlen\r
 +       * strlen wrapper\r
 +       * \r
 +       * @static\r
 +       * @param       string  $string target string\r
 +       * @return      integer the number of letters\r
 +       */\r
 +      static public function strlen($string)\r
 +      {\r
 +              $length = 0;\r
 +              if ( self::$mode == 'iconv' )\r
 +              {\r
 +                      $length = iconv_strlen($string, self::$current_charset);\r
 +              }\r
 +              else if ( self::$mode == 'mbstring' )\r
 +              {\r
 +                      $length = mb_strlen($string, self::$current_charset);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $length = strlen($string);\r
 +              }\r
 +              return (integer) $length;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::strpos\r
 +       * strpos wrapper\r
 +       * \r
 +       * @static\r
 +       * @param       string  $haystack       string to search\r
 +       * @param       string  $needle string for search\r
 +       * @param       integer $offset the position from which the search should be performed. \r
 +       * @return      integer/FALSE   the numeric position of the first occurrence of needle in haystack\r
 +       */\r
 +      static public function strpos($haystack, $needle, $offset=0)\r
 +      {\r
 +              $position = 0;\r
 +              if ( self::$mode == 'iconv' )\r
 +              {\r
 +                      $position = iconv_strpos($haystack, $needle, $offset, self::$current_charset);\r
 +              }\r
 +              else if ( self::$mode == 'mbstring' )\r
 +              {\r
 +                      $position = mb_strpos($haystack, $needle, $offset, self::$current_charset);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $position = strpos($haystack, $needle, $offset);\r
 +              }\r
 +              \r
 +              if ( $position !== FALSE)\r
 +              {\r
 +                      $position = (integer) $position;\r
 +              }\r
 +              return $position;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::strrpos\r
 +       * strrpos wrapper\r
 +       * \r
 +       * @static\r
 +       * @param       string  $haystack       string to search\r
 +       * @param       string  $needle string for search\r
 +       * @return      integer/FALSE   the numeric position of the last occurrence of needle in haystack\r
 +       */\r
 +      static public function strrpos ($haystack, $needle)\r
 +      {\r
 +              $position = 0;\r
 +              if ( self::$mode == 'iconv' )\r
 +              {\r
 +                      $position = iconv_strrpos($haystack, $needle, self::$current_charset);\r
 +              }\r
 +              else if ( self::$mode == 'mbstring' )\r
 +              {\r
 +                      $position = mb_strrpos($haystack, $needle, 0, self::$current_charset);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $position = strrpos($haystack, $needle, 0);\r
 +              }\r
 +              \r
 +              if ( $position !== FALSE)\r
 +              {\r
 +                      $position = (integer) $position;\r
 +              }\r
 +              return $position;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::substr\r
 +       * substr wrapper\r
 +       * \r
 +       * @static\r
 +       * @param       string  $string string to be cut\r
 +       * @param       string  $start  the position of starting\r
 +       * @param       integer $length the length to be cut\r
 +       * @return      string  the extracted part of string\r
 +       */\r
 +      static public function substr($string, $start, $length=0)\r
 +      {\r
 +              $return = '';\r
 +              \r
 +              if ( $length == 0 )\r
 +              {\r
 +                      $length = self::strlen($string) - $start;\r
 +              }\r
 +              \r
 +              if ( self::$mode == 'iconv' )\r
 +              {\r
 +                      $return = iconv_substr($string, $start, $length, self::$current_charset);\r
 +              }\r
 +              else if ( self::$mode == 'mbstring' )\r
 +              {\r
 +                      $return = mb_substr($string, $start, $length, self::$current_charset);\r
 +              }\r
 +              else\r
 +              {\r
 +                      $return = strrpos($string, $start, $length);\r
 +              }\r
 +              return (string) $return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::strftime\r
 +       * strftime function based on multibyte processing\r
 +       * \r
 +       * @static\r
 +       * @param       string  $format format with singlebyte or multibyte\r
 +       * @param       timestamp       $timestamp      UNIX timestamp\r
 +       * @return      string  formatted timestamp\r
 +       */\r
 +      static public function strftime($format, $timestamp='')\r
 +      {\r
 +              return preg_replace_callback('/(%[a-z%])/i',\r
 +                      create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),\r
 +                      $format\r
 +              );\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::formatted_datetime()\r
 +       * return formatted datetime string\r
 +       * \r
 +       * Date and Time Formats\r
 +       * @link        http://www.w3.org/TR/NOTE-datetime\r
 +       * \r
 +       * Working with Time Zones\r
 +       * @link        http://www.w3.org/TR/timezone/\r
 +       * \r
 +       * @param       String  $format time expression format\r
 +       * @param       String  $timestamp      UNIX timestamp\r
 +       * @param       Integer $offset timestamp offset\r
 +       * @return      String  formatted datetime\r
 +       */\r
 +      static public function formatted_datetime($format, $timestamp, $offset=0)\r
 +      {\r
 +              $suffix = '';\r
 +              $string = '';\r
 +              \r
 +              switch ( $format )\r
 +              {\r
 +                      case 'mysql':\r
 +                              /*\r
 +                               * MySQL 5.0 Reference Manual\r
 +                               *  10.3.1. The DATE, DATETIME, and TIMESTAMP Types\r
 +                               *   http://dev.mysql.com/doc/refman/5.0/en/datetime.html\r
 +                               */\r
 +                              $timestamp += $offset;\r
 +                              $format = '%Y-%m-%d %H:%M:%S';\r
 +                              $suffix ='';\r
 +                              break;\r
 +                      case 'rfc822':\r
 +                              /*\r
 +                               * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES\r
 +                               *  5.  DATE AND TIME SPECIFICATION\r
 +                               *   http://www.ietf.org/rfc/rfc0822.txt\r
 +                               */\r
 +                              $format = '%a, %d %m %y %H:%M:%S ';\r
 +                              if ( $offset < 0 )\r
 +                              {\r
 +                                      $suffix = '-';\r
 +                                      $offset = -$offset;\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $suffix = '+';\r
 +                              }\r
 +                              \r
 +                              $suffix .= sprintf("%02d%02d", floor($offset / 3600), round(($offset % 3600) / 60) );\r
 +                              break;\r
 +                      case 'rfc822GMT':\r
 +                              /*\r
 +                               * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES\r
 +                               *  5.  DATE AND TIME SPECIFICATION\r
 +                               *   http://www.ietf.org/rfc/rfc0822.txt\r
 +                               */\r
 +                              $format = '%a, %d %m %y %H:%M:%S ';\r
 +                              $timestamp -= $offset;\r
 +                              $suffix = 'GMT';\r
 +                              break;\r
 +                      case 'iso8601':\r
 +                      case 'rfc3339':\r
 +                              /*\r
 +                               * RFC3339: Date and Time on the Internet: Timestamps\r
 +                               *  5. Date and Time format\r
 +                               *   http://www.ietf.org/rfc/rfc3339.txt\r
 +                               */\r
 +                              $format = '%Y-%m-%dT%H:%M:%S';\r
 +                              if ( $offset < 0 )\r
 +                              {\r
 +                                      $suffix = '-';\r
 +                                      $offset = -$offset;\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $suffix = '+';\r
 +                              }\r
 +                              $suffix .= sprintf("%02d:%02d", floor($offset / 3600), round(($offset % 3600) / 60) );\r
 +                              break;\r
 +                      case 'utc':\r
 +                      case 'iso8601UTC':\r
 +                      case 'rfc3339UTC':\r
 +                              /*\r
 +                               * RFC3339: Date and Time on the Internet: Timestamps\r
 +                               *  5. Date and Time format\r
 +                               *   http://www.ietf.org/rfc/rfc3339.txt\r
 +                               */\r
 +                              $timestamp -= $offset;\r
 +                              $format = '%Y-%m-%dT%H:%M:%SZ';\r
 +                              $suffix = '';\r
 +                              break;\r
 +                      case '':\r
 +                              $format = '%X %x';\r
 +                              $offset = '';\r
 +                              break;\r
 +                      default:\r
 +                              $suffix = '';\r
 +                              break;\r
 +              }\r
 +              return i18n::strftime($format, $timestamp) . $suffix;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::convert_locale_to_old_language_file_name()\r
 +       * NOTE: this should be obsoleted near future.\r
 +       * \r
 +       * @static\r
 +       * @param       string  $target_locale  locale name as language_script_region\r
 +       * @return      string  old translation file name\r
 +       */\r
 +      static public function convert_locale_to_old_language_file_name($target_locale)\r
 +      {\r
 +              $target_language = '';\r
 +              foreach ( self::$lang_refs as $language => $locale )\r
 +              {\r
 +                      if ( preg_match('#-#', $language) )\r
 +                      {\r
 +                              if ( $target_locale . '.' . self::$current_charset == $locale )\r
 +                              {\r
 +                                      $target_language = $language;\r
 +                                      break;\r
 +                              }\r
 +                      }\r
 +                      else if ( $target_locale == $locale )\r
 +                      {\r
 +                              $target_language = $language;\r
 +                      }\r
 +              }\r
 +              return $target_language;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::convert_old_language_file_name_to_locale()\r
 +       * NOTE: this should be obsoleted near future.\r
 +       * \r
 +       * @static\r
 +       * @param       string  $target_language        old translation file name\r
 +       * @return      string  locale name as language_script_region\r
 +       */\r
 +      static public function convert_old_language_file_name_to_locale($target_language)\r
 +      {\r
 +              $target_locale = '';\r
 +              foreach ( self::$lang_refs as $language => $locale )\r
 +              {\r
 +                      if ( $target_language == $language )\r
 +                      {\r
 +                              if ( preg_match('#^(.+)\.(.+)$#', $locale, $match) )\r
 +                              {\r
 +                                      $target_locale = $match[1];\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $target_locale = $locale;\r
 +                              }\r
 +                              break;\r
 +                      }\r
 +              }\r
 +              return $target_locale;\r
 +      }\r
 +      \r
 +      /**\r
 +       * i18n::$lang_refs\r
 +       * reference table to convert old and new way to name translation files.\r
 +       * NOTE: this should be obsoleted as soon as possible.\r
 +       * \r
 +       * @static\r
 +       */\r
 +      static private $lang_refs = array(\r
 +              "english"               => "en_Latn_US",\r
 +              "english-utf8"  => "en_Latn_US.UTF-8",\r
 +              "bulgarian"     => "bg_Cyrl_BG",\r
 +              "finnish"               => "fi_Latn_FU",\r
 +              "catalan"               => "ca_Latn_ES",\r
 +              "french"                => "fr_Latn_FR",\r
 +              "russian"               => "ru_Cyrl_RU",\r
 +              "chinese"               => "zh_Hans_CN",\r
 +              "simchinese"    => "zh_Hans_CN",\r
 +              "chineseb5"     => "zh_Hant_TW",\r
 +              "traditional_chinese"   =>      "zh_Hant_TW",\r
 +              "galego"                => "gl_Latn_ES",\r
 +              "german"                => "de_Latn_DE",\r
 +              "korean-utf"    => "ko_Kore_KR.UTF-8",\r
 +              "korean-euc-kr" => "ko_Kore_KR.EUC-KR",\r
 +              "slovak"                => "sk_Latn_SK",\r
 +              "czech"         => "cs_Latn_CZ",\r
 +              "hungarian"     => "hu_Latn_HU",\r
 +              "latvian"               => "lv_Latn_LV",\r
 +              "nederlands"    => "nl_Latn_NL",\r
 +              "italiano"              => "it_Latn_IT",\r
 +              "persian"               => "fa_Arab_IR",\r
 +              "spanish"               => "es_Latn_ES",\r
 +              "spanish-utf8"  => "es_Latn_ES.UTF-8",\r
 +              "japanese-euc"  => "ja_Jpan_JP.EUC-JP",\r
 +              "japanese-utf8" => "ja_Jpan_JP.UTF-8",\r
 +              "portuguese_brazil"     => "pt_Latn_BR"\r
 +      );\r
 +}\r
++=======
+ <?php
+ /**
+  * i18n class for Nucleus CMS
+  * written by Takashi Sakamoto as of Feb 03, 2012
+  * 
+  * This includes wrapper functions of iconv and mbstring
+  * for multibyte processing and includes parameters related to locale.
+  * 
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2011 The Nucleus Group
+  * @version $Id: i18n.php 1876 2012-06-17 07:33:00Z sakamocchi $
+  */
+ class i18n
+ {
+       static private $mode = FALSE;
+       
+       static private $current_charset = '';
+       static private $current_language = '';
+       static private $current_script = '';
+       static private $current_region = '';
+       
+       static private $locale_list = array();
+       static private $timezone = 'UTC';
+       
+       static private $forced_charset = '';
+       static private $forced_language = '';
+       static private $forced_script = '';
+       static private $forced_region = '';
+       
+       /**
+        * i18n::init
+        * Initializing i18n class
+        * 
+        * @static
+        * @param       string  $charset        character set
+        * @return      boolean 
+        */
+       static public function init($charset, $dir)
+       {
+               /* i18n is already initialized */
+               if ( self::$mode )
+               {
+                       return TRUE;
+               }
+               
+               /* make locale list in this Nucleus CMS */
+               if ( ($handle = opendir($dir)) === FALSE )
+               {
+                       return FALSE;
+               }
+               while ($filename = readdir($handle))
+               {
+                       if (preg_match("#^(.+_.+_.+)\.{$charset}\.php$#", $filename, $matches) )
+                       {
+                               if ( !in_array($matches[1], self::$locale_list) )
+                               {
+                                       self::$locale_list[] = $matches[1];
+                               }
+                       }
+               }
+               closedir($handle);
+               
+               /* set i18n backend and validate character set */
+               if ( extension_loaded('iconv') )
+               {
+                       /* this is just for checking the charset. */
+                       if ( iconv_set_encoding('internal_encoding', $charset)
+                        && iconv_set_encoding('output_encoding', $charset)
+                        && iconv_set_encoding('internal_encoding', $charset) )
+                       {
+                               self::$current_charset = $charset;
+                               self::$mode = 'iconv';
+                       }
+               }
+               else if ( extension_loaded('mbstring') )
+               {
+                       /* this is just for checking the charset. */
+                       if ( mb_http_output($charset)
+                        && mb_internal_encoding($charset)
+                        && mb_regex_encoding($charset) )
+                       {
+                               self::$current_charset = $charset;
+                               self::$mode = 'mbstring';
+                       }
+               }
+               
+               return TRUE;
+       }
+       
+       /**
+        * i18n::get_available_locale_list
+        * return available locale list with current charset
+        * 
+        * @static
+        * @param       void
+        * @return      array   available locale list
+        */
+       static public function get_available_locale_list()
+       {
+               return self::$locale_list;
+       }
+       
+       /**
+        * i18n::get_current_charset
+        * return current charset
+        * 
+        * @static
+        * @param       void
+        * @return      string  $charset        current character set
+        */
+       static public function get_current_charset()
+       {
+               return self::$current_charset;
+       }
+       
+       /**
+        * i18n::set_locale
+        * Set current locale
+        * 
+        * NOTE:
+        * naming rule is "$language_$script_$region.$charset.php", refer to RFC 5646.
+        * @link http://www.ietf.org/rfc/rfc5646.txt
+        * @see 2.  The Language Tag
+        * 
+        * @static
+        * @param       string  $locale
+        * @return      bool    TRUE/FALSE
+        * 
+        */
+       static public function set_current_locale($locale)
+       {
+               if ( preg_match('#^(.+)_(.+)_(.+)$#', $locale, $match) )
+               {
+                       self::$current_language = $match[1];
+                       self::$current_script   = $match[2];
+                       self::$current_region   = $match[3];
+                       return TRUE;
+               }
+               return FALSE;
+       }
+       
+       /**
+        * i18n::get_locale
+        * Get current locale
+        * 
+        * @static
+        * @param       void
+        * @return      $locale
+        */
+       static public function get_current_locale()
+       {
+               $elements = array(self::$current_language, self::$current_script, self::$current_region);
+               return implode('_', $elements);
+       }
+       
+       /**
+        * i18n::set_forced_locale()
+        * Set forced locale
+        * 
+        * @static
+        * @param       string  $forced_locale
+        * @return      bool    TRUE/FALSE
+        * 
+        */
+       static public function set_forced_locale($forced_locale)
+       {
+               if ( preg_match('#^(.+)_(.+)_(.+)$#', $forced_locale, $match) )
+               {
+                       self::$forced_language  = $match[1];
+                       self::$forced_script    = $match[2];
+                       self::$forced_region    = $match[3];
+                       return TRUE;
+               }
+               return FALSE;
+       }
+       
+       /**
+        * i18n::get_forced_locale
+        * Get forced locale
+        * 
+        * @static
+        * @param       void
+        * @return      $forced_locale
+        */
+       static public function get_forced_locale()
+       {
+               if ( !self::$forced_language )
+               {
+                       return '';
+               }
+               
+               $elements = array(self::$forced_language, self::$forced_script, self::$forced_region);
+               return implode('_', $elements);
+       }
+       
+       /**
+        * i18n::set_forced_charset
+        * return forced charset
+        * 
+        * @static
+        * @param       void    $charset        forced character set
+        * @return      void
+        */
+       static public function set_forced_charset($forced_charset)
+       {
+               self::$forced_charset = $forced_charset;
+               return;
+       }
+       
+       /**
+        * i18n::get_forced_charset
+        * return forced charset
+        * 
+        * @static
+        * @param       void
+        * @return      string  $charset        forced character set
+        */
+       static public function get_forced_charset()
+       {
+               return self::$forced_charset;
+       }
+       
+       /**
+        * i18n::confirm_default_date_timezone
+        * to avoid E_NOTICE or E_WARNING generated when every calling to a date/time function.
+        * 
+        * NOTE:
+        * Some private servers are lack of its timezone setting
+        * http://www.php.net/manual/en/function.date-default-timezone-set.php
+        * 
+        * @static
+        * @param       void
+        * @return      void
+        */
+       static public function confirm_default_date_timezone()
+       {
+               if ( function_exists('date_default_timezone_get') 
+                && FALSE !== ($timezone = @date_default_timezone_get()))
+               {
+                       self::$timezone = $timezone;
+               }
+               if (function_exists('date_default_timezone_set')) {
+                        @date_default_timezone_set(self::$timezone);
+               }
+               return;
+       }
+       
+       /**
+        * i18n::get_current_date_timezone()
+        * get current timezone
+        * 
+        * @static
+        * @param       void
+        * @return      $timezone
+        */
+       static public function get_date_timezone()
+       {
+               return self::$timezone;
+       }
+       
+       /**
+        * i18n::convert
+        * character set converter
+        * 
+        * @static
+        * @param       string  $string target string binary
+        * @param       string  $from   original character set encoding
+        * @param       string  $to     target character set encoding
+        * @return      string  converted string
+        */
+       static public function convert($string, $from, $to='')
+       {
+               if ( $to == '' )
+               {
+                       $to = self::$current_charset;
+               }
+               
+               if ( $from == $to )
+               {
+                       /* do nothing */
+               }
+               else if ( self::$mode == 'iconv' )
+               {
+                       $string = iconv($from, $to.'//TRANSLIT', $string);
+               }
+               else if ( self::$mode == 'mbstring' )
+               {
+                       $string = mb_convert_encoding($string, $to, $from);
+               }
+               return (string) $string;
+       }
+       
+       /**
+        * i18n::convert_handler
+        * callable handler for character set converter
+        * 
+        * @static
+        * @param       string  $string target string binary
+        * @return      void
+        */
+       static public function convert_handler($string)
+       {
+               return self::convert($string, self::$current_charset, self::$forced_charset);
+       }
+       
+       /**
+        * i18n::convert_array
+        * recursively converting array
+        * 
+        * @static
+        * @param       array   $array  array to convert
+        * @return      void
+        */
+       static public function convert_array($array, $from, $to='')
+       {
+               if ( !is_array($array) )
+               {
+                       $array = self::convert($array, $from, $to);
+               }
+               else
+               {
+                       foreach ( $array as $key => $value )
+                       {
+                               if ( !is_array($value) )
+                               {
+                                       $array[$key] = self::convert($value, $from, $to);
+                               }
+                               else
+                               {
+                                       self::convert_array($array[$key]);
+                               }
+                       }
+               }
+               
+               return $array;
+       }
+       
+       /**
+        * i18n::strlen
+        * strlen wrapper
+        * 
+        * @static
+        * @param       string  $string target string
+        * @return      integer the number of letters
+        */
+       static public function strlen($string)
+       {
+               $length = 0;
+               if ( self::$mode == 'iconv' )
+               {
+                       $length = iconv_strlen($string, self::$current_charset);
+               }
+               else if ( self::$mode == 'mbstring' )
+               {
+                       $length = mb_strlen($string, self::$current_charset);
+               }
+               else
+               {
+                       $length = strlen($string);
+               }
+               return (integer) $length;
+       }
+       
+       /**
+        * i18n::strpos
+        * strpos wrapper
+        * 
+        * @static
+        * @param       string  $haystack       string to search
+        * @param       string  $needle string for search
+        * @param       integer $offset the position from which the search should be performed. 
+        * @return      integer/FALSE   the numeric position of the first occurrence of needle in haystack
+        */
+       static public function strpos($haystack, $needle, $offset=0)
+       {
+               $position = 0;
+               if ( self::$mode == 'iconv' )
+               {
+                       $position = iconv_strpos($haystack, $needle, $offset, self::$current_charset);
+               }
+               else if ( self::$mode == 'mbstring' )
+               {
+                       $position = mb_strpos($haystack, $needle, $offset, self::$current_charset);
+               }
+               else
+               {
+                       $position = strpos($haystack, $needle, $offset);
+               }
+               
+               if ( $position !== FALSE)
+               {
+                       $position = (integer) $position;
+               }
+               return $position;
+       }
+       
+       /**
+        * i18n::strrpos
+        * strrpos wrapper
+        * 
+        * @static
+        * @param       string  $haystack       string to search
+        * @param       string  $needle string for search
+        * @return      integer/FALSE   the numeric position of the last occurrence of needle in haystack
+        */
+       static public function strrpos ($haystack, $needle)
+       {
+               $position = 0;
+               if ( self::$mode == 'iconv' )
+               {
+                       $position = iconv_strrpos($haystack, $needle, self::$current_charset);
+               }
+               else if ( self::$mode == 'mbstring' )
+               {
+                       $position = mb_strrpos($haystack, $needle, 0, self::$current_charset);
+               }
+               else
+               {
+                       $position = strrpos($haystack, $needle, 0);
+               }
+               
+               if ( $position !== FALSE)
+               {
+                       $position = (integer) $position;
+               }
+               return $position;
+       }
+       
+       /**
+        * i18n::substr
+        * substr wrapper
+        * 
+        * @static
+        * @param       string  $string string to be cut
+        * @param       string  $start  the position of starting
+        * @param       integer $length the length to be cut
+        * @return      string  the extracted part of string
+        */
+       static public function substr($string, $start, $length=0)
+       {
+               $return = '';
+               
+               if ( $length == 0 )
+               {
+                       $length = self::strlen($string) - $start;
+               }
+               
+               if ( self::$mode == 'iconv' )
+               {
+                       $return = iconv_substr($string, $start, $length, self::$current_charset);
+               }
+               else if ( self::$mode == 'mbstring' )
+               {
+                       $return = mb_substr($string, $start, $length, self::$current_charset);
+               }
+               else
+               {
+                       $return = strrpos($string, $start, $length);
+               }
+               return (string) $return;
+       }
+       
+       /**
+        * i18n::strftime
+        * strftime function based on multibyte processing
+        * 
+        * @static
+        * @param       string  $format format with singlebyte or multibyte
+        * @param       timestamp       $timestamp      UNIX timestamp
+        * @return      string  formatted timestamp
+        */
+       static public function strftime($format, $timestamp='')
+       {
+               return preg_replace_callback('/(%[a-z%])/i',
+                       create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),
+                       $format
+               );
+               }
+               
+       /**
+        * i18n::formatted_datetime()
+        * return formatted datetime string
+        * 
+        * Date and Time Formats
+        * @link        http://www.w3.org/TR/NOTE-datetime
+        * 
+        * Working with Time Zones
+        * @link        http://www.w3.org/TR/timezone/
+        * 
+        * @param       String  $format time expression format
+        * @param       String  $timestamp      UNIX timestamp
+        * @param       Integer $offset timestamp offset
+        * @return      String  formatted datetime
+        */
+       static public function formatted_datetime($format, $timestamp, $offset=0)
+       {
+               $suffix = '';
+               $string = '';
+               
+               switch ( $format )
+               {
+                       case 'mysql':
+                               /*
+                                * MySQL 5.0 Reference Manual
+                                *  10.3.1. The DATE, DATETIME, and TIMESTAMP Types
+                                *   http://dev.mysql.com/doc/refman/5.0/en/datetime.html
+                                */
+                               $timestamp += $offset;
+                               $format = '%Y-%m-%d %H:%M:%S';
+                               $suffix ='';
+                               break;
+                       
+                       case 'rfc822':
+                               /*
+                                * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES
+                                *  5.  DATE AND TIME SPECIFICATION
+                                *   http://www.ietf.org/rfc/rfc0822.txt
+                                */
+                               $format = '%a, %d %m %y %H:%M:%S ';
+                               if ( $offset < 0 )
+                               {
+                                       $suffix = '-';
+                                       $offset = -$offset;
+                               }
+                               else
+                               {
+                                       $suffix = '+';
+                               }
+                               
+                               $suffix .= sprintf("%02d%02d", floor($offset / 3600), round(($offset % 3600) / 60) );
+                               break;
+                       case 'rfc822GMT':
+                               /*
+                                * RFC 822: STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES
+                                *  5.  DATE AND TIME SPECIFICATION
+                                *   http://www.ietf.org/rfc/rfc0822.txt
+                                */
+                               $format = '%a, %d %m %y %H:%M:%S ';
+                               $timestamp -= $offset;
+                               $suffix = 'GMT';
+                               break;
+                       case 'iso8601':
+                       case 'rfc3339':
+                               /*
+                                * RFC3339: Date and Time on the Internet: Timestamps
+                                *  5. Date and Time format
+                                *   http://www.ietf.org/rfc/rfc3339.txt
+                                */
+                               $format = '%Y-%m-%dT%H:%M:%S';
+                               if ( $offset < 0 )
+                               {
+                                       $suffix = '-';
+                                       $offset = -$offset;
+                               }
+                               else
+                               {
+                                       $suffix = '+';
+                               }
+                               $suffix .= sprintf("%02d:%02d", floor($offset / 3600), round(($offset % 3600) / 60) );
+                               break;
+                       case 'utc':
+                       case 'iso8601UTC':
+                       case 'rfc3339UTC':
+                               /*
+                                * RFC3339: Date and Time on the Internet: Timestamps
+                                *  5. Date and Time format
+                                *   http://www.ietf.org/rfc/rfc3339.txt
+                                */
+                               $timestamp -= $offset;
+                               $format = '%Y-%m-%dT%H:%M:%SZ';
+                               $suffix = '';
+                               break;
+                       case '':
+                               $format = '%X %x';
+                               $offset = '';
+                               break;
+                       default:
+                               $suffix = '';
+                               break;
+               }
+               return i18n::strftime($format, $timestamp) . $suffix;
+       }
+       
+       /**
+        * i18n::convert_locale_to_old_language_file_name()
+        * NOTE: this should be obsoleted near future.
+        * 
+        * @static
+        * @param       string  $target_locale  locale name as language_script_region
+        * @return      string  old translation file name
+        */
+       static public function convert_locale_to_old_language_file_name($target_locale)
+       {
+               $target_language = '';
+               foreach ( self::$lang_refs as $language => $locale )
+               {
+                       if ( preg_match('#-#', $language) )
+                       {
+                               if ( $target_locale . '.' . self::$current_charset == $locale )
+                               {
+                                       $target_language = $language;
+                                       break;
+                               }
+                       }
+                       else if ( $target_locale == $locale )
+                       {
+                               $target_language = $language;
+                       }
+               }
+               return $target_language;
+       }
+       
+       /**
+        * i18n::convert_old_language_file_name_to_locale()
+        * NOTE: this should be obsoleted near future.
+        * 
+        * @static
+        * @param       string  $target_language        old translation file name
+        * @return      string  locale name as language_script_region
+        */
+       static public function convert_old_language_file_name_to_locale($target_language)
+       {
+               $target_locale = '';
+               foreach ( self::$lang_refs as $language => $locale )
+               {
+                       if ( $target_language == $language )
+                       {
+                               if ( preg_match('#^(.+)\.(.+)$#', $locale, $match) )
+                               {
+                                       $target_locale = $match[1];
+                               }
+                               else
+                               {
+                                       $target_locale = $locale;
+                               }
+                               break;
+                       }
+               }
+               return $target_locale;
+       }
+       
+       /**
+        * i18n::$lang_refs
+        * reference table to convert old and new way to name translation files.
+        * NOTE: this should be obsoleted as soon as possible.
+        * 
+        * @static
+        */
+       static private $lang_refs = array(
+               "english"               => "en_Latn_US",
+               "english-utf8"  => "en_Latn_US.UTF-8",
+               "bulgarian"     => "bg_Cyrl_BG",
+               "finnish"               => "fi_Latn_FI",
+               "catalan"               => "ca_Latn_ES",
+               "french"                => "fr_Latn_FR",
+               "russian"               => "ru_Cyrl_RU",
+               "chinese"               => "zh_Hans_CN",
+               "simchinese"    => "zh_Hans_CN",
+               "chineseb5"     => "zh_Hant_TW",
+               "traditional_chinese"   =>      "zh_Hant_TW",
+               "galego"                => "gl_Latn_ES",
+               "german"                => "de_Latn_DE",
+               "korean-utf"    => "ko_Kore_KR.UTF-8",
+               "korean-euc-kr" => "ko_Kore_KR.EUC-KR",
+               "slovak"                => "sk_Latn_SK",
+               "czech"         => "cs_Latn_CZ",
+               "hungarian"     => "hu_Latn_HU",
+               "latvian"               => "lv_Latn_LV",
+               "nederlands"    => "nl_Latn_NL",
+               "italiano"              => "it_Latn_IT",
+               "persian"               => "fa_Arab_IR",
+               "spanish"               => "es_Latn_ES",
+               "spanish-utf8"  => "es_Latn_ES.UTF-8",
+               "japanese-euc"  => "ja_Jpan_JP.EUC-JP",
+               "japanese-utf8" => "ja_Jpan_JP.UTF-8",
+               "portuguese_brazil"     => "pt_Latn_BR"
+       );
+ }
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: showlist.php 1785 2012-04-22 11:25:14Z sakamocchi $
++=======
+  * @version $Id: showlist.php 1886 2012-06-17 08:27:27Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  
  // can take either an array of objects, or an SQL query
++<<<<<<< HEAD
 +function showlist($query, $type, $template)
 +{
 +      if ( is_array($query) )
 +      {
 +              if ( sizeof($query) == 0 )
 +              {
 +                      return 0;
 +              }
 +              
 +              call_user_func("listplug_{$type}", $template, 'HEAD');
 +              
 +              foreach ( $query as $currentObj )
 +              {
 +                      $template['current'] = $currentObj;
 +                      call_user_func("listplug_{$type}", $template, 'BODY');
 +              }
 +              
 +              call_user_func("listplug_{$type}", $template, 'FOOT');
 +              
 +              return sizeof($query);
 +      }
 +      else
 +      {
 +              $res = DB::getResult($query);
 +              
 +              // don't do anything if there are no results
 +              $numrows = $res->rowCount();
 +              if ( $numrows == 0 )
 +              {
 +                      return 0;
 +              }
 +              call_user_func("listplug_{$type}", $template, 'HEAD');
 +              
 +              foreach ( $res as $row )
 +              {
 +                      $template['current'] = $row;
 +                      call_user_func("listplug_{$type}", $template, 'BODY');
 +              }
 +              
 +              call_user_func("listplug_{$type}", $template, 'FOOT');
 +              
 +              $res->closeCursor();
 +              
 +              // return amount of results
 +              return $numrows;
 +      }
 +}
 +
 +function listplug_select($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo "<select name=\"{$template['name']}\" tabindex=\"{$template['tabindex']}\"";
 +                      if ( array_key_exists('javascript', $template) && !empty($template['javascript']) )
 +                      {
 +                              echo " {$template['javascript']}";
 +                      }
 +                      echo ">\n";
 +                      
 +                      // add extra row if needed
 +                      if ( array_key_exists('extra', $template) && !empty($template['extra']) )
 +                      {
 +                              echo "<option value=\"{$template['extraval']}\">{$template['extra']}</option>\n";
 +                      }
 +                      
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
 +
 +                      echo '<option value="' . Entity::hsc($current['value']) . '"';
 +                      if ( array_key_exists('selected', $template) && $template['selected'] == $current['value'] )
 +                      {
 +                              echo ' selected="selected" ';
 +                      }
 +                      if ( isset($template['shorten']) && $template['shorten'] > 0 )
 +                      {
 +                              echo ' title="'. Entity::hsc($current['text']).'"';
 +                              $current['text'] = Entity::hsc(Entity::shorten($current['text'], $template['shorten'], $template['shortenel']));
 +                      }
 +                      echo '>' . Entity::hsc($current['text']) . "</option>\n";
 +                      break;
 +              case 'FOOT':
 +                      echo '</select>';
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_table($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo "\n\n";
 +                      echo "<table frame=\"box\" rules=\"all\" summary=\"{$template['content']}\">\n";
 +                      echo "<thead>\n";
 +                      echo "<tr>\n";
 +                      // print head
 +                      call_user_func("listplug_table_{$template['content']}" , $template, 'HEAD');
 +                      echo "</tr>\n";
 +                      echo "</thead>\n";
 +                      echo "<tbody>\n";
 +                      break;
 +              case 'BODY':
 +                      // print tabletype specific thingies
 +                      echo "<tr>\n";
 +                      call_user_func("listplug_table_{$template['content']}" , $template,  'BODY');
 +                      echo "</tr>\n";
 +                      break;
 +              case 'FOOT':
 +                      call_user_func("listplug_table_{$template['content']}" , $template,  'FOOT');
 +                      echo "</tbody>\n";
 +                      echo "</table>\n";
 +                      echo "\n";
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_table_memberlist($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo '<th>' . _LIST_MEMBER_NAME . "</th>\n";
 +                      echo '<th>' . _LIST_MEMBER_RNAME . "</th>\n";
 +                      echo '<th>' . _LIST_MEMBER_URL . "</th>\n";
 +                      echo '<th>' . _LIST_MEMBER_ADMIN;
 +                      help('superadmin');
 +                      echo "</th>\n";
 +                      echo '<th>' . _LIST_MEMBER_LOGIN;
 +                      help('canlogin');
 +                      echo "</th>\n";
 +                      echo '<th colspan="2">' . _LISTS_ACTIONS. "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
 +                      echo '<td>';
 +                      $id = listplug_nextBatchId();
 +                      echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['mnumber']}\" />\n";
 +                      echo "<label for=\"batch{$id}\">\n";
 +                      echo '<a href="mailto:' . Entity::hsc($current['memail']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['mname']), "</a>\n";
 +                      echo "</label>\n";
 +                      echo "</td>";
 +                      echo "<td>" . Entity::hsc($current['mrealname']) . "</td>\n";
 +                      echo '<td><a href="' . Entity::hsc($current['murl']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['murl']) . "</a></td>\n";
 +                      echo '<td>' . ($current['madmin'] ? _YES : _NO) . "</td>\n";
 +                      echo '<td>' . ($current['mcanlogin'] ? _YES : _NO) . "</td>\n";
 +                      echo '<td><a href="index.php?action=memberedit&amp;memberid=' . $current['mnumber'] . '" tabindex="' . $template['tabindex'] . '">' . _LISTS_EDIT . "</a></td>\n";
 +                      echo '<td><a href="index.php?action=memberdelete&amp;memberid=' . $current['mnumber'] . '" tabindex="' . $template['tabindex'].'">' . _LISTS_DELETE . "</a></td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_table_teamlist($template, $type)
 +{
 +      global $manager;
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo "<th>" . _LIST_MEMBER_NAME . "</th>\n";
 +                      echo "<th>" . _LIST_MEMBER_RNAME . "</th>\n";
 +                      echo "<th>" . _LIST_TEAM_ADMIN;
 +                      help('teamadmin');
 +                      echo "</th>\n";
 +                      echo "<th colspan=\"2\">"._LISTS_ACTIONS."</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
 +                      
 +                      echo '<td>';
 +                      $id = listplug_nextBatchId();
 +                      echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['tmember']}\" />\n";
 +                      echo '<label for="batch',$id,'">';
 +                      echo '<a href="mailto:' . Entity::hsc($current['memail']) . '" tabindex="' . $template['tabindex'] . '">' . Entity::hsc($current['mname']), "</a>\n";
 +                      echo "</label>\n";
 +                      echo "</td>";
 +                      echo '<td>', Entity::hsc($current['mrealname']), "</td>\n";
 +                      echo '<td>', ($current['tadmin'] ? _YES : _NO) , "</td>\n";
 +                      echo '<td><a href="index.php?action=teamdelete&amp;memberid=' . $current['tmember'] . '&amp;blogid=' . $current['tblog'] . '" tabindex="' . $template['tabindex'] . '">' . _LISTS_DELETE . "</a></td>\n";
 +                      
 +                      $url = "index.php?action=teamchangeadmin&memberid={$current['tmember']}&blogid={$current['tblog']}";
 +                      $url = $manager->addTicketToUrl($url);
 +                      echo '<td><a href="' . Entity::hsc($url) . '" tabindex="' . $template['tabindex'] . '">' . _LIST_TEAM_CHADMIN . "</a></td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_table_pluginlist($template, $type)
 +{
 +      global $manager;
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo '<th>' . _LISTS_INFO . "</th>\n";
 +                      echo '<th>' . _LISTS_DESC . "</th>\n";
 +                      echo '<th>' . _LISTS_ACTIONS . "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
++=======
+ function showlist($query, $type, $vars, $template_name = '')
+ {
+       $contents = '';
+       
+       /* count */
+       if ( is_string($query) )
+       {
+               $resource = DB::getResult($query);
+       }
+       else
+       {
+               $resource = $query;
+       }
+       
+       /* HEAD */
+       $contents .= call_user_func("listplug_{$type}", $vars, 'HEAD', $template_name);
+       
+       /* BODY */
+       foreach ( $resource as $row )
+       {
+               $vars['current'] = $row;
+               $contents .= call_user_func("listplug_{$type}", $vars, 'BODY', $template_name);
+       }
+       
+       /* FOOT */
+       $contents .= call_user_func("listplug_{$type}", $vars, 'FOOT', $template_name);
+       
+       /* close SQL resource */
+       if ( is_string($query) )
+       {
+               $resource->closeCursor();
+       }
+       
+       return $contents;
+ }
+ function listplug_select($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_HEAD']) )
+                       {
+                               $template = "<select name=\"<%name%>\" tabindex=\"<%tabindex%>\" <%javascript%>>\n"
+                                         . "<%extraoption%>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_SELECT_HEAD'];
+                       }
+                       $data = array(
+                               'name'                  => $vars['name'],
+                               'tabindex'              => $vars['tabindex'],
+                               'javascript'    => !array_key_exists('javascript', $vars) ? '' : $vars['javascript'],
+                               'extraoption'   => !array_key_exists('extra', $vars) ? '' : "<option value=\"\">{$vars['extra']}</option>"
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_BODY']) )
+                       {
+                               $template = "<option value=\"<%value%>\" <%selected%> title=\"<%title%>\"><%option%></option>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_SELECT_BODY'];
+                       }
+                       $data = array(
+                               'value'         => Entity::hsc($current['value']),
+                               'selected'      => ($vars['selected'] == $current['value']) ? 'selected="selected"' : '',
+                       );
+                       if ( array_key_exists('shorten', $vars) && $vars['shorten'] > 0 )
+                       {
+                               $data['title'] = Entity::hsc($current['text']);
+                               $data['option'] = Entity::hsc(Entity::shorten($current['text'], $vars['shorten'], $vars['shortenel']));
+                       }
+                       else
+                       {
+                               $data['title'] = '';
+                       }
+                       $data['option'] = Entity::hsc($current['text']);
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_SELECT_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_SELECT_FOOT']) )
+                       {
+                               $template = "</select>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_SELECT_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       
+       return Template::fill($template, $data);
+ }
+ function listplug_table($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_HEAD']) )
+                       {
+                               $template = "<table frame=\"box\" rules=\"all\" summary=\"{$vars['content']}\">\n"
+                                         . "<thead>\n"
+                                         . "<tr>\n"
+                                         . "<%typehead%>\n"
+                                         . "</tr>\n"
+                                         . "</thead>\n"
+                                         . "<tbody>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_HEAD'];
+                       }
+                       $data = array(
+                               'summary'       =>      $vars['content'],
+                               'typehead' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'HEAD', $template_name)
+                       );
+                       break;
+               case 'BODY':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BODY']) )
+                       {
+                               $template = "<tr onmouseover=\"focusRow(this);\" onmouseout=\"blurRow(this);\">\n"
+                                         . "<%typebody%>\n"
+                                         . "</tr>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BODY'];
+                       }
+                       // tabletype specific thingies
+                       $data = array(
+                               'typebody' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'BODY', $template_name)
+                       );
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_FOOT']) )
+                       {
+                               $template = "<%typefoot%>\n"
+                                         . "</tbody>\n"
+                                         . "</table>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_FOOT'];
+                       }
+                       // tabletype specific thingies
+                       $data = array(
+                               'typefoot' => call_user_func("listplug_table_" . $vars['content'] , $vars, 'FOOT', $template_name)
+                       );
+                       break;
+       }
+       
+       return Template::fill($template, $data);
+ }
+ function listplug_table_memberlist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD']) )
+                       {
+                               $template = "<th><%colmembername%></th>\n"
+                                         . "<th><%colmemberrname%></th>\n"
+                                         . "<th><%colmemberurl%></th>\n"
+                                         . "<th><%colmemberadmin%><%helplink(superadmin)%></th>\n"
+                                         . "<th><%colmemberlogin%><%helplink(canlogin)%></th>\n"
+                                         . "<th colspan=\"2\"><%colactions%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colmembername'         => _LIST_MEMBER_NAME,
+                               'colmemberrname'        => _LIST_MEMBER_RNAME,
+                               'colmemberurl'          => _LIST_MEMBER_URL,
+                               'colmemberadmin'        => _LIST_MEMBER_ADMIN,
+                               'colmemberlogin'        => _LIST_MEMBER_LOGIN,
+                               'colactions'            => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY']) )
+                       {
+                               $template = "<td>\n"
+                                         . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+                                         . "<label for=\"batch<%id%>\">\n"
+                                         . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
+                                         . "</label>\n</td>\n"
+                                         . "<td><%realname%></td>\n"
+                                         . "<td><a href=\"<%url%>\" tabindex=\"<%tabindex%>\"><%url%></a></td>\n"
+                                         . "<td><%admin%></td>\n"
+                                         . "<td><%login%></td>\n"
+                                         . "<td><a href=\"index.php?action=memberedit&amp;memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
+                                         . "<td><a href=\"index.php?action=memberdelete&amp;memberid=<%memberid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_BODY'];
+                       }
+                       $data = array(
+                               'id'                    => listplug_nextBatchId(),
+                               'memberid'              => $current['mnumber'],
+                               'mailaddress'   => Entity::hsc($current['memail']),
+                               'tabindex'              => $vars['tabindex'],
+                               'name'                  => Entity::hsc($current['mname']),
+                               'realname'              => Entity::hsc($current['mrealname']),
+                               'url'                   => Entity::hsc($current['murl']),
+                               'admin'                 => $current['madmin'] ? _YES : _NO,
+                               'login'                 => $current['mcanlogin'] ? _YES : _NO,
+                               'editbtn'               => _LISTS_EDIT,
+                               'deletebtn'             => _LISTS_DELETE,
+                       );
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT']) )
+                       {
+                               $template = "";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_MEMBLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_teamlist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD']) )
+                       {
+                               $template = "<th><%colmembername%></th>\n"
+                                         . "<th><%colmemberrname%></th>\n"
+                                         . "<th><%colteamadmin%><%helplink(teamadmin)%></th>\n"
+                                         . "<th colspan=\"2\"><%colactions%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colmembername'         => _LIST_MEMBER_NAME,
+                               'colmemberrname'        => _LIST_MEMBER_RNAME,
+                               'colteamadmin'          => _LIST_TEAM_ADMIN,
+                               'colactions'            => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY']) )
+                       {
+                               $template = "<td>\n"
+                                         . "<input type=\"checkbox\" id=\"batch<%id%>\" name=\"batch[<%id%>]\" value=\"<%memberid%>\" />\n"
+                                         . "<label for=\"batch<%id%>\">\n"
+                                         . "<a href=\"mailto:<%mailaddress%>\" tabindex=\"<%tabindex%>\"><%name%></a>\n"
+                                         . "</label>\n</td>\n"
+                                         . "<td><%realname%></td>\n"
+                                         . "<td><%admin%></td>\n"
+                                         . "<td><a href=\"index.php?action=teamdelete&amp;memberid=<%memberid%>&amp;blogid=<%blogid%>\" tabindex=\"<%tabindex%>\"><%deletebtn%></a></td>\n"
+                                         . "<td><a href=\"<%chadminurl%>\" tabindex=\"<%tabindex%>\"><%chadminbtn%></a></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_BODY'];
+                       }
+                       $url  = 'index.php?action=teamchangeadmin&memberid=' . intval($current['tmember']) . '&blogid=' . intval($current['tblog']);
+                       $url  = $manager->addTicketToUrl($url);
+                       $data = array(
+                                       'id'                    => listplug_nextBatchId(),
+                                       'memberid'              => $current['tmember'],
+                                       'mailaddress'   => Entity::hsc($current['memail']),
+                                       'tabindex'              => $vars['tabindex'],
+                                       'name'                  => Entity::hsc($current['mname']),
+                                       'realname'              => Entity::hsc($current['mrealname']),
+                                       'admin'                 => ($current['tadmin'] ? _YES : _NO),
+                                       'blogid'                => $current['tblog'],
+                                       'deletebtn'             => '<%text(_LISTS_DELETE)%>',
+                                       'chadminurl'    => Entity::hsc($url),
+                                       'chadminbtn'    => '<%text(_LIST_TEAM_CHADMIN)%>'
+                       );
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT']) )
+                       {
+                               $template = "";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TEAMLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_pluginlist($vars, $type, $template_name = '')
+ {
+       static $plugins = array();
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD']) )
+                       {
+                               $template = "<th><%colinfo%></th>\n"
+                                         . "<th><%coldesc%></th>\n"
+                                         . "<th colspan=\"2\"><%colactions%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colinfo'    => _LISTS_INFO,
+                               'coldesc'    => _LISTS_DESC,
+                               'colactions' => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
++>>>>>>> skinnable-master
                        
                        $plug =& $manager->getPlugin($current['pfile']);
                        if ( $plug )
                        {
++<<<<<<< HEAD
 +                              echo "<td>\n";
 +                              echo '<h3>' . Entity::hsc($plug->getName()) . "</h3>\n";
 +                              
 +                              echo "<dl>\n";
 +                              if ( $plug->getAuthor() )
 +                              {
 +                                      echo '<dt>' . _LIST_PLUGS_AUTHOR . "</dt>\n";
 +                                      echo '<dd>' . Entity::hsc($plug->getAuthor()) , "</dd>\n";
 +                              }
 +                              
 +                              if ( $plug->getVersion() )
 +                              {
 +                                      echo '<dt>' . _LIST_PLUGS_VER, "</dt>\n";
 +                                      echo '<dd>' . Entity::hsc($plug->getVersion()) . "</dd>\n";
 +                              }
 +                              
 +                              if ( $plug->getURL() )
 +                              {
 +                                      echo '<dt>' . _LIST_PLUGS_SITE . "<dt>\n";
 +                                      echo '<dd><a href="' .  Entity::hsc($plug->getURL()) . '" tabindex="' . $template['tabindex'] . '">リンク</a></dd>' . "\n";
 +                              }
 +                              echo "</dl>\n";
 +                              echo "</td>\n";
 +                              
 +                              echo "<td>\n";
 +                              echo "<dl>\n";
 +                              echo '<dt>' . _LIST_PLUGS_DESC ."</dt>\n";
 +                              echo '<dd>' . Entity::hen($plug->getDescription()) ."</dd>\n";
 +                              if ( sizeof($plug->getEventList()) > 0 )
 +                              {
 +                                      echo '<dt>' . _LIST_PLUGS_SUBS ."</dt>\n";
 +                                      echo '<dd>' . Entity::hsc(implode(', ', $plug->getEventList())) ."</dd>\n";
 +                              }
 +                              
 +                              if ( sizeof($plug->getPluginDep()) > 0 )
 +                              {
 +                                      echo '<dt>' . _LIST_PLUGS_DEP ."</dt>\n";
 +                                      echo '<dd>' . Entity::hsc(implode(', ', $plug->getPluginDep())) ."</dd>\n";
 +                              }
 +                              
 +                              /* check dependency */
 +                              $req = array();
 +                              $res = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
 +                              foreach ( $res as $row )
 +                              {
 +                                      $preq =& $manager->getPlugin($row['pfile']);
++=======
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY']) )
+                               {
+                                       $template = "<td>\n"
+                                                 . "<strong><%plugname%></strong><br />\n"
+                                                 . "<%autherlabel%> <%plugauther%><br />\n"
+                                                 . "<%versionlabel%> <%plugversion%><br />\n"
+                                                 . "<%pluggeturl%><br />\n"
+                                                 . "</td>\n"
+                                                 . "<td>\n"
+                                                 . "<%desclabel%><br /><%plugdesc%>\n"
+                                                 . "<%eventlist%>\n"
+                                                 . "<%needupdate%>\n"
+                                                 . "<%dependlist%>\n"
+                                                 . "<%depreqlist%>\n"
+                                                 . "</td>\n";
+                               }
+                               else
+                               {
+                                       $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY'];
+                               }
+                               $data = array(
+                                       'plugname'              => Entity::hsc($plug->getName()),
+                                       'autherlabel'   => _LIST_PLUGS_AUTHOR,
+                                       'plugauther'    => Entity::hsc($plug->getAuthor()),
+                                       'versionlabel'  => _LIST_PLUGS_VER,
+                                       'plugversion'   => Entity::hsc($plug->getVersion()),
+                                       'tabindex'              => $vars['tabindex'],
+                                       'desclabel'             => _LIST_PLUGS_DESC,
+                                       'plugdesc'              => Entity::hen($plug->getDescription()),
+                               );
+                               if ( $plug->getURL() )
+                               {
+                                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL']) )
+                                       {
+                                               $subTpl = "<a href=\"<%plugurl%>\" tabindex=\"<%tabindex%>\"><%plugsite%></a>";
+                                       }
+                                       else
+                                       {
+                                               $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL'];
+                                       }
+                                       $subData = array(
+                                               'plugurl'       => Entity::hsc($plug->getURL()),
+                                               'tabindex'      => $vars['tabindex'],
+                                               'plugsite'      => _LIST_PLUGS_SITE,
+                                       );
+                                       $data['pluggeturl'] = Template::fill($subTpl, $subData);
+                               }
+                               else
+                               {
+                                       $data['pluggeturl'] = '';
+                               }
+                               if ( count($plug->getEventList()) > 0 )
+                               {
+                                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST']) )
+                                       {
+                                               $subTpl = "<br /><br /><%evntlstlbl%><br /><%eventlist%>";
+                                       }
+                                       else
+                                       {
+                                               $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST'];
+                                       }
+                                       $subData = array(
+                                               'evntlstlbl'    => _LIST_PLUGS_SUBS,
+                                               'eventlist'             => Entity::hsc(implode(', ', $plug->getEventList())),
+                                       );
+                                       $data['eventlist'] = Template::fill($subTpl, $subData);
+                               }
+                               else
+                               {
+                                       $data['eventlist'] = '';
+                               }
+                               if ( !$plug->subscribtionListIsUptodate() )
+                               {
+                                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE']) )
+                                       {
+                                               $subTpl = "<br /><br /><strong><%updatealert%></strong>";
+                                       }
+                                       else
+                                       {
+                                               $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE'];
+                                       }
+                                       $subData = array(
+                                               'updatealert' => _LIST_PLUG_SUBS_NEEDUPDATE,
+                                       );
+                                       $data['needupdate'] = Template::fill($subTpl, $subData);
+                               }
+                               else
+                               {
+                                       $data['needupdate'] = '';
+                               }
+                               if ( count($plug->getPluginDep() ) > 0)
+                               {
+                                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND']) )
+                                       {
+                                               $subTpl = "<br /><br /><%deplistlbl%><br /><%dependlist%>";
+                                       }
+                                       else
+                                       {
+                                               $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND'];
+                                       }
+                                       $subData = array(
+                                               'deplistlbl' => _LIST_PLUGS_DEP,
+                                               'dependlist' => Entity::hsc(implode(', ', $plug->getPluginDep())),
+                                       );
+                                       $data['dependlist'] = Template::fill($subTpl, $subData);
+                               }
+                               else
+                               {
+                                       $data['dependlist'] = '';
+                               }
+                               /* check dependency */
+                               if ( empty($plugins) )
+                               {
+                                       $plugins = DB::getResult('SELECT pfile FROM ' . sql_table('plugin'));
+                               }
+                               $req = array();
+                               foreach ( $plugins as $plugin )
+                               {
+                                       $preq =& $manager->getPlugin($plugin['pfile']);
++>>>>>>> skinnable-master
                                        if ( $preq )
                                        {
                                                $depList = $preq->getPluginDep();
                                                {
                                                        if ( $current['pfile'] == $depName )
                                                        {
++<<<<<<< HEAD
 +                                                              $req[] = $row['pfile'];
++=======
+                                                               $req[] = $plugin['pfile'];
++>>>>>>> skinnable-master
                                                        }
                                                }
                                        }
                                
                                if ( count($req) > 0 )
                                {
-       $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
-       
-       // retreive the optionmeta
-       $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
-       
-       // only if it is not a hidden option write the controls to the page
-       if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
-       {
-               return;
-       }
-       
-       if ( !$current['description'] )
-       {
-               echo '<td>' , Entity::hsc($current['name']) . "</td>\n";
-       }
-       else
-       {
-               if ( !defined($current['description']) )
-               {
-                       echo '<td>' , Entity::hsc($current['description']) . "</td>\n";
-               }
-               else
-               {
-                       echo '<td>' , Entity::hsc(constant($current['description'])) . "</td>\n";
-               }
-       }
-       echo "<td>\n";
-       switch($current['type'])
-       {
-               case 'yesno':
-                       Admin::input_yesno($varname, $current['value'], 0, 'yes', 'no');
-                       break;
-               case 'password':
-                       echo '<input type="password" size="40" maxlength="128" name="',Entity::hsc($varname),'" value="',Entity::hsc($current['value']),"\" />\n";
-                       break;
-               case 'select':
-                       echo '<select name="'.Entity::hsc($varname)."\">\n";
-                       $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
-                       $options = preg_split('/\|/', $options);
++<<<<<<< HEAD
 +                                      echo '<dt>' . _LIST_PLUGS_DEPREQ . "</dt>\n";
 +                                      echo '<dd>' . Entity::hsc(implode(', ', $req)) . "</dd>\n";
 +                              }
 +                              
 +                              /* check the database to see if it is up-to-date and notice the user if not */
 +                              if ( !$plug->subscribtionListIsUptodate() )
 +                              {
 +                                      echo '<dt>' . 'NOTICE:' . "</dt>\n";
 +                                      echo '<dd>' . _LIST_PLUG_SUBS_NEEDUPDATE . "</dd>\n";
 +                              }
 +                              
 +                              echo "</dl>\n";
 +                              echo "</td>\n";
 +                      }
 +                      else
 +                      {
 +                              echo '<td colspan="2">' . sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])) . "</td>\n";
 +                      }
 +                      
 +                      echo "<td>\n";
 +                      echo "<ul>\n";
 +                      $current['pid'] = (integer) $current['pid'];
 +                      
 +                      $url = Entity::hsc($manager->addTicketToUrl("index.php?plugid={$current['pid']}&action=pluginup"));
 +                      echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" , _LIST_PLUGS_UP , "</a></li>\n";
 +                      
 +                      $url = Entity::hsc($manager->addTicketToUrl("index.php?plugid={$current['pid']}&action=plugindown"));
 +                      echo "<li><a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_DOWN , "</a></li>\n";
 +                      echo "<li><a href=\"index.php?action=plugindelete&amp;plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_UNINSTALL , "</a></li>\n";
 +                      
 +                      if ( $plug && ($plug->hasAdminArea() > 0) )
 +                      {
 +                              echo '<li><a href="' , Entity::hsc($plug->getAdminURL()) , '" tabindex="' , $template['tabindex'] , '">' , _LIST_PLUGS_ADMIN , "</a></li>\n";
 +                      }
 +                      
 +                      if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
 +                      {
 +                              echo "<li><a href=\"index.php?action=pluginhelp&amp;plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_HELP , "</a></li>\n";
 +                      }
 +                      
 +                      $query = "SELECT COUNT(*) AS result FROM %s WHERE ocontext='global' and opid=%s;";
 +                      $query = sprintf($query, sql_table('plugin_option_desc'), (integer) $current['pid']);
 +                      if ( DB::getValue($query) > 0 )
 +                      {
 +                              echo "<li><a href=\"index.php?action=pluginoptions&amp;plugid={$current['pid']}\" tabindex=\"{$template['tabindex']}\">" . _LIST_PLUGS_OPTIONS . "</a></li>\n";
 +                      }
 +                      echo "</ul>\n";
 +                      echo "</td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_table_plugoptionlist($template, $type)
 +{
 +      global $manager;
 +      switch( $type )
 +      {
 +              case 'HEAD':
 +                      echo '<th>' . _LISTS_INFO . "</th>\n";
 +                      echo '<th>' . _LISTS_VALUE . "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      listplug_plugOptionRow($template['current']);
 +                      break;
 +              case 'FOOT':
 +                      echo "<tr>\n";
 +                      echo '<th colspan="2">' . _PLUGS_SAVE . "</th>\n";
 +                      echo "</tr>\n";
 +                      echo "<tr>\n";
 +                      echo "<td>" . _PLUGS_SAVE . "</td>\n";
 +                      echo "<td><input type=\"submit\" value=\"".  _PLUGS_SAVE . "\" /></td>\n";
 +                      echo "</tr>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
 +function listplug_plugOptionRow($current)
 +{
-       
-       switch( $type )
-       {
-               case 'HEAD':
-                       echo "<th>"._LIST_ITEM_INFO."</th>\n";
-                       echo "<th>"._LIST_ITEM_CONTENT."</th>\n";
-                       echo "<th colspan='1'>"._LISTS_ACTIONS."</th>";
-                       break;
-               case 'BODY':
-                       $current = $template['current'];
-                       // string -> unix timestamp
-                       $current['itime'] = strtotime($current['itime']);
-                       
-                       if ( $current['idraft'] == 1 )
-                       {
-                               $cssclass = " class='draft'";
-                       }
-                       
-                       // (can't use offset time since offsets might vary between blogs)
-                       if ( $current['itime'] > $template['now'] )
-                       {
-                               $cssclass = " class='future'";
-                       }
-                       
-                       echo "<td{$cssclass}>\n";
-                       echo "<dl>\n";
-                       echo '<dt>' . _LIST_ITEM_BLOG . "</dt>\n";
-                       echo '<dd>' . Entity::hsc($current['bshortname']) . "</dd>\n";
-                       echo '<dt>' . _LIST_ITEM_CAT . "</dt>\n";
-                       echo '<dd>' . Entity::hsc($current['cname']) . "</dd>\n";
-                       echo '<dt>' . _LIST_ITEM_AUTHOR . "</dt>\n";
-                       echo '<dd>' . Entity::hsc($current['mname']) . "</dd>\n";
-                       echo '<dt>' . _LIST_ITEM_DATE . "</dt>\n";
-                       echo '<dd>' . date("Y-m-d",$current['itime']) . "</dd>\n";
-                       echo '<dt>' . _LIST_ITEM_TIME . "</dt>\n";
-                       echo '<dd>' . date("H:i",$current['itime']) . "</dd>\n";
-                       echo "</dl>\n";
-                       echo "</td>\n";
-                       
-                       $id = listplug_nextBatchId();
-                       
-                       echo "<td{$cssclass}>\n";
-                       echo "<h3>\n";
-                       echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['inumber']}\" />\n";
-                       echo "<label for=\"batch{$id}\">" . Entity::hsc(strip_tags($current['ititle'])) . "</label>\n";
-                       echo "</h3>\n";
-                       
-                       $current['ibody'] = strip_tags($current['ibody']);
-                       $current['ibody'] = Entity::hsc(Entity::shorten($current['ibody'], 300, '...'));
-                       echo "<p>{$current['ibody']}</p>\n";
-                       echo "</td>\n";
-                       
-                       echo "<td{$cssclass}>\n";
-                       echo "<ul>\n";
-                       echo "<li><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></li>\n";
-                       
-                       // evaluate amount of comments for the item
-                       $COMMENTS = new Comments($current['inumber']);
-                       $camount = $COMMENTS->amountComments();
-                       if ( $camount > 0 )
-                       {
-                               echo "<li><a href=\"index.php?action=itemcommentlist&amp;itemid={$current['inumber']}\">( ";
-                               echo sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments()) . " )</a></li>\n";
-                       }
-                       else
-                       {
-                               echo '<li>' . _LIST_ITEM_NOCONTENT . "</li>\n";
-                       }
-                       
-                       echo "<li><a href=\"index.php?action=itemmove&amp;itemid={$current['inumber']}\">" . _LISTS_MOVE . "</a></li>\n";
-                       echo "<li><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></li>\n";
-                       echo "</ul>\n";
-                       echo "</td>\n";
-                       break;
++=======
+                                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ']) )
+                                       {
+                                               $subTpl = "<br /><br /><%deprlstlbl%><br /><%depreqlist%>";
+                                       }
+                                       else
+                                       {
+                                               $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ'];
+                                       }
+                                       $subData = array(
+                                               'deprlstlbl' => _LIST_PLUGS_DEPREQ,
+                                               'depreqlist' => Entity::hsc(implode(', ', $req)),
+                                       );
+                                       $data['depreqlist'] = Template::fill($subTpl, $subData);
+                               }
+                               else
+                               {
+                                       $data['depreqlist'] = '';
+                               }
+                       }
+                       else
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE']) )
+                               {
+                                       $template = "<td colspan=\"2\"><%noplugalert%></td>\n";
+                               }
+                               else
+                               {
+                                       $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE'];
+                               }
+                               $data = array(
+                                       'noplugalert' => sprintf(_PLUGINFILE_COULDNT_BELOADED, Entity::hsc($current['pfile'])),
+                               );
+                       }
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN']) )
+                       {
+                               $template .= "<td>\n"
+                                          . "<a href=\"<%actionupurl%>\" tabindex=\"<%tabindex%>\"><%actionuptxt%></a><br />\n"
+                                          . "<a href=\"<%actiondownurl%>\" tabindex=\"<%tabindex%>\"><%actiondowntxt%></a><br />\n"
+                                          . "<a href=\"<%actuninsturl%>\" tabindex=\"<%tabindex%>\"><%actuninsttxt%></a><br />"
+                                          . "<%plugadminurl%>\n"
+                                          . "<%plughelpurl%>\n"
+                                          . "<%plugoptsetting%>\n"
+                                          . "</td>\n";
+                       }
+                       else
+                       {
+                               $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN'];
+                       }
+                       
+                       $baseUrl        = 'index.php?plugid=' . $current['pid'] . '&action=';
+                       $upUrl          = $manager->addTicketToUrl($baseUrl . 'pluginup');
+                       $downUrl        = $manager->addTicketToUrl($baseUrl . 'plugindown');
+                       
+                       $data['actionuptxt']    = _LIST_PLUGS_UP;
+                       $data['actionupurl']    = Entity::hsc($upUrl);
+                       $data['actiondowntxt']  = _LIST_PLUGS_DOWN;
+                       $data['actiondownurl']  = Entity::hsc($downUrl);
+                       $data['actuninsttxt']   = _LIST_PLUGS_UNINSTALL;
+                       $data['actuninsturl']   = 'index.php?action=plugindelete&amp;plugid=' . $current['pid'];
+                       
+                       if ( $plug && ($plug->hasAdminArea() > 0) )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN']) )
+                               {
+                                       $subTpl = "<a href=\"<%actadminurl%>\" tabindex=\"<%tabindex%>\"><%actadmintxt%></a><br />\n";
+                               }
+                               else
+                               {
+                                       $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN'];
+                               }
+                               $subData = array(
+                                       'actadminurl'   => Entity::hsc($plug->getAdminURL()),
+                                       'tabindex'              => $vars['tabindex'],
+                                       'actadmintxt'   => _LIST_PLUGS_ADMIN,
+                               );
+                               $data['plugadminurl'] = Template::fill($subTpl, $subData);
+                       }
+                       else
+                       {
+                               $data['plugadminurl'] = '';
+                       }
+                       if ( $plug && ($plug->supportsFeature('HelpPage') > 0) )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP']) )
+                               {
+                                       $subTpl = "<a href=\"<%acthelpurl%>\" tabindex=\"<%tabindex%>\"><%acthelptxt%></a><br />\n";
+                               }
+                               else
+                               {
+                                       $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP'];
+                               }
+                               $subData = array(
+                                       'acthelpurl'    => 'index.php?action=pluginhelp&amp;plugid=' . $current['pid'],
+                                       'tabindex'              => $vars['tabindex'],
+                                       'acthelptxt'    => _LIST_PLUGS_HELP,
+                               );
+                               $data['plughelpurl'] = Template::fill($subTpl, $subData);
+                       }
+                       else
+                       {
+                               $data['plughelpurl'] = '';
+                       }
+                       $optQuery = 'SELECT '
+                                 . '    COUNT(*) AS result '
+                                 . 'FROM '
+                                 .      sql_table('plugin_option_desc') . ' '
+                                 . 'WHERE '
+                                 . '    ocontext = "global" '
+                                 . 'AND opid     = %d';
+                       $pOptions = DB::getValue(sprintf($optQuery, $current['pid']));
+                       if ( $pOptions > 0 )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL']) )
+                               {
+                                       $subTpl = "<a href=\"<%actoptionurl%>\" tabindex=\"<%tabindex%>\"><%actoptiontxt%></a>\n";
+                               }
+                               else
+                               {
+                                       $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL'];
+                               }
+                               $subData = array(
+                                       'actoptionurl'  => 'index.php?action=pluginoptions&amp;plugid=' . $current['pid'],
+                                       'tabindex'              => $vars['tabindex'],
+                                       'actoptiontxt'  => _LIST_PLUGS_OPTIONS,
+                               );
+                               $data['plugoptsetting'] = Template::fill($subTpl, $subData);
+                       }
+                       else
+                       {
+                               $data['plugoptsetting'] = '';
+                       }
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT']) )
+                       {
+                               $template = "";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLUGLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_plugoptionlist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD']) )
+                       {
+                               $template = "<th><%colinfo%></th>\n"
+                                         . "<th><%colvalue%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colinfo'       => _LISTS_INFO,
+                               'colvalue'      => _LISTS_VALUE,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       $template = listplug_plugOptionRow($current, $template_name);
+                       $data = array();
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT']) )
+                       {
+                               $template = "<tr>\n"
+                                         . "<th colspan=\"2\"><%savetext%></th>\n"
+                                         . "</tr>\n"
+                                         . "<tr>\n"
+                                         . "<td><%savetext%></td>\n"
+                                         . "<td><input type=\"submit\" value=\"<%savetext%>\" /></td>\n"
+                                         . "</tr>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_FOOT'];
+                       }
+                       $data = array(
+                               'savetext' => _PLUGS_SAVE,
+                       );
+                       break;
+       }
+       
+       return Template::fill($template, $data);
+ }
+ function listplug_plugOptionRow($current, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
++>>>>>>> skinnable-master
+       $varname = "plugoption[{$current['oid']}][{$current['contextid']}]";
+       
+       // retreive the optionmeta
+       $meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
+       
+       // only if it is not a hidden option write the controls to the page
+       if ( in_array('access', $meta) && $meta['access'] == 'hidden' )
+       {
++<<<<<<< HEAD
++              return;
++      }
++      
++      if ( !$current['description'] )
++      {
++              echo '<td>' , Entity::hsc($current['name']) . "</td>\n";
++      }
++      else
++      {
++              if ( !defined($current['description']) )
++              {
++                      echo '<td>' , Entity::hsc($current['description']) . "</td>\n";
++              }
++              else
++              {
++                      echo '<td>' , Entity::hsc(constant($current['description'])) . "</td>\n";
++              }
++      }
++      echo "<td>\n";
++      switch($current['type'])
++      {
++              case 'yesno':
++                      Admin::input_yesno($varname, $current['value'], 0, 'yes', 'no');
++                      break;
++              case 'password':
++                      echo '<input type="password" size="40" maxlength="128" name="',Entity::hsc($varname),'" value="',Entity::hsc($current['value']),"\" />\n";
++                      break;
++              case 'select':
++                      echo '<select name="'.Entity::hsc($varname)."\">\n";
++                      $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
++                      $options = preg_split('/\|/', $options);
 +                      
 +                      for ( $i=0; $i<(count($options)-1); $i+=2 )
 +                      {
 +                              if ($options[$i+1] == $current['value'])
 +                              {
 +                                      echo '<option value="' . Entity::hsc($options[$i+1]) . '" selected="selected">';
 +                              }
 +                              else
 +                              {
 +                                      echo '<option value="' . Entity::hsc($options[$i+1]) . '">';
 +                              }
 +                              if ( defined($options[$i]) )
 +                              {
 +                                      echo Entity::hsc(constant($options[$i]));
 +                              }
 +                              else
 +                              {
 +                                      echo Entity::hsc($options[$i]);
 +                              }
 +                              echo "</option>\n";
 +                      }
 +                      echo "</select>\n";
 +                      
 +                      break;
 +              case 'textarea':
 +                      //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
 +                      if ( array_key_exists('access', $meta) && $meta['access'] == 'readonly' )
 +                      {
 +                              echo '<textarea class="pluginoption" cols="30" rows="5" name="' . Entity::hsc($varname) . "\" readonly=\"readonly\">\n";
 +                      }
 +                      else
 +                      {
 +                              echo '<textarea class="pluginoption" cols="30" rows="5" name="' . Entity::hsc($varname) . "\">\n";
 +                      }
 +                      echo Entity::hsc($current['value']) . "\n";
 +                      echo "</textarea>\n";
 +                      break;
 +              case 'text':
 +              default:
 +                      //$meta = NucleusPlugin::getOptionMeta($current['typeinfo']);
 +                      echo '<input type="text" size="40" maxlength="128" name="',Entity::hsc($varname),'" value="',Entity::hsc($current['value']),'"';
 +                      if ( array_key_exists('datatype', $meta) && $meta['datatype'] == 'numerical' )
 +                      {
 +                              echo ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
 +                      }
 +                      if ( array_key_exists('access', $current) && $meta['access'] == 'readonly')
 +                      {
 +                              echo ' readonly="readonly"';
 +                      }
 +                      echo " />\n";
 +      }
 +      if ( array_key_exists('extra', $current) )
 +      {
 +              echo $current['extra'];
 +      }
 +      echo "</td>\n";
 +      
 +      return;
 +}
 +
 +function listplug_table_itemlist($template, $type)
 +{
 +      $cssclass = '';
++=======
+               return false;
        }
-       return;
- }
- // for batch operations: generates the index numbers for checkboxes
- function listplug_nextBatchId()
- {
-       static $id = 0;
-       return $id++;
- }
- function listplug_table_commentlist($template, $type)
- {
-       switch( $type )
+       else
        {
-               case 'HEAD':
-                       echo '<th>' . _LISTS_INFO . "</th>\n";
-                       echo '<th>' . _LIST_COMMENT . "</th>\n";
-                       echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>";
-                       break;
-               case 'BODY':
-                       $current = $template['current'];
-                       $current['ctime'] = strtotime($current['ctime']);       // string -> unix timestamp
-                       
-                       echo "<td>\n";
-                       echo "<ul>\n";
-                       echo '<li>' . date("Y-m-d@H:i",$current['ctime']) . "</li>\n";
-                       if ( isset($current['mname']) )
-                       {
-                               echo '<li>' . Entity::hsc($current['mname']) ,' ', _LIST_COMMENTS_MEMBER . "</li>\n";
-                       }
-                       else
-                       {
-                               echo '<li>' . Entity::hsc($current['cuser']) . "</li>\n";
-                       }
-                       if ( isset($current['cmail']) && $current['cmail'] )
-                       {
-                               echo '<li>' . Entity::hsc($current['cmail']) . "</li>\n";
-                       }
-                       if ( isset($current['cemail']) && $current['cemail'] )
-                       {
-                               echo '<li>' . Entity::hsc($current['cemail']) . "</li>\n";
+               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY']) )
+               {
+                       $template = "<td><%description%></td>\n"
+                                 . "<td>\n";
+               }
+               else
+               {
+                       $template = $templates['SHOWLIST_LISTPLUG_TABLE_POPTLIST_BODY'];
+               }
+               
+               $data = array();
+               
+               switch($current['type'])
+               {
+                       case 'yesno':
+                               $template .= listplug_input_yesno($varname, $current['value'], 0, 'yes', 'no', _YES, _NO, 0, $template_name, 1);
+                               break;
+                       case 'password':
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD']) )
+                               {
+                                       $template .= "<input type=\"password\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\" />\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OPWORD'];
+                               }
+                               $data = array(
+                                       'varname'       => Entity::hsc($varname),
+                                       'value'         => Entity::hsc($current['value']),
+                               );
+                               break;
+                       case 'select':
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP']) )
+                               {
+                                       $template .= "<select name=\"<%varname%>\">\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEP'];
+                               }
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO']) )
+                               {
+                                       $subTpl = "<option value=\"<%value%>\"<%selected%>><%optname%></option>\n";
+                               }
+                               else
+                               {
+                                       $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEO'];
+                               }
+                               $options = NucleusPlugin::getOptionSelectValues($current['typeinfo']);
+                               $options = preg_split('#\|#', $options);
+                               
+                               for ( $i=0; $i<(count($options)-1); $i+=2 )
+                               {
+                                       $name   = $options[$i];
+                                       $value  = $options[$i+1];
+                                       if ( defined($name) )
+                                       {
+                                               $name = constant($name);
+                                       }
+                                       
+                                       $subData = array(
+                                               'optname'       => Entity::hsc($name),
+                                               'value'         => Entity::hsc($value)
+                                       );
+                                       if ($value != $current['value'])
+                                       {
+                                               $subData['selected'] = '';
+                                       }
+                                       else
+                                       {
+                                               $subData['selected'] = ' selected="selected"';
+                                       }
+                                       $template .= Template::fill($subTpl, $subData);
+                               }
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC']) )
+                               {
+                                       $template .= "</select>\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OSELEC'];
+                               }
+                               $data['varname'] = Entity::hsc($varname);
+                               break;
+                       case 'textarea':
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA']) )
+                               {
+                                       $template .= "<textarea class=\"pluginoption\" cols=\"30\" rows=\"5\" name=\"<%varname%>\"<%readonly%>><%value%></textarea>\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OTAREA'];
+                               }
+                               $data = array(
+                                       'varname'       => Entity::hsc($varname),
+                                       'value'         => Entity::hsc($current['value'])
+                               );
+                               if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
+                               {
+                                       $data['readonly'] = '';
+                               }
+                               else
+                               {
+                                       $data['readonly'] = ' readonly="readonly"';
+                               }
+                               break;
+                       case 'text':
+                       default:
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT']) )
+                               {
+                                       $template .= "<input type=\"text\" size=\"40\" maxlength=\"128\" name=\"<%varname%>\" value=\"<%value%>\"<%datatype%><%readonly%> />\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OITEXT'];
+                               }
+                               $data = array(
+                                       'varname'       => Entity::hsc($varname),
+                                       'value'         => Entity::hsc($current['value'])
+                               );
+                               if ( !array_key_exists('datatype', $current) || $current['datatype'] != 'numerical')
+                               {
+                                       $data['datatype'] = '';
+                               }
+                               else
+                               {
+                                       $data['datatype'] = ' onkeyup="checkNumeric(this)" onblur="checkNumeric(this)"';
+                               }
+                               if ( !array_key_exists('access', $current) || $current['access'] != 'readonly')
+                               {
+                                       $data['readonly'] = '';
+                               }
+                               else
+                               {
+                                       $data['readonly'] = ' readonly="readonly"';
+                               }
+               }
+               
+               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT']) )
+               {
+                       $template .= "<%extra%></td>\n";
+               }
+               else
+               {
+                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_PLUGOPTN_FOOT'];
+               }
+               
+               if ( !array_key_exists('extra', $current) )
+               {
+                       $data['extra'] = '';
+               }
+               else
+               {
+                       $data['extra'] = Entity::hsc($current['extra']);
+               }
+               
+               if ( !array_key_exists('description', $current) )
+               {
+                       $data['description'] = Entity::hsc($current['name']);
+               }
+               else if ( !defined($current['description']) )
+               {
+                       $data['description'] = Entity::hsc($current['description']);
+               }
+               else
+               {
+                       $data['description'] = Entity::hsc(constant($current['description']));
+               }
+       }
+       return Template::fill($template, $data, 1);
+ }
+ /**
+  * listplug_templateEditRow()
+  * 
+  * @param     array   $content                content of target template
+  * @param     string  $desc                   description of target template
+  * @param     string  $name                   name of target template
+  * @param     string  $help                   help text
+  * @param     integer $tabindex               a number for tab index
+  * @param     boolean $big                    large or small textarea
+  * @param     array   $template_name  name of template for filling
+  * @return    void
+  */
+ function listplug_templateEditRow($content, $desc, $name, $help = '', $tabindex = 0, $big = 0, $template_name = '')
+ {
+       global $manager;
+       
+       static $count = 0;
+       
+       $tmplt = array();
+       $base  = array();
+       
+       $templates = array();
+       if ( $template_name )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       $data = array(
+               'description'   => $desc,
+               'help'                  => empty($help) ? '' : helpHtml('template' . $help),
+               'count'                 => $count++,
+               'name'                  => $name,
+               'tabindex'              => $tabindex,
+               'rows'                  => $big ? 10 : 5,
+       );
+       
+       $message = '';
+       
+       /* row head */
+       if ( !array_key_exists('TEMPLATE_EDIT_ROW_HEAD', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_HEAD']) )
+       {
+               $template = "<tr>\n"
+                         . "<td><%description%><%help%></td>\n"
+                         . "<td id=\"td<%count%>\">\n"
+                         . "<textarea class=\"templateedit\" name=\"<%name%>\" tabindex=\"<%tabindex%>\" cols=\"50\" rows=\"<%rows%>\" id=\"textarea<%count%>\">";
+       }
+       else
+       {
+               $template = $tmplt['TEMPLATE_EDIT_ROW_HEAD'];
+       }
+       $message .= TEMPLATE::fill($template, $data);
+       
+       /* row content */
+       $message .= ENTITY::hsc($content);
+       
+       /* row tail */
+       if ( !array_key_exists('TEMPLATE_EDIT_ROW_TAIL', $templates) || empty($tmplt['TEMPLATE_EDIT_ROW_TAIL']) )
+       {
+               $template = "</textarea>\n"
+                         . "</td>\n"
+                         . "</tr>\n";
+       }
+       else
+       {
+               $template = $tmplt['TEMPLATE_EDIT_ROW_TAIL'];
+       }
+       $message .= TEMPLATE::fill($template, $data);
+       
+       return $message;
+ }
+ function listplug_table_itemlist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $cssclass  = '';
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
++>>>>>>> skinnable-master
+       
+       switch( $type )
+       {
+               case 'HEAD':
++<<<<<<< HEAD
++                      echo "<th>"._LIST_ITEM_INFO."</th>\n";
++                      echo "<th>"._LIST_ITEM_CONTENT."</th>\n";
++                      echo "<th colspan='1'>"._LISTS_ACTIONS."</th>";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      // string -> unix timestamp
++                      $current['itime'] = strtotime($current['itime']);
++                      
++                      if ( $current['idraft'] == 1 )
++                      {
++                              $cssclass = " class='draft'";
++                      }
++                      
++                      // (can't use offset time since offsets might vary between blogs)
++                      if ( $current['itime'] > $template['now'] )
++                      {
++                              $cssclass = " class='future'";
++                      }
++                      
++                      echo "<td{$cssclass}>\n";
++                      echo "<dl>\n";
++                      echo '<dt>' . _LIST_ITEM_BLOG . "</dt>\n";
++                      echo '<dd>' . Entity::hsc($current['bshortname']) . "</dd>\n";
++                      echo '<dt>' . _LIST_ITEM_CAT . "</dt>\n";
++                      echo '<dd>' . Entity::hsc($current['cname']) . "</dd>\n";
++                      echo '<dt>' . _LIST_ITEM_AUTHOR . "</dt>\n";
++                      echo '<dd>' . Entity::hsc($current['mname']) . "</dd>\n";
++                      echo '<dt>' . _LIST_ITEM_DATE . "</dt>\n";
++                      echo '<dd>' . date("Y-m-d",$current['itime']) . "</dd>\n";
++                      echo '<dt>' . _LIST_ITEM_TIME . "</dt>\n";
++                      echo '<dd>' . date("H:i",$current['itime']) . "</dd>\n";
++                      echo "</dl>\n";
++                      echo "</td>\n";
++                      
++                      $id = listplug_nextBatchId();
++                      
++                      echo "<td{$cssclass}>\n";
++                      echo "<h3>\n";
++                      echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['inumber']}\" />\n";
++                      echo "<label for=\"batch{$id}\">" . Entity::hsc(strip_tags($current['ititle'])) . "</label>\n";
++                      echo "</h3>\n";
++                      
++                      $current['ibody'] = strip_tags($current['ibody']);
++                      $current['ibody'] = Entity::hsc(Entity::shorten($current['ibody'], 300, '...'));
++                      echo "<p>{$current['ibody']}</p>\n";
++                      echo "</td>\n";
++                      
++                      echo "<td{$cssclass}>\n";
++                      echo "<ul>\n";
++                      echo "<li><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></li>\n";
++                      
++                      // evaluate amount of comments for the item
++                      $COMMENTS = new Comments($current['inumber']);
++                      $camount = $COMMENTS->amountComments();
++                      if ( $camount > 0 )
++                      {
++                              echo "<li><a href=\"index.php?action=itemcommentlist&amp;itemid={$current['inumber']}\">( ";
++                              echo sprintf(_LIST_ITEM_COMMENTS, $COMMENTS->amountComments()) . " )</a></li>\n";
++                      }
++                      else
++                      {
++                              echo '<li>' . _LIST_ITEM_NOCONTENT . "</li>\n";
 +                      }
++                      
++                      echo "<li><a href=\"index.php?action=itemmove&amp;itemid={$current['inumber']}\">" . _LISTS_MOVE . "</a></li>\n";
++                      echo "<li><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></li>\n";
 +                      echo "</ul>\n";
 +                      echo "</td>\n";
++                      break;
++      }
++      return;
++=======
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD']) )
+                       {
+                               $template = "<th><%colinfo%></th>\n"
+                                         . "<th><%colcontent%></th>\n"
+                                         . "<th style=\"white-space:nowrap\"><%colaction%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colinfo'               => _LIST_ITEM_INFO,
+                               'colcontent'    => _LIST_ITEM_CONTENT,
+                               'colaction'             => _LISTS_ACTIONS
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       // string -> unix timestamp
+                       $current['itime'] = strtotime($current['itime']);
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY']) )
+                       {
+                               $template = "<td<%cssclass%>>\n"
+                                         . "<%bshortlabel%> <%bshortnameval%><br />\n"
+                                         . "<%categorylabel%> <%categorynameval%><br />\n"
+                                         . "<%authorlabel%> <%authornameval%><br />\n"
+                                         . "<%itemdatelabel%> <%itemdateval%><br />\n"
+                                         . "<%itemtimelabel%> <%itemtimeval%>\n"
+                                         . "</td>\n"
+                                         . "<td<%cssclass%>>\n"
+                                         . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%itemid%>\" />\n"
+                                         . "<label for=\"batch<%batchid%>\"><b><%itemtitle%></b></label><br />\n"
+                                         . "<%itembody%>\n"
+                                         . "</td>\n"
+                                         . "<td<%cssclass%>>\n"
+                                         . "<a href=\"index.php?action=itemedit&amp;itemid=<%itemid%>\"><%editbtn%></a><br />\n"
+                                         . "<a href=\"index.php?action=itemmove&amp;itemid=<%itemid%>\"><%movebtn%></a><br />\n"
+                                         . "<a href=\"index.php?action=itemdelete&amp;itemid=<%itemid%>\"><%delbtn%></a><br />\n"
+                                         . "<%camount%>\n"
+                                         . "</td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_BODY'];
+                       }
+                       $cssclass  = '';
+                       
+                       if ( $current['idraft'] == 1 )
+                       {
+                               $cssclass = ' class="draft"';
+                       }
+                       
+                       // (can't use offset time since offsets might vary between blogs)
+                       if ( $current['itime'] > $vars['now'] )
+                       {
+                               $cssclass = ' class="future"';
+                       }
+                       $body = strip_tags($current['ibody']);
+                       $data = array(
+                               'cssclass'                      => $cssclass,
+                               'bshortlabel'           => _LIST_ITEM_BLOG,
+                               'bshortnameval'         => Entity::hsc($current['bshortname']),
+                               'categorylabel'         => _LIST_ITEM_CAT,
+                               'categorynameval'       => Entity::hsc($current['cname']),
+                               'authorlabel'           => _LIST_ITEM_AUTHOR,
+                               'authornameval'         => Entity::hsc($current['mname']),
+                               'itemdatelabel'         => _LIST_ITEM_DATE,
+                               'itemdateval'           => date("Y-m-d",$current['itime']),
+                               'itemdatelabel'         => _LIST_ITEM_TIME,
+                               'itemdateval'           => date("H:i",$current['itime']),
+                               'batchid'                       => listplug_nextBatchId(),
+                               'itemid'                        => $current['inumber'],
+                               'itemtitle'                     => Entity::hsc(strip_tags($current['ititle'])),
+                               'itembody'                      => Entity::hsc(Entity::shorten($body, 300, '...')),
+                               'editbtn'                       => _LISTS_EDIT,
+                               'movebtn'                       => _LISTS_MOVE,
+                               'delbtn'                        => _LISTS_DELETE,
+                       );
+                       // evaluate amount of comments for the item
+                       $comment = new Comments($current['inumber']);
+                       $camount = $comment->amountComments();
+                       if ( $camount > 0 )
+                       {
+                               $data['camount'] = "<a href=\"index.php?action=itemcommentlist&amp;itemid={$current['inumber']}\">(" . sprintf(_LIST_ITEM_COMMENTS, $comment->amountComments()) . ")</a><br />\n";
+                       }
+                       else
+                       {
+                               $data['camount'] = _LIST_ITEM_NOCONTENT . "<br />\n";
+                       }
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_ITEMLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
++>>>>>>> skinnable-master
+ }
  
-                       $id = listplug_nextBatchId();
+ // for batch operations: generates the index numbers for checkboxes
+ function listplug_nextBatchId()
+ {
+       static $id = 0;
+       return $id++;
+ }
++<<<<<<< HEAD
++function listplug_table_commentlist($template, $type)
++{
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _LISTS_INFO . "</th>\n";
++                      echo '<th>' . _LIST_COMMENT . "</th>\n";
++                      echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['ctime'] = strtotime($current['ctime']);       // string -> unix timestamp
 +                      
-                       echo '<td>';
-                       echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}\" value=\"{$current['cnumber']}\" />\n";
-                       echo "<label for=\"batch{$id}\">\n";
-                       $current['cbody'] = strip_tags($current['cbody']);
-                       $current['cbody'] = Entity::hsc(Entity::shorten($current['cbody'], 300, '...'));
++                      echo "<td>\n";
++                      echo "<ul>\n";
++                      echo '<li>' . date("Y-m-d@H:i",$current['ctime']) . "</li>\n";
++                      if ( isset($current['mname']) )
++                      {
++                              echo '<li>' . Entity::hsc($current['mname']) ,' ', _LIST_COMMENTS_MEMBER . "</li>\n";
++                      }
++                      else
++                      {
++                              echo '<li>' . Entity::hsc($current['cuser']) . "</li>\n";
++                      }
++                      if ( isset($current['cmail']) && $current['cmail'] )
++                      {
++                              echo '<li>' . Entity::hsc($current['cmail']) . "</li>\n";
++                      }
++                      if ( isset($current['cemail']) && $current['cemail'] )
++                      {
++                              echo '<li>' . Entity::hsc($current['cemail']) . "</li>\n";
++                      }
++                      echo "</ul>\n";
++                      echo "</td>\n";
++
++                      $id = listplug_nextBatchId();
++                      
++                      echo '<td>';
++                      echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}\" value=\"{$current['cnumber']}\" />\n";
++                      echo "<label for=\"batch{$id}\">\n";
++                      $current['cbody'] = strip_tags($current['cbody']);
++                      $current['cbody'] = Entity::hsc(Entity::shorten($current['cbody'], 300, '...'));
 +                      echo $current['cbody'];
 +                      echo '</label>';
 +                      echo '</td>';
 +                      
-                       echo '<td><a href="index.php?action=commentedit&amp;commentid=' . $current['cnumber'] . '">' . _LISTS_EDIT . "</a></td>\n";
-                       echo '<td><a href="index.php?action=commentdelete&amp;commentid=' . $current['cnumber'] . '">' . _LISTS_DELETE . "</a></td>\n";
-                       if ( $template['canAddBan'] )
-                       {
-                               echo '<td><a href="index.php?action=banlistnewfromitem&amp;itemid=' . $current['citem'] . '&amp;ip=' . Entity::hsc($current['cip']), '" title="' . Entity::hsc($current['chost']) . '">' . _LIST_COMMENT_BANIP . "</a></td>\n";
-                       }
++                      echo '<td><a href="index.php?action=commentedit&amp;commentid=' . $current['cnumber'] . '">' . _LISTS_EDIT . "</a></td>\n";
++                      echo '<td><a href="index.php?action=commentdelete&amp;commentid=' . $current['cnumber'] . '">' . _LISTS_DELETE . "</a></td>\n";
++                      if ( $template['canAddBan'] )
++                      {
++                              echo '<td><a href="index.php?action=banlistnewfromitem&amp;itemid=' . $current['citem'] . '&amp;ip=' . Entity::hsc($current['cip']), '" title="' . Entity::hsc($current['chost']) . '">' . _LIST_COMMENT_BANIP . "</a></td>\n";
++                      }
++                      break;
++      }
++      return;
++}
++
++function listplug_table_bloglist($template, $type)
++{
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _NAME . "</th>\n";
++                      echo '<th colspan="7">' . _LISTS_ACTIONS . "</th>\n";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['bname'] = Entity::hsc($current['bname']);
++                      
++                      echo "<td title=\"blogid:{$current['bnumber']} shortname:{$current['bshortname']}\"><a href=\"{$current['burl']}\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"". _BLOGLIST_TT_VISIT."\" /></a>{$current['bname']}</td>\n";
++                      echo "<td><a href=\"index.php?action=createitem&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_ADD ."\">" . _BLOGLIST_ADD . "</a></td>\n";
++                      echo "<td><a href=\"index.php?action=itemlist&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_EDIT."\">". _BLOGLIST_EDIT."</a></td>\n";
++                      echo "<td><a href=\"index.php?action=blogcommentlist&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_COMMENTS."\">". _BLOGLIST_COMMENTS."</a></td>\n";
++                      echo "<td><a href=\"index.php?action=bookmarklet&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_BMLET."\">". _BLOGLIST_BMLET . "</a></td>\n";
++                      
++                      if ( $current['tadmin'] == 1 )
++                      {
++                              echo "<td><a href=\"index.php?action=blogsettings&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_SETTINGS . "\">" . _BLOGLIST_SETTINGS . "</a></td>\n";
++                              echo "<td><a href=\"index.php?action=banlist&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_BANS . "\">" . _BLOGLIST_BANS . "</a></td>\n";
++                      }
++                      
++                      if ( $template['superadmin'] )
++                      {
++                              echo "<td><a href=\"index.php?action=deleteblog&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_DELETE."\">" ._BLOGLIST_DELETE. "</a></td>\n";
++                      }
++                      break;
++      }
++      return;
++}
++
++function listplug_table_shortblognames($template, $type)
++{
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _EBLOG_SHORTNAME . "</th>\n";
++                      echo '<th>' . _EBLOG_NAME. "</th>";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['bshortname'] = Entity::hsc($current['bshortname']);
++                      $current['bname'] = Entity::hsc($current['bname']);
++                      
++                      echo "<td>{$current['bshortname']}</td>\n";
++                      echo "<td>{$current['bname']}</td>\n";
++                      break;
++      }
++      return;
++}
++
++function listplug_table_shortnames($template, $type)
++{
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _NAME . "</th>\n";
++                      echo '<th>' . _LISTS_DESC. "</th>\n";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['name'] = Entity::hsc($current['name']);
++                      $current['description'] = Entity::hsc($current['description']);
++                      
++                      echo "<td>{$current['name']}</td>\n";
++                      echo "<td>{$current['description']}</td>\n";
++                      break;
++      }
++      return;
++}
++
++
++function listplug_table_categorylist($template, $type)
++{
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _LISTS_NAME . "</th>";
++                      echo '<th>' . _LISTS_DESC."</th>\n";
++                      echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
++                      break;
++              case 'BODY':
++                      $id = listplug_nextBatchId();
++                      
++                      $current = $template['current'];
++                      $current['cname'] = Entity::hsc($current['cname']);
++                      $current['cdesc'] = Entity::hsc($current['cdesc']);
++                      
++                      echo "<td>\n";
++                      echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['catid']}\" />\n";
++                      echo "<label for=\"batch{$id}\">{$current['cname']}</label>\n";
++                      echo "</td>\n";
++                      echo "<td>{$current['cdesc']}</td>\n";
++                      echo "<td><a href=\"index.php?action=categoryedit&amp;blogid={$current['cblog']}&amp;catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a></td>\n";
++                      echo "<td><a href=\"index.php?action=categorydelete&amp;blogid={$current['cblog']}&amp;catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
++                      break;
++      }
++      return;
++}
++
++function listplug_table_templatelist($template, $type)
++{
++      global $manager;
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _LISTS_NAME . "</th>\n";
++                      echo '<th>' . _LISTS_DESC . "</th>\n";
++                      echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['tdnumber'] = (integer) $current['tdnumber'];
++                      $current['tdname'] = Entity::hsc($current['tdname']);
++                      $current['tddesc'] = Entity::hsc($current['tddesc']);
++                      
++                      $url = "index.php?action=templateclone&templateid={$current['tdnumber']}";
++                      $url = Entity::hsc($manager->addTicketToUrl($url));
++                      
++                      echo "<td>{$current['tdname']}</td>\n";
++                      echo "<td>{$current['tddesc']}</td>\n";
++                      echo "<td>\n";
++                      echo "<a href=\"index.php?action=templateedit&amp;templateid={$current['tdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a>\n";
++                      echo "</td>\n";
++                      echo "<td>\n";
++                      echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
++                      echo "</td>\n";
++                      echo "<td>\n";
++                      echo "<a href=\"index.php?action=templatedelete&amp;templateid={$current['tdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a>\n";
++                      echo "</td>\n";
++                      break;
++      }
++      return;
++}
++
++function listplug_table_skinlist($template, $type)
++{
++      global $CONF, $DIR_SKINS, $manager;
++      switch( $type )
++      {
++              case 'HEAD':
++                      echo '<th>' . _LISTS_NAME . "</th>\n";
++                      echo '<th>' . _LISTS_DESC . "</th>\n";
++                      echo '<th colspan="3">' . _LISTS_ACTIONS . "</th>\n";
++                      break;
++              case 'BODY':
++                      $current = $template['current'];
++                      $current['sdnumber'] = (integer) $current['sdnumber'];
++                      $current['sdname'] = Entity::hsc($current['sdname']);
++                      $current['sdtype'] = Entity::hsc($current['sdtype']);
++                      
++                      echo "<td>\n";
++                      
++                      // use a special style for the default skin
++                      if ( $current['sdnumber'] == $CONF['BaseSkin'] )
++                      {
++                              echo '<h3 id="base_skin">' . $current['sdname'] . "</h3>\n";
++                      }
++                      else
++                      {
++                              echo '<h3>' . $current['sdname'] . "</h3>\n";
++                      }
++                      
++                      echo "<dl>\n";
++                      echo '<dt>' . _LISTS_TYPE . "</dt>\n";
++                      echo '<dd>' . $current['sdtype'] . "</dd>\n";
++                      
++                      echo '<dt>' . _LIST_SKINS_INCMODE . "</dt>\n";
++                      
++                      if ( $current['sdincmode'] == 'skindir' )
++                      {
++                              echo '<dd>' . _PARSER_INCMODE_SKINDIR . "</dd>\n";
++                      }
++                      else
++                      {
++                              echo '<dd>' . _PARSER_INCMODE_NORMAL . "</dd>\n";
++                      }
++                      
++                      if ( $current['sdincpref'] )
++                      {
++                              echo '<dt>' . _LIST_SKINS_INCPREFIX . "</dt>\n";
++                              echo '<dd>' . Entity::hsc($current['sdincpref']) . "</dd>\n";
++                      }
++                      echo "</dl>\n";
++=======
+ function listplug_table_commentlist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD']) )
+                       {
+                               $template = "<th><%colinfo%></th>\n"
+                                         . "<th><%colcontent%></th>\n"
+                                         . "<th colspan=\"3\"><%colaction%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colinfo'               => _LISTS_INFO,
+                               'colcontent'    => _LIST_COMMENT,
+                               'colaction'             => _LISTS_ACTIONS
+                       );
+                       break;
+               case 'BODY':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY']) )
+                       {
+                               $template = "<td><%commentdate%><br /><%commentator%><br /><%commentsite%><br /><%commentmail%><br /></td>\n"
+                                         . "<td>\n"
+                                         . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%commentid%>\" />"
+                                         . "<label for=\"batch<%batchid%>\"><%commentbody%></label>\n"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">\n"
+                                         . "<a href=\"index.php?action=commentedit&amp;commentid=<%commentid%>\"><%editbtn%></a>\n"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">\n"
+                                         . "<a href=\"index.php?action=commentdelete&amp;commentid=<%commentid%>\"><%delbtn%></a>\n"
+                                         . "</td>\n"
+                                         . "<%addbanlist%>";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_BODY'];
+                       }
+                       $current = $vars['current'];
+                       $body = strip_tags($current['cbody']);
+                       $data = array(
+                               'commentdate'   => date("Y-m-d@H:i", strtotime($current['ctime'])),
+                               'batchid'               => listplug_nextBatchId(),
+                               'commentid'             => $current['cnumber'],
+                               'commentbody'   => Entity::hsc(Entity::shorten($current['cbody'], 300, '...')),
+                               'editbtn'               => _LISTS_EDIT,
+                               'delbtn'                => _LISTS_DELETE,
+                       );
+                       if ( isset($current['mname']) )
+                       {
+                               $data['commentator'] = Entity::hsc($current['mname']) . ' ' . _LIST_COMMENTS_MEMBER;
+                       }
+                       else
+                       {
+                               $data['commentator'] = Entity::hsc($current['cuser']);
+                       }
+                       if ( isset($current['cmail']) && $current['cmail'] )
+                       {
+                               $data['commentsite'] = Entity::hsc($current['cmail']);
+                       }
+                               else
+                       {
+                               $data['commentsite'] = '';
+                       }
+                       if ( isset($current['cemail']) && $current['cemail'] )
+                       {
+                               $data['commentmail'] = Entity::hsc($current['cemail']);
+                       }
+                               else
+                       {
+                               $data['commentmail'] = '';
+                       }
+                       if ( $vars['canAddBan'] )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN']) )
+                               {
+                                       $subTpl = "<td style=\"white-space:nowrap\">"
+                                               . "<a href=\"index.php?action=banlistnewfromitem&amp;itemid=<%itemid%>&amp;ip=<%banip%>\" title=\"<%banhost%>\"><%banbtn%></a>"
+                                               . "</td>\n";
+                               }
+                               else
+                               {
+                                       $subTpl = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_ABAN'];
+                               }
+                               $subData = array(
+                                       'itemid'        => $current['citem'],
+                                       'banip'         => Entity::hsc($current['cip']),
+                                       'banbtn'        => _LIST_COMMENT_BANIP,
+                               );
+                               $data['addbanlist'] = Template::fill($subTpl, $subData);
+                       }
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT']) )
+                       {
+                               $template = "";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CMNTLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_bloglist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD']) )
+                       {
+                               $template = "<th><%blognames%></th>\n"
+                                         . "<th colspan=\"7\"><%actionshead%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_HEAD'];
+                       }
+                       $data = array(
+                               'blognames'   => _NAME,
+                               'actionshead' => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY']) )
+                       {
+                               $template = "<td title=\"blogid:<%blogid%> shortname:<%shortname%>\">\n"
+                                         . "<a href=\"<%blogurl%>\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"<%iconalt%>\" /></a><%blogname%></td>\n"
+                                         . "<td><a href=\"index.php?action=createitem&amp;blogid=<%blogid%>\" title=\"<%ttaddtext%>\"><%addtext%></a></td>\n"
+                                         . "<td><a href=\"index.php?action=itemlist&amp;blogid=<%blogid%>\" title=\"<%ttedittext%>\"><%edittext%></a></td>\n"
+                                         . "<td><a href=\"index.php?action=blogcommentlist&amp;blogid=<%blogid%>\" title=\"<%ttcommenttext%>\"><%commenttext%></a></td>\n"
+                                         . "<td><a href=\"index.php?action=bookmarklet&amp;blogid=<%blogid%>\" title=\"<%ttbmlettext%>\"><%bmlettext%></a></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_BODY'];
+                       }
+                       $data = array(
+                               'blogid'                => $current['bnumber'],
+                               'shortname'             => Entity::hsc($current['bshortname']),
+                               'blogurl'               => $current['burl'],
+                               'blogname'              => Entity::hsc($current['bname']),
+                               'ttaddtext'             => _BLOGLIST_TT_ADD,
+                               'addtext'               => _BLOGLIST_ADD,
+                               'ttedittext'    => _BLOGLIST_TT_EDIT,
+                               'edittext'              => _BLOGLIST_EDIT,
+                               'ttcommenttext' => _BLOGLIST_TT_COMMENTS,
+                               'commenttext'   => _BLOGLIST_COMMENTS,
+                               'ttbmlettext'   => _BLOGLIST_TT_BMLET,
+                               'bmlettext'             => _BLOGLIST_BMLET,
+                       );
+                       if ( $current['tadmin'] == 1 )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+                               {
+                                       $template .= "<td><a href=\"index.php?action=blogsettings&amp;blogid=<%blogid%>\" title=\"<%ttsettingtext%>\"><%settingtext%></a></td>\n"
+                                                  . "<td><a href=\"index.php?action=banlist&amp;blogid=<%blogid%>\" title=\"<%ttbanstext%>\"><%banstext%></a></td>\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM'];
+                               }
+                               $data['ttsettingtext']  = _BLOGLIST_TT_SETTINGS;
+                               $data['settingtext']    = _BLOGLIST_SETTINGS;
+                               $data['ttbanstext']             = _BLOGLIST_TT_BANS;
+                               $data['banstext']               = _BLOGLIST_BANS;
+                       }
+                       
+                       if ( $vars['superadmin'] )
+                       {
+                               if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM']) )
+                               {
+                                       $template .= "<td><a href=\"index.php?action=deleteblog&amp;blogid=<%blogid%>\" title=\"<%ttdeletetext%>\"><%deletetext%></a></td>\n";
+                               }
+                               else
+                               {
+                                       $template .= $templates['SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM'];
+                               }
+                               $data['ttdeletetext']   = _BLOGLIST_TT_DELETE;
+                               $data['deletetext']             = _BLOGLIST_DELETE;
+                       }
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_shortblognames($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD']) )
+                       {
+                               $template = "<th><%colshortname%></th>\n"
+                                         . "<th><%colblogname%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_HEAD'];
+                       }
+                       $data = array(
+                               'colshortname' => _EBLOG_SHORTNAME,
+                               'colblogname'  => _EBLOG_NAME,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY']) )
+                       {
+                               $template = "<td><%bshortname%></td>\n"
+                                         . "<td><%blogname%></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_BODY'];
+                       }
+                       $data = array(
+                               'bshortname' => Entity::hsc($current['bshortname']),
+                               'blogname'   => Entity::hsc($current['bname']),
+                       );
+                       break;
+               case 'FOOT':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_BLOGSNAM_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_shortnames($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD']) )
+                       {
+                               $template = "<th><%colname%></th>\n"
+                                         . "<th><%coldesc%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_HEAD'];
+                       }
+                       $data = array(
+                               'colname' => _NAME,
+                               'coldesc' => _LISTS_DESC,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY']) )
+                       {
+                               $template = "<td><%name%></td>\n"
+                                         . "<td><%desc%></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_BODY'];
+                       }
+                       $data = array(
+                               'name' => Entity::hsc($current['name']),
+                               'desc' => Entity::hsc($current['description']),
+                       );
+                       break;
+               case 'FOOT':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SHORTNAM_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_categorylist($vars, $type, $template_name = '')
+ {
+       global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD']) )
+                       {
+                               $template = "<th><%colname%></th>\n"
+                                         . "<th><%coldesc%></th>\n"
+                                         . "<th colspan=\"2\"><%colact%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_HEAD'];
+                       }
+                       $data = array(
+                               'colname' => _LISTS_NAME,
+                               'coldesc' => _LISTS_DESC,
+                               'colact'  => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY']) )
+                       {
+                               $template = "<td>\n"
+                                         . "<input type=\"checkbox\" id=\"batch<%batchid%>\" name=\"batch[<%batchid%>]\" value=\"<%catid%>\" />\n"
+                                         . "<label for=\"batch<%batchid%>\"><%catname%></label>\n"
+                                         . "</td>\n"
+                                         . "<td><%catdesc%></td>\n"
+                                         . "<td><a href=\"index.php?action=categoryedit&amp;blogid=<%blogid%>&amp;catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a></td>\n"
+                                         . "<td><a href=\"index.php?action=categorydelete&amp;blogid=<%blogid%>&amp;catid=<%catid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a></td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_BODY'];
+                       }
+                       
+                       $data = array(
+                               'batchid'       => listplug_nextBatchId(),
+                               'catid'         => intval($current['catid']),
+                               'catname'       => Entity::hsc($current['cname']),
+                               'catdesc'       => Entity::hsc($current['cdesc']),
+                               'blogid'        => intval($current['cblog']),
+                               'tabindex'      => intval($vars['tabindex']),
+                               'editbtn'       => _LISTS_EDIT,
+                               'delbtn'        => _LISTS_DELETE,
+                       );
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_CATELIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_templatelist($vars, $type, $template_name = '')
+ {
+       global $manager, $CONF;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD']) )
+                       {
+                               $template = "<th><%colname%></th>\n"
+                                         . "<th><%coldesc%></th>\n"
+                                         . "<th colspan=\"3\"><%colact%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colname' => _LISTS_NAME,
+                               'coldesc' => _LISTS_DESC,
+                               'colact'  => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY']) )
+                       {
+                               $template = "<td><%templatename%></td>\n"
+                                         . "<td><%templatedesc%></td>\n"
+                                         . "<td style=\"white-space:nowrap\">"
+                                         . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>\n"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">\n"
+                                         . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>\n"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">\n"
+                                         . "<a href=\"<%deleteurl%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>\n"
+                                         . "</td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_BODY'];
+                       }
+                       
+                       $data = array(
+                               'templatename'  => Entity::hsc($current['tdname']),
+                               'templatedesc'  => Entity::hsc($current['tddesc']),
+                               'templateid'    => (integer) $current['tdnumber'],
+                               'tabindex'              => (integer) $vars['tabindex'],
+                               
+                               'clonebtn'              => _LISTS_CLONE,
+                               'cloneaction'   => $vars['cloneaction'],
+                               'cloneurl'              => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&amp;templateid={$current['tdnumber']}",
+                               
+                               'delbtn'                => _LISTS_DELETE,
+                               'deleteaction'  => $vars['deleteaction'],
+                               'deleteurl'             => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&amp;templateid={$current['tdnumber']}",
+                               
+                               'editbtn'               => _LISTS_EDIT,
+                               'editaction'    => $vars['editaction'],
+                               'editurl'               => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&amp;templateid={$current['tdnumber']}"
+                       );
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT']) )
+                       {
+                               $template = "\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_TPLTLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
+ }
+ function listplug_table_skinlist($vars, $type, $template_name = '')
+ {
+       global $CONF, $DIR_SKINS, $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch( $type )
+       {
+               case 'HEAD':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD']) )
+                       {
+                               $template = "<th><%colname%></th>\n"
+                                         . "<th><%coldesc%></th>\n"
+                                         . "<th colspan=\"3\"><%colact%></th>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_HEAD'];
+                       }
+                       $data = array(
+                               'colname'       => _LISTS_NAME,
+                               'coldesc'       => _LISTS_DESC,
+                               'colact'        => _LISTS_ACTIONS,
+                       );
+                       break;
+               case 'BODY':
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY']) )
+                       {
+                               $template = "<td><%skinname%><br /><br />\n"
+                                         . "<%skintypelabel%> <%skintype%><br />\n"
+                                         . "<%incmodelabel%> <%incmode%><br />\n"
+                                         . "<%incpreflabel%> <%incpref%><br />\n"
+                                         . "<%skinthumb%>"
+                                         . "<%readme%></td>\n"
+                                         . "<td class=\"availableSkinTypes\"><%skindesc%><%skinparts%></td>\n"
+                                         . "<td style=\"white-space:nowrap\">"
+                                         . "<a href=\"index.php?action=skinedit&amp;skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%editbtn%></a>"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">"
+                                         . "<a href=\"<%cloneurl%>\" tabindex=\"<%tabindex%>\"><%clonebtn%></a>"
+                                         . "</td>\n"
+                                         . "<td style=\"white-space:nowrap\">"
+                                         . "<a href=\"index.php?action=skindelete&amp;skinid=<%skinid%>\" tabindex=\"<%tabindex%>\"><%delbtn%></a>"
+                                         . "</td>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_BODY'];
+                       }
+                       
+                       $data = array(
+                               'tabindex'              => $vars['tabindex']++,
+                               
+                               'skinid'                => (integer) $current['sdnumber'],
+                               'skindesc'              => Entity::hsc($current['sddesc']),
+                               
+                               'skintypelabel' => _LISTS_TYPE,
+                               'skintype'              => Entity::hsc($current['sdtype']),
+                               
+                               'incmodelabel'  => _LIST_SKINS_INCMODE,
+                               'incmode'               => ($current['sdincmode'] == 'skindir') ? _PARSER_INCMODE_SKINDIR : _PARSER_INCMODE_NORMAL,
+                               
+                               'incpreflabel'  => ($current['sdincpref']) ? _SKIN_INCLUDE_PREFIX : '',
+                               'incpref'               => ($current['sdincpref']) ? Entity::hsc($current['sdincpref']) : '',
+                               
+                               'editbtn'               => _LISTS_EDIT,
+                               'editaction'    => $vars['editaction'],
+                               'editurl'               => "{$CONF['AdminURL']}index.php?action={$vars['editaction']}&skinid={$current['sdnumber']}",
+                               
+                               'clonebtn'              => _LISTS_CLONE,
+                               'cloneaction'   => $vars['cloneaction'],
+                               'cloneurl'              => "{$CONF['AdminURL']}index.php?action={$vars['cloneaction']}&skinid={$current['sdnumber']}",
+                               
+                               'delbtn'                => _LISTS_DELETE,
+                               'deleteaction'  => $vars['deleteaction'],
+                               'deleteurl'             => "{$CONF['AdminURL']}index.php?action={$vars['deleteaction']}&skinid={$current['sdnumber']}"
+                       );
+                       
+                       if ( $current['sdnumber'] != $vars['default'] )
+                       {
+                               $data['skinname'] = Entity::hsc($current['sdname']);
+                       }
+                       else
+                       {
+                               $data['skinname'] = '<strong>' . Entity::hsc($current['sdname']) . '</strong>';
+                       }
++>>>>>>> skinnable-master
+                       
+                       // add preview image when present
+                       if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
+                       {
++<<<<<<< HEAD
++                              echo "<p>\n";
++=======
+                               $data['skinthumb'] = "<p>\n";
++>>>>>>> skinnable-master
+                               
+                               $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
+                               $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
+                               if ( $has_enlargement )
+                               {
++<<<<<<< HEAD
++                                      echo '<a href="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
++                                      echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
++                                      echo "</a><br />\n";
++                              }
++                              else
++                              {
++                                      echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" /><br />\n";
++=======
+                                       $data['skinthumb'] .= '<a href="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
+                               }
+                               $data['skinthumb'] .= '<img class="skinpreview" src="' . $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
+                               if ( $has_enlargement )
+                               {
+                                       $data['skinthumb'] .= "</a><br />\n";
++>>>>>>> skinnable-master
+                               }
+                               
+                               if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
+                               {
+                                       $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
+                                       $title = sprintf(_LIST_SKIN_README, $current['sdname']);
++<<<<<<< HEAD
++                                      echo "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
++                              }
++                              
++                              echo "</p>\n";
++                      }
++                      
++                      echo "</td>\n";
++                      
++                      echo "<td>\n";
++                      echo '<p>' . Entity::hsc($current['sddesc']) . "</p>\n";
++                      
++                      /* make list of defined skins */
++                      $skin = new Skin($current['sdnumber']);
++                      $available_skin_types = $skin->getAvailableTypes();
++                      
++                      echo _LIST_SKINS_DEFINED;
++                      echo "<ul>\n";
++                      foreach ( $available_skin_types as $type => $friendlyName )
++                      {
++                              if ( $friendlyName === FALSE )
++                              {
++                                      $friendlyName = ucfirst($type);
++=======
+                                       $data['readme'] = "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
+                               }
+                               else
+                               {
+                                       $data['readme'] ="";
+                               }
+                               
+                               $data['skinthumb'] .=  "</p>\n";
+                       }
+                       
+                       $skin =& $manager->getSkin($current['sdnumber'], $vars['handler']);
+                       $available_types = $skin->getAvailableTypes();
+                       
+                       $data['skinparts'] = _LIST_SKINS_DEFINED
+                                          . "<ul>\n";
+                       foreach ( $available_types as $type => $label )
+                       {
+                               if ( $label === FALSE )
+                               {
+                                       $label = ucfirst($type);
++>>>>>>> skinnable-master
+                                       $article = 'skinpartspecial';
+                               }
+                               else
+                               {
+                                       $article = "skinpart{$type}";
+                               }
++<<<<<<< HEAD
++                              echo "<li>\n";
++                              echo helpHtml($article) . "\n";
++                              echo "<a href=\"index.php?action=skinedittype&amp;skinid={$current['sdnumber']}&amp;type={$type}\" tabindex=\"{$template['tabindex']}\">";
++                              echo Entity::hsc($friendlyName);
++                              echo "</a>\n";
++                              echo "</li>\n";
++                      }
++                      echo "</ul>\n";
++                      
++                      echo "</td>";
++                      echo "<td>\n";
++                      echo "<a href=\nindex.php?action=skinedit&amp;skinid={$current['sdnumber']}\n tabindex=\n{$template['tabindex']}>" . _LISTS_EDIT . "</a>\n";
++                      echo "</td>\n";
++                      
++                      $url = "index.php?action=skinclone&skinid={$current['sdnumber']}";
++                      $url = Entity::hsc($manager->addTicketToUrl($url));
++                      echo "<td>\n";
++                      echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
++                      echo "</td>\n";
++                      echo "<td>\n";
++                      echo "<a href=\"index.php?action=skindelete&amp;skinid={$current['sdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
- function listplug_table_bloglist($template, $type)
++function listplug_table_draftlist($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
-                       echo '<th>' . _NAME . "</th>\n";
-                       echo '<th colspan="7">' . _LISTS_ACTIONS . "</th>\n";
++                      echo '<th>' . _LISTS_BLOG . "</th>\n";
++                      echo '<th>' . _LISTS_TITLE . "</th>\n";
++                      echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
-                       $current['bname'] = Entity::hsc($current['bname']);
-                       
-                       echo "<td title=\"blogid:{$current['bnumber']} shortname:{$current['bshortname']}\"><a href=\"{$current['burl']}\"><img src=\"images/globe.gif\" width=\"13\" height=\"13\" alt=\"". _BLOGLIST_TT_VISIT."\" /></a>{$current['bname']}</td>\n";
-                       echo "<td><a href=\"index.php?action=createitem&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_ADD ."\">" . _BLOGLIST_ADD . "</a></td>\n";
-                       echo "<td><a href=\"index.php?action=itemlist&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_EDIT."\">". _BLOGLIST_EDIT."</a></td>\n";
-                       echo "<td><a href=\"index.php?action=blogcommentlist&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_COMMENTS."\">". _BLOGLIST_COMMENTS."</a></td>\n";
-                       echo "<td><a href=\"index.php?action=bookmarklet&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_BMLET."\">". _BLOGLIST_BMLET . "</a></td>\n";
-                       
-                       if ( $current['tadmin'] == 1 )
-                       {
-                               echo "<td><a href=\"index.php?action=blogsettings&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_SETTINGS . "\">" . _BLOGLIST_SETTINGS . "</a></td>\n";
-                               echo "<td><a href=\"index.php?action=banlist&amp;blogid={$current['bnumber']}\" title=\"" . _BLOGLIST_TT_BANS . "\">" . _BLOGLIST_BANS . "</a></td>\n";
-                       }
++                      $current['bshortname'] = Entity::hsc($current['bshortname']);
++                      $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
 +                      
-                       if ( $template['superadmin'] )
-                       {
-                               echo "<td><a href=\"index.php?action=deleteblog&amp;blogid={$current['bnumber']}\" title=\"". _BLOGLIST_TT_DELETE."\">" ._BLOGLIST_DELETE. "</a></td>\n";
-                       }
++                      echo "<td>{$current['bshortname']}</td>\n";
++                      echo "<td>{$current['ititle']}</td>\n";
++                      echo "<td><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
++                      echo "<td><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
- function listplug_table_shortblognames($template, $type)
++function listplug_table_otherdraftlist($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
-                       echo '<th>' . _EBLOG_SHORTNAME . "</th>\n";
-                       echo '<th>' . _EBLOG_NAME. "</th>";
++                      echo '<th>' . _LISTS_BLOG . "</th>\n";
++                      echo '<th>' . _LISTS_TITLE . "</th>\n";
++                      echo '<th>' . _LISTS_AUTHOR . "</th>\n";
++                      echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
 +                      $current['bshortname'] = Entity::hsc($current['bshortname']);
-                       $current['bname'] = Entity::hsc($current['bname']);
++                      $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
++                      $current['mname'] = Entity::hsc($current['mname']);
 +                      
 +                      echo "<td>{$current['bshortname']}</td>\n";
-                       echo "<td>{$current['bname']}</td>\n";
++                      echo "<td>{$current['ititle']}</td>\n";
++                      echo "<td>{$current['mname']}</td>\n";
++                      echo "<td><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
++                      echo "<td><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
- function listplug_table_shortnames($template, $type)
++function listplug_table_actionlist($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
-                       echo '<th>' . _NAME . "</th>\n";
-                       echo '<th>' . _LISTS_DESC. "</th>\n";
++                      echo '<th>' . _LISTS_TIME . "</th>\n";
++                      echo '<th>' . _LIST_ACTION_MSG . "</th>\n";
 +                      break;
 +              case 'BODY':
 +                      $current = $template['current'];
-                       $current['name'] = Entity::hsc($current['name']);
-                       $current['description'] = Entity::hsc($current['description']);
++                      $current['timestamp'] = Entity::hsc($current['timestamp']);
++                      $current['message'] = Entity::hsc($current['message']);
 +                      
-                       echo "<td>{$current['name']}</td>\n";
-                       echo "<td>{$current['description']}</td>\n";
++                      echo "<td>{$current['timestamp']}</td>\n";
++                      echo "<td>{$current['message']}</td>\n";
 +                      break;
 +      }
 +      return;
 +}
 +
- function listplug_table_categorylist($template, $type)
++function listplug_table_banlist($template, $type)
 +{
 +      switch( $type )
 +      {
 +              case 'HEAD':
-                       echo '<th>' . _LISTS_NAME . "</th>";
-                       echo '<th>' . _LISTS_DESC."</th>\n";
-                       echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
++                      echo '<th>' . _LIST_BAN_IPRANGE . "</th>\n";
++                      echo '<th>' . _LIST_BAN_REASON."</th>\n";
++                      echo '<th>' . _LISTS_ACTIONS . "</th>\n";
 +                      break;
 +              case 'BODY':
-                       $id = listplug_nextBatchId();
-                       
 +                      $current = $template['current'];
-                       $current['cname'] = Entity::hsc($current['cname']);
-                       $current['cdesc'] = Entity::hsc($current['cdesc']);
++                      $current['blogid'] = (integer) $current['blogid'];
++                      $current['iprange'] = Entity::hsc($current['iprange']);
++                      $current['reason'] = Entity::hsc($current['reason']);
 +                      
-                       echo "<td>\n";
-                       echo "<input type=\"checkbox\" id=\"batch{$id}\" name=\"batch[{$id}]\" value=\"{$current['catid']}\" />\n";
-                       echo "<label for=\"batch{$id}\">{$current['cname']}</label>\n";
-                       echo "</td>\n";
-                       echo "<td>{$current['cdesc']}</td>\n";
-                       echo "<td><a href=\"index.php?action=categoryedit&amp;blogid={$current['cblog']}&amp;catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_EDIT . "</a></td>\n";
-                       echo "<td><a href=\"index.php?action=categorydelete&amp;blogid={$current['cblog']}&amp;catid={$current['catid']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
++                      echo "<td>{$current['iprange']}</td>\n";
++                      echo "<td>{$current['reason']}</td>\n";
++                      echo '<td><a href="index.php?action=banlistdelete&amp;blogid=' . $current['blogid'] . '&amp;iprange=' . Entity::hsc($current['iprange']) . '">' . _LISTS_DELETE . "</a></td>\n";
 +                      break;
 +      }
 +      return;
++=======
+                               $data['skinparts'] .= "<li>\n"
+                                                  . helpHtml($article) . "\n"
+                                                  . "<a href=\"{$CONF['AdminURL']}index.php?action={$vars['edittypeaction']}&amp;skinid={$current['sdnumber']}&amp;type={$type}\" tabindex=\"{$vars['tabindex']}\">"
+                                                  . Entity::hsc($label)
+                                                  . "</a>\n"
+                                                  . "</li>\n";
+                       }
+                       $data['skinparts'] .= "</ul>\n";
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT']) )
+                       {
+                               $template = "";
+                       }
+                       else
+                       {
+                               $template = $templates['SHOWLIST_LISTPLUG_TABLE_SKINLIST_FOOT'];
+                       }
+                       $data = array();
+                       break;
+       }
+       return Template::fill($template, $data);
  }
  
- function listplug_table_templatelist($template, $type)
+ function listplug_table_draftlist($vars, $type, $template_name = '')
  {
        global $manager;
+       
+       $templates = array();
+       if ( !empty($template_name) )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
        switch( $type )
        {
                case 'HEAD':
@@@ -788,180 -2084,381 +3005,382 @@@ function listplug_list_normalskinlist($
                        }
                        else
                        {
-                               echo '<dd>' . _PARSER_INCMODE_NORMAL . "</dd>\n";
-                       }
-                       
-                       if ( $current['sdincpref'] )
-                       {
-                               echo '<dt>' . _LIST_SKINS_INCPREFIX . "</dt>\n";
-                               echo '<dd>' . Entity::hsc($current['sdincpref']) . "</dd>\n";
+                               $template = $templates['NORMALSKINLIST_BODY'];
                        }
-                       echo "</dl>\n";
                        
-                       // add preview image when present
-                       if ( $current['sdincpref'] && @file_exists("{$DIR_SKINS}{$current['sdincpref']}preview.png") )
+                       $data['tabindex']               = $vars['tabindex']++;
+                       $data['skintype']               = $current['skintype'];
+                       $data['skintypename']   = $current['skintypename'];
+                       $data['editaction']             = $vars['editaction'];
+                       $data['editurl']                = "{$CONF['AdminURL']}?action={$vars['editaction']}&amp;skinid={$vars['skinid']}&amp;type={$current['skintype']}";
+                       /* TODO: removeaction? */
+                       /* TODO: customHelpHtml("skinpart{$skintype}-{$template_name}") */
+                       $data['help']                   = '';
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('NORMALSKINLIST_FOOT', $templates) || empty($templates['NORMALSKINLIST_FOOT']) )
                        {
-                               echo "<p>\n";
-                               
-                               $alternatve_text = sprintf(_LIST_SKIN_PREVIEW, $current['sdname']);
-                               $has_enlargement = @file_exists($DIR_SKINS . $current['sdincpref'] . 'preview-large.png');
-                               if ( $has_enlargement )
-                               {
-                                       echo '<a href="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview-large.png" title="' . _LIST_SKIN_PREVIEW_VIEWLARGER . "\">\n";
-                                       echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" />\n";
-                                       echo "</a><br />\n";
-                               }
-                               else
-                               {
-                                       echo '<img class="skinpreview" src="',$CONF['SkinsURL'], Entity::hsc($current['sdincpref']),'preview.png" width="100" height="75" alt="' . $alternatve_text . "\" /><br />\n";
-                               }
-                               
-                               if ( @file_exists("{$DIR_SKINS}{$current['sdincpref']}readme.html") )
-                               {
-                                       $url = $CONF['SkinsURL'] . Entity::hsc($current['sdincpref']) . 'readme.html';
-                                       $title = sprintf(_LIST_SKIN_README, $current['sdname']);
-                                       echo "<a href=\"{$url}\" title=\"{$title}\">" . _LIST_SKIN_README_TXT . "</a>\n";
-                               }
-                               
-                               echo "</p>\n";
+                               $template = "</ul>\n";
                        }
-                       
-                       echo "</td>\n";
-                       
-                       echo "<td>\n";
-                       echo '<p>' . Entity::hsc($current['sddesc']) . "</p>\n";
-                       
-                       /* make list of defined skins */
-                       $skin = new Skin($current['sdnumber']);
-                       $available_skin_types = $skin->getAvailableTypes();
-                       
-                       echo _LIST_SKINS_DEFINED;
-                       echo "<ul>\n";
-                       foreach ( $available_skin_types as $type => $friendlyName )
+                       else
                        {
-                               if ( $friendlyName === FALSE )
-                               {
-                                       $friendlyName = ucfirst($type);
-                                       $article = 'skinpartspecial';
-                               }
-                               else
-                               {
-                                       $article = "skinpart{$type}";
-                               }
-                               echo "<li>\n";
-                               echo helpHtml($article) . "\n";
-                               echo "<a href=\"index.php?action=skinedittype&amp;skinid={$current['sdnumber']}&amp;type={$type}\" tabindex=\"{$template['tabindex']}\">";
-                               echo Entity::hsc($friendlyName);
-                               echo "</a>\n";
-                               echo "</li>\n";
+                               $template = $templates['NORMALSKINLIST_FOOT'];
                        }
-                       echo "</ul>\n";
                        
-                       echo "</td>";
-                       echo "<td>\n";
-                       echo "<a href=\nindex.php?action=skinedit&amp;skinid={$current['sdnumber']}\n tabindex=\n{$template['tabindex']}>" . _LISTS_EDIT . "</a>\n";
-                       echo "</td>\n";
-                       
-                       $url = "index.php?action=skinclone&skinid={$current['sdnumber']}";
-                       $url = Entity::hsc($manager->addTicketToUrl($url));
-                       echo "<td>\n";
-                       echo "<a href=\"{$url}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_CLONE . "</a>\n";
-                       echo "</td>\n";
-                       echo "<td>\n";
-                       echo "<a href=\"index.php?action=skindelete&amp;skinid={$current['sdnumber']}\" tabindex=\"{$template['tabindex']}\">" . _LISTS_DELETE . "</a></td>\n";
                        break;
        }
-       return;
+       
+       return Template::fill($template, $data);
  }
  
- function listplug_table_draftlist($template, $type)
+ /**
+  * listplug_list_specialskinlist()
+  * 
+  * @param     array   $vars                   array for variables
+  * @param     string  $type                   HEAD/BODY/FOOT
+  * @param     string  $template_name  name of template
+  * @return    string  marked-up string
+  */
+ function listplug_list_specialskinlist($vars, $type, $template_name = '')
  {
-       switch( $type )
+       global $manager, $CONF;
+       
+       /* available variables as a default */
+       $data = array(
+               'skinid'        => (integer) $vars['skinid'],
+               'skinname'      => Entity::hsc($vars['skinname']),
+       );
+       
+       /* retrieve templates */
+       $templates = array();
+       if ( $template_name )
+       {
+               $templates =& $manager->getTemplate($template_name);
+       }
+       
+       switch ( $type )
        {
                case 'HEAD':
-                       echo '<th>' . _LISTS_BLOG . "</th>\n";
-                       echo '<th>' . _LISTS_TITLE . "</th>\n";
-                       echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
+                       if ( !array_key_exists('SPECIALSKINLIST_HEAD', $templates) || empty($templates['SPECIALSKINLIST_HEAD']) )
+                       {
+                               $template = "<ul>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SPECIALSKINLIST_HEAD'];
+                       }
                        break;
                case 'BODY':
-                       $current = $template['current'];
-                       $current['bshortname'] = Entity::hsc($current['bshortname']);
-                       $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
+                       $current = $vars['current'];
+                       if ( !array_key_exists('SPECIALSKINLIST_BODY', $templates) || empty($templates['SPECIALSKINLIST_BODY']) )
+                       {
+                               $template = "<li>"
+                                         . "<a href=\"<%editurl%>\" tabindex=\"<%tabindex%>\">"
+                                         . "<%skintype%>"
+                                         . "</a>"
+                                         . " ("
+                                         . "<a href=\"<%removeurl%>\" tabindex=\"<%tabindex%>\" >"
+                                         . "<%text(_LISTS_DELETE)%>"
+                                         . "</a>"
+                                         . ")"
+                                         . "</li>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SPECIALSKINLIST_BODY'];
+                       }
                        
-                       echo "<td>{$current['bshortname']}</td>\n";
-                       echo "<td>{$current['ititle']}</td>\n";
-                       echo "<td><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
-                       echo "<td><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
+                       $data['tabindex']               = (integer) $vars['tabindex']++;
+                       $data['skintype']               = Entity::hsc($current['skintype']);
+                       $data['skintypename']   = Entity::hsc($current['skintypename']);
+                       $data['editaction']             = $vars['editaction'];
+                       $data['editurl']                = "{$CONF['AdminURL']}?action={$vars['editaction']}&amp;skinid={$vars['skinid']}&amp;type={$current['skintype']}";
+                       $data['removeaction']   = $vars['editaction'];
+                       $data['removeurl']              = "{$CONF['AdminURL']}?action={$vars['removeaction']}&amp;skinid={$vars['skinid']}&amp;type={$current['skintype']}";
+                       
+                       break;
+               case 'FOOT':
+                       if ( !array_key_exists('SPECIALSKINLIST_FOOT', $templates) || empty($templates['SPECIALSKINLIST_FOOT']) )
+                       {
+                               $template = "</ul>\n";
+                       }
+                       else
+                       {
+                               $template = $templates['SPECIALSKINLIST_FOOT'];
+                       }
                        break;
        }
-       return;
+       
+       return Template::fill($template, $data);
  }
  
- function listplug_table_otherdraftlist($template, $type)
+ /**
+  * listplug_input_yesno()
+  *
+  * @param     string  $name                   name of input element with radio type attribute
+  * @param     string  $checkedval             value which should be checked
+  * @param     integer $tabindex               tabindex number
+  * @param     string  $value1                 value of radio 1
+  * @param     string  $value2                 value of radio 2
+  * @param     string  $yesval                 label for yes
+  * @param     string  $noval                  label for no
+  * @param     boolean $isAdmin                super admin or not
+  * @param     string  $template_name  name of template
+  * @param     boolean $showlist               used in showlist or not
+  * @return    string  marked-up string
+  */
+ function listplug_input_yesno($name, $checkedval, $tabindex = 0,
+       $value1 = 1, $value2 = 0, $yesval = _YES, $noval = _NO,
+       $isAdmin = 0, $template_name = '', $showlist = FALSE)
  {
-       switch( $type )
+       global $manager;
+       
+       $templates = array();
+       if ( $template_name )
        {
-               case 'HEAD':
-                       echo '<th>' . _LISTS_BLOG . "</th>\n";
-                       echo '<th>' . _LISTS_TITLE . "</th>\n";
-                       echo '<th>' . _LISTS_AUTHOR . "</th>\n";
-                       echo '<th colspan="2">' . _LISTS_ACTIONS . "</th>\n";
-                       break;
-               case 'BODY':
-                       $current = $template['current'];
-                       $current['bshortname'] = Entity::hsc($current['bshortname']);
-                       $current['ititle'] = Entity::hsc(strip_tags($current['ititle']));
-                       $current['mname'] = Entity::hsc($current['mname']);
-                       
-                       echo "<td>{$current['bshortname']}</td>\n";
-                       echo "<td>{$current['ititle']}</td>\n";
-                       echo "<td>{$current['mname']}</td>\n";
-                       echo "<td><a href=\"index.php?action=itemedit&amp;itemid={$current['inumber']}\">" . _LISTS_EDIT . "</a></td>\n";
-                       echo "<td><a href=\"index.php?action=itemdelete&amp;itemid={$current['inumber']}\">" . _LISTS_DELETE . "</a></td>\n";
-                       break;
+               $templates =& $manager->getTemplate($template_name);
        }
-       return;
+       
+       if ( $name == 'admin' )
+       {
+               if ( !array_key_exists('INPUTYESNO_TEMPLATE_ADMIN', $templates) || empty($templates['INPUTYESNO_TEMPLATE_ADMIN']) )
+               {
+                       $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> onclick=\"selectCanLogin(true);\" />\n"
+                                 . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
+                                 . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> onclick=\"selectCanLogin(false);\" />\n"
+                                 . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
+               }
+               else
+               {
+                       $template = $templates['INPUTYESNO_TEMPLATE_ADMIN'];
+               }
+       }
+       else
+       {
+               if ( array_key_exists('INPUTYESNO_TEMPLATE_NORMAL', $templates) && !empty($templates['INPUTYESNO_TEMPLATE_NORMAL']) )
+               {
+                       $template = $templates['INPUTYESNO_TEMPLATE_NORMAL'];
+               }
+               else if ( $showlist && array_key_exists('SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO', $templates) && !empty($templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO']) )
+               {
+                       $template = $templates['SHOWLIST_LISTPLUG_TABLE_PLGOPT_OYESNO'];
+               }
+               else
+               {
+               $template = "<input type=\"radio\" id=\"<%yesid%>\" name=\"<%name%>\" value=\"<%yesval%>\" <%yescheckedval%> />\n"
+                         . "<label for=\"<%yesid%>\"><%yesvaltext%></label>\n"
+                         . "<input type=\"radio\" id=\"<%noid%>\" name=\"<%name%>\" value=\"<%noval%>\" <%nocheckedval%> <%disabled%> />\n"
+                         . "<label for=\"<%noid%>\"><%novaltext%></label>\n";
+               }
+       }
+       
+       $id             = preg_replace('#[|]#', '-', $name);
+       $id1    = $id . $value1;
+       $id2    = $id . $value2;
+       $dat = array(
+               'name'                  => Entity::hsc($name),
+               'yesval'                => Entity::hsc($value1),
+               'noval'                 => Entity::hsc($value2),
+               'yesid'                 => Entity::hsc($id1),
+               'noid'                  => Entity::hsc($id2),
+               'yesvaltext'    => $yesval,
+               'novaltext'             => $noval,
+               'yescheckedval' => ($checkedval == $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+               'nocheckedval'  => ($checkedval != $value1) ? 'checked="checked" tabindex="' . $tabindex . '"': '',
+               'disabled'              => ($isAdmin && $name == 'canlogin') ? ' disabled="disabled"' : '',
+       );
+       
+       return Template::fill($template, $dat);
  }
  
- function listplug_table_actionlist($template, $type)
+ /**
+  * listplug_batchlist()
+  * 
+  * @param     string          $attr   item/member/team/category/comment
+  * @param     resource        $query  SQL resorce
+  * @param     string          $type   type for showlist()
+  * @param     array           $vars   array for variables
+  */
+ function listplug_batchlist($attr, $query, $type, $vars, $template_name)
  {
-       switch( $type )
+       global $manager;
+       
+       /* HEAD */
+       $content = "<form method=\"post\" action=\"index.php\">\n";
+       
+       /* BODY */
+       $content .= showlist($query, $type, $vars, $template_name);
+       
+       /* FOOT */
+       switch ( $attr )
        {
-               case 'HEAD':
-                       echo '<th>' . _LISTS_TIME . "</th>\n";
-                       echo '<th>' . _LIST_ACTION_MSG . "</th>\n";
+               case 'item':
+                       $options = array(
+                               'delete'        => _BATCH_ITEM_DELETE,
+                               'move'          => _BATCH_ITEM_MOVE
+                       );
                        break;
-               case 'BODY':
-                       $current = $template['current'];
-                       $current['timestamp'] = Entity::hsc($current['timestamp']);
-                       $current['message'] = Entity::hsc($current['message']);
-                       
-                       echo "<td>{$current['timestamp']}</td>\n";
-                       echo "<td>{$current['message']}</td>\n";
+               case 'member':
+                       $options = array(
+                               'delete'        => _BATCH_MEMBER_DELETE,
+                               'setadmin'      => _BATCH_MEMBER_SET_ADM,
+                               'unsetadmin' => _BATCH_MEMBER_UNSET_ADM
+                       );
+                       break;
+               case 'team':
+                       $options = array(
+                               'delete'        => _BATCH_TEAM_DELETE,
+                               'setadmin'      => _BATCH_TEAM_SET_ADM,
+                               'unsetadmin' => _BATCH_TEAM_UNSET_ADM,
+                       );
+                       break;
+               case 'category':
+                       $options = array(
+                               'delete'        => _BATCH_CAT_DELETE,
+                               'move'          => _BATCH_CAT_MOVE,
+                       );
+                       break;
+               case 'comment':
+                       $options = array(
+                               'delete'        => _BATCH_COMMENT_DELETE,
+                       );
+                       break;
+               default:
+                       $options = array();
                        break;
        }
-       return;
+       
+       $content .= "<p class=\"batchoperations\">\n"
+                  . _BATCH_WITH_SEL
+                  . "<select name=\"batchaction\">\n";
+       
+       foreach ( $options as $option => $label )
+       {
+               $content .= "<option value=\"{$option}\">{$label}</option>\n";
+       }
+       $content .= "</select>\n";
+       
+       if ( $attr == 'team' )
+       {
+               $content .= '<input type="hidden" name="blogid" value="' . intRequestVar('blogid') . '" />';
+       }
+       else if ( $attr == 'comment' )
+       {
+               $content .= '<input type="hidden" name="itemid" value="' . intRequestVar('itemid') . '" />';
+       }
+       
+       $content .= '<input type="submit" value="' . _BATCH_EXEC . '" />'
+                  . "("
+                  . "<a href=\"\" onclick=\"if( event &amp;&amp; event.preventDefault ) event.preventDefault(); return batchSelectAll(1); \">" . _BATCH_SELECTALL . "</a>"
+                  . " - "
+                  . "<a href=\"\" onclick=\"if( event &amp;&amp; event.preventDefault ) event.preventDefault(); return batchSelectAll(0); \">" . _BATCH_DESELECTALL . "</a>"
+                  . ")\n"
+                  . "<input type=\"hidden\" name=\"action\" value=\"batch{$attr}\" />\n"
+                  . '<input type="hidden" name="ticket" value="' . Entity::hsc($manager->getNewTicket()) . '" />' . "\n"
+                  . "</p>\n"
+                  . "</form>\n";
+       
+       return $content;
  }
  
- function listplug_table_banlist($template, $type)
+ /**
+  * listplug_navlist()
+  * 
+  * @param     string          $attr                   item/member/team/category/comment
+  * @param     resource        $query                  SQL resorce
+  * @param     string          $type                   type for showlist()
+  * @param     array           $vars                   array for variables
+  * @param     string          $template_name  name of template
+  * @return    string          contents
+  */
+ function listplug_navlist($attribute, $query, $type, $vars, $template_name)
  {
-       switch( $type )
+       global $CONF, $manager;
+       $dat['adminurl'] = $CONF['AdminURL'];
+       
+       $templates = array();
+       if ( $template_name )
        {
-               case 'HEAD':
-                       echo '<th>' . _LIST_BAN_IPRANGE . "</th>\n";
-                       echo '<th>' . _LIST_BAN_REASON."</th>\n";
-                       echo '<th>' . _LISTS_ACTIONS . "</th>\n";
-                       break;
-               case 'BODY':
-                       $current = $template['current'];
-                       $current['blogid'] = (integer) $current['blogid'];
-                       $current['iprange'] = Entity::hsc($current['iprange']);
-                       $current['reason'] = Entity::hsc($current['reason']);
-                       
-                       echo "<td>{$current['iprange']}</td>\n";
-                       echo "<td>{$current['reason']}</td>\n";
-                       echo '<td><a href="index.php?action=banlistdelete&amp;blogid=' . $current['blogid'] . '&amp;iprange=' . Entity::hsc($current['iprange']) . '">' . _LISTS_DELETE . "</a></td>\n";
-                       break;
+               $templates =& $manager->getTemplate($template_name);
        }
-       return;
+       
+       $dat['prev'] = $vars['start'] - $vars['amount'];
+       if ( $dat['prev'] < $vars['minamount'] )
+       {
+               $dat['prev'] = $vars['minamount'];
+       }
+       
+       $dat['next'] = $vars['start'] + $vars['amount'];
+       
+       $navi = "\n";
+       if ( !array_key_exists('SHOWLIST_LISTPLUG_TABLE_NAVILIST', $templates) || empty($templates['SHOWLIST_LISTPLUG_TABLE_NAVILIST']) )
+       {
+               $navi .= "<table frame=\"box\" rules=\"all\" sumamry=\"navigation actions\" class=\"navigation\">\n"
+                      . "<tr>\n";
+               $navi .= "<td>\n"
+                      . "<form method=\"post\" action=\"<%adminurl%>\">\n"
+                      . "<input type=\"hidden\" name=\"start\" value=\"<%prev%>\" />\n"
+                      . "<button type=\"submit\" name=\"action\" value=\"<%action%>\">&lt; &lt; <%listsprev%></button>\n"
+                      . "<input type=\"hidden\" name=\"blogid\" value=\"<%blogid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"itemid\" value=\"<%itemid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"search\" value=\"<%search%>\" />\n"
+                      . "<input type=\"hidden\" name=\"amount\" value=\"<%amount%>\" />\n"
+                      . "</form>\n"
+                      . "</td>\n";
+               $navi .= "<td>\n"
+                      . "<form method=\"post\" action=\"<%adminurl%>\">\n"
+                      . "<input type=\"text\" name=\"amount\" size=\"3\" value=\"<%amount%>\" />\n"
+                      . "<%listsperpage%>"
+                      . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
+                      . "<button type=\"submit\" name=\"action\" value=\"<%action%>\">&gt; <%listschange%></button>\n"
+                      . "<input type=\"hidden\" name=\"blogid\" value=\"<%blogid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"itemid\" value=\"<%itemid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"search\" value=\"<%search%>\" />\n"
+                      . "<input type=\"hidden\" name=\"amount\" value=\"<%amount%>\" />\n"
+                      . "</form>\n"
+                      . "</td>\n";
+               $navi .= "<td>\n"
+                      . "<form method=\"post\" action=\"<%adminurl%>\">\n"
+                      . "<input type=\"text\" name=\"search\" value=\"<%search%>\" size=\"7\" />\n"
+                      . "<input type=\"hidden\" name=\"start\" value=\"0\" />\n"
+                      . "<button type=\"submit\" name=\"action\" value=\"<%action%>\">&gt; <%listssearch%></button>\n"
+                      . "<input type=\"hidden\" name=\"blogid\" value=\"<%blogid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"itemid\" value=\"<%itemid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"search\" value=\"<%search%>\" />\n"
+                      . "<input type=\"hidden\" name=\"amount\" value=\"<%amount%>\" />\n"
+                      . "</form>\n"
+                      . "</td>\n";
+               $navi .= "<td>\n"
+                      . "<form method=\"post\" action=\"<%adminurl%>\">\n"
+                      . "<input type=\"hidden\" name=\"start\" value=\"<%next%>\" />\n"
+                      . "<button type=\"submit\" name=\"action\" value=\"<%action%>\"><%listsnext%>&gt; &gt; </button>\n"
+                      . "<input type=\"hidden\" name=\"blogid\" value=\"<%blogid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"itemid\" value=\"<%itemid%>\" />\n"
+                      . "<input type=\"hidden\" name=\"search\" value=\"<%search%>\" />\n"
+                      . "<input type=\"hidden\" name=\"amount\" value=\"<%amount%>\" />\n"
+                      . "</form>\n"
+                      . "</td>\n";
+               $navi .= "</tr>\n"
+                      . "</table>\n";
+       }
+       else
+       {
+               $navi .= $templates['SHOWLIST_LISTPLUG_TABLE_NAVILIST'];
+       }
+       $dat['listsprev']               = _LISTS_PREV;
+       $dat['listschange']             = _LISTS_CHANGE;
+       $dat['listssearch']             = _LISTS_SEARCH;
+       $dat['listsnext']               = _LISTS_NEXT;
+       $dat['listsperpage']    = _LISTS_PERPAGE;
+       /* HEAD */
+       $template = Template::fill($navi, $dat);
+       
+       /* BODY */
+       $template .= listplug_batchlist($attribute, $query, $type, $vars, $template_name);
+       
+       /* FOOT */
+       $template .= Template::fill($navi, $dat);
+       
+       return $template;
++>>>>>>> skinnable-master
  }
 -}
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2002-2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + *    This class contains two classes that can be used for importing and\r
 + *    exporting Nucleus skins: SKINIMPORT and SKINEXPORT\r
 + *\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group\r
 + * @version $Id: skinie.php 1624 2012-01-09 11:36:20Z sakamocchi $\r
 + */\r
 +\r
 +class SkinImport\r
 +{\r
 +      // hardcoded value (see constructor). When 1, interesting info about the\r
 +      // parsing process is sent to the output\r
 +      private $debug;\r
 +      \r
 +      // parser/file pointer\r
 +      private $parser;\r
 +      private $fp;\r
 +      \r
 +      // parset internal charset, US-ASCII/ISO-8859-1/UTF-8\r
 +      private $parse_charset = 'UTF-8';\r
 +      \r
 +      // which data has been read?\r
 +      private $metaDataRead;\r
 +      private $allRead;\r
 +      \r
 +      // extracted data\r
 +      private $skins;\r
 +      private $templates;\r
 +      private $info;\r
 +      \r
 +      // to maintain track of where we are inside the XML file\r
 +      private $inXml;\r
 +      private $inData;\r
 +      private $inMeta;\r
 +      private $inSkin;\r
 +      private $inTemplate;\r
 +      private $currentName;\r
 +      private $currentPartName;\r
 +      private $cdata;\r
 +      \r
 +      /**\r
 +       * constructor initializes data structures\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              // disable magic_quotes_runtime if it's turned on\r
 +              //set_magic_quotes_runtime(0);\r
 +              if ( version_compare(PHP_VERSION, '5.3.0', '<') )\r
 +              {\r
 +                      ini_set('magic_quotes_runtime', '0');\r
 +              }\r
 +              \r
 +              // debugging mode?\r
 +              $this->debug = 0;\r
 +              \r
 +              $this->reset();\r
 +              return;\r
 +      }\r
 +      \r
 +      public function __destruct()\r
 +      {\r
 +              return;\r
 +      }\r
 +      \r
 +      public function reset()\r
 +      {\r
 +              if ( $this->parser )\r
 +              {\r
 +                      xml_parser_free($this->parser);\r
 +              }\r
 +              \r
 +              // XML file pointer\r
 +              $this->fp = 0;\r
 +              \r
 +              // which data has been read?\r
 +              $this->metaDataRead = 0;\r
 +              $this->allRead = 0;\r
 +              \r
 +              // to maintain track of where we are inside the XML file\r
 +              $this->inXml = 0;\r
 +              $this->inData = 0;\r
 +              $this->inMeta = 0;\r
 +              $this->inSkin = 0;\r
 +              $this->inTemplate = 0;\r
 +              $this->currentName = '';\r
 +              $this->currentPartName = '';\r
 +              \r
 +              // character data pile\r
 +              $this->cdata = '';\r
 +              \r
 +              // list of skinnames and templatenames (will be array of array)\r
 +              $this->skins = array();\r
 +              $this->templates = array();\r
 +              \r
 +              // extra info included in the XML files (e.g. installation notes)\r
 +              $this->info = '';\r
 +              \r
 +              // init XML parser, this parser deal with characters as encoded by UTF-8\r
 +              $this->parser = xml_parser_create($this->parse_charset);\r
 +              xml_set_object($this->parser, $this);\r
 +              xml_set_element_handler($this->parser, 'start_element', 'end_element');\r
 +              xml_set_character_data_handler($this->parser, 'character_data');\r
 +              xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Reads an XML file into memory\r
 +       *\r
 +       * @param $filename\r
 +       *              Which file to read\r
 +       * @param $metaOnly\r
 +       *              Set to 1 when only the metadata needs to be read (optional, default 0)\r
 +       */\r
 +      public function readFile($filename, $metaOnly = 0)\r
 +      {\r
 +              // open file\r
 +              $this->fp = @fopen($filename, 'r');\r
 +              if ( !$this->fp )\r
 +              {\r
 +                      return _SKINIE_ERROR_FAILEDOPEN_FILEURL;\r
 +              }\r
 +              \r
 +              // here we go!\r
 +              $this->inXml = 1;\r
 +              \r
 +              $tempbuffer = null;\r
 +              \r
 +              while ( !feof($this->fp) )\r
 +              {\r
 +                      $tempbuffer .= fread($this->fp, 4096);\r
 +              }\r
 +              fclose($this->fp);\r
 +              \r
 +              /*\r
 +               * NOTE: conver character set.\r
 +               * We hope all characters in the file also includes UTF-8 coded character set,\r
 +               *  because this PHP extension implements support for James Clark's expat in PHP\r
 +               *   and it supports juust US-ASCII, ISO-8859-1, UTF-8 character coding scheme.\r
 +               */\r
 +              if ( i18n::get_current_charset() != $this->parse_charset )\r
 +              {\r
 +                      $tempbuffer = i18n::convert($tempbuffer, i18n::get_current_charset(), $this->parse_charset);\r
 +              }\r
 +              \r
 +              $temp = tmpfile();\r
 +              fwrite($temp, $tempbuffer);\r
 +              rewind($temp);\r
 +              \r
 +              while ( ($buffer = fread($temp, 4096) )\r
 +               && (!$metaOnly || ($metaOnly && !$this->metaDataRead)) )\r
 +               {\r
 +                      $err = xml_parse( $this->parser, $buffer, feof($temp) );\r
 +                      if ( !$err && $this->debug )\r
 +                      {\r
 +                              echo 'ERROR: ', xml_error_string(xml_get_error_code($this->parser)), '<br />';\r
 +                      }\r
 +              }\r
 +              \r
 +              // all done\r
 +              $this->inXml = 0;\r
 +              fclose($temp);\r
 +              \r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the list of skin names\r
 +       */\r
 +      public function getSkinNames()\r
 +      {\r
 +              return array_keys($this->skins);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the list of template names\r
 +       */\r
 +      public function getTemplateNames()\r
 +      {\r
 +              return array_keys($this->templates);\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the extra information included in the XML file\r
 +       */\r
 +      public function getInfo()\r
 +      {\r
 +              return $this->info;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Writes the skins and templates to the database\r
 +       *\r
 +       * @param $allowOverwrite\r
 +       *              set to 1 when allowed to overwrite existing skins with the same name\r
 +       *              (default = 0)\r
 +       */\r
 +      public function writeToDatabase($allowOverwrite = 0)\r
 +      {\r
 +              $existingSkins = $this->checkSkinNameClashes();\r
 +              $existingTemplates = $this->checkTemplateNameClashes();\r
 +              $invalidSkinNames = $this->checkSkinNamesValid();\r
 +              $invalidTemplateNames = $this->checkTemplateNamesValid();\r
 +              \r
 +              // if there are invalid skin or template names, stop executioin and return and error\r
 +              if ( (sizeof($invalidSkinNames) > 0) || (sizeof($invalidTemplateNames) > 0) )\r
 +              {\r
 +                      $inames_error = "<p>"._SKINIE_INVALID_NAMES_DETECTED."</p>\n";\r
 +                      $inames_error .= "<ul>";\r
 +                      foreach( $invalidSkinNames as $sName )\r
 +                      {\r
 +                              $inames_error .= "<li>".Entity::hsc($sName)."</li>";\r
 +                      }\r
 +                      foreach( $invalidTemplateNames as $sName )\r
 +                      {\r
 +                              $inames_error .= "<li>".Entity::hsc($sName)."</li>";\r
 +                      }\r
 +                      $inames_error .= "</ul>";\r
 +                      return $inames_error;\r
 +              }\r
 +              \r
 +              // if not allowed to overwrite, check if any nameclashes exists\r
 +              if ( !$allowOverwrite )\r
 +              {\r
 +                      if ( (sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0) )\r
 +                      {\r
 +                              return _SKINIE_NAME_CLASHES_DETECTED;\r
 +                      }\r
 +              }\r
 +              \r
 +              foreach ( $this->skins as $skinName => $data )\r
 +              {\r
 +                      // 1. if exists: delete all part data, update desc data\r
 +                      //    if not exists: create desc\r
 +                      if ( in_array($skinName, $existingSkins) )\r
 +                      {\r
 +                              $skinObj = SKIN::createFromName($skinName);\r
 +                              \r
 +                              // delete all parts of the skin\r
 +                              $skinObj->deleteAllParts();\r
 +                              \r
 +                              // update general info\r
 +                              $skinObj->updateGeneralInfo(\r
 +                                      $skinName,\r
 +                                      $data['description'],\r
 +                                      $data['type'],\r
 +                                      $data['includeMode'],\r
 +                                      $data['includePrefix']\r
 +                              );\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $skinid = SKIN::createNew(\r
 +                                      $skinName,\r
 +                                      $data['description'],\r
 +                                      $data['type'],\r
 +                                      $data['includeMode'],\r
 +                                      $data['includePrefix']\r
 +                              );\r
 +                              $skinObj = new SKIN($skinid);\r
 +                      }\r
 +                      \r
 +                      // 2. add parts\r
 +                      foreach ( $data['parts'] as $partName => $partContent )\r
 +                      {\r
 +                              $skinObj->update($partName, $partContent);\r
 +                      }\r
 +              }\r
 +              \r
 +              foreach ( $this->templates as $templateName => $data )\r
 +              {\r
 +                      // 1. if exists: delete all part data, update desc data\r
 +                      //    if not exists: create desc\r
 +                      if ( in_array($templateName, $existingTemplates) )\r
 +                      {\r
 +                              $templateObj = Template::createFromName($templateName);\r
 +                              \r
 +                              // delete all parts of the template\r
 +                              $templateObj->deleteAllParts();\r
 +                              \r
 +                              // update general info\r
 +                              $templateObj->updateGeneralInfo($templateName, $data['description']);\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              $templateid = Template::createNew($templateName, $data['description']);\r
 +                              $templateObj = new Template($templateid);\r
 +                      }\r
 +                      \r
 +                      // 2. add parts\r
 +                      foreach ( $data['parts'] as $partName => $partContent )\r
 +                      {\r
 +                              $templateObj->update($partName, $partContent);\r
 +                      }\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +        * returns an array of all the skin nameclashes (empty array when no name clashes)\r
 +        */\r
 +      public function checkSkinNameClashes()\r
 +      {\r
 +              $clashes = array();\r
 +              \r
 +              foreach ( $this->skins as $skinName => $data )\r
 +              {\r
 +                      if ( SKIN::exists($skinName) )\r
 +                      {\r
 +                              array_push($clashes, $skinName);\r
 +                      }\r
 +              }\r
 +              return $clashes;\r
 +      }\r
 +      \r
 +      /**\r
 +        * returns an array of all the template nameclashes\r
 +        * (empty array when no name clashes)\r
 +        */\r
 +      public function checkTemplateNameClashes()\r
 +      {\r
 +              $clashes = array();\r
 +              \r
 +              foreach ( $this->templates as $templateName => $data )\r
 +              {\r
 +                      if ( Template::exists($templateName) )\r
 +                      {\r
 +                              array_push($clashes, $templateName);\r
 +                      }\r
 +              }\r
 +              return $clashes;\r
 +      }\r
 +      \r
 +      /**\r
 +        * returns an array of all the invalid skin names (empty array when no invalid names )\r
 +        */\r
 +      private function checkSkinNamesValid()\r
 +      {\r
 +              $notValid = array();\r
 +              \r
 +              foreach ( $this->skins as $skinName => $data )\r
 +              {\r
 +                      if ( !isValidSkinName($skinName) )\r
 +                      {\r
 +                              array_push($notValid, $skinName);\r
 +                      }\r
 +              }\r
 +              return $notValid;\r
 +      }\r
 +      \r
 +      /**\r
 +        * returns an array of all the invalid template names (empty array when no invalid names )\r
 +        */\r
 +      private function checkTemplateNamesValid()\r
 +      {\r
 +              $notValid = array();\r
 +              \r
 +              foreach ( $this->templates as $templateName => $data )\r
 +              {\r
 +                      if ( !isValidTemplateName($templateName) )\r
 +                      {\r
 +                              array_push($notValid, $templateName);\r
 +                      }\r
 +              }\r
 +              return $notValid;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Called by XML parser for each new start element encountered\r
 +       */\r
 +      private function start_element($parser, $name, $attrs)\r
 +      {\r
 +              foreach( $attrs as $key=>$value )\r
 +              {\r
 +                      if ( $this->parse_charset != i18n::get_current_charset() )\r
 +                      {\r
 +                              $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());\r
 +                              $value = i18n::convert($value, $this->parse_charset, i18n::get_current_charset());\r
 +                      }\r
 +                      \r
 +                      $attrs[$key] = $value;\r
 +              }\r
 +              \r
 +              if ( $this->debug )\r
 +              {\r
 +                      echo 'START: ', Entity::hsc($name), '<br />';\r
 +              }\r
 +              \r
 +              switch ( $name )\r
 +              {\r
 +                      case 'nucleusskin':\r
 +                              $this->inData = 1;\r
 +                              break;\r
 +                      case 'meta':\r
 +                              $this->inMeta = 1;\r
 +                              break;\r
 +                      case 'info':\r
 +                              // no action needed\r
 +                              break;\r
 +                      case 'skin':\r
 +                              if ( !$this->inMeta )\r
 +                              {\r
 +                                      $this->inSkin = 1;\r
 +                                      $this->currentName = $attrs['name'];\r
 +                                      $this->skins[$this->currentName]['type'] = $attrs['type'];\r
 +                                      $this->skins[$this->currentName]['includeMode'] = $attrs['includeMode'];\r
 +                                      $this->skins[$this->currentName]['includePrefix'] = $attrs['includePrefix'];\r
 +                                      $this->skins[$this->currentName]['parts'] = array();\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $this->skins[$attrs['name']] = array();\r
 +                                      $this->skins[$attrs['name']]['parts'] = array();\r
 +                              }\r
 +                              break;\r
 +                      case 'template':\r
 +                              if ( !$this->inMeta )\r
 +                              {\r
 +                                      $this->inTemplate = 1;\r
 +                                      $this->currentName = $attrs['name'];\r
 +                                      $this->templates[$this->currentName]['parts'] = array();\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $this->templates[$attrs['name']] = array();\r
 +                                      $this->templates[$attrs['name']]['parts'] = array();\r
 +                              }\r
 +                              break;\r
 +                      case 'description':\r
 +                              // no action needed\r
 +                              break;\r
 +                      case 'part':\r
 +                              $this->currentPartName = $attrs['name'];\r
 +                              break;\r
 +                      default:\r
 +                              echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';\r
 +                              break;\r
 +              }\r
 +              // character data never contains other tags\r
 +              $this->clear_character_data();\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +        * Called by the XML parser for each closing tag encountered\r
 +        */\r
 +      private function end_element($parser, $name)\r
 +      {\r
 +              if ( $this->debug )\r
 +              {\r
 +                      echo 'END: ' . Entity::hsc($name) . '<br />';\r
 +              }\r
 +              \r
 +              if ( $this->parse_charset != i18n::get_current_charset() )\r
 +              {\r
 +                      $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());\r
 +                      $charset_data = i18n::convert($this->get_character_data(), $this->parse_charset, i18n::get_current_charset());\r
 +              }\r
 +              else\r
 +              {\r
 +                      $charset_data = $this->get_character_data();\r
 +              }\r
 +              \r
 +              switch ( $name )\r
 +              {\r
 +                      case 'nucleusskin':\r
 +                              $this->inData = 0;\r
 +                              $this->allRead = 1;\r
 +                              break;\r
 +                      case 'meta':\r
 +                              $this->inMeta = 0;\r
 +                              $this->metaDataRead = 1;\r
 +                              break;\r
 +                      case 'info':\r
 +                              $this->info = $charset_data;\r
 +                      case 'skin':\r
 +                              if ( !$this->inMeta )\r
 +                              {\r
 +                                      $this->inSkin = 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'template':\r
 +                              if ( !$this->inMeta )\r
 +                              {\r
 +                                      $this->inTemplate = 0;\r
 +                              }\r
 +                              break;\r
 +                      case 'description':\r
 +                              if ( $this->inSkin )\r
 +                              {\r
 +                                      $this->skins[$this->currentName]['description'] = $charset_data;\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $this->templates[$this->currentName]['description'] = $charset_data;\r
 +                              }\r
 +                              break;\r
 +                      case 'part':\r
 +                              if ( $this->inSkin )\r
 +                              {\r
 +                                      $this->skins[$this->currentName]['parts'][$this->currentPartName] = $charset_data;\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $this->templates[$this->currentName]['parts'][$this->currentPartName] = $charset_data;\r
 +                              }\r
 +                              break;\r
 +                      default:\r
 +                              echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';\r
 +                              break;\r
 +              }\r
 +              $this->clear_character_data();\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Called by XML parser for data inside elements\r
 +       */\r
 +      private function character_data ($parser, $data)\r
 +      {\r
 +              if ( $this->debug )\r
 +              {\r
 +                      echo 'NEW DATA: ' . Entity::hsc($data) . '<br />';\r
 +              }\r
 +              $this->cdata .= $data;\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Returns the data collected so far\r
 +       */\r
 +      private function get_character_data()\r
 +      {\r
 +              return $this->cdata;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Clears the data buffer\r
 +       */\r
 +      private function clear_character_data()\r
 +      {\r
 +              $this->cdata = '';\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Static method that looks for importable XML files in subdirs of the given dir\r
 +       */\r
 +      static public function searchForCandidates($dir)\r
 +      {\r
 +              $candidates = array();\r
 +              \r
 +              $dirhandle = opendir($dir);\r
 +              while ( $filename = readdir($dirhandle) )\r
 +              {\r
 +                      if ( @is_dir($dir . $filename) && ($filename != '.') && ($filename != '..') )\r
 +                      {\r
 +                              $xml_file = $dir . $filename . '/skinbackup.xml';\r
 +                              if ( file_exists($xml_file) && is_readable($xml_file) )\r
 +                              {\r
 +                                      //$xml_file;\r
 +                                      $candidates[$filename] = $filename;\r
 +                              }\r
 +                              \r
 +                              // backwards compatibility\r
 +                              $xml_file = $dir . $filename . '/skindata.xml';\r
 +                              if ( file_exists($xml_file) && is_readable($xml_file) )\r
 +                              {\r
 +                                      //$xml_file;\r
 +                                      $candidates[$filename] = $filename;\r
 +                              }\r
 +                      }\r
 +              }\r
 +              closedir($dirhandle);\r
 +              return $candidates;\r
 +      }\r
 +}\r
 +\r
 +class SkinExport\r
 +{\r
 +      private $templates;\r
 +      private $skins;\r
 +      private $info;\r
 +      \r
 +      /**\r
 +       * Constructor initializes data structures\r
 +       */\r
 +      public function __construct()\r
 +      {\r
 +              // list of templateIDs to export\r
 +              $this->templates = array();\r
 +              \r
 +              // list of skinIDs to export\r
 +              $this->skins = array();\r
 +              \r
 +              // extra info to be in XML file\r
 +              $this->info = '';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Adds a template to be exported\r
 +       *\r
 +       * @param id\r
 +       *              template ID\r
 +       * @result false when no such ID exists\r
 +       */\r
 +      public function addTemplate($id)\r
 +      {\r
 +              if ( !Template::existsID($id) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              $this->templates[$id] = Template::getNameFromId($id);\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Adds a skin to be exported\r
 +       *\r
 +       * @param id\r
 +       *              skin ID\r
 +       * @result false when no such ID exists\r
 +       */\r
 +      public function addSkin($id)\r
 +      {\r
 +              if ( !SKIN::existsID($id) )\r
 +              {\r
 +                      return 0;\r
 +              }\r
 +              \r
 +              $this->skins[$id] = SKIN::getNameFromId($id);\r
 +              return 1;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Sets the extra info to be included in the exported file\r
 +       */\r
 +      public function setInfo($info)\r
 +      {\r
 +              $this->info = $info;\r
 +      }\r
 +      \r
 +      /**\r
 +       * Outputs the XML contents of the export file\r
 +       *\r
 +       * @param $setHeaders\r
 +       *              set to 0 if you don't want to send out headers\r
 +       *              (optional, default 1)\r
 +       */\r
 +      public function export($setHeaders = 1)\r
 +      {\r
 +              if ( $setHeaders )\r
 +              {\r
 +                      // make sure the mimetype is correct, and that the data does not show up\r
 +                      // in the browser, but gets saved into and XML file (popup download window)\r
 +                      header('Content-Type: text/xml; charset=' . i18n::get_current_charset());\r
 +                      header('Content-Disposition: attachment; filename="skinbackup.xml"');\r
 +                      header('Expires: 0');\r
 +                      header('Pragma: no-cache');\r
 +              }\r
 +              \r
 +              echo "<nucleusskin>\n";\r
 +              \r
 +              // meta\r
 +              echo "\t<meta>\n";\r
 +              // skins\r
 +              foreach ( $this->skins as $skinId => $skinName )\r
 +              {\r
 +                      echo "\t\t" . '<skin name="' . Entity::hsc($skinName) . '" />' . "\n";\r
 +              }\r
 +              // templates\r
 +              foreach ( $this->templates as $templateId => $templateName )\r
 +              {\r
 +                      echo "\t\t" . '<template name="' . Entity::hsc($templateName) . '" />' . "\n";\r
 +              }\r
 +              // extra info\r
 +              if ( $this->info )\r
 +              {\r
 +                      echo "\t\t<info><![CDATA[" . $this->info . "]]></info>\n";\r
 +              }\r
 +              echo "\t</meta>\n\n\n";\r
 +              \r
 +              // contents skins\r
 +              foreach ($this->skins as $skinId => $skinName)\r
 +              {\r
 +                      $skinId = intval($skinId);\r
 +                      $skinObj = new SKIN($skinId);\r
 +                      \r
 +                      echo "\t" . '<skin name="' . Entity::hsc($skinName) . '" type="' . Entity::hsc($skinObj->getContentType()) . '" includeMode="' . Entity::hsc($skinObj->getIncludeMode()) . '" includePrefix="' . Entity::hsc($skinObj->getIncludePrefix()) . '">' . "\n";\r
 +                      echo "\t\t<description>" . Entity::hsc($skinObj->getDescription()) . "</description>\n";\r
 +                      \r
 +                      $res = DB::getResult('SELECT stype, scontent FROM '. sql_table('skin') .' WHERE sdesc=' . $skinId);\r
 +                      foreach ( $res as $row )\r
 +                      {\r
 +                              echo "\t\t" . '<part name="',Entity::hsc($row['stype']) . '">';\r
 +                              echo '<![CDATA[' . $this->escapeCDATA($row['scontent']) . ']]>';\r
 +                              echo "</part>\n\n";\r
 +                      }\r
 +                      echo "\t</skin>\n\n\n";\r
 +              }\r
 +              \r
 +              // contents templates\r
 +              foreach ( $this->templates as $templateId => $templateName )\r
 +              {\r
 +                      $templateId = intval($templateId);\r
 +                      \r
 +                      echo "\t" . '<template name="' . Entity::hsc($templateName) . '">' . "\n";\r
 +                      echo "\t\t<description>" . Entity::hsc(Template::getDesc($templateId)) . "</description>\n";\r
 +                      \r
 +                      $res = DB::getResult('SELECT tpartname, tcontent FROM '. sql_table('template') .' WHERE tdesc=' . $templateId);\r
 +                      foreach ( $res as $row )\r
 +                      {\r
 +                              echo "\t\t" . '<part name="' . Entity::hsc($row['tpartname']) . '">';\r
 +                              echo '<![CDATA[' . $this->escapeCDATA($row['tcontent']) . ']]>';\r
 +                              echo "</part>\n\n";\r
 +                      }\r
 +                      \r
 +                      echo "\t</template>\n\n\n";\r
 +              }\r
 +              echo '</nucleusskin>';\r
 +      }\r
 +      \r
 +      /**\r
 +       * Escapes CDATA content so it can be included in another CDATA section\r
 +       */\r
 +      private function escapeCDATA($cdata)\r
 +      {\r
 +              return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2002-2009 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  *    This class contains two classes that can be used for importing and
+  *    exporting Nucleus skins: SKINIMPORT and SKINEXPORT
+  *
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2009 The Nucleus Group
+  * @version $Id: skinie.php 1883 2012-06-17 07:55:47Z sakamocchi $
+  */
+ class SkinImport
+ {
+       // hardcoded value (see constructor). When 1, interesting info about the
+       // parsing process is sent to the output
+       private $debug;
+       
+       // parser/file pointer
+       private $parser;
+       private $fp;
+       
+       // parset internal charset, US-ASCII/ISO-8859-1/UTF-8
+       private $parse_charset = 'UTF-8';
+       
+       // which data has been read?
+       private $metaDataRead;
+       private $allRead;
+       
+       // extracted data
+       private $skins;
+       private $templates;
+       private $info;
+       
+       // to maintain track of where we are inside the XML file
+       private $inXml;
+       private $inData;
+       private $inMeta;
+       private $inSkin;
+       private $inTemplate;
+       private $currentName;
+       private $currentPartName;
+       private $cdata;
+       
+       /**
+        * constructor initializes data structures
+        */
+       public function __construct()
+       {
+               // disable magic_quotes_runtime if it's turned on
+               //set_magic_quotes_runtime(0);
+               if ( version_compare(PHP_VERSION, '5.3.0', '<') )
+               {
+                       ini_set('magic_quotes_runtime', '0');
+               }
+               
+               // debugging mode?
+               $this->debug = 0;
+               
+               $this->reset();
+               return;
+       }
+       
+       public function __destruct()
+       {
+               return;
+       }
+       
+       public function reset()
+       {
+               if ( $this->parser )
+               {
+                       xml_parser_free($this->parser);
+               }
+               
+               // XML file pointer
+               $this->fp = 0;
+               
+               // which data has been read?
+               $this->metaDataRead = 0;
+               $this->allRead = 0;
+               
+               // to maintain track of where we are inside the XML file
+               $this->inXml = 0;
+               $this->inData = 0;
+               $this->inMeta = 0;
+               $this->inSkin = 0;
+               $this->inTemplate = 0;
+               $this->currentName = '';
+               $this->currentPartName = '';
+               
+               // character data pile
+               $this->cdata = '';
+               
+               // list of skinnames and templatenames (will be array of array)
+               $this->skins = array();
+               $this->templates = array();
+               
+               // extra info included in the XML files (e.g. installation notes)
+               $this->info = '';
+               
+               // init XML parser, this parser deal with characters as encoded by UTF-8
+               $this->parser = xml_parser_create($this->parse_charset);
+               xml_set_object($this->parser, $this);
+               xml_set_element_handler($this->parser, 'start_element', 'end_element');
+               xml_set_character_data_handler($this->parser, 'character_data');
+               xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
+               
+               return;
+       }
+       
+       /**
+        * Reads an XML file into memory
+        *
+        * @param $filename
+        *              Which file to read
+        * @param $metaOnly
+        *              Set to 1 when only the metadata needs to be read (optional, default 0)
+        */
+       public function readFile($filename, $metaOnly = 0)
+       {
+               // open file
+               $this->fp = @fopen($filename, 'r');
+               if ( !$this->fp )
+               {
+                       return _SKINIE_ERROR_FAILEDOPEN_FILEURL;
+               }
+               
+               // here we go!
+               $this->inXml = 1;
+               
+               $tempbuffer = null;
+               
+               while ( !feof($this->fp) )
+               {
+                       $tempbuffer .= fread($this->fp, 4096);
+               }
+               fclose($this->fp);
+               
+               /*
+                * NOTE: conver character set.
+                * We hope all characters in the file also includes UTF-8 coded character set,
+                *  because this PHP extension implements support for James Clark's expat in PHP
+                *   and it supports juust US-ASCII, ISO-8859-1, UTF-8 character coding scheme.
+                */
+               if ( i18n::get_current_charset() != $this->parse_charset )
+               {
+                       $tempbuffer = i18n::convert($tempbuffer, i18n::get_current_charset(), $this->parse_charset);
+               }
+               
+               $temp = tmpfile();
+               fwrite($temp, $tempbuffer);
+               rewind($temp);
+               
+               while ( ($buffer = fread($temp, 4096) )
+                && (!$metaOnly || ($metaOnly && !$this->metaDataRead)) )
+                {
+                       $err = xml_parse( $this->parser, $buffer, feof($temp) );
+                       if ( !$err && $this->debug )
+                       {
+                               echo 'ERROR: ', xml_error_string(xml_get_error_code($this->parser)), '<br />';
+                       }
+               }
+               
+               // all done
+               $this->inXml = 0;
+               fclose($temp);
+               
+               return;
+       }
+       
+       /**
+        * Returns the list of skin names
+        */
+       public function getSkinNames()
+       {
+               return array_keys($this->skins);
+       }
+       
+       /**
+        * Returns the list of template names
+        */
+       public function getTemplateNames()
+       {
+               return array_keys($this->templates);
+       }
+       
+       /**
+        * Returns the extra information included in the XML file
+        */
+       public function getInfo()
+       {
+               return $this->info;
+       }
+       
+       /**
+        * Writes the skins and templates to the database
+        *
+        * @param $allowOverwrite
+        *              set to 1 when allowed to overwrite existing skins with the same name
+        *              (default = 0)
+        */
+       public function writeToDatabase($allowOverwrite = 0)
+       {
+               global $manager;
+               
+               $existingSkins = $this->checkSkinNameClashes();
+               $existingTemplates = $this->checkTemplateNameClashes();
+               $invalidSkinNames = $this->checkSkinNamesValid();
+               $invalidTemplateNames = $this->checkTemplateNamesValid();
+               
+               // if there are invalid skin or template names, stop executioin and return and error
+               if ( (sizeof($invalidSkinNames) > 0) || (sizeof($invalidTemplateNames) > 0) )
+               {
+                       $inames_error = "<p>"._SKINIE_INVALID_NAMES_DETECTED."</p>\n";
+                       $inames_error .= "<ul>";
+                       foreach( $invalidSkinNames as $sName )
+                       {
+                               $inames_error .= "<li>".Entity::hsc($sName)."</li>";
+                       }
+                       foreach( $invalidTemplateNames as $sName )
+                       {
+                               $inames_error .= "<li>".Entity::hsc($sName)."</li>";
+                       }
+                       $inames_error .= "</ul>";
+                       return $inames_error;
+               }
+               
+               // if not allowed to overwrite, check if any nameclashes exists
+               if ( !$allowOverwrite )
+               {
+                       if ( (sizeof($existingSkins) > 0) || (sizeof($existingTemplates) > 0) )
+                       {
+                               return _SKINIE_NAME_CLASHES_DETECTED;
+                       }
+               }
+               
+               foreach ( $this->skins as $skinName => $data )
+               {
+                       // 1. if exists: delete all part data, update desc data
+                       //    if not exists: create desc
+                       if ( in_array($skinName, $existingSkins) )
+                       {
+                               $skinObj = SKIN::createFromName($skinName);
+                               
+                               // delete all parts of the skin
+                               $skinObj->deleteAllParts();
+                               
+                               // update general info
+                               $skinObj->updateGeneralInfo(
+                                       $skinName,
+                                       $data['description'],
+                                       $data['type'],
+                                       $data['includeMode'],
+                                       $data['includePrefix']
+                               );
+                       }
+                       else
+                       {
+                               $skinid = SKIN::createNew(
+                                       $skinName,
+                                       $data['description'],
+                                       $data['type'],
+                                       $data['includeMode'],
+                                       $data['includePrefix']
+                               );
+                               $skinObj =& $manager->getSkin($skinid);
+                       }
+                       
+                       // 2. add parts
+                       foreach ( $data['parts'] as $partName => $partContent )
+                       {
+                               $skinObj->update($partName, $partContent);
+                       }
+               }
+               
+               foreach ( $this->templates as $templateName => $data )
+               {
+                       // 1. if exists: delete all part data, update desc data
+                       //    if not exists: create desc
+                       if ( in_array($templateName, $existingTemplates) )
+                       {
+                               $templateObj = Template::createFromName($templateName);
+                               
+                               // delete all parts of the template
+                               $templateObj->deleteAllParts();
+                               
+                               // update general info
+                               $templateObj->updateGeneralInfo($templateName, $data['description']);
+                       }
+                       else
+                       {
+                               $templateid = Template::createNew($templateName, $data['description']);
+                               $templateObj = new Template($templateid);
+                       }
+                       
+                       // 2. add parts
+                       foreach ( $data['parts'] as $partName => $partContent )
+                       {
+                               $templateObj->update($partName, $partContent);
+                       }
+               }
+               return;
+       }
+       
+       /**
+         * returns an array of all the skin nameclashes (empty array when no name clashes)
+         */
+       public function checkSkinNameClashes()
+       {
+               $clashes = array();
+               
+               foreach ( $this->skins as $skinName => $data )
+               {
+                       if ( SKIN::exists($skinName) )
+                       {
+                               array_push($clashes, $skinName);
+                       }
+               }
+               return $clashes;
+       }
+       
+       /**
+         * returns an array of all the template nameclashes
+         * (empty array when no name clashes)
+         */
+       public function checkTemplateNameClashes()
+       {
+               $clashes = array();
+               
+               foreach ( $this->templates as $templateName => $data )
+               {
+                       if ( Template::exists($templateName) )
+                       {
+                               array_push($clashes, $templateName);
+                       }
+               }
+               return $clashes;
+       }
+       
+       /**
+         * returns an array of all the invalid skin names (empty array when no invalid names )
+         */
+       private function checkSkinNamesValid()
+       {
+               $notValid = array();
+               
+               foreach ( $this->skins as $skinName => $data )
+               {
+                       if ( !isValidSkinName($skinName) )
+                       {
+                               array_push($notValid, $skinName);
+                       }
+               }
+               return $notValid;
+       }
+       
+       /**
+         * returns an array of all the invalid template names (empty array when no invalid names )
+         */
+       private function checkTemplateNamesValid()
+       {
+               $notValid = array();
+               
+               foreach ( $this->templates as $templateName => $data )
+               {
+                       if ( !isValidTemplateName($templateName) )
+                       {
+                               array_push($notValid, $templateName);
+                       }
+               }
+               return $notValid;
+       }
+       
+       /**
+        * Called by XML parser for each new start element encountered
+        */
+       private function start_element($parser, $name, $attrs)
+       {
+               foreach( $attrs as $key=>$value )
+               {
+                       if ( $this->parse_charset != i18n::get_current_charset() )
+                       {
+                               $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());
+                               $value = i18n::convert($value, $this->parse_charset, i18n::get_current_charset());
+                       }
+                       
+                       $attrs[$key] = $value;
+               }
+               
+               if ( $this->debug )
+               {
+                       echo 'START: ', Entity::hsc($name), '<br />';
+               }
+               
+               switch ( $name )
+               {
+                       case 'nucleusskin':
+                               $this->inData = 1;
+                               break;
+                       case 'meta':
+                               $this->inMeta = 1;
+                               break;
+                       case 'info':
+                               // no action needed
+                               break;
+                       case 'skin':
+                               if ( !$this->inMeta )
+                               {
+                                       $this->inSkin = 1;
+                                       $this->currentName = $attrs['name'];
+                                       $this->skins[$this->currentName]['type'] = $attrs['type'];
+                                       $this->skins[$this->currentName]['includeMode'] = $attrs['includeMode'];
+                                       $this->skins[$this->currentName]['includePrefix'] = $attrs['includePrefix'];
+                                       $this->skins[$this->currentName]['parts'] = array();
+                               }
+                               else
+                               {
+                                       $this->skins[$attrs['name']] = array();
+                                       $this->skins[$attrs['name']]['parts'] = array();
+                               }
+                               break;
+                       case 'template':
+                               if ( !$this->inMeta )
+                               {
+                                       $this->inTemplate = 1;
+                                       $this->currentName = $attrs['name'];
+                                       $this->templates[$this->currentName]['parts'] = array();
+                               }
+                               else
+                               {
+                                       $this->templates[$attrs['name']] = array();
+                                       $this->templates[$attrs['name']]['parts'] = array();
+                               }
+                               break;
+                       case 'description':
+                               // no action needed
+                               break;
+                       case 'part':
+                               $this->currentPartName = $attrs['name'];
+                               break;
+                       default:
+                               echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';
+                               break;
+               }
+               // character data never contains other tags
+               $this->clear_character_data();
+               return;
+       }
+       
+       /**
+         * Called by the XML parser for each closing tag encountered
+         */
+       private function end_element($parser, $name)
+       {
+               if ( $this->debug )
+               {
+                       echo 'END: ' . Entity::hsc($name) . '<br />';
+               }
+               
+               if ( $this->parse_charset != i18n::get_current_charset() )
+               {
+                       $name = i18n::convert($name, $this->parse_charset, i18n::get_current_charset());
+                       $charset_data = i18n::convert($this->get_character_data(), $this->parse_charset, i18n::get_current_charset());
+               }
+               else
+               {
+                       $charset_data = $this->get_character_data();
+               }
+               
+               switch ( $name )
+               {
+                       case 'nucleusskin':
+                               $this->inData = 0;
+                               $this->allRead = 1;
+                               break;
+                       case 'meta':
+                               $this->inMeta = 0;
+                               $this->metaDataRead = 1;
+                               break;
+                       case 'info':
+                               $this->info = $charset_data;
+                       case 'skin':
+                               if ( !$this->inMeta )
+                               {
+                                       $this->inSkin = 0;
+                               }
+                               break;
+                       case 'template':
+                               if ( !$this->inMeta )
+                               {
+                                       $this->inTemplate = 0;
+                               }
+                               break;
+                       case 'description':
+                               if ( $this->inSkin )
+                               {
+                                       $this->skins[$this->currentName]['description'] = $charset_data;
+                               }
+                               else
+                               {
+                                       $this->templates[$this->currentName]['description'] = $charset_data;
+                               }
+                               break;
+                       case 'part':
+                               if ( $this->inSkin )
+                               {
+                                       $this->skins[$this->currentName]['parts'][$this->currentPartName] = $charset_data;
+                               }
+                               else
+                               {
+                                       $this->templates[$this->currentName]['parts'][$this->currentPartName] = $charset_data;
+                               }
+                               break;
+                       default:
+                               echo _SKINIE_SEELEMENT_UNEXPECTEDTAG . Entity::hsc($name) . '<br />';
+                               break;
+               }
+               $this->clear_character_data();
+               return;
+       }
+       
+       /**
+        * Called by XML parser for data inside elements
+        */
+       private function character_data ($parser, $data)
+       {
+               if ( $this->debug )
+               {
+                       echo 'NEW DATA: ' . Entity::hsc($data) . '<br />';
+               }
+               $this->cdata .= $data;
+               return;
+       }
+       
+       /**
+        * Returns the data collected so far
+        */
+       private function get_character_data()
+       {
+               return $this->cdata;
+       }
+       
+       /**
+        * Clears the data buffer
+        */
+       private function clear_character_data()
+       {
+               $this->cdata = '';
+               return;
+       }
+       
+       /**
+        * Static method that looks for importable XML files in subdirs of the given dir
+        */
+       static public function searchForCandidates($dir)
+       {
+               $candidates = array();
+               
+               $dirhandle = opendir($dir);
+               while ( $filename = readdir($dirhandle) )
+               {
+                       if ( @is_dir($dir . $filename) && ($filename != '.') && ($filename != '..') )
+                       {
+                               $xml_file = $dir . $filename . '/skinbackup.xml';
+                               if ( file_exists($xml_file) && is_readable($xml_file) )
+                               {
+                                       //$xml_file;
+                                       $candidates[$filename] = $filename;
+                               }
+                               
+                               // backwards compatibility
+                               $xml_file = $dir . $filename . '/skindata.xml';
+                               if ( file_exists($xml_file) && is_readable($xml_file) )
+                               {
+                                       //$xml_file;
+                                       $candidates[$filename] = $filename;
+                               }
+                       }
+               }
+               closedir($dirhandle);
+               return $candidates;
+       }
+ }
+ class SkinExport
+ {
+       private $templates;
+       private $skins;
+       private $info;
+       
+       /**
+        * Constructor initializes data structures
+        */
+       public function __construct()
+       {
+               // list of templateIDs to export
+               $this->templates = array();
+               
+               // list of skinIDs to export
+               $this->skins = array();
+               
+               // extra info to be in XML file
+               $this->info = '';
+       }
+       
+       /**
+        * Adds a template to be exported
+        *
+        * @param id
+        *              template ID
+        * @result false when no such ID exists
+        */
+       public function addTemplate($id)
+       {
+               if ( !Template::existsID($id) )
+               {
+                       return 0;
+               }
+               
+               $this->templates[$id] = Template::getNameFromId($id);
+               return 1;
+       }
+       
+       /**
+        * Adds a skin to be exported
+        *
+        * @param id
+        *              skin ID
+        * @result false when no such ID exists
+        */
+       public function addSkin($id)
+       {
+               if ( !SKIN::existsID($id) )
+               {
+                       return 0;
+               }
+               
+               $this->skins[$id] = SKIN::getNameFromId($id);
+               return 1;
+       }
+       
+       /**
+        * Sets the extra info to be included in the exported file
+        */
+       public function setInfo($info)
+       {
+               $this->info = $info;
+       }
+       
+       /**
+        * Outputs the XML contents of the export file
+        *
+        * @param $setHeaders
+        *              set to 0 if you don't want to send out headers
+        *              (optional, default 1)
+        */
+       public function export($setHeaders = 1)
+       {
+               global $manager;
+               
+               if ( $setHeaders )
+               {
+                       // make sure the mimetype is correct, and that the data does not show up
+                       // in the browser, but gets saved into and XML file (popup download window)
+                       header('Content-Type: text/xml; charset=' . i18n::get_current_charset());
+                       header('Content-Disposition: attachment; filename="skinbackup.xml"');
+                       header('Expires: 0');
+                       header('Pragma: no-cache');
+               }
+               
+               echo "<nucleusskin>\n";
+               
+               // meta
+               echo "\t<meta>\n";
+               // skins
+               foreach ( $this->skins as $skinId => $skinName )
+               {
+                       echo "\t\t" . '<skin name="' . Entity::hsc($skinName) . '" />' . "\n";
+               }
+               // templates
+               foreach ( $this->templates as $templateId => $templateName )
+               {
+                       echo "\t\t" . '<template name="' . Entity::hsc($templateName) . '" />' . "\n";
+               }
+               // extra info
+               if ( $this->info )
+               {
+                       echo "\t\t<info><![CDATA[" . $this->info . "]]></info>\n";
+               }
+               echo "\t</meta>\n\n\n";
+               
+               // contents skins
+               foreach ($this->skins as $skinId => $skinName)
+               {
+                       $skinId = (integer) $skinId;
+                       $skinObj =& $manager->getSkin($skinId);
+                       
+                       echo "\t" . '<skin name="' . Entity::hsc($skinName) . '" type="' . Entity::hsc($skinObj->getContentType()) . '" includeMode="' . Entity::hsc($skinObj->getIncludeMode()) . '" includePrefix="' . Entity::hsc($skinObj->getIncludePrefix()) . '">' . "\n";
+                       echo "\t\t<description>" . Entity::hsc($skinObj->getDescription()) . "</description>\n";
+                       
+                       $res = DB::getResult('SELECT stype, scontent FROM '. sql_table('skin') .' WHERE sdesc=' . $skinId);
+                       foreach ( $res as $row )
+                       {
+                               echo "\t\t" . '<part name="',Entity::hsc($row['stype']) . '">';
+                               echo '<![CDATA[' . $this->escapeCDATA($row['scontent']) . ']]>';
+                               echo "</part>\n\n";
+                       }
+                       echo "\t</skin>\n\n\n";
+               }
+               
+               // contents templates
+               foreach ( $this->templates as $templateId => $templateName )
+               {
+                       $templateId = intval($templateId);
+                       
+                       echo "\t" . '<template name="' . Entity::hsc($templateName) . '">' . "\n";
+                       echo "\t\t<description>" . Entity::hsc(Template::getDesc($templateId)) . "</description>\n";
+                       
+                       $res = DB::getResult('SELECT tpartname, tcontent FROM '. sql_table('template') .' WHERE tdesc=' . $templateId);
+                       foreach ( $res as $row )
+                       {
+                               echo "\t\t" . '<part name="' . Entity::hsc($row['tpartname']) . '">';
+                               echo '<![CDATA[' . $this->escapeCDATA($row['tcontent']) . ']]>';
+                               echo "</part>\n\n";
+                       }
+                       
+                       echo "\t</template>\n\n\n";
+               }
+               echo '</nucleusskin>';
+       }
+       
+       /**
+        * Escapes CDATA content so it can be included in another CDATA section
+        */
+       private function escapeCDATA($cdata)
+       {
+               return preg_replace('/]]>/', ']]]]><![CDATA[>', $cdata);
+       }
++}
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2012 The Nucleus Group\r
 + * @version $Id$\r
 + */\r
 +\r
 +class DB\r
 +{\r
 +      private static $dbh;\r
 +      private static $execCount = 0;\r
 +      private static $dateFormat = '\'%Y-%m-%d %H:%M:%S\'';\r
 +      \r
 +      /**\r
 +       * DB::setConnectionInfo()\r
 +       * Set the information to connect to the database, it will attempt to connect.\r
 +       * @param string $engine Engine\r
 +       * @param string $host Host\r
 +       * @param string $user User\r
 +       * @param string $password Password\r
 +       * @param string $database Database\r
 +       * @return bool Returns TRUE if able to connect, otherwise it returns FALSE.\r
 +       */\r
 +      public static function setConnectionInfo($engine, $host, $user, $password, $database)\r
 +      {\r
 +              self::disConnect();\r
 +\r
 +              try\r
 +              {\r
 +                      if ( i18n::strpos($host, ':') === false )\r
 +                      {\r
 +                              $portnum = '';\r
 +                      }\r
 +                      else\r
 +                      {\r
 +                              list($host, $portnum) = i18n::explode(":", $host);\r
 +                              if ( isset($portnum) )\r
 +                              {\r
 +                                      $portnum = trim($portnum);\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $portnum = '';\r
 +                              }\r
 +                      }\r
 +\r
 +                      switch ( $engine )\r
 +                      {\r
 +                              case 'sybase':\r
 +                              case 'dblib':\r
 +                                      $port = is_numeric($portnum) ? ':' . intval($portnum) : '';\r
 +                                      $db = $database ? ';dbname=' . $database : '';\r
 +                                      self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);\r
 +                                      break;\r
 +                              case 'mssql':\r
 +                                      $port = is_numeric($portnum) ? ',' . intval($portnum) : '';\r
 +                                      $db = $database ? ';dbname=' . $database : '';\r
 +                                      self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);\r
 +                                      break;\r
 +                              case 'oci':\r
 +                                      $port = is_numeric($portnum) ? ':' . intval($portnum) : '';\r
 +                                      self::$dbh = new PDO($engine . ':dbname=//' . $host . $port . '/' . $database, $user, $password);\r
 +                                      break;\r
 +                              case 'odbc':\r
 +                                      $port = is_numeric($portnum) ? ';PORT=' . intval($portnum) : '';\r
 +                                      self::$dbh = new PDO(\r
 +                                              $engine . ':DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=' . $host . $port . ';DATABASE=' . $database . ';PROTOCOL=TCPIP;UID='\r
 +                                                      . $user . ';PWD=' . $password);\r
 +                                      break;\r
 +                              case 'pgsql':\r
 +                                      $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';\r
 +                                      $db = $database ? ';dbname=' . $database : '';\r
 +                                      self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);\r
 +                                      break;\r
 +                              case 'sqlite':\r
 +                              case 'sqlite2':\r
 +                                      $port = is_numeric($portnum) ? ':' . intval($portnum) : '';\r
 +                                      self::$dbh = new PDO($engine . ':' . $database, $user, $password);\r
 +                                      if ( self::$dbh )\r
 +                                      {\r
 +                                              self::$dbh->sqliteCreateFunction('SUBSTRING', 'substr', 3);\r
 +                                              self::$dbh->sqliteCreateFunction('UNIX_TIMESTAMP', 'strtotime', 1);\r
 +                                      }\r
 +                                      break;\r
 +                              case 'mysql':\r
 +                                      $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';\r
 +                                      $db = $database ? ';dbname=' . $database : '';\r
 +                                      self::$dbh = new PDO(\r
 +                                              'mysql' . ':host=' . $host . $port . $db,\r
 +                                              $user,\r
 +                                              $password,\r
 +                                              array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'utf8\''));\r
 +                                      break;\r
 +                              default: // mysql\r
 +                                      if ( !class_exists('MysqlPDO') )\r
 +                                      {\r
 +                                              include_once realpath(dirname(__FILE__)) . '/MYSQLPDO.php';\r
 +                                      }\r
 +                                      $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';\r
 +                                      $db = $database ? ';dbname=' . $database : '';\r
 +                                      self::$dbh = new MysqlPDO(\r
 +                                              'mysql' . ':host=' . $host . $port . $db,\r
 +                                              $user,\r
 +                                              $password,\r
 +                                              array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'utf8\''));\r
 +                                      break;\r
 +                      }\r
 +              }\r
 +              catch (PDOException $e)\r
 +              {\r
 +                      self::disConnect();\r
 +                      return FALSE;\r
 +              }\r
 +              return TRUE;\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::disConnect()\r
 +       * Disconnect the connection to the database.\r
 +       */\r
 +      public static function disConnect()\r
 +      {\r
 +              self::$dbh = null;\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::getExecCount()\r
 +       * To get the number of times you run the statement.\r
 +       * @return int Number of executions\r
 +       */\r
 +      public static function getExecCount()\r
 +      {\r
 +              return self::$execCount;\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::formatDateTime()\r
 +       * The value converted to a format that can be passed to the database datetime.\r
 +       * @param int $timestamp UNIX timestamp\r
 +       * @param int $offset timestamp offset\r
 +       * @return string formatted datetime (quart treated)\r
 +       */\r
 +      public static function formatDateTime($timestamp = null, $offset=0)\r
 +      {\r
 +              if ( $timestamp == null )\r
 +              {\r
 +                      $timestamp = time();\r
 +              }\r
 +              $timestamp += $offset;\r
 +              return preg_replace_callback('/(%[a-z%])/i',\r
 +                      create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),\r
 +                      self::$dateFormat\r
 +              );\r
 +      }\r
 +      \r
 +      /**\r
 +       * DB::getValue()\r
 +       * Gets the value of the first column of the first row of the results obtained in the statement.\r
 +       * @param string $statement SQL Statement\r
 +       * @return mixed Result value. If the call fails, it will return FALSE.\r
 +       */\r
 +      public static function getValue($statement)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              self::$execCount++;\r
 +              $result = self::callQuery($statement);\r
 +              if ( $row = $result->fetch(PDO::FETCH_NUM) )\r
 +              {\r
 +                      return $row[0];\r
 +              }\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::getRow()\r
 +       * Gets the first row of the results obtained in the statement.\r
 +       * @param string $statement SQL Statement\r
 +       * @return array Result row. If the call fails, it will return FALSE.\r
 +       */\r
 +      public static function getRow($statement)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              self::$execCount++;\r
 +              $result = self::callQuery($statement);\r
 +              return $result->fetch(PDO::FETCH_BOTH);\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::getResult()\r
 +       * Gets the set of results obtained in the statement.\r
 +       * @param string $statement SQL Statement\r
 +       * @return PDOStatement Result set object. If the call fails, it will return FALSE.\r
 +       */\r
 +      public static function getResult($statement)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              self::$execCount++;\r
 +              return self::callQuery($statement);\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::execute()\r
 +       * Execute an SQL statement and return the number of affected rows.\r
 +       * @param string $statement SQL Statement\r
 +       * @return int number of rows that were modified or deleted by the SQL statement you issued. If the call fails, it will return FALSE.\r
 +       */\r
 +      public static function execute($statement)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              self::$execCount++;\r
 +              return self::callExec($statement);\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::callQuery()\r
 +       * Run the query to retrieve the result set.\r
 +       * @param string $statement query to be executed\r
 +       * @return PDOStatement Result set object. If the call fails, it will return FALSE.\r
 +       */\r
 +      private static function callQuery($statement)\r
 +      {\r
 +              $result = self::$dbh->query($statement);\r
 +              if ( $result === FALSE )\r
 +              {\r
 +                      self::showErrorDisplay($statement);\r
 +              }\r
 +              return $result;\r
 +      }\r
 +      \r
 +      /**\r
 +       * DB::callExec()\r
 +       * Run the query and returns the number of rows affected.\r
 +       * @param string $statement query to be executed\r
 +       * @return int number of rows that were modified or deleted by the SQL statement you issued. If the call fails, it will return FALSE.\r
 +       */\r
 +      private static function callExec($statement)\r
 +      {\r
 +              $result = self::$dbh->exec($statement);\r
 +              if ( $result === FALSE )\r
 +              {\r
 +                      self::showErrorDisplay($statement);\r
 +              }\r
 +              return $result;\r
 +      }\r
 +      \r
 +      /**\r
 +       * DB::showErrorDisplay()\r
 +       * The error message is output to the screen of the query.\r
 +       * @param string $statement query output to the screen\r
 +       */\r
 +      private static function showErrorDisplay($statement)\r
 +      {\r
 +              global $CONF;\r
 +              if ( array_key_exists('debug', $CONF) && $CONF['debug'] )\r
 +              {\r
 +                      $err = self::getError();\r
 +                      print("mySQL error with query '{$statement}' : " . $err[2]);\r
 +              }\r
 +              return;\r
 +      }\r
 +      \r
 +      /**\r
 +       * DB::getError()\r
 +       * Gets the error information associated with the last operation.\r
 +       * @return array Error info\r
 +       */\r
 +      public static function getError()\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              return self::$dbh->errorInfo();\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::quoteValue()\r
 +       * Quotes a string for use in a query.\r
 +       * @param string $value Value to quote\r
 +       * @return string Quoted value\r
 +       */\r
 +      public static function quoteValue($value)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              return self::$dbh->quote($value);\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::getInsertId()\r
 +       * Get the value of the ID of the rows that are inserted at the end.\r
 +       * @return string ID of the row\r
 +       */\r
 +      public static function getInsertId()\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              return self::$dbh->lastInsertId();\r
 +      }\r
 +\r
 +      /**\r
 +       * DB::getAttribute()\r
 +       * Gets the attribute of the database.\r
 +       * @return string Attribute\r
 +       */\r
 +      public static function getAttribute($attribute)\r
 +      {\r
 +              if ( self::$dbh == null ) return FALSE;\r
 +              return self::$dbh->getAttribute($attribute);\r
 +      }\r
 +      \r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2012 The Nucleus Group
+  * @version $Id$
+  */
+ class DB
+ {
+       private static $dbh;
+       private static $execCount = 0;
+       private static $dateFormat = '\'%Y-%m-%d %H:%M:%S\'';
+       
+       /**
+        * DB::setConnectionInfo()
+        * Set the information to connect to the database, it will attempt to connect.
+        * @param string $engine Engine
+        * @param string $host Host
+        * @param string $user User
+        * @param string $password Password
+        * @param string $database Database
+        * @return bool Returns TRUE if able to connect, otherwise it returns FALSE.
+        */
+       public static function setConnectionInfo($engine, $host, $user, $password, $database)
+       {
+               self::disConnect();
+               try
+               {
+                       if ( i18n::strpos($host, ':') === false )
+                       {
+                               $portnum = '';
+                       }
+                       else
+                       {
+                               list($host, $portnum) = i18n::explode(":", $host);
+                               if ( isset($portnum) )
+                               {
+                                       $portnum = trim($portnum);
+                               }
+                               else
+                               {
+                                       $portnum = '';
+                               }
+                       }
+                       switch ( $engine )
+                       {
+                               case 'sybase':
+                               case 'dblib':
+                                       $port = is_numeric($portnum) ? ':' . intval($portnum) : '';
+                                       $db = $database ? ';dbname=' . $database : '';
+                                       self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);
+                                       break;
+                               case 'mssql':
+                                       $port = is_numeric($portnum) ? ',' . intval($portnum) : '';
+                                       $db = $database ? ';dbname=' . $database : '';
+                                       self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);
+                                       break;
+                               case 'oci':
+                                       $port = is_numeric($portnum) ? ':' . intval($portnum) : '';
+                                       self::$dbh = new PDO($engine . ':dbname=//' . $host . $port . '/' . $database, $user, $password);
+                                       break;
+                               case 'odbc':
+                                       $port = is_numeric($portnum) ? ';PORT=' . intval($portnum) : '';
+                                       self::$dbh = new PDO(
+                                               $engine . ':DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=' . $host . $port . ';DATABASE=' . $database . ';PROTOCOL=TCPIP;UID='
+                                                       . $user . ';PWD=' . $password);
+                                       break;
+                               case 'pgsql':
+                                       $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';
+                                       $db = $database ? ';dbname=' . $database : '';
+                                       self::$dbh = new PDO($engine . ':host=' . $host . $port . $db, $user, $password);
+                                       break;
+                               case 'sqlite':
+                               case 'sqlite2':
+                                       $port = is_numeric($portnum) ? ':' . intval($portnum) : '';
+                                       self::$dbh = new PDO($engine . ':' . $database, $user, $password);
+                                       if ( self::$dbh )
+                                       {
+                                               self::$dbh->sqliteCreateFunction('SUBSTRING', 'substr', 3);
+                                               self::$dbh->sqliteCreateFunction('UNIX_TIMESTAMP', 'strtotime', 1);
+                                       }
+                                       break;
+                               case 'mysql':
+                                       $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';
+                                       $db = $database ? ';dbname=' . $database : '';
+                                       self::$dbh = new PDO(
+                                               'mysql' . ':host=' . $host . $port . $db,
+                                               $user,
+                                               $password,
+                                               array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'utf8\''));
+                                       break;
+                               default: // mysql
+                                       if ( !class_exists('MysqlPDO') )
+                                       {
+                                               include_once realpath(dirname(__FILE__)) . '/MYSQLPDO.php';
+                                       }
+                                       $port = is_numeric($portnum) ? ';port=' . intval($portnum) : '';
+                                       $db = $database ? ';dbname=' . $database : '';
+                                       self::$dbh = new MysqlPDO(
+                                               'mysql' . ':host=' . $host . $port . $db,
+                                               $user,
+                                               $password,
+                                               array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'utf8\''));
+                                       break;
+                       }
+               }
+               catch (PDOException $e)
+               {
+                       self::disConnect();
+                       return FALSE;
+               }
+               return TRUE;
+       }
+       /**
+        * DB::disConnect()
+        * Disconnect the connection to the database.
+        */
+       public static function disConnect()
+       {
+               self::$dbh = null;
+       }
+       /**
+        * DB::getExecCount()
+        * To get the number of times you run the statement.
+        * @return int Number of executions
+        */
+       public static function getExecCount()
+       {
+               return self::$execCount;
+       }
+       /**
+        * DB::formatDateTime()
+        * The value converted to a format that can be passed to the database datetime.
+        * @param int $timestamp UNIX timestamp
+        * @param int $offset timestamp offset
+        * @return string formatted datetime (quart treated)
+        */
+       public static function formatDateTime($timestamp = null, $offset=0)
+       {
+               if ( $timestamp == null )
+               {
+                       $timestamp = time();
+               }
+               $timestamp += $offset;
+               return preg_replace_callback('/(%[a-z%])/i',
+                       create_function('$matches', 'return strftime($matches[1], ' . intval($timestamp) . ');'),
+                       self::$dateFormat
+               );
+       }
+       
+       /**
+        * DB::getValue()
+        * Gets the value of the first column of the first row of the results obtained in the statement.
+        * @param string $statement SQL Statement
+        * @return mixed Result value. If the call fails, it will return FALSE.
+        */
+       public static function getValue($statement)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               self::$execCount++;
+               $result = self::callQuery($statement);
+               if ( $row = $result->fetch(PDO::FETCH_NUM) )
+               {
+                       return $row[0];
+               }
+               return FALSE;
+       }
+       /**
+        * DB::getRow()
+        * Gets the first row of the results obtained in the statement.
+        * @param string $statement SQL Statement
+        * @return array Result row. If the call fails, it will return FALSE.
+        */
+       public static function getRow($statement)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               self::$execCount++;
+               $result = self::callQuery($statement);
+               return $result->fetch(PDO::FETCH_BOTH);
+       }
+       /**
+        * DB::getResult()
+        * Gets the set of results obtained in the statement.
+        * @param string $statement SQL Statement
+        * @return PDOStatement Result set object. If the call fails, it will return FALSE.
+        */
+       public static function getResult($statement)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               self::$execCount++;
+               return self::callQuery($statement);
+       }
+       /**
+        * DB::execute()
+        * Execute an SQL statement and return the number of affected rows.
+        * @param string $statement SQL Statement
+        * @return int number of rows that were modified or deleted by the SQL statement you issued. If the call fails, it will return FALSE.
+        */
+       public static function execute($statement)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               self::$execCount++;
+               return self::callExec($statement);
+       }
+       /**
+        * DB::callQuery()
+        * Run the query to retrieve the result set.
+        * @param string $statement query to be executed
+        * @return PDOStatement Result set object. If the call fails, it will return FALSE.
+        */
+       private static function callQuery($statement)
+       {
+               $result = self::$dbh->query($statement);
+               if ( $result === FALSE )
+               {
+                       self::showErrorDisplay($statement);
+               }
+               return $result;
+       }
+       
+       /**
+        * DB::callExec()
+        * Run the query and returns the number of rows affected.
+        * @param string $statement query to be executed
+        * @return int number of rows that were modified or deleted by the SQL statement you issued. If the call fails, it will return FALSE.
+        */
+       private static function callExec($statement)
+       {
+               $result = self::$dbh->exec($statement);
+               if ( $result === FALSE )
+               {
+                       self::showErrorDisplay($statement);
+               }
+               return $result;
+       }
+       
+       /**
+        * DB::showErrorDisplay()
+        * The error message is output to the screen of the query.
+        * @param string $statement query output to the screen
+        */
+       private static function showErrorDisplay($statement)
+       {
+               global $CONF;
+               if ( array_key_exists('debug', $CONF) && $CONF['debug'] )
+               {
+                       $err = self::getError();
+                       print("mySQL error with query '{$statement}' : " . $err[2]);
+               }
+               return;
+       }
+       
+       /**
+        * DB::getError()
+        * Gets the error information associated with the last operation.
+        * @return array Error info
+        */
+       public static function getError()
+       {
+               if ( self::$dbh == null ) return FALSE;
+               return self::$dbh->errorInfo();
+       }
+       /**
+        * DB::quoteValue()
+        * Quotes a string for use in a query.
+        * @param string $value Value to quote
+        * @return string Quoted value
+        */
+       public static function quoteValue($value)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               return self::$dbh->quote($value);
+       }
+       /**
+        * DB::getInsertId()
+        * Get the value of the ID of the rows that are inserted at the end.
+        * @return string ID of the row
+        */
+       public static function getInsertId()
+       {
+               if ( self::$dbh == null ) return FALSE;
+               return self::$dbh->lastInsertId();
+       }
+       /**
+        * DB::getAttribute()
+        * Gets the attribute of the database.
+        * @return string Attribute
+        */
+       public static function getAttribute($attribute)
+       {
+               if ( self::$dbh == null ) return FALSE;
+               return self::$dbh->getAttribute($attribute);
+       }
+       
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2012 The Nucleus Group\r
 + * @version $Id$\r
 + */\r
 +\r
 +if ( !class_exists('PDO') )\r
 +{\r
 +\r
 +      /**\r
 +       * Dummy constant of the PDO class\r
 +       */\r
 +      class PDO\r
 +      {\r
 +              /* constant values */\r
 +              const PARAM_NULL = 0;\r
 +              const PARAM_INT = 1;\r
 +              const PARAM_STR = 2;\r
 +              const PARAM_LOB = 3;\r
 +              const PARAM_STMT = 4;\r
 +              const PARAM_BOOL = 5;\r
 +              const PARAM_INPUT_OUTPUT = 128; // orignal is undefined.\r
 +              const FETCH_LAZY = 1;\r
 +              const FETCH_ASSOC = 2;\r
 +              const FETCH_NUM = 3;\r
 +              const FETCH_BOTH = 4;\r
 +              const FETCH_OBJ = 5;\r
 +              const FETCH_BOUND = 6;\r
 +              const FETCH_COLUMN = 7;\r
 +              const FETCH_CLASS = 8;\r
 +              const FETCH_INTO = 9;\r
 +              const FETCH_FUNC = 10;\r
 +              const FETCH_NAMED = 11;\r
 +              const FETCH_KEY_PAIR = 12;\r
 +              const FETCH_GROUP = 65536;\r
 +              const FETCH_UNIQUE = 196608;\r
 +              const FETCH_CLASSTYPE = 262144;\r
 +              const FETCH_SERIALIZE = 524288;\r
 +              const FETCH_PROPS_LATE = 1048576;\r
 +              const ATTR_AUTOCOMMIT = 0;\r
 +              const ATTR_PREFETCH = 1;\r
 +              const ATTR_TIMEOUT = 2;\r
 +              const ATTR_ERRMODE = 3;\r
 +              const ATTR_SERVER_VERSION = 4;\r
 +              const ATTR_CLIENT_VERSION = 5;\r
 +              const ATTR_SERVER_INFO = 6;\r
 +              const ATTR_CONNECTION_STATUS = 7;\r
 +              const ATTR_CASE = 8;\r
 +              const ATTR_CURSOR_NAME = 9;\r
 +              const ATTR_CURSOR = 10;\r
 +              const ATTR_ORACLE_NULLS = 11;\r
 +              const ATTR_PERSISTENT = 12;\r
 +              const ATTR_STATEMENT_CLASS = 13;\r
 +              const ATTR_FETCH_TABLE_NAMES = 14;\r
 +              const ATTR_FETCH_CATALOG_NAMES = 15;\r
 +              const ATTR_DRIVER_NAME = 16;\r
 +              const ATTR_STRINGIFY_FETCHES = 17;\r
 +              const ATTR_MAX_COLUMN_LEN = 18;\r
 +              const ATTR_DEFAULT_FETCH_MODE = 19;\r
 +              const ATTR_EMULATE_PREPARES = 20;\r
 +              const ERRMODE_SILENT = 0;\r
 +              const ERRMODE_WARNING = 1;\r
 +              const ERRMODE_EXCEPTION = 2;\r
 +              const CASE_NATURAL = 0;\r
 +              const CASE_UPPER = 1;\r
 +              const CASE_LOWER = 2;\r
 +              const NULL_NATURAL = 0;\r
 +              const NULL_EMPTY_STRING = 1;\r
 +              const NULL_TO_STRING = 2;\r
 +              const FETCH_ORI_NEXT = 0;\r
 +              const FETCH_ORI_PRIOR = 1;\r
 +              const FETCH_ORI_FIRST = 2;\r
 +              const FETCH_ORI_LAST = 3;\r
 +              const FETCH_ORI_ABS = 4;\r
 +              const FETCH_ORI_REL = 5;\r
 +              const CURSOR_FWDONLY = 0;\r
 +              const CURSOR_SCROLL = 1;\r
 +              // from here orignal is undefined.\r
 +              const ERR_CANT_MAP = 0;\r
 +              const ERR_SYNTAX = 0;\r
 +              const ERR_CONSTRAINT = 0;\r
 +              const ERR_NOT_FOUND = 0;\r
 +              const ERR_ALREADY_EXISTS = 0;\r
 +              const ERR_NOT_IMPLEMENTED = 0;\r
 +              const ERR_MISMATCH = 0;\r
 +              const ERR_TRUNCATED = 0;\r
 +              const ERR_DISCONNECTED = 0;\r
 +              const ERR_NO_PERM = 0;\r
 +              // so far\r
 +              const ERR_NONE = '00000';\r
 +              const PARAM_EVT_ALLOC = 0;\r
 +              const PARAM_EVT_FREE = 1;\r
 +              const PARAM_EVT_EXEC_PRE = 2;\r
 +              const PARAM_EVT_EXEC_POST = 3;\r
 +              const PARAM_EVT_FETCH_PRE = 4;\r
 +              const PARAM_EVT_FETCH_POST = 5;\r
 +              const PARAM_EVT_NORMALIZE = 6;\r
 +\r
 +              const MYSQL_ATTR_INIT_COMMAND = 1002;\r
 +      }\r
 +\r
 +      /**\r
 +       * PDOException class of dummy\r
 +       */\r
 +      class PDOException extends Exception\r
 +      {}\r
 +}\r
 +\r
 +/**\r
 + * MysqlPDO class that wraps the mysql_ or mysqli_ function like PDO class\r
 + */\r
 +class MysqlPDO\r
 +{\r
 +      // Prefix function name\r
 +      public static $handler;\r
 +\r
 +      private $dbcon;\r
 +\r
 +      /**\r
 +       * Creates a PDO instance representing a connection to a MySQL database.\r
 +       * @param string $dsn DSN\r
 +       * @param string $username UserName\r
 +       * @param string $password Password\r
 +       * @param mixed $driver_options Options[optional]\r
 +       * @throws PDOException Thrown when failed to connect to the database.\r
 +       */\r
 +      public function __construct($dsn, $username, $password, $driver_options = '')\r
 +      {\r
 +              // select use function\r
 +              if ( function_exists('mysql_query') )\r
 +              {\r
 +                      MysqlPDO::$handler = 'mysql_';\r
 +              }\r
 +              else if ( function_exists('mysqli_query') )\r
 +              {\r
 +                      MysqlPDO::$handler = 'mysqli_';\r
 +              }\r
 +              else\r
 +              {\r
 +                      throw new PDOException('Can not be found mysql_ or mysqli_ functions.', 'IM000');\r
 +              }\r
 +\r
 +              if ( preg_match('/host=([^;]+)/', $dsn, $matches) )\r
 +              {\r
 +                      $host = $matches[1];\r
 +              }\r
 +              else\r
 +              {\r
 +                      throw new PDOException('Host has not been set.', '01000');\r
 +              }\r
 +              if ( preg_match('/port=([^;]+)/', $dsn, $matches) )\r
 +              {\r
 +                      $host .= ':' . $matches[1];\r
 +              }\r
 +\r
 +              // mysql connect\r
 +              $this->dbcon = @call_user_func(MysqlPDO::$handler . 'connect', $host, $username, $password);\r
 +\r
 +              if ( $this->dbcon == FALSE )\r
 +              {\r
 +                      throw new PDOException('Failed to connect to the server.', '01000');\r
 +              }\r
 +\r
 +              // select database\r
 +              if ( preg_match('/dbname=([^;]+)/', $dsn, $matches) )\r
 +              {\r
 +                      $dbname = $matches[1];\r
 +                      if ( $dbname )\r
 +                      {\r
 +                              if ( MysqlPDO::$handler == 'mysql_' )\r
 +                              {\r
 +                                      call_user_func(MysqlPDO::$handler . 'select_db', $dbname, $this->dbcon);\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      call_user_func(MysqlPDO::$handler . 'select_db', $this->dbcon, $dbname);\r
 +                              }\r
 +\r
 +                              // set use character\r
 +                              $charset = 'utf8';\r
 +                              if ( is_array($driver_options) && array_key_exists(PDO::MYSQL_ATTR_INIT_COMMAND, $driver_options) )\r
 +                              {\r
 +                                      if ( preg_match('/SET\s+CHARACTER\s+SET\s+\'?([a-z0-9_-]+)\'?/', $driver_options[PDO::MYSQL_ATTR_INIT_COMMAND], $matches) )\r
 +                                      {\r
 +                                              $charset = $matches[1];\r
 +                                      }\r
 +                              }\r
 +                              $server_info = call_user_func(MysqlPDO::$handler . 'get_server_info', $this->dbcon);\r
 +                              $mysql_version = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{1,2})(.*)$/', '$1.$2.$3', $server_info);\r
 +\r
 +                              if ( version_compare($mysql_version, '5.0.7', '>=') && function_exists(MysqlPDO::$handler . 'set_charset') )\r
 +                              {\r
 +                                      call_user_func(MysqlPDO::$handler . 'set_charset', $charset);\r
 +                              }\r
 +                              else if ( version_compare($mysql_version, '5.0.7', '<') )\r
 +                              {\r
 +                                      $this->exec("SET CHARACTER SET '{$charset}';");\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      $this->exec("SET NAMES '{$charset}';");\r
 +                              }\r
 +                      }\r
 +              }\r
 +      }\r
 +\r
 +      /**\r
 +       * Close the connection to the MySQL server.\r
 +       */\r
 +      public function __destruct()\r
 +      {\r
 +              if ( $this->dbcon )\r
 +              {\r
 +                      @call_user_func(MysqlPDO::$handler . 'close', $this->dbcon);\r
 +              }\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function beginTransaction()\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function commit()\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Fetch the SQLSTATE associated with the last operation.\r
 +       * However, if successful '00000' Otherwise, the return to '01000'.\r
 +       * @return string Error code\r
 +       */\r
 +      public function errorCode()\r
 +      {\r
 +              $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);\r
 +              return $errno === 0 ? '00000' : '01000';\r
 +      }\r
 +\r
 +      /**\r
 +       * To get extended error information associated with the last operation.\r
 +       * Element 0: if successful '00000' Otherwise, the return to '01000'\r
 +       * Element 1: The return value of mysql_errno()\r
 +       * Element 2: The return value of mysql_error()\r
 +       * @return array Array of error information\r
 +       */\r
 +      public function errorInfo()\r
 +      {\r
 +              $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);\r
 +              $error = call_user_func(MysqlPDO::$handler . 'error', $this->dbcon);\r
 +              return array($errno === 0 ? '00000' : '01000', $errno, $error);\r
 +      }\r
 +\r
 +      public function exec($statement)\r
 +      {\r
 +              $result = @call_user_func(MysqlPDO::$handler . 'query', $statement, $this->dbcon);\r
 +              if ( $result === TRUE )\r
 +              {\r
 +                      return @call_user_func(MysqlPDO::$handler . 'affected_rows', $this->dbcon);\r
 +              }\r
 +              else if ( is_resource($result) )\r
 +              {\r
 +                      return;\r
 +              }\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function getAttribute($attribute)\r
 +      {\r
 +              switch ( $attribute )\r
 +              {\r
 +                      case PDO::ATTR_SERVER_VERSION:\r
 +                              return call_user_func(MysqlPDO::$handler . 'get_server_info', $this->dbcon);\r
 +                              break;\r
 +                      case PDO::ATTR_CLIENT_VERSION:\r
 +                              return call_user_func(MysqlPDO::$handler . 'get_client_info');\r
 +                              break;\r
 +                      default:\r
 +                              return FALSE;\r
 +              }\r
 +      }\r
 +\r
 +      public static function getAvailableDrivers()\r
 +      {\r
 +              return array('mysql');\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function inTransaction()\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function lastInsertId($name = null)\r
 +      {\r
 +              return call_user_func(MysqlPDO::$handler . 'insert_id', $this->dbcon);\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function prepare($statement, $driver_options = array())\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function query($statement)\r
 +      {\r
 +              $result = @call_user_func(MysqlPDO::$handler . 'query', $statement, $this->dbcon);\r
 +              return ($result == FALSE) ? FALSE : new MysqlPDOStatement($statement, $result, $this->dbcon);\r
 +      }\r
 +\r
 +      public function quote($string, $parameter_type = PDO::PARAM_STR)\r
 +      {\r
 +              switch ( $parameter_type )\r
 +              {\r
 +                      case PDO::PARAM_NULL:\r
 +                              return 'null';\r
 +                      case PDO::PARAM_BOOL:\r
 +                              return $string ? '1' : '0';\r
 +                      default:\r
 +                              if ( $parameter_type == PDO::PARAM_INT && is_numeric($string) )\r
 +                              {\r
 +                                      return $string;\r
 +                              }\r
 +                              else\r
 +                              {\r
 +                                      return '\'' . call_user_func(MysqlPDO::$handler . 'real_escape_string', $string) . '\'';\r
 +                              }\r
 +              }\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function rollBack()\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function setAttribute($attribute, $value)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +}\r
 +\r
 +/**\r
 + * MysqlPDOStatement class PDOStatement class like.\r
 + */\r
 +class MysqlPDOStatement implements Iterator\r
 +{\r
 +      private $result;\r
 +      private $dbcon;\r
 +      private $_queryString = '';\r
 +\r
 +      private $def_fetch_mode = PDO::FETCH_BOTH;\r
 +      private $def_col_num = 0;\r
 +      private $def_class_name = 'stdClass';\r
 +      private $def_ctorargs = null;\r
 +      private $bind_object = null;\r
 +\r
 +      public function __get($name)\r
 +      {\r
 +              if ( $name == 'queryString' )\r
 +              {\r
 +                      return $this->_queryString;\r
 +              }\r
 +      }\r
 +\r
 +      public function __construct($query, $result, $dbconnect = null)\r
 +      {\r
 +              $this->dbcon = $dbconnect;\r
 +              $this->_queryString = $query;\r
 +              $this->result = $result;\r
 +      }\r
 +\r
 +      public function __destruct()\r
 +      {\r
 +              $this->result = null;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function bindColumn($column, &$param, $type, $maxlen, $driverdata)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length, $driver_options)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function bindValue($parameter, $value, $data_type = PDO::PARAM_STR)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function closeCursor()\r
 +      {\r
 +              return call_user_func(MysqlPDO::$handler . 'free_result', $this->result);\r
 +      }\r
 +\r
 +      public function columnCount()\r
 +      {\r
 +              return call_user_func(MysqlPDO::$handler . 'num_fields', $this->result);\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function debugDumpParams()\r
 +      {\r
 +              return;\r
 +      }\r
 +\r
 +      public function errorCode()\r
 +      {\r
 +              $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);\r
 +              return $errno === 0 ? '00000' : '01000';\r
 +      }\r
 +\r
 +      public function errorInfo()\r
 +      {\r
 +              $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);\r
 +              $error = call_user_func(MysqlPDO::$handler . 'error', $this->dbcon);\r
 +              return array($errno === 0 ? '00000' : '01000', $errno, $error);\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function execute($input_parameters)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function fetch($fetch_style = PDO::ATTR_DEFAULT_FETCH_MODE, $cursor_orientation = PDO::FETCH_ORI_NEXT, $cursor_offset = 0)\r
 +      {\r
 +              if ( !is_resource($this->result) || $cursor_orientation != PDO::FETCH_ORI_NEXT )\r
 +              {\r
 +                      return FALSE;\r
 +              }\r
 +              \r
 +              if ( $fetch_style == PDO::ATTR_DEFAULT_FETCH_MODE )\r
 +              {\r
 +                      $fetch_style = $this->def_fetch_mode;\r
 +              }\r
 +\r
 +              switch ( $fetch_style )\r
 +              {\r
 +                      case PDO::FETCH_ASSOC:\r
 +                              return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_ASSOC);\r
 +                      case PDO::FETCH_BOTH:\r
 +                              return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_BOTH);\r
 +                      case PDO::FETCH_NUM:\r
 +                              return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_NUM);\r
 +                      case PDO::FETCH_OBJ:\r
 +                              return $this->fetchObject();\r
 +                      case PDO::FETCH_CLASS:\r
 +                              return $this->fetchObject($this->def_class_name, $this->def_ctorargs);\r
 +                      case PDO::FETCH_COLUMN:\r
 +                              return $this->fetchColumn($this->def_col_num);\r
 +                      case PDO::FETCH_BOUND:\r
 +                              return FALSE; // Not supported\r
 +                      case PDO::FETCH_INTO:\r
 +                              return FALSE; // Not supported\r
 +                      case PDO::FETCH_LAZY:\r
 +                              return FALSE; // Not supported\r
 +                      default:\r
 +                              return FALSE;\r
 +              }\r
 +      }\r
 +\r
 +      public function fetchAll($fetch_style = PDO::ATTR_DEFAULT_FETCH_MODE, $fetch_argument = null, $ctor_args = array())\r
 +      {\r
 +              if ( $fetch_style == PDO::ATTR_DEFAULT_FETCH_MODE )\r
 +              {\r
 +                      $fetch_style = PDO::FETCH_BOTH;\r
 +              }\r
 +              \r
 +              $ret = array();\r
 +              if ( ($fetch_style & PDO::FETCH_COLUMN) != 0 )\r
 +              {\r
 +                      if ( $fetch_style == PDO::FETCH_COLUMN )\r
 +                      {\r
 +                              $column = $fetch_argument == null ? 0 : intval($fetch_argument);\r
 +                              while ( $row = $this->fetchColumn($column) )\r
 +                              {\r
 +                                      $ret[] = $row;\r
 +                              }\r
 +                      }\r
 +                      elseif ( ($fetch_style & PDO::FETCH_UNIQUE) != 0 )\r
 +                      {\r
 +                              return FALSE;\r
 +                      }\r
 +                      elseif ( ($fetch_style & PDO::FETCH_GROUP) != 0 )\r
 +                      {\r
 +                              return FALSE;\r
 +                      }\r
 +              }\r
 +              elseif ( $fetch_style == PDO::FETCH_CLASS )\r
 +              {\r
 +                      while ( $row = $this->fetchObject($fetch_argument, $ctor_args) )\r
 +                      {\r
 +                              $ret[] = $row;\r
 +                      }\r
 +              }\r
 +              elseif ( $fetch_style == PDO::FETCH_FUNC )\r
 +              {\r
 +                      while ( $row = $this->fetch(PDO::FETCH_ASSOC) )\r
 +                      {\r
 +                              $ret[] = call_user_func_array($fetch_argument, array_values($row));\r
 +                      }\r
 +              }\r
 +              else\r
 +              {\r
 +                      while ( $row = $this->fetch($fetch_style) )\r
 +                      {\r
 +                              $ret[] = $row;\r
 +                      }\r
 +              }\r
 +              return $ret;\r
 +      }\r
 +\r
 +      public function fetchColumn($column_number = 0)\r
 +      {\r
 +              if ( $ret = $this->fetch(PDO::FETCH_NUM) )\r
 +              {\r
 +                      return $ret[$column_number];\r
 +              }\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function fetchObject($class_name = 'stdClass', $ctor_args = null)\r
 +      {\r
 +              if ( is_array($ctor_args) && !empty($ctor_args) )\r
 +              {\r
 +                      return @call_user_func(MysqlPDO::$handler . 'fetch_object', $this->result, $class_name, $ctor_args);\r
 +              }\r
 +              else\r
 +              {\r
 +                      return @call_user_func(MysqlPDO::$handler . 'fetch_object', $this->result, $class_name);\r
 +              }\r
 +      }\r
 +\r
 +      public function getAttribute($attribute)\r
 +      {\r
 +              switch ( $attribute )\r
 +              {\r
 +                      default:\r
 +                              return FALSE;\r
 +              }\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function getColumnMeta($column)\r
 +      {\r
 +              $result = array();\r
 +              if ( MysqlPDO::$handler == 'mysql_' )\r
 +              {\r
 +                      $result['name'] = @call_user_func(MysqlPDO::$handler . 'field_name', $this->result, $column);\r
 +              }\r
 +              return $result;\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function nextRowset()\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function rowCount()\r
 +      {\r
 +              return @call_user_func(MysqlPDO::$handler . 'affected_rows', $this->dbcon);\r
 +      }\r
 +\r
 +      /**\r
 +       * Not supported\r
 +       */\r
 +      public function setAttribute($attribute, $value)\r
 +      {\r
 +              return FALSE;\r
 +      }\r
 +\r
 +      public function setFetchMode($mode, &$mode_argument, $ctorargs)\r
 +      {\r
 +              switch ( $mode )\r
 +              {\r
 +                      case PDO::FETCH_COLUMN:\r
 +                              $this->def_col_num = $mode_argument;\r
 +                              break;\r
 +                      case PDO::FETCH_CLASS:\r
 +                              $this->def_class_name = $mode_argument;\r
 +                              $this->def_ctorargs = $ctorargs;\r
 +                              break;\r
 +                      case PDO::FETCH_INTO:\r
 +                              $this->bind_object = &$mode_argument;\r
 +                              return FALSE; // Not supported\r
 +                      default:\r
 +                              $this->def_fetch_mode = $mode;\r
 +                              break;\r
 +              }\r
 +              return 1;\r
 +      }\r
 +\r
 +      // Iterator\r
 +      private $iterator_value;\r
 +\r
 +      function rewind()\r
 +      {}\r
 +\r
 +      function next()\r
 +      {}\r
 +\r
 +      function valid()\r
 +      {\r
 +              return ($this->iterator_value = $this->fetch());\r
 +      }\r
 +\r
 +      function current()\r
 +      {\r
 +              return $this->iterator_value;\r
 +      }\r
 +\r
 +      function key()\r
 +      {\r
 +              return null;\r
 +      }\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2012 The Nucleus Group
+  * @version $Id$
+  */
+ if ( !class_exists('PDO') )
+ {
+       /**
+        * Dummy constant of the PDO class
+        */
+       class PDO
+       {
+               /* constant values */
+               const PARAM_NULL = 0;
+               const PARAM_INT = 1;
+               const PARAM_STR = 2;
+               const PARAM_LOB = 3;
+               const PARAM_STMT = 4;
+               const PARAM_BOOL = 5;
+               const PARAM_INPUT_OUTPUT = 128; // orignal is undefined.
+               const FETCH_LAZY = 1;
+               const FETCH_ASSOC = 2;
+               const FETCH_NUM = 3;
+               const FETCH_BOTH = 4;
+               const FETCH_OBJ = 5;
+               const FETCH_BOUND = 6;
+               const FETCH_COLUMN = 7;
+               const FETCH_CLASS = 8;
+               const FETCH_INTO = 9;
+               const FETCH_FUNC = 10;
+               const FETCH_NAMED = 11;
+               const FETCH_KEY_PAIR = 12;
+               const FETCH_GROUP = 65536;
+               const FETCH_UNIQUE = 196608;
+               const FETCH_CLASSTYPE = 262144;
+               const FETCH_SERIALIZE = 524288;
+               const FETCH_PROPS_LATE = 1048576;
+               const ATTR_AUTOCOMMIT = 0;
+               const ATTR_PREFETCH = 1;
+               const ATTR_TIMEOUT = 2;
+               const ATTR_ERRMODE = 3;
+               const ATTR_SERVER_VERSION = 4;
+               const ATTR_CLIENT_VERSION = 5;
+               const ATTR_SERVER_INFO = 6;
+               const ATTR_CONNECTION_STATUS = 7;
+               const ATTR_CASE = 8;
+               const ATTR_CURSOR_NAME = 9;
+               const ATTR_CURSOR = 10;
+               const ATTR_ORACLE_NULLS = 11;
+               const ATTR_PERSISTENT = 12;
+               const ATTR_STATEMENT_CLASS = 13;
+               const ATTR_FETCH_TABLE_NAMES = 14;
+               const ATTR_FETCH_CATALOG_NAMES = 15;
+               const ATTR_DRIVER_NAME = 16;
+               const ATTR_STRINGIFY_FETCHES = 17;
+               const ATTR_MAX_COLUMN_LEN = 18;
+               const ATTR_DEFAULT_FETCH_MODE = 19;
+               const ATTR_EMULATE_PREPARES = 20;
+               const ERRMODE_SILENT = 0;
+               const ERRMODE_WARNING = 1;
+               const ERRMODE_EXCEPTION = 2;
+               const CASE_NATURAL = 0;
+               const CASE_UPPER = 1;
+               const CASE_LOWER = 2;
+               const NULL_NATURAL = 0;
+               const NULL_EMPTY_STRING = 1;
+               const NULL_TO_STRING = 2;
+               const FETCH_ORI_NEXT = 0;
+               const FETCH_ORI_PRIOR = 1;
+               const FETCH_ORI_FIRST = 2;
+               const FETCH_ORI_LAST = 3;
+               const FETCH_ORI_ABS = 4;
+               const FETCH_ORI_REL = 5;
+               const CURSOR_FWDONLY = 0;
+               const CURSOR_SCROLL = 1;
+               // from here orignal is undefined.
+               const ERR_CANT_MAP = 0;
+               const ERR_SYNTAX = 0;
+               const ERR_CONSTRAINT = 0;
+               const ERR_NOT_FOUND = 0;
+               const ERR_ALREADY_EXISTS = 0;
+               const ERR_NOT_IMPLEMENTED = 0;
+               const ERR_MISMATCH = 0;
+               const ERR_TRUNCATED = 0;
+               const ERR_DISCONNECTED = 0;
+               const ERR_NO_PERM = 0;
+               // so far
+               const ERR_NONE = '00000';
+               const PARAM_EVT_ALLOC = 0;
+               const PARAM_EVT_FREE = 1;
+               const PARAM_EVT_EXEC_PRE = 2;
+               const PARAM_EVT_EXEC_POST = 3;
+               const PARAM_EVT_FETCH_PRE = 4;
+               const PARAM_EVT_FETCH_POST = 5;
+               const PARAM_EVT_NORMALIZE = 6;
+               const MYSQL_ATTR_INIT_COMMAND = 1002;
+       }
+       /**
+        * PDOException class of dummy
+        */
+       class PDOException extends Exception
+       {}
+ }
+ /**
+  * MysqlPDO class that wraps the mysql_ or mysqli_ function like PDO class
+  */
+ class MysqlPDO
+ {
+       // Prefix function name
+       public static $handler;
+       private $dbcon;
+       /**
+        * Creates a PDO instance representing a connection to a MySQL database.
+        * @param string $dsn DSN
+        * @param string $username UserName
+        * @param string $password Password
+        * @param mixed $driver_options Options[optional]
+        * @throws PDOException Thrown when failed to connect to the database.
+        */
+       public function __construct($dsn, $username, $password, $driver_options = '')
+       {
+               // select use function
+               if ( function_exists('mysql_query') )
+               {
+                       MysqlPDO::$handler = 'mysql_';
+               }
+               else if ( function_exists('mysqli_query') )
+               {
+                       MysqlPDO::$handler = 'mysqli_';
+               }
+               else
+               {
+                       throw new PDOException('Can not be found mysql_ or mysqli_ functions.', 'IM000');
+               }
+               if ( preg_match('/host=([^;]+)/', $dsn, $matches) )
+               {
+                       $host = $matches[1];
+               }
+               else
+               {
+                       throw new PDOException('Host has not been set.', '01000');
+               }
+               if ( preg_match('/port=([^;]+)/', $dsn, $matches) )
+               {
+                       $host .= ':' . $matches[1];
+               }
+               // mysql connect
+               $this->dbcon = @call_user_func(MysqlPDO::$handler . 'connect', $host, $username, $password);
+               if ( $this->dbcon == FALSE )
+               {
+                       throw new PDOException('Failed to connect to the server.', '01000');
+               }
+               // select database
+               if ( preg_match('/dbname=([^;]+)/', $dsn, $matches) )
+               {
+                       $dbname = $matches[1];
+                       if ( $dbname )
+                       {
+                               if ( MysqlPDO::$handler == 'mysql_' )
+                               {
+                                       call_user_func(MysqlPDO::$handler . 'select_db', $dbname, $this->dbcon);
+                               }
+                               else
+                               {
+                                       call_user_func(MysqlPDO::$handler . 'select_db', $this->dbcon, $dbname);
+                               }
+                               // set use character
+                               $charset = 'utf8';
+                               if ( is_array($driver_options) && array_key_exists(PDO::MYSQL_ATTR_INIT_COMMAND, $driver_options) )
+                               {
+                                       if ( preg_match('/SET\s+CHARACTER\s+SET\s+\'?([a-z0-9_-]+)\'?/', $driver_options[PDO::MYSQL_ATTR_INIT_COMMAND], $matches) )
+                                       {
+                                               $charset = $matches[1];
+                                       }
+                               }
+                               $server_info = call_user_func(MysqlPDO::$handler . 'get_server_info', $this->dbcon);
+                               $mysql_version = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{1,2})(.*)$/', '$1.$2.$3', $server_info);
+                               if ( version_compare($mysql_version, '5.0.7', '>=') && function_exists(MysqlPDO::$handler . 'set_charset') )
+                               {
+                                       call_user_func(MysqlPDO::$handler . 'set_charset', $charset);
+                               }
+                               else if ( version_compare($mysql_version, '5.0.7', '<') )
+                               {
+                                       $this->exec("SET CHARACTER SET '{$charset}';");
+                               }
+                               else
+                               {
+                                       $this->exec("SET NAMES '{$charset}';");
+                               }
+                       }
+               }
+       }
+       /**
+        * Close the connection to the MySQL server.
+        */
+       public function __destruct()
+       {
+               if ( $this->dbcon )
+               {
+                       @call_user_func(MysqlPDO::$handler . 'close', $this->dbcon);
+               }
+       }
+       /**
+        * Not supported
+        */
+       public function beginTransaction()
+       {
+               return FALSE;
+       }
+       /**
+        * Not supported
+        */
+       public function commit()
+       {
+               return FALSE;
+       }
+       /**
+        * Fetch the SQLSTATE associated with the last operation.
+        * However, if successful '00000' Otherwise, the return to '01000'.
+        * @return string Error code
+        */
+       public function errorCode()
+       {
+               $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);
+               return $errno === 0 ? '00000' : '01000';
+       }
+       /**
+        * To get extended error information associated with the last operation.
+        * Element 0: if successful '00000' Otherwise, the return to '01000'
+        * Element 1: The return value of mysql_errno()
+        * Element 2: The return value of mysql_error()
+        * @return array Array of error information
+        */
+       public function errorInfo()
+       {
+               $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);
+               $error = call_user_func(MysqlPDO::$handler . 'error', $this->dbcon);
+               return array($errno === 0 ? '00000' : '01000', $errno, $error);
+       }
+       public function exec($statement)
+       {
+               $result = @call_user_func(MysqlPDO::$handler . 'query', $statement, $this->dbcon);
+               if ( $result === TRUE )
+               {
+                       return @call_user_func(MysqlPDO::$handler . 'affected_rows', $this->dbcon);
+               }
+               else if ( is_resource($result) )
+               {
+                       return;
+               }
+               return FALSE;
+       }
+       public function getAttribute($attribute)
+       {
+               switch ( $attribute )
+               {
+                       case PDO::ATTR_SERVER_VERSION:
+                               return call_user_func(MysqlPDO::$handler . 'get_server_info', $this->dbcon);
+                               break;
+                       case PDO::ATTR_CLIENT_VERSION:
+                               return call_user_func(MysqlPDO::$handler . 'get_client_info');
+                               break;
+                       default:
+                               return FALSE;
+               }
+       }
+       public static function getAvailableDrivers()
+       {
+               return array('mysql');
+       }
+       /**
+        * Not supported
+        */
+       public function inTransaction()
+       {
+               return FALSE;
+       }
+       public function lastInsertId($name = null)
+       {
+               return call_user_func(MysqlPDO::$handler . 'insert_id', $this->dbcon);
+       }
+       /**
+        * Not supported
+        */
+       public function prepare($statement, $driver_options = array())
+       {
+               return FALSE;
+       }
+       public function query($statement)
+       {
+               $result = @call_user_func(MysqlPDO::$handler . 'query', $statement, $this->dbcon);
+               return ($result == FALSE) ? FALSE : new MysqlPDOStatement($statement, $result, $this->dbcon);
+       }
+       public function quote($string, $parameter_type = PDO::PARAM_STR)
+       {
+               switch ( $parameter_type )
+               {
+                       case PDO::PARAM_NULL:
+                               return 'null';
+                       case PDO::PARAM_BOOL:
+                               return $string ? '1' : '0';
+                       default:
+                               if ( $parameter_type == PDO::PARAM_INT && is_numeric($string) )
+                               {
+                                       return $string;
+                               }
+                               else
+                               {
+                                       return '\'' . call_user_func(MysqlPDO::$handler . 'real_escape_string', $string) . '\'';
+                               }
+               }
+       }
+       /**
+        * Not supported
+        */
+       public function rollBack()
+       {
+               return FALSE;
+       }
+       /**
+        * Not supported
+        */
+       public function setAttribute($attribute, $value)
+       {
+               return FALSE;
+       }
+ }
+ /**
+  * MysqlPDOStatement class PDOStatement class like.
+  */
+ class MysqlPDOStatement implements Iterator
+ {
+       private $result;
+       private $dbcon;
+       private $_queryString = '';
+       private $def_fetch_mode = PDO::FETCH_BOTH;
+       private $def_col_num = 0;
+       private $def_class_name = 'stdClass';
+       private $def_ctorargs = null;
+       private $bind_object = null;
+       public function __get($name)
+       {
+               if ( $name == 'queryString' )
+               {
+                       return $this->_queryString;
+               }
+       }
+       public function __construct($query, $result, $dbconnect = null)
+       {
+               $this->dbcon = $dbconnect;
+               $this->_queryString = $query;
+               $this->result = $result;
+       }
+       public function __destruct()
+       {
+               $this->result = null;
+       }
+       /**
+        * Not supported
+        */
+       public function bindColumn($column, &$param, $type, $maxlen, $driverdata)
+       {
+               return FALSE;
+       }
+       /**
+        * Not supported
+        */
+       public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length, $driver_options)
+       {
+               return FALSE;
+       }
+       /**
+        * Not supported
+        */
+       public function bindValue($parameter, $value, $data_type = PDO::PARAM_STR)
+       {
+               return FALSE;
+       }
+       public function closeCursor()
+       {
+               return call_user_func(MysqlPDO::$handler . 'free_result', $this->result);
+       }
+       public function columnCount()
+       {
+               return call_user_func(MysqlPDO::$handler . 'num_fields', $this->result);
+       }
+       /**
+        * Not supported
+        */
+       public function debugDumpParams()
+       {
+               return;
+       }
+       public function errorCode()
+       {
+               $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);
+               return $errno === 0 ? '00000' : '01000';
+       }
+       public function errorInfo()
+       {
+               $errno = call_user_func(MysqlPDO::$handler . 'errno', $this->dbcon);
+               $error = call_user_func(MysqlPDO::$handler . 'error', $this->dbcon);
+               return array($errno === 0 ? '00000' : '01000', $errno, $error);
+       }
+       /**
+        * Not supported
+        */
+       public function execute($input_parameters)
+       {
+               return FALSE;
+       }
+       public function fetch($fetch_style = PDO::ATTR_DEFAULT_FETCH_MODE, $cursor_orientation = PDO::FETCH_ORI_NEXT, $cursor_offset = 0)
+       {
+               if ( !is_resource($this->result) || $cursor_orientation != PDO::FETCH_ORI_NEXT )
+               {
+                       return FALSE;
+               }
+               
+               if ( $fetch_style == PDO::ATTR_DEFAULT_FETCH_MODE )
+               {
+                       $fetch_style = $this->def_fetch_mode;
+               }
+               switch ( $fetch_style )
+               {
+                       case PDO::FETCH_ASSOC:
+                               return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_ASSOC);
+                       case PDO::FETCH_BOTH:
+                               return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_BOTH);
+                       case PDO::FETCH_NUM:
+                               return @call_user_func(MysqlPDO::$handler . 'fetch_array', $this->result, MYSQL_NUM);
+                       case PDO::FETCH_OBJ:
+                               return $this->fetchObject();
+                       case PDO::FETCH_CLASS:
+                               return $this->fetchObject($this->def_class_name, $this->def_ctorargs);
+                       case PDO::FETCH_COLUMN:
+                               return $this->fetchColumn($this->def_col_num);
+                       case PDO::FETCH_BOUND:
+                               return FALSE; // Not supported
+                       case PDO::FETCH_INTO:
+                               return FALSE; // Not supported
+                       case PDO::FETCH_LAZY:
+                               return FALSE; // Not supported
+                       default:
+                               return FALSE;
+               }
+       }
+       public function fetchAll($fetch_style = PDO::ATTR_DEFAULT_FETCH_MODE, $fetch_argument = null, $ctor_args = array())
+       {
+               if ( $fetch_style == PDO::ATTR_DEFAULT_FETCH_MODE )
+               {
+                       $fetch_style = PDO::FETCH_BOTH;
+               }
+               
+               $ret = array();
+               if ( ($fetch_style & PDO::FETCH_COLUMN) != 0 )
+               {
+                       if ( $fetch_style == PDO::FETCH_COLUMN )
+                       {
+                               $column = $fetch_argument == null ? 0 : intval($fetch_argument);
+                               while ( $row = $this->fetchColumn($column) )
+                               {
+                                       $ret[] = $row;
+                               }
+                       }
+                       elseif ( ($fetch_style & PDO::FETCH_UNIQUE) != 0 )
+                       {
+                               return FALSE;
+                       }
+                       elseif ( ($fetch_style & PDO::FETCH_GROUP) != 0 )
+                       {
+                               return FALSE;
+                       }
+               }
+               elseif ( $fetch_style == PDO::FETCH_CLASS )
+               {
+                       while ( $row = $this->fetchObject($fetch_argument, $ctor_args) )
+                       {
+                               $ret[] = $row;
+                       }
+               }
+               elseif ( $fetch_style == PDO::FETCH_FUNC )
+               {
+                       while ( $row = $this->fetch(PDO::FETCH_ASSOC) )
+                       {
+                               $ret[] = call_user_func_array($fetch_argument, array_values($row));
+                       }
+               }
+               else
+               {
+                       while ( $row = $this->fetch($fetch_style) )
+                       {
+                               $ret[] = $row;
+                       }
+               }
+               return $ret;
+       }
+       public function fetchColumn($column_number = 0)
+       {
+               if ( $ret = $this->fetch(PDO::FETCH_NUM) )
+               {
+                       return $ret[$column_number];
+               }
+               return FALSE;
+       }
+       public function fetchObject($class_name = 'stdClass', $ctor_args = null)
+       {
+               if ( is_array($ctor_args) && !empty($ctor_args) )
+               {
+                       return @call_user_func(MysqlPDO::$handler . 'fetch_object', $this->result, $class_name, $ctor_args);
+               }
+               else
+               {
+                       return @call_user_func(MysqlPDO::$handler . 'fetch_object', $this->result, $class_name);
+               }
+       }
+       public function getAttribute($attribute)
+       {
+               switch ( $attribute )
+               {
+                       default:
+                               return FALSE;
+               }
+       }
+       /**
+        * Not supported
+        */
+       public function getColumnMeta($column)
+       {
+               $result = array();
+               if ( MysqlPDO::$handler == 'mysql_' )
+               {
+                       $result['name'] = @call_user_func(MysqlPDO::$handler . 'field_name', $this->result, $column);
+               }
+               return $result;
+       }
+       /**
+        * Not supported
+        */
+       public function nextRowset()
+       {
+               return FALSE;
+       }
+       public function rowCount()
+       {
+               return @call_user_func(MysqlPDO::$handler . 'affected_rows', $this->dbcon);
+       }
+       /**
+        * Not supported
+        */
+       public function setAttribute($attribute, $value)
+       {
+               return FALSE;
+       }
+       public function setFetchMode($mode, &$mode_argument, $ctorargs)
+       {
+               switch ( $mode )
+               {
+                       case PDO::FETCH_COLUMN:
+                               $this->def_col_num = $mode_argument;
+                               break;
+                       case PDO::FETCH_CLASS:
+                               $this->def_class_name = $mode_argument;
+                               $this->def_ctorargs = $ctorargs;
+                               break;
+                       case PDO::FETCH_INTO:
+                               $this->bind_object = &$mode_argument;
+                               return FALSE; // Not supported
+                       default:
+                               $this->def_fetch_mode = $mode;
+                               break;
+               }
+               return 1;
+       }
+       // Iterator
+       private $iterator_value;
+       function rewind()
+       {}
+       function next()
+       {}
+       function valid()
+       {
+               return ($this->iterator_value = $this->fetch());
+       }
+       function current()
+       {
+               return $this->iterator_value;
+       }
+       function key()
+       {
+               return null;
+       }
+ }
++>>>>>>> skinnable-master
++<<<<<<< HEAD
 +<?php\r
 +\r
 +/*\r
 + * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)\r
 + * Copyright (C) 2012 The Nucleus Group\r
 + *\r
 + * This program is free software; you can redistribute it and/or\r
 + * modify it under the terms of the GNU General Public License\r
 + * as published by the Free Software Foundation; either version 2\r
 + * of the License, or (at your option) any later version.\r
 + * (see nucleus/documentation/index.html#license for more info)\r
 + */\r
 +/**\r
 + * @license http://nucleuscms.org/license.txt GNU General Public License\r
 + * @copyright Copyright (C) 2012 The Nucleus Group\r
 + * @version $Id$\r
 + */\r
 +\r
 +/*\r
 + * sql_* wrappers for DB class access\r
 + */\r
 +if ( !class_exists('DB') )\r
 +{\r
 +      include_once realpath(dirname(__FILE__)) . '/DB.php';\r
 +}\r
 +\r
 +/**\r
 + * Connects to database server with arguments\r
 + * @deprecated\r
 + */\r
 +function sql_connect_args($host = 'localhost', $user = '', $password = '', $database = '', $new_link = FALSE)\r
 +{\r
 +      global $MYSQL_HANDLER;\r
 +      return DB::setConnectionInfo($MYSQL_HANDLER[1], $host, $user, $password, $database);\r
 +}\r
 +\r
 +/**\r
 + * Connects to database server\r
 + * @deprecated\r
 + */\r
 +function sql_connect()\r
 +{\r
 +      global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE;\r
 +\r
 +      return DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);\r
 +}\r
 +\r
 +/**\r
 + * disconnects from SQL server\r
 + * @deprecated\r
 + */\r
 +function sql_disconnect($conn = false)\r
 +{\r
 +      DB::disConnect();\r
 +}\r
 +\r
 +/**\r
 + * disconnects from SQL server\r
 + * @deprecated\r
 + * @param unknown_type $conn\r
 + */\r
 +function sql_close($conn = false)\r
 +{\r
 +      DB::disConnect();\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL query\r
 + * @deprecated\r
 + */\r
 +function sql_query($query, $conn = false)\r
 +{\r
 +      global $mysql_affected_row;\r
 +      $mysql_affected_row = -1;\r
 +      if ( preg_match('/^\W*(INSERT|UPDATE|DELETE|DROP)/i', $query) )\r
 +      {\r
 +              $mysql_affected_row = DB::execute($query);\r
 +              return $mysql_affected_row !== FALSE ? TRUE : FALSE;\r
 +      }\r
 +      return DB::getResult($query);\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL error\r
 + * @deprecated\r
 + */\r
 +function sql_error($conn = false)\r
 +{\r
 +      $err = DB::getError();\r
 +      return $err[2];\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL db select\r
 + * @deprecated\r
 + */\r
 +function sql_select_db($db, $conn = false)\r
 +{\r
 +      sql_disconnect();\r
 +      return sql_connect();\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL real escape\r
 + * @deprecated\r
 + */\r
 +function sql_real_escape_string($val, $conn = false)\r
 +{\r
 +      if ( is_numeric($val) )\r
 +      {\r
 +              return $val;\r
 +      }\r
 +      $escapeval = DB::quoteValue($val);\r
 +      if ( preg_match("/^'(.*)'$/", $escapeval, $matches) )\r
 +      {\r
 +              $escapeval = $matches[1];\r
 +      }\r
 +      return $escapeval;\r
 +}\r
 +\r
 +/**\r
 + * executes an PDO::quote() like escape, ie adds quotes arround the string and escapes chars as needed\r
 + * @deprecated\r
 + */\r
 +function sql_quote_string($val, $conn = false)\r
 +{\r
 +      if ( is_numeric($val) )\r
 +      {\r
 +              return $val;\r
 +      }\r
 +      return DB::quoteValue($val);\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL insert id\r
 + * @deprecated\r
 + */\r
 +function sql_insert_id($conn = false)\r
 +{\r
 +      return DB::getInsertId();\r
 +}\r
 +\r
 +/**\r
 + * executes an SQL result request\r
 + * @deprecated\r
 + */\r
 +function sql_result($res, $row, $col)\r
 +{\r
 +      if ( !method_exists($res, 'fetch') ) return FALSE;\r
 +      for ( $i = 0; $i < $row; $i++ )\r
 +              $res->fetch();\r
 +      return $res->fetchColumn($col);\r
 +}\r
 +\r
 +/**\r
 + * frees sql result resources\r
 + * @deprecated\r
 + */\r
 +function sql_free_result($res)\r
 +{\r
 +      if ( !method_exists($res, 'closeCursor') ) return FALSE;\r
 +      return $res->closeCursor();\r
 +}\r
 +\r
 +/**\r
 + * returns number of rows in SQL result\r
 + * @deprecated\r
 + */\r
 +function sql_num_rows($res)\r
 +{\r
 +      if ( !method_exists($res, 'rowCount') ) return FALSE;\r
 +      return $res->rowCount();\r
 +}\r
 +\r
 +/**\r
 + * returns number of rows affected by SQL query\r
 + * @deprecated\r
 + */\r
 +function sql_affected_rows($conn = false)\r
 +{\r
 +      global $mysql_affected_row;\r
 +      return $mysql_affected_row;\r
 +}\r
 +\r
 +/**\r
 + * Get number of fields in result\r
 + * @deprecated\r
 + */\r
 +function sql_num_fields($res)\r
 +{\r
 +      if ( !method_exists($res, 'columnCount') ) return FALSE;\r
 +      return $res->columnCount();\r
 +}\r
 +\r
 +/**\r
 + * fetches next row of SQL result as an associative array\r
 + * @deprecated\r
 + */\r
 +function sql_fetch_assoc($res)\r
 +{\r
 +      if ( !method_exists($res, 'fetch') ) return FALSE;\r
 +      return $res->fetch(PDO::FETCH_ASSOC);\r
 +}\r
 +\r
 +/**\r
 + * Fetch a result row as an associative array, a numeric array, or both\r
 + * @deprecated\r
 + */\r
 +function sql_fetch_array($res)\r
 +{\r
 +      if ( !method_exists($res, 'fetch') ) return FALSE;\r
 +      return $res->fetch(PDO::FETCH_BOTH);\r
 +}\r
 +\r
 +/**\r
 + * fetches next row of SQL result as an object\r
 + * @deprecated\r
 + */\r
 +function sql_fetch_object($res)\r
 +{\r
 +      if ( !method_exists($res, 'fetch') ) return FALSE;\r
 +      return $res->fetch(PDO::FETCH_OBJ);\r
 +}\r
 +\r
 +/**\r
 + * Get a result row as an enumerated array\r
 + * @deprecated\r
 + */\r
 +function sql_fetch_row($res)\r
 +{\r
 +      if ( !method_exists($res, 'fetch') ) return FALSE;\r
 +      return $res->fetch(PDO::FETCH_NUM);\r
 +}\r
 +\r
 +/**\r
 + * Get column information from a result and return as an object\r
 + * @deprecated\r
 + */\r
 +function sql_fetch_field($res, $offset = 0)\r
 +{\r
 +      return FALSE;\r
 +}\r
 +\r
 +/**\r
 + * Get current system status (returns string)\r
 + * @deprecated\r
 + */\r
 +function sql_stat($conn = false)\r
 +{\r
 +      return FALSE;\r
 +}\r
 +\r
 +/**\r
 + * Returns the name of the character set\r
 + * @deprecated\r
 + */\r
 +function sql_client_encoding($conn = false)\r
 +{\r
 +      return FALSE;\r
 +}\r
 +\r
 +/**\r
 + * Get SQL client version\r
 + * @deprecated\r
 + */\r
 +function sql_get_client_info()\r
 +{\r
 +      return DB::getAttribute(PDO::ATTR_CLIENT_VERSION);\r
 +}\r
 +\r
 +/**\r
 + * Get SQL server version\r
 + * @deprecated\r
 + */\r
 +function sql_get_server_info($conn = false)\r
 +{\r
 +      return DB::getAttribute(PDO::ATTR_SERVER_VERSION);\r
 +}\r
 +\r
 +/**\r
 + * Returns a string describing the type of SQL connection in use for the connection or FALSE on failure\r
 + * @deprecated\r
 + */\r
 +function sql_get_host_info($conn = false)\r
 +{\r
 +      return FALSE;\r
 +}\r
 +\r
 +/**\r
 + * Returns the SQL protocol on success, or FALSE on failure.\r
 + * @deprecated\r
 + */\r
 +function sql_get_proto_info($conn = false)\r
 +{\r
 +      return FALSE;\r
 +}\r
 +\r
 +/**\r
 + * Get the name of the specified field in a result\r
 + * @deprecated\r
 + */\r
 +function sql_field_name($res, $offset = 0)\r
 +{\r
 +      if ( !method_exists($res, 'getColumnMeta') ) return FALSE;\r
 +      $column = $res->getColumnMeta($offset);\r
 +      return $column['name'];\r
 +}\r
 +\r
 +/**\r
 + * Set character encodings in each fields related to MySQL connection.\r
 + * @deprecated\r
 + */\r
 +function sql_set_charset($charset)\r
 +{\r
 +      return TRUE;\r
 +}\r
++=======
+ <?php
+ /*
+  * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
+  * Copyright (C) 2012 The Nucleus Group
+  *
+  * This program is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU General Public License
+  * as published by the Free Software Foundation; either version 2
+  * of the License, or (at your option) any later version.
+  * (see nucleus/documentation/index.html#license for more info)
+  */
+ /**
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2012 The Nucleus Group
+  * @version $Id$
+  */
+ /*
+  * sql_* wrappers for DB class access
+  */
+ if ( !class_exists('DB') )
+ {
+       include_once realpath(dirname(__FILE__)) . '/DB.php';
+ }
+ /**
+  * Connects to database server with arguments
+  * @deprecated
+  */
+ function sql_connect_args($host = 'localhost', $user = '', $password = '', $database = '', $new_link = FALSE)
+ {
+       global $MYSQL_HANDLER;
+       return DB::setConnectionInfo($MYSQL_HANDLER[1], $host, $user, $password, $database);
+ }
+ /**
+  * Connects to database server
+  * @deprecated
+  */
+ function sql_connect()
+ {
+       global $MYSQL_HANDLER, $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE;
+       return DB::setConnectionInfo($MYSQL_HANDLER[1], $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE);
+ }
+ /**
+  * disconnects from SQL server
+  * @deprecated
+  */
+ function sql_disconnect($conn = false)
+ {
+       DB::disConnect();
+ }
+ /**
+  * disconnects from SQL server
+  * @deprecated
+  * @param unknown_type $conn
+  */
+ function sql_close($conn = false)
+ {
+       DB::disConnect();
+ }
+ /**
+  * executes an SQL query
+  * @deprecated
+  */
+ function sql_query($query, $conn = false)
+ {
+       global $mysql_affected_row;
+       $mysql_affected_row = -1;
+       if ( preg_match('/^\W*(INSERT|UPDATE|DELETE|DROP)/i', $query) )
+       {
+               $mysql_affected_row = DB::execute($query);
+               return $mysql_affected_row !== FALSE ? TRUE : FALSE;
+       }
+       return DB::getResult($query);
+ }
+ /**
+  * executes an SQL error
+  * @deprecated
+  */
+ function sql_error($conn = false)
+ {
+       $err = DB::getError();
+       return $err[2];
+ }
+ /**
+  * executes an SQL db select
+  * @deprecated
+  */
+ function sql_select_db($db, $conn = false)
+ {
+       sql_disconnect();
+       return sql_connect();
+ }
+ /**
+  * executes an SQL real escape
+  * @deprecated
+  */
+ function sql_real_escape_string($val, $conn = false)
+ {
+       if ( is_numeric($val) )
+       {
+               return $val;
+       }
+       $escapeval = DB::quoteValue($val);
+       if ( preg_match("/^'(.*)'$/", $escapeval, $matches) )
+       {
+               $escapeval = $matches[1];
+       }
+       return $escapeval;
+ }
+ /**
+  * executes an PDO::quote() like escape, ie adds quotes arround the string and escapes chars as needed
+  * @deprecated
+  */
+ function sql_quote_string($val, $conn = false)
+ {
+       if ( is_numeric($val) )
+       {
+               return $val;
+       }
+       return DB::quoteValue($val);
+ }
+ /**
+  * executes an SQL insert id
+  * @deprecated
+  */
+ function sql_insert_id($conn = false)
+ {
+       return DB::getInsertId();
+ }
+ /**
+  * executes an SQL result request
+  * @deprecated
+  */
+ function sql_result($res, $row, $col)
+ {
+       if ( !method_exists($res, 'fetch') ) return FALSE;
+       for ( $i = 0; $i < $row; $i++ )
+               $res->fetch();
+       return $res->fetchColumn($col);
+ }
+ /**
+  * frees sql result resources
+  * @deprecated
+  */
+ function sql_free_result($res)
+ {
+       if ( !method_exists($res, 'closeCursor') ) return FALSE;
+       return $res->closeCursor();
+ }
+ /**
+  * returns number of rows in SQL result
+  * @deprecated
+  */
+ function sql_num_rows($res)
+ {
+       if ( !method_exists($res, 'rowCount') ) return FALSE;
+       return $res->rowCount();
+ }
+ /**
+  * returns number of rows affected by SQL query
+  * @deprecated
+  */
+ function sql_affected_rows($conn = false)
+ {
+       global $mysql_affected_row;
+       return $mysql_affected_row;
+ }
+ /**
+  * Get number of fields in result
+  * @deprecated
+  */
+ function sql_num_fields($res)
+ {
+       if ( !method_exists($res, 'columnCount') ) return FALSE;
+       return $res->columnCount();
+ }
+ /**
+  * fetches next row of SQL result as an associative array
+  * @deprecated
+  */
+ function sql_fetch_assoc($res)
+ {
+       if ( !method_exists($res, 'fetch') ) return FALSE;
+       return $res->fetch(PDO::FETCH_ASSOC);
+ }
+ /**
+  * Fetch a result row as an associative array, a numeric array, or both
+  * @deprecated
+  */
+ function sql_fetch_array($res)
+ {
+       if ( !method_exists($res, 'fetch') ) return FALSE;
+       return $res->fetch(PDO::FETCH_BOTH);
+ }
+ /**
+  * fetches next row of SQL result as an object
+  * @deprecated
+  */
+ function sql_fetch_object($res)
+ {
+       if ( !method_exists($res, 'fetch') ) return FALSE;
+       return $res->fetch(PDO::FETCH_OBJ);
+ }
+ /**
+  * Get a result row as an enumerated array
+  * @deprecated
+  */
+ function sql_fetch_row($res)
+ {
+       if ( !method_exists($res, 'fetch') ) return FALSE;
+       return $res->fetch(PDO::FETCH_NUM);
+ }
+ /**
+  * Get column information from a result and return as an object
+  * @deprecated
+  */
+ function sql_fetch_field($res, $offset = 0)
+ {
+       return FALSE;
+ }
+ /**
+  * Get current system status (returns string)
+  * @deprecated
+  */
+ function sql_stat($conn = false)
+ {
+       return FALSE;
+ }
+ /**
+  * Returns the name of the character set
+  * @deprecated
+  */
+ function sql_client_encoding($conn = false)
+ {
+       return FALSE;
+ }
+ /**
+  * Get SQL client version
+  * @deprecated
+  */
+ function sql_get_client_info()
+ {
+       return DB::getAttribute(PDO::ATTR_CLIENT_VERSION);
+ }
+ /**
+  * Get SQL server version
+  * @deprecated
+  */
+ function sql_get_server_info($conn = false)
+ {
+       return DB::getAttribute(PDO::ATTR_SERVER_VERSION);
+ }
+ /**
+  * Returns a string describing the type of SQL connection in use for the connection or FALSE on failure
+  * @deprecated
+  */
+ function sql_get_host_info($conn = false)
+ {
+       return FALSE;
+ }
+ /**
+  * Returns the SQL protocol on success, or FALSE on failure.
+  * @deprecated
+  */
+ function sql_get_proto_info($conn = false)
+ {
+       return FALSE;
+ }
+ /**
+  * Get the name of the specified field in a result
+  * @deprecated
+  */
+ function sql_field_name($res, $offset = 0)
+ {
+       if ( !method_exists($res, 'getColumnMeta') ) return FALSE;
+       $column = $res->getColumnMeta($offset);
+       return $column['name'];
+ }
+ /**
+  * Set character encodings in each fields related to MySQL connection.
+  * @deprecated
+  */
+ function sql_set_charset($charset)
+ {
+       return TRUE;
+ }
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: bg_Cyrl_BG.ISO-8859-5.php 1868 2012-05-22 05:10:53Z sakamocchi $
 + */
 +
 + /********************************************
++=======
+  * @version $Id: bg_Cyrl_BG.ISO-8859-5.php 1887 2012-06-17 08:30:08Z sakamocchi $
+  */
+ /********************************************
++>>>>>>> skinnable-master
   *        Start New for 4.0                 *
   ********************************************/
- define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
- define('_LISTS_AUTHOR', 'Author');
- define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
-  
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: bg_Cyrl_BG.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: bg_Cyrl_BG.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
 /********************************************
+ /********************************************
   *        Start New for 4.0                 *
   ********************************************/
- define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
- define('_LISTS_AUTHOR', 'Author');
- define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
-  
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ca_Latn_ES.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ca_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ca_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ca_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: cs_Latn_CZ.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: cs_Latn_CZ.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -1,14 -1,14 +1,26 @@@
  <?php
  /**
++<<<<<<< HEAD
 + * Nucleus Translation File
 + * Czech in Czech Republic
 + *
 + * Author: Mnemonic (mnemonic@dead-code.org)
 + * Nucleus version: v1.0-v2.0
 + *
 + * @license http://nucleuscms.org/license.txt GNU General Public License
 + * @copyright Copyright (C) 2002-2012 The Nucleus Group
 + * @version $Id: cs_Latn_CZ.WINDOWS-1250.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * Nucleus CMS Translation File
+  * Czech in Czech Republic (Latin script)
+  * 
+  * Nucleus version: v1.0-v2.0
+  * Author: Mnemonic (mnemonic@dead-code.org)
+  * 
+  * @license http://nucleuscms.org/license.txt GNU General Public License
+  * @copyright Copyright (C) 2002-2012 The Nucleus Group
+  * @version $Id: cs_Latn_CZ.WINDOWS-1250.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -471,9 -546,6 +558,12 @@@ define('_MEDIA_COLLECTION_LABEL', 'Aktu
  define('_ADD_ALIGNLEFT_TT',                   'Zarovnat doleva');
  define('_ADD_ALIGNRIGHT_TT',          'Zarovnat doprava');
  define('_ADD_ALIGNCENTER_TT',         'Zarovnat na støed');
++<<<<<<< HEAD
 +
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Zahrnout do hledání');
++=======
++>>>>>>> skinnable-master
  
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Nahrávání selhalo');
@@@ -761,7 -833,6 +851,10 @@@ define('_COMMENTFORM_YOUARE',             'Jste')
  define('_COMMENTFORM_SUBMIT',         'Pøidat komentáø');
  define('_COMMENTFORM_COMMENT',                'Vá\9a komentáø');
  define('_COMMENTFORM_NAME',                   'Jméno');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Pamatuj si mne');
  
  // loginform
@@@ -788,7 -859,6 +881,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Zakáz
  define('_ADD_DRAFTNFUTURE',                   'Koncepty a èlánky pro pozdìj\9aí publikování');
  define('_ADD_ADDITEM',                                'Pøidat èlánek');
  define('_ADD_ADDNOW',                         'Pøidat nyní');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Pøidat pozdìji');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Umístit na');
  define('_ADD_ADDDRAFT',                               'Pøidat mezi koncepty');
  define('_ADD_NOPASTDATES',                    '(data a èasy v minulosti NEJSOU platné, v tom pøípadì bude pou\9eit aktuální èas)');
@@@ -1132,8 -1202,6 +1228,11 @@@ define('_BAN_ADD_BTN',                         'Pøidat omeze
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Zpráva');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Jméno');
 +define('_LOGIN_PASSWORD',                     'Heslo');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Zapomnìl jste heslo?');
  
@@@ -1265,3 -1333,19 +1364,22 @@@ define('_EDITC_NONMEMBER',                    'není èlen
  // move item
  define('_MOVE_TITLE',                         'Pøesunout do jakého blogu?');
  define('_MOVE_BTN',                                   'Pøesunout èlánek');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: de_Latn_DE.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: de_Latn_DE.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -88,7 -169,7 +173,11 @@@ define('_ERROR_INSREQPLUGIN',                                              'Plu
  define('_ERROR_DELREQPLUGIN',                                         'Lö;schen des Plugins misslungen, benö;tigt von ');
  
  //define('_ADD_ADDLATER',                                                     'Add Later');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                                               'Add the dates specified');
++=======
+ define('_ADD_ADDLATER',                               'Später hinzufügen');
++>>>>>>> skinnable-master
  
  define('_LOGIN_NAME',                                                         'Name:');
  define('_LOGIN_PASSWORD',                                                     'Password:');
@@@ -188,13 -269,7 +277,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
  define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
++define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -304,6 -379,6 +397,7 @@@ define('_CREATED_NEW_CATEGORY_DESC'
  
  // ADMIN.php blog settings
  define('_EBLOG_CURRENT_TEAM_MEMBER',                          'Mitglieder im Team:');
++<<<<<<< HEAD
  
  /********************************************
   *        End New for 3.40                  *
@@@ -330,6 -405,6 +424,34 @@@ define('_EBLOG_REQUIREDEMAIL',            'E-Mai
  define('_ERROR_COMMENTS_SPAM',      'Your comment was rejected because it did not pass the spam test');
  // END changed/added after 3.22 END
  
++=======
++
++/********************************************
++ *        End New for 3.40                  *
++ ********************************************/
++
++// START changed/added after 3.3 START
++define('_AUTOSAVEDRAFT',              'Auto save draft');
++define('_AUTOSAVEDRAFT_LASTSAVED',    'Last saved: ');
++define('_AUTOSAVEDRAFT_NOTYETSAVED',  'No saves have been made yet');
++define('_AUTOSAVEDRAFT_NOW',          'Auto save now');
++define('_SKIN_PARTS_SPECIAL',         'Special skin parts');
++define('_ERROR_SKIN_PARTS_SPECIAL_FORMAT',            'You must enter a name that exists only out of lowercase letters and digits');
++define('_ERROR_SKIN_PARTS_SPECIAL_DELETE',            'Can\'t delete this skin part');
++define('_CONFIRMTXT_SKIN_PARTS_SPECIAL',              'Do you really want to delete this special skin part?');
++define('_ERROR_PLUGIN_LOAD',          'Plugin could not be loaded, or does not support certain features that are required for it to run on your Nucleus installation (you might want to check the <a href="?action=actionlog">actionlog</a> for more info)');
++// END changed/added after 3.3 END
++
++// START changed/added after 3.22 START
++define('_SEARCHFORM_QUERY',                   'Keywords to search');
++define('_ERROR_EMAIL_REQUIRED',               'Email address is required');
++define('_COMMENTFORM_MAIL',                   'eMail/HTTP');
++define('_COMMENTFORM_EMAIL',          'E-mail:');
++define('_EBLOG_REQUIREDEMAIL',                'E-Mail Addresse für Kommentare voraussetzen?');
++define('_ERROR_COMMENTS_SPAM',      'Your comment was rejected because it did not pass the spam test');
++// END changed/added after 3.22 END
++
++>>>>>>> skinnable-master
  // START changed/added after 3.15 START
  
  define('_LIST_PLUG_SUBS_NEEDUPDATE','Bitte benutzen Sie den \'Update Subscribtion list\'-Taste zum Update der Plugin-Abonnementliste.');
@@@ -720,16 -795,8 +842,21 @@@ define('_MANAGE_GENERAL',                        'Verschiede
  define('_MANAGE_SKINS',                               'Skins und Vorlagen');
  define('_MANAGE_EXTRA',                               'Spezielle Einstellungen');
  define('_BACKTOMANAGE',                               'Zurück zur Nucleus Verwaltung');
++<<<<<<< HEAD
 +
 +define('_BACKTOMANAGE',                               'Back to Nucleus management');
 +
 +
  // END introduced after v1.1 END
  
 +
 +
 +
 +
++=======
++// END introduced after v1.1 END
++
++>>>>>>> skinnable-master
  // global stuff
  define('_LOGOUT',                                     'Abmelden');
  define('_LOGIN',                                      'Anmelden');
@@@ -784,7 -851,6 +911,10 @@@ define('_ADD_PREVIEW',                            'Vorschau')
  define('_ADD_DISABLE_COMMENTS',               'Kommentare verbieten?');
  define('_ADD_ADDITEM',                                'Artikel hinzufügen');
  define('_ADD_ADDNOW',                         'Jetzt hinzufügen');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Später hinzufügen');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'am');
  define('_ADD_ADDDRAFT',                               'Zu Entwürfen hinzufügen');
  define('_ADD_DRAFTNFUTURE',                   'Entwürfe &amp; zukünftige Inhalte');
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: de_Latn_DE.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: de_Latn_DE.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -88,7 -169,7 +173,11 @@@ define('_ERROR_INSREQPLUGIN',                                              'Plu
  define('_ERROR_DELREQPLUGIN',                                         'Lö;schen des Plugins misslungen, benö;tigt von ');
  
  //define('_ADD_ADDLATER',                                                     'Add Later');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                                               'Add the dates specified');
++=======
+ define('_ADD_ADDLATER',                               'Später hinzufügen');
++>>>>>>> skinnable-master
  
  define('_LOGIN_NAME',                                                         'Name:');
  define('_LOGIN_PASSWORD',                                                     'Password:');
@@@ -188,13 -269,7 +277,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
  define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
++define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -720,16 -795,8 +813,21 @@@ define('_MANAGE_GENERAL',                        'Verschiede
  define('_MANAGE_SKINS',                               'Skins und Vorlagen');
  define('_MANAGE_EXTRA',                               'Spezielle Einstellungen');
  define('_BACKTOMANAGE',                               'Zurück zur Nucleus Verwaltung');
++<<<<<<< HEAD
 +
 +define('_BACKTOMANAGE',                               'Back to Nucleus management');
 +
 +
  // END introduced after v1.1 END
  
 +
 +
 +
 +
++=======
++// END introduced after v1.1 END
++
++>>>>>>> skinnable-master
  // global stuff
  define('_LOGOUT',                                     'Abmelden');
  define('_LOGIN',                                      'Anmelden');
@@@ -784,7 -851,6 +882,10 @@@ define('_ADD_PREVIEW',                            'Vorschau')
  define('_ADD_DISABLE_COMMENTS',               'Kommentare verbieten?');
  define('_ADD_ADDITEM',                                'Artikel hinzufügen');
  define('_ADD_ADDNOW',                         'Jetzt hinzufügen');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Später hinzufügen');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'am');
  define('_ADD_ADDDRAFT',                               'Zu Entwürfen hinzufügen');
  define('_ADD_DRAFTNFUTURE',                   'Entwürfe &amp; zukünftige Inhalte');
@@@ -5,7 -5,7 +5,11 @@@
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: en_Latn_US.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: en_Latn_US.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -1,11 -1,11 +1,19 @@@
  <?php
  /**
++<<<<<<< HEAD
 + * Nucleus CMS Locale File
++=======
+  * Nucleus CMS Translation File
++>>>>>>> skinnable-master
   * English in United States (Latin script)
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: en_Latn_US.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: en_Latn_US.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: es_Latn_ES.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: es_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -333,114 -408,110 +412,202 @@@ define('_ERROR_COMMENTS_SPAM',      'Yo
  
  // START changed/added after 315 START
  
++<<<<<<< HEAD
 +define('_LIST_PLUG_SUBS_NEEDUPDATE','Per favore usa il pulsante \'Aggiorna lista di sottoscrizione\' per aggiornare la lista di sottoscrizione dei plugin.');
 +define('_LIST_PLUGS_DEP',                     'I Plugin richiedono:');
++=======
+ define('_LIST_PLUG_SUBS_NEEDUPDATE','Por favor, usa el botón de la \'lista de suscripción de actualizaciones\' para actualizar la lista de suscripciones de los plugin\'s.');
+ define('_LIST_PLUGS_DEP',                     'Plugin(s) requires:');
++>>>>>>> skinnable-master
  
  // END changed/added after 3.15
  
  // START changed/added after 3.1 START
  
  // comments list per weblog
++<<<<<<< HEAD
 +define('_COMMENTS_BLOG',                      'Tutti i commenti di un blog');
 +define('_NOCOMMENTS_BLOG',                    'Nessun commento è stato fatto agli elementi di questo blog');
 +define('_BLOGLIST_COMMENTS',          'Commenti');
 +define('_BLOGLIST_TT_COMMENTS',               'Un elenco di tutti i commenti fatti agli elementi di questo blog');
++=======
+ define('_COMMENTS_BLOG',                      'Todos los comentarios para la bitácora');
+ define('_NOCOMMENTS_BLOG',                    'No se hicieron comentarios en los elementos de esta bitácora');
+ define('_BLOGLIST_COMMENTS',          'Comentarios');
+ define('_BLOGLIST_TT_COMMENTS',               'Una lista de los comentarios hechos en los elementos de esta bitácora');
++>>>>>>> skinnable-master
  
  
  // for use in archivetype-skinvar
 -define('_ARCHIVETYPE_DAY',                    'dia');
 -define('_ARCHIVETYPE_MONTH',          'mes');
 +define('_ARCHIVETYPE_DAY',                    'giorno');
 +define('_ARCHIVETYPE_MONTH',          'mese');
  
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
++<<<<<<< HEAD
 +define('_ERROR_BADTICKET',                    'Biglietto non valido o scaduto.');
 +
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Installazione del plugin fallita, richiede ');
 +define('_ERROR_DELREQPLUGIN',         'Cancellazione del plugin fallita, è richiesto da ');
++=======
+ define('_ERROR_BADTICKET',                    'Ticket inválido o caducado.');
++>>>>>>> skinnable-master
  
  // cookie prefix
 -define('_SETTINGS_COOKIEPREFIX',      'Prefijo de la Cookie');
 +define('_SETTINGS_COOKIEPREFIX',      'Prefisso dei Cookie');
  
  // account activation
++<<<<<<< HEAD
 +define('_ERROR_NOLOGON_NOACTIVATE',   'Impossibile inviare il link di attivazione. Non sei autorizzato ad eseguire il login.');
 +define('_ERROR_ACTIVATE',                     'La chiave di attivazione non esiste, non &egrave; valida o &egrave; scaduta.');
 +define('_ACTIONLOG_ACTIVATIONLINK', 'Link di attivazione inviato');
 +define('_MSG_ACTIVATION_SENT',                'Un link di attivazione &egrave; stato inviato per e-mail.');
 +
 +// activation link emails
 +define('_ACTIVATE_REGISTER_MAIL',     "Ciao <%memberName%>,\n\nHai bisogno di attivare il tuo account su <%siteName%> (<%siteUrl%>).\nPuoi farlo visitando il link seguente: \n\n\t<%activationUrl%>\n\nHai 2 giorni di tempo per farlo. Dopo questo periodo, il link di attivazione non sar&agrave; pi&ugrave; valido.");
 +define('_ACTIVATE_REGISTER_MAILTITLE',        "Attiva il tuo account '<%memberName%>'");
 +define('_ACTIVATE_REGISTER_TITLE',    'Benvenuto <%memberName%>');
 +define('_ACTIVATE_REGISTER_TEXT',     'Ci sei quasi. Per favore scegli una password per il tuo account di seguito.');
 +define('_ACTIVATE_FORGOT_MAIL',               "Ciao <%memberName%>,\n\nUsando il link seguente, potrai scegliere una nuova password per il tuo account su <%siteName%> (<%siteUrl%>).\n\n\t<%activationUrl%>\n\nHai 2 giorni di tempo per farlo. Dopo questo periodo, il link di attivazione non sar&agrave; pi&ugrave; valido.");
 +define('_ACTIVATE_FORGOT_MAILTITLE',"Riattiva il tuo account '<%memberName%>'");
 +define('_ACTIVATE_FORGOT_TITLE',      'Benvenuto <%memberName%>');
 +define('_ACTIVATE_FORGOT_TEXT',               'Puoi scegliere una nuova password per il tuo account di seguito:');
 +define('_ACTIVATE_CHANGE_MAIL',               "Ciao <%memberName%>,\n\nDato che il tuo indirizzo e-mail &egrave; cambiato, devi riattivare il tuo account su <%siteName%> (<%siteUrl%>).\nPuoi farlo visitando il link seguente: \n\n\t<%activationUrl%>\n\nHai 2 giorni di tempo per farlo. Dopo questo periodo, il link di attivazione non sar&agrave; pi&ugrave; valido.");
 +define('_ACTIVATE_CHANGE_MAILTITLE',"Riattiva il tuo account '<%memberName%>'");
 +define('_ACTIVATE_CHANGE_TITLE',      'Benvenuto <%memberName%>');
 +define('_ACTIVATE_CHANGE_TEXT',               'Il tuo cambio di indirizzo &egrave; stato verificato. Grazie!');
 +define('_ACTIVATE_SUCCESS_TITLE',     'Attivazione avvenuta con successo');
 +define('_ACTIVATE_SUCCESS_TEXT',      'Il tuo account &egrave; stato attivato con successo.');
 +define('_MEMBERS_SETPWD',                     'Imposta Password');
 +define('_MEMBERS_SETPWD_BTN',         'Imposta Password');
 +define('_QMENU_ACTIVATE',                     'Attivazione account');
 +define('_QMENU_ACTIVATE_TEXT',                '<p>Dopo che avrai attivato il tuo account, potrai iniziare ad usarlo <a href="index.php?action=showlogin">eseguendo il login</a>.</p>');
 +
 +define('_PLUGS_BTN_UPDATE',                   'Aggiorna la lista di sottoscrizione');
 +
 +// global settings
 +define('_SETTINGS_JSTOOLBAR',         'Stile della Barra degli Strumenti Javascript');
 +define('_SETTINGS_JSTOOLBAR_FULL',    'Barra degli Strumenti Completa (IE)');
 +define('_SETTINGS_JSTOOLBAR_SIMPLE','Barra degli Strumenti Semplice (Non-IE)');
 +define('_SETTINGS_JSTOOLBAR_NONE',    'Disabilita la Barra degli Strumenti');
 +define('_SETTINGS_URLMODE_HELP',      '(Info: <a href="documentation/tips.html#searchengines-fancyurls">Come puoi attivare le URL brevi</a>)');
 +
 +// extra plugin settings part when editing categories/members/blogs/...
 +define('_PLUGINS_EXTRA',                      'Impostazioni extra per i Plugin');
 +
 +// itemlist info column keys
 +define('_LIST_ITEM_BLOG',                     'blog:');
++=======
+ define('_ERROR_NOLOGON_NOACTIVATE',   'No se puede enviar el enlace de activación. No tienes permitido el acceso.');
+ define('_ERROR_ACTIVATE',                     'La clave de activación no existe, es inválida, o ha caducado.');
+ define('_ACTIONLOG_ACTIVATIONLINK', 'Enlace de activación enviado');
+ define('_MSG_ACTIVATION_SENT',                'Un enlace de activación ha sido enviado por correo electrónico.');
+ // activation link emails
+ define('_ACTIVATE_REGISTER_MAIL',     "Hola <%memberName%>,\n\nNecesitas activar tu cuenta en <%siteName%> (<%siteUrl%>).\nPuedes hacerlo visitando el siguiente enlace: \n\n\t<%activationUrl%>\n\nTienes 2 dias para hacerlo. Después, el enlace de activación pierde su validez.");
+ define('_ACTIVATE_REGISTER_MAILTITLE',        "Activa tu cuenta '<%memberName%>'");
+ define('_ACTIVATE_REGISTER_TITLE',    'Bienvenido <%memberName%>');
+ define('_ACTIVATE_REGISTER_TEXT',     'Ya casi está. Por favor, selecciona una clave para tu cuenta aquí.');
+ define('_ACTIVATE_FORGOT_MAIL',               "Hola <%memberName%>,\n\nUsando el enlace inferior, puedes seleccionar una nueva clave para tu cuenta en <%siteName%> (<%siteUrl%>).\n\n\t<%activationUrl%>\n\nTienes 2 dias para hacerlo. Después, el enlace de activación pierde su validez.");
+ define('_ACTIVATE_FORGOT_MAILTITLE',"Reactiva tu cuenta '<%memberName%>'");
+ define('_ACTIVATE_FORGOT_TITLE',      'Bienvenido <%memberName%>');
+ define('_ACTIVATE_FORGOT_TEXT',               'Puedes elegir una nueva clave para tu cuenta aquí:');
+ define('_ACTIVATE_CHANGE_MAIL',               "Hola <%memberName%>,\n\nPuesto que tu dirección de correo electrónico ha cambiado, necesitarás reactivar tu cuenta en <%siteName%> (<%siteUrl%>).\nPuedes hacerlo visitando el siguiente enlace: \n\n\t<%activationUrl%>\n\nTienes 2 dias para hacerlo. Después, el enlace de activación pierde su validez.");
+ define('_ACTIVATE_CHANGE_MAILTITLE',"Reactiva tu cuenta '<%memberName%>'");
+ define('_ACTIVATE_CHANGE_TITLE',      'Bienvenido <%memberName%>');
+ define('_ACTIVATE_CHANGE_TEXT',               'Tu cambio de dirección ha sido verificado. ¡Gracias!');
+ define('_ACTIVATE_SUCCESS_TITLE',     'Activation Succeeded');
+ define('_ACTIVATE_SUCCESS_TEXT',      'Tu cuenta ha sido activada con éxito.');
+ define('_MEMBERS_SETPWD',                     'Introduce clave');
+ define('_MEMBERS_SETPWD_BTN',         'Introduce clave');
+ define('_QMENU_ACTIVATE',                     'Activación de la cuenta');
+ define('_QMENU_ACTIVATE_TEXT',                '<p>Después de que hayas activado tu cuenta, puedes empezar a usarla <a href="index.php?action=showlogin">accediendo</a>.</p>');
+ define('_PLUGS_BTN_UPDATE',                   'Lista de suscripción de actualizaciones');
+ // global settings 
+ define('_SETTINGS_JSTOOLBAR',         'Estilo de barra de herramientas Javascript');
+ define('_SETTINGS_JSTOOLBAR_FULL',    'Barra de herramientas completa (IE)');
+ define('_SETTINGS_JSTOOLBAR_SIMPLE','Barra de herramientas simple (No IE)');
+ define('_SETTINGS_JSTOOLBAR_NONE',    'Deshabilita la barra de herramientas');
+ define('_SETTINGS_URLMODE_HELP',      '(Info: <a href="documentation/tips.html#searchengines-fancyurls">Cómo activar URLs atractivas</a>)');
+ // extra plugin settings part when editing categories/members/blogs/...
+ define('_PLUGINS_EXTRA',                      'Configuración Extra de Plugins');
+ // itemlist info column keys
+ define('_LIST_ITEM_BLOG',                     'bitácora:');
++>>>>>>> skinnable-master
  define('_LIST_ITEM_CAT',                      'cat:');
 -define('_LIST_ITEM_AUTHOR',                   'autor:');
 -define('_LIST_ITEM_DATE',                     'fecha:');
 -define('_LIST_ITEM_TIME',                     'hora:');
 +define('_LIST_ITEM_AUTHOR',                   'autore:');
 +define('_LIST_ITEM_DATE',                     'data:');
 +define('_LIST_ITEM_TIME',                     'ora:');
  
  // indication of registered members in comments list
 -define('_LIST_COMMENTS_MEMBER',       '(miembro)');
 +define('_LIST_COMMENTS_MEMBER',       '(membro)');
  
  // batch operations
 -define('_BATCH_WITH_SEL',                     'con los seleccionados:');
 -define('_BATCH_EXEC',                         'Ejecutar');
 +define('_BATCH_WITH_SEL',                     'Con la selezione:');
 +define('_BATCH_EXEC',                         'Esegui');
  
  // quickmenu
++<<<<<<< HEAD
 +define('_QMENU_HOME',                         'Home');
 +define('_QMENU_ADD',                          'Aggiungi articoli');
 +define('_QMENU_ADD_SELECT',                   '-- seleziona --');
 +define('_QMENU_USER_SETTINGS',                'Impostazioni');
 +define('_QMENU_USER_ITEMS',                   'Articoli');
 +define('_QMENU_USER_COMMENTS',                'Commenti');
 +define('_QMENU_MANAGE',                               'Gestione');
 +define('_QMENU_MANAGE_LOG',                   'Log Azioni');
 +define('_QMENU_MANAGE_SETTINGS',      'Impostazioni Globali');
 +define('_QMENU_MANAGE_MEMBERS',               'Membri');
 +define('_QMENU_MANAGE_NEWBLOG',               'Nuovo Weblog');
 +define('_QMENU_MANAGE_BACKUPS',               'Backups');
 +define('_QMENU_MANAGE_PLUGINS',               'Plugins');
 +define('_QMENU_LAYOUT',                               'Layout');
 +define('_QMENU_LAYOUT_SKINS',         'Temi');
 +define('_QMENU_LAYOUT_TEMPL',         'Modelli');
 +define('_QMENU_LAYOUT_IEXPORT',               'Importa/Esporta');
 +define('_QMENU_PLUGINS',                      'Plugins');
 +
 +// quickmenu on logon screen
 +define('_QMENU_INTRO',                                'Introduzione');
 +define('_QMENU_INTRO_TEXT',                   '<p>Questa &egrave; la schermata di Login per BLOG:CMS, il sistema di gestione contenuti che &egrave; usato per gestire questo sito web.</p><p>Se hai un account, puoi fare il login e iniziare a inviare nuovi articoli.</p>');
 +
 +// helppages for plugins
 +define('_ERROR_PLUGNOHELPFILE',               'Il file di aiuto per questo plugin non pu&ograve; essere trovato');
 +define('_PLUGS_HELP_TITLE',                   'Pagina di aiuto per il plugin');
 +define('_LIST_PLUGS_HELP',                    'aiuto');
++=======
+ define('_QMENU_HOME',                         'Inicio');
+ define('_QMENU_ADD',                          'Agregar elemento');
+ define('_QMENU_ADD_SELECT',                   '-- seleccionar --');
+ define('_QMENU_USER_SETTINGS',                'Configuración');
+ define('_QMENU_USER_ITEMS',                   'Elementos');
+ define('_QMENU_USER_COMMENTS',                'Comentarios');
+ define('_QMENU_MANAGE',                               'Gestión');
+ define('_QMENU_MANAGE_LOG',                   'Historial de acciones');
+ define('_QMENU_MANAGE_SETTINGS',      'Configuración global');
+ define('_QMENU_MANAGE_MEMBERS',               'Miembros');
+ define('_QMENU_MANAGE_NEWBLOG',               'Nueva bitácora');
+ define('_QMENU_MANAGE_BACKUPS',               'Copias de seguridad');
+ define('_QMENU_MANAGE_PLUGINS',               'Plugins');
+ define('_QMENU_LAYOUT',                               'Distribución');
+ define('_QMENU_LAYOUT_SKINS',         'Pieles');
+ define('_QMENU_LAYOUT_TEMPL',         'Plantillas');
+ define('_QMENU_LAYOUT_IEXPORT',               'Import/Export');
+ define('_QMENU_PLUGINS',                      'Plugins');
+ // quickmenu on logon screen
+ define('_QMENU_INTRO',                                'Introducción');
+ define('_QMENU_INTRO_TEXT',                   '<p>Esta es la pantalla de entrada de Nucleus CMS, el sistema de gestión de contenido usado para mantener este sitio.</p><p>Si tienes una cuenta, puedes acceder e introducir nuevos elementos (historias o posts).</p>');
+ // helppages for plugins
+ define('_ERROR_PLUGNOHELPFILE',               'El archivo de ayuda de este plugin no se encuentra');
+ define('_PLUGS_HELP_TITLE',                   'Página de ayuda del plugin');
+ define('_LIST_PLUGS_HELP',                    'ayuda');
++>>>>>>> skinnable-master
  
  
  // END changed/started after 3.1
  // START changed/added after v2.5beta START
  
  // general settings (security)
++<<<<<<< HEAD
 +define('_SETTINGS_EXTAUTH',                   'Abilita l\'Autenticazione Esterna');
 +define('_WARNING_EXTAUTH',                    'Attenzione: Abilitare solo se necessario.');
 +
 +// member profile
 +define('_MEMBERS_BYPASS',                     'Usa l\'Autenticazione Esterna');
 +
 +// 'always include in search' blog setting (yes/no) [in v2.5beta, the 'always' part wasn't clear]
 +define('_EBLOG_SEARCH',                               'Includi <em>SEMPRE</em> nella ricerca');
++=======
+ define('_SETTINGS_EXTAUTH',                   'Habilita la autenticación externa');
+ define('_WARNING_EXTAUTH',                    'Aviso: Habilita sólo si es necesario.');
+ // member profile
+ define('_MEMBERS_BYPASS',                     'Usar Autenticación Externa');
+ // 'always include in search' blog setting (yes/no) [in v2.5beta, the 'always' part wasn't clear]
+ define('_EBLOG_SEARCH',                               'Incluir en búsquedas');
++>>>>>>> skinnable-master
  
  // END changed/added after v2.5beta
  
  // START introduced after v2.0 START
  
  // media library
 -define('_MEDIA_VIEW',                         'ver');
 -define('_MEDIA_VIEW_TT',                      'Ver archivo (se abre en nueva ventana)');
 -define('_MEDIA_FILTER_APPLY',         'Aplicar filtro');
 +define('_MEDIA_VIEW',                         'visualizza');
 +define('_MEDIA_VIEW_TT',                      'Visualizza il file (apre una nuova finestra)');
 +define('_MEDIA_FILTER_APPLY',         'Applica filtro');
  define('_MEDIA_FILTER_LABEL',         'Filtro: ');
++<<<<<<< HEAD
 +define('_MEDIA_UPLOAD_TO',                    'Carica in...');
 +define('_MEDIA_UPLOAD_NEW',                   'Carica un nuovo file...');
 +define('_MEDIA_COLLECTION_SELECT',    'Seleziona');
 +define('_MEDIA_COLLECTION_TT',                'Passa a questa categoria');
 +define('_MEDIA_COLLECTION_LABEL',     'Collezione corrente: ');
++=======
+ define('_MEDIA_UPLOAD_TO',                    'Subir a...');
+ define('_MEDIA_UPLOAD_NEW',                   'Subir nuevo archivo...');
+ define('_MEDIA_COLLECTION_SELECT',    'Seleccionar');
+ define('_MEDIA_COLLECTION_TT',                'Cambiar a esta categoría');
+ define('_MEDIA_COLLECTION_LABEL',     'Colección actual: ');
++>>>>>>> skinnable-master
  
  // tooltips on toolbar
 -define('_ADD_ALIGNLEFT_TT',                   'Alinear a la izquierda');
 -define('_ADD_ALIGNRIGHT_TT',          'Alinear a la derecha');
 -define('_ADD_ALIGNCENTER_TT',         'Alinear al centro');
 +define('_ADD_ALIGNLEFT_TT',                   'Allinea a sinistra');
 +define('_ADD_ALIGNRIGHT_TT',          'Allinea a destra');
 +define('_ADD_ALIGNCENTER_TT',         'Centra');
  
++<<<<<<< HEAD
 +
++=======
++>>>>>>> skinnable-master
  // generic upload failure
 -define('_ERROR_UPLOADFAILED',         'Error al subir');
 +define('_ERROR_UPLOADFAILED',         'Caricamento fallito');
  
  // END introduced after v2.0 END
  
  // START introduced after v1.5 START
  
  // posting to the past/edit timestamps
 -define('_EBLOG_ALLOWPASTPOSTING',     'Permite introducir entradas en el pasado');
 -define('_ADD_CHANGEDATE',                     'Actualizar fecha y hora');
 -define('_BMLET_CHANGEDATE',                   'Actualizar fecha y hora');
 +define('_EBLOG_ALLOWPASTPOSTING',     'Permetti l\'invio di articoli nel passato');
 +define('_ADD_CHANGEDATE',                     'Aggiorna il timestamp');
 +define('_BMLET_CHANGEDATE',                   'Aggiorna il timestamp');
  
  // skin import/export
 -define('_OVERVIEW_SKINIMPORT',                'Importar/exportar piel...');
 +define('_OVERVIEW_SKINIMPORT',                'Importa/esporta temi...');
  
  // skin settings
 -define('_PARSER_INCMODE_NORMAL',      'Normal');
 -define('_PARSER_INCMODE_SKINDIR',     'Usar el directorio de pieles');
 -define('_SKIN_INCLUDE_MODE',          'Incluir modo');
 -define('_SKIN_INCLUDE_PREFIX',                'Incluir prefijo');
 +define('_PARSER_INCMODE_NORMAL',      'Normale');
 +define('_PARSER_INCMODE_SKINDIR',     'Usa la directory dei temi');
 +define('_SKIN_INCLUDE_MODE',          'Modo inclusione');
 +define('_SKIN_INCLUDE_PREFIX',                'Prefisso inclusione');
  
  // global settings
 -define('_SETTINGS_BASESKIN',          'Piel base');
 -define('_SETTINGS_SKINSURL',          'URL de pieles');
 -define('_SETTINGS_ACTIONSURL',                'URL completa para action.php');
 +define('_SETTINGS_BASESKIN',          'Tema di base');
 +define('_SETTINGS_SKINSURL',          'URL dei temi');
 +define('_SETTINGS_ACTIONSURL',                'URL completa al file action.php');
  
  // category moves (batch)
++<<<<<<< HEAD
 +define('_ERROR_MOVEDEFCATEGORY',      'Non posso spostare la categoria di default');
 +define('_ERROR_MOVETOSELF',                   'Non posso spostare la categoria (il blog di destinazione coincide con quello di partenza)');
 +define('_MOVECAT_TITLE',                      'Seleziona il blog dove spostare la categoria selezionata');
 +define('_MOVECAT_BTN',                                'Sposta la Categoria');
++=======
+ define('_ERROR_MOVEDEFCATEGORY',      'No se puede mover la categoría por defecto');
+ define('_ERROR_MOVETOSELF',                   'No se puede mover la categoría (la bitácora de destino es la misma que la de origen)');
+ define('_MOVECAT_TITLE',                      'Seleccionar la bitácora a la que mover la categoría');
+ define('_MOVECAT_BTN',                                'Mover categoría');
++>>>>>>> skinnable-master
  
  // URLMode setting
  define('_SETTINGS_URLMODE',                   'Modo URL');
 -define('_SETTINGS_URLMODE_NORMAL',    'Normal');
 -define('_SETTINGS_URLMODE_PATHINFO','Atractivo');
 +define('_SETTINGS_URLMODE_NORMAL',    'Normale');
 +define('_SETTINGS_URLMODE_PATHINFO','Fancy');
  
  // Batch operations
++<<<<<<< HEAD
 +define('_BATCH_NOSELECTION',          'Non &egrave; stato selezionato nulla su cui eseguire le azioni richieste');
 +define('_BATCH_ITEMS',                                'Operazione automatiche sugli articoli');
 +define('_BATCH_CATEGORIES',                   'Operazioni automatiche sulle categorie');
 +define('_BATCH_MEMBERS',                      'Operazioni automatiche sui membri');
 +define('_BATCH_TEAM',                         'Operazioni automatiche sui membri del gruppo');
 +define('_BATCH_COMMENTS',                     'Operazioni automatiche sui commenti');
 +define('_BATCH_UNKNOWN',                      'Operazione automatica sconosciuta: ');
 +define('_BATCH_EXECUTING',                    'Esecuzione dell\'operazione di');
 +define('_BATCH_ONCATEGORY',                   'sulla categoria');
 +define('_BATCH_ONITEM',                               'sull\'articolo');
 +define('_BATCH_ONCOMMENT',                    'sul commento');
 +define('_BATCH_ONMEMBER',                     'sull\'utente');
 +define('_BATCH_ONTEAM',                               'sul ');
 +define('_BATCH_SUCCESS',                      ' Operazione effettuata con successo!');
 +define('_BATCH_DONE',                         'Fatto!');
 +define('_BATCH_DELETE_CONFIRM',               'Conferma l\'operazione di eliminazione');
 +define('_BATCH_DELETE_CONFIRM_BTN',   'Conferma operazione eliminazione');
 +define('_BATCH_SELECTALL',                    'seleziona tutti');
 +define('_BATCH_DESELECTALL',          'deseleziona tutti');
 +
 +// batch operations: options in dropdowns
 +define('_BATCH_ITEM_DELETE',          'Cancella');
 +define('_BATCH_ITEM_MOVE',                    'Sposta');
 +define('_BATCH_MEMBER_DELETE',                'Cancella');
 +define('_BATCH_MEMBER_SET_ADM',               'Dai i permessi di amministrazione');
 +define('_BATCH_MEMBER_UNSET_ADM',     'Togli i permessi di amministrazione');
 +define('_BATCH_TEAM_DELETE',          'Cancellalo dal gruppo');
 +define('_BATCH_TEAM_SET_ADM',         'Dai i permessi di amministrazione');
 +define('_BATCH_TEAM_UNSET_ADM',               'Togli i privilegi di amministrazione');
 +define('_BATCH_CAT_DELETE',                   'Cancella');
 +define('_BATCH_CAT_MOVE',                     'Spostalo in un altro blog');
 +define('_BATCH_COMMENT_DELETE',               'Cancella');
++=======
+ define('_BATCH_NOSELECTION',          'Nada seleccionado sobre lo que se pueda realizar una acción');
+ define('_BATCH_ITEMS',                                'Operación de lotes sobre elementos');
+ define('_BATCH_CATEGORIES',                   'Operación de lotes sobre categorías');
+ define('_BATCH_MEMBERS',                      'Operación de lotes sobre miembros');
+ define('_BATCH_TEAM',                         'Operación de lotes sobre miembros de equipos');
+ define('_BATCH_COMMENTS',                     'Operación de lotes sobre comentarios');
+ define('_BATCH_UNKNOWN',                      'Operación de lotes desconocida: ');
+ define('_BATCH_EXECUTING',                    'Ejecutando');
+ define('_BATCH_ONCATEGORY',                   'sobre la categoría');
+ define('_BATCH_ONITEM',                               'sobre el elemento');
+ define('_BATCH_ONCOMMENT',                    'sobre el comentario');
+ define('_BATCH_ONMEMBER',                     'sobre el miembro');
+ define('_BATCH_ONTEAM',                               'sobre el miembro de equipo');
+ define('_BATCH_SUCCESS',                      '¡Sin problemas!');
+ define('_BATCH_DONE',                         '¡Hecho!');
+ define('_BATCH_DELETE_CONFIRM',               'Confirmar eliminación de lote');
+ define('_BATCH_DELETE_CONFIRM_BTN',   'Confirmar eliminación de lote');
+ define('_BATCH_SELECTALL',                    'seleccionar todo');
+ define('_BATCH_DESELECTALL',          'deseleccionar todo');
+ // batch operations: options in dropdowns
+ define('_BATCH_ITEM_DELETE',          'Eliminar');
+ define('_BATCH_ITEM_MOVE',                    'Mover');
+ define('_BATCH_MEMBER_DELETE',                'Eliminar');
+ define('_BATCH_MEMBER_SET_ADM',               'Dar derechos de administración');
+ define('_BATCH_MEMBER_UNSET_ADM',     'Quitar derechos de administración');
+ define('_BATCH_TEAM_DELETE',          'Borrar del equipo');
+ define('_BATCH_TEAM_SET_ADM',         'Dar derechos de administración');
+ define('_BATCH_TEAM_UNSET_ADM',               'Quitar derechos de administración');
+ define('_BATCH_CAT_DELETE',                   'Eliminar');
+ define('_BATCH_CAT_MOVE',                     'Mover a otra bitácora');
+ define('_BATCH_COMMENT_DELETE',               'Eliminar');
++>>>>>>> skinnable-master
  
  // itemlist: Add new item...
 -define('_ITEMLIST_ADDNEW',                    'Introducir nuevo elemento...');
 -define('_ADD_PLUGIN_EXTRAS',          'Opciones extra de plugin');
 +define('_ITEMLIST_ADDNEW',                    'Aggiungi un nuovo articolo...');
 +define('_ADD_PLUGIN_EXTRAS',          'Moduli aggiuntivi - Opzioni extra ');
  
  // errors
++<<<<<<< HEAD
 +define('_ERROR_CATCREATEFAIL',                'Non posso creare una nuova categoria');
 +define('_ERROR_NUCLEUSVERSIONREQ',    'Questo modulo aggiuntivo richiede una versione di Nucleus pi&ugrave; recente: ');
 +
 +// backlinks
 +define('_BACK_TO_BLOGSETTINGS',               'Torna alle impostazioni del blog');
 +
 +// skin import export
 +define('_SKINIE_TITLE_IMPORT',                'Importa');
 +define('_SKINIE_TITLE_EXPORT',                'Esporta');
 +define('_SKINIE_BTN_IMPORT',          'Importa');
 +define('_SKINIE_BTN_EXPORT',          'Esporta i temi o i modelli selezionati');
 +define('_SKINIE_LOCAL',                               'Importa da un file locale:');
 +define('_SKINIE_NOCANDIDATES',                'Nessuna tema da importare &egrave; stato individuato nella directory dei temi');
 +define('_SKINIE_FROMURL',                     'Importa dall\'URL:');
 +define('_SKINIE_EXPORT_INTRO',                'Seleziona i temi ed i modelli che vuoi esportare dalla lista che segue');
 +define('_SKINIE_EXPORT_SKINS',                'Temi');
 +define('_SKINIE_EXPORT_TEMPLATES',    'Modelli');
 +define('_SKINIE_EXPORT_EXTRA',                'Informazioni aggiuntive');
 +define('_SKINIE_CONFIRM_OVERWRITE',   'Sovrascrivi i temi esistenti (see nameclashes)');
 +define('_SKINIE_CONFIRM_IMPORT',      'Si, voglio importarlo');
 +define('_SKINIE_CONFIRM_TITLE',               'Sull\'importazioni di temi e modelli');
 +define('_SKINIE_INFO_SKINS',          'File del tema:');
 +define('_SKINIE_INFO_TEMPLATES',      'File del modello:');
 +define('_SKINIE_INFO_GENERAL',                'Informazioni:');
 +define('_SKINIE_INFO_SKINCLASH',      'Collisioni nomi dei temi:');
 +define('_SKINIE_INFO_TEMPLCLASH',     'Collisioni nomi dei modelli:');
 +define('_SKINIE_INFO_IMPORTEDSKINS','Temi importati:');
 +define('_SKINIE_INFO_IMPORTEDTEMPLS','Modelli importati:');
 +define('_SKINIE_DONE',                                'Importazione effettuata');
 +
 +define('_AND',                                                'e');
 +define('_OR',                                         'o');
 +
 +// empty fields on template edit
 +define('_EDITTEMPLATE_EMPTY',         'campo vuoto (clicca per modificare)');
++=======
+ define('_ERROR_CATCREATEFAIL',                'No se puede crear una nueva categoría');
+ define('_ERROR_NUCLEUSVERSIONREQ',    'Este plugin necesita una versión más reciente de Nucleus: ');
+ // backlinks
+ define('_BACK_TO_BLOGSETTINGS',               'Volver a preferencias de bitácora');
+ // skin import export
+ define('_SKINIE_TITLE_IMPORT',                'Importar');
+ define('_SKINIE_TITLE_EXPORT',                'Exportar');
+ define('_SKINIE_BTN_IMPORT',          'Importar');
+ define('_SKINIE_BTN_EXPORT',          'Exportar pieles/plantillas seleccionadas');
+ define('_SKINIE_LOCAL',                               'Importar desde un archivo local:');
+ define('_SKINIE_NOCANDIDATES',                'No se han encontrado candidatos para importar en el directorio de pieles');
+ define('_SKINIE_FROMURL',                     'Importar desde URL:');
+ define('_SKINIE_EXPORT_INTRO',                'Seleccionar abajo las pieles y plantillas a exportar');
+ define('_SKINIE_EXPORT_SKINS',                'Pieles');
+ define('_SKINIE_EXPORT_TEMPLATES',    'Plantillas');
+ define('_SKINIE_EXPORT_EXTRA',                'Información Extra');
+ define('_SKINIE_CONFIRM_OVERWRITE',   'Sobreescribe pieles que ya existan (ver conflictos de nombre)');
+ define('_SKINIE_CONFIRM_IMPORT',      'Sí, quiero importar ésto');
+ define('_SKINIE_CONFIRM_TITLE',               'Sobre importar pieles y plantillas');
+ define('_SKINIE_INFO_SKINS',          'Pieles en archivo:');
+ define('_SKINIE_INFO_TEMPLATES',      'Plantillas en archivo:');
+ define('_SKINIE_INFO_GENERAL',                'Información:');
+ define('_SKINIE_INFO_SKINCLASH',      'Nombre de piel conflictivo:');
+ define('_SKINIE_INFO_TEMPLCLASH',     'Nombre de plantilla conflictivo:');
+ define('_SKINIE_INFO_IMPORTEDSKINS','Pieles importadas:');
+ define('_SKINIE_INFO_IMPORTEDTEMPLS','Plantillas importadas:');
+ define('_SKINIE_DONE',                                'Importación realizada');
+ define('_AND',                                                'y');
+ define('_OR',                                         'o');
+ // empty fields on template edit
+ define('_EDITTEMPLATE_EMPTY',         'campo vacío (hacer clic para editar)');
++>>>>>>> skinnable-master
  
  // skin overview list
 -define('_LIST_SKINS_INCMODE',         'Incluye modo:');
 -define('_LIST_SKINS_INCPREFIX',               'Incluye prefijo:');
 -define('_LIST_SKINS_DEFINED',         'Partes definidas:');
 +define('_LIST_SKINS_INCMODE',         'Modo inclusione:');
 +define('_LIST_SKINS_INCPREFIX',               'Prefisso inclusione:');
 +define('_LIST_SKINS_DEFINED',         'Parti definite:');
  
  // backup
++<<<<<<< HEAD
 +define('_BACKUPS_TITLE',                      'Salva / Ripristina');
 +define('_BACKUP_TITLE',                               'Salvataggio');
 +define('_BACKUP_INTRO',                               'Clicca sul pulsante qui sotto per eseguire un salvataggio (backup) del database di Nucleus. Ti verr&agrave; richiesto di salvare un file contenente il backup: scegli di conservare tale file in un posto sicuro.');
 +define('_BACKUP_ZIP_YES',                     'Prova ad utilizzare la compressione dei dati');
 +define('_BACKUP_ZIP_NO',                      'Non utilizzare la compressione dei dati');
 +define('_BACKUP_BTN',                         'Crea il backup');
 +define('_BACKUP_NOTE',                                '<b>Nota:</b> solo il contenuto del database verr&agrave; salvato nel backup. Tutti gli altri file, comprese le impostazioni presenti nel file config.php, <b>NON</b> verranno incluse nel salvataggio.');
 +define('_RESTORE_TITLE',                      'Ripristina');
 +define('_RESTORE_NOTE',                               '<b>ATTENZIONE:</b> il ripristino del database da una copia di backup  <b>CANCELLERA\'</b> tutto il contenuto corrente del database di Nucleus! Esegui questa operazione solo se sei veramente sicuro di ci&ograve; che stai facendo!   <br />  <b>Nota:</b> la versione di Nucleus da cui hai creato il file di backup deve essere identica alla versione che stai utilizzando in questo momento! Il ripristino dei dati tra versioni differenti di Nucleus non &egrave; assicurato.');
 +define('_RESTORE_INTRO',                      'Seleziona il file contenente il backup: il file selezionato verr&agrave; caricato sul server. Clicca sul pulsante &quot;Ripristina&quot; per eseguire il recupero dei dati.');
 +define('_RESTORE_IMSURE',                     'Si, sono sicuro! Voglio procedere con il ripristino dei dati.');
 +define('_RESTORE_BTN',                                'Ripristina');
 +define('_RESTORE_WARNING',                    '(assicurati di selezionare il backup corretto; &egrave; consigliato effettuare un nuovo backup prima di procedere con il ripristino di un precedente salvataggio)');
 +define('_ERROR_BACKUP_NOTSURE',               'Devi spuntare la casellina \'Si, sono sicuro\' per poter procedere con il ripristino dei dati');
 +define('_RESTORE_COMPLETE',                   'Ripristino dati completato');
++=======
+ define('_BACKUPS_TITLE',                      'Almacenar / Restaurar');
+ define('_BACKUP_TITLE',                               'Almacenar');
+ define('_BACKUP_INTRO',                               'Hacer clic sobre el siguiente botón para crear una copia de seguridad de la base de datos de Nucleus. Se pedirá que guarde un archivo de seguridad. Guárdelo en lugar seguro.');
+ define('_BACKUP_ZIP_YES',                     'Intente usar la compresión');
+ define('_BACKUP_ZIP_NO',                      'No use compresión');
+ define('_BACKUP_BTN',                         'Crear copia de seguridad');
+ define('_BACKUP_NOTE',                                '<b>Nota:</b> Sólo los contenidos de la base de datos se guardan en la copia de seguridad. Archivos de medios, imágenes y preferencias de config.php <b>NO</b> se incluyen en la copia de seguridad.');
+ define('_RESTORE_TITLE',                      'Restaurar');
+ define('_RESTORE_NOTE',                               '<b>AVISO:</b> Restaurar desde una copia de seguridad <b>BORRARÁ</b> todos los datos de Nucleus actuales! ¡Hacer ésto sólo se esté totalmente seguro!   <br />  <b>Nota:</b> Comprobar que la versión de Nucleus en la que se creó la copia es la misma que la versión que se está usando ahora! No funcionará si no es así');
+ define('_RESTORE_INTRO',                      'Seleccionar el archivo de copia de seguridad (será enviado al servidor) y haga clic sobre el botón "Restaurar" para empezar.');
+ define('_RESTORE_IMSURE',                     '¡Sí, estoy seguro de que quiero hacer eso!');
+ define('_RESTORE_BTN',                                'Restaurar desde archivo');
+ define('_RESTORE_WARNING',                    '(asegurarse de estar restaurando la copia de seguridad correcta, quizá sea mejor hacer una copia de seguridad antes de empezar)');
+ define('_ERROR_BACKUP_NOTSURE',               'Necesitará marcar la casilla \'Estoy seguro\'');
+ define('_RESTORE_COMPLETE',                   'Restauración completada');
++>>>>>>> skinnable-master
  
  // new item notification
 -define('_NOTIFY_NI_MSG',                      'Un nuevo elemento ha sido insertado:');
 -define('_NOTIFY_NI_TITLE',                    'Nuevo elemento!');
 -define('_NOTIFY_KV_MSG',                      'Voto Karma del elemento:');
 +define('_NOTIFY_NI_MSG',                      'E\' stato inserito un nuovo articolo:');
 +define('_NOTIFY_NI_TITLE',                    'nuovo Articolo!');
 +define('_NOTIFY_KV_MSG',                      'Voto karma sull\'articolo:');
  define('_NOTIFY_KV_TITLE',                    'Nucleus karma:');
 -define('_NOTIFY_NC_MSG',                      'Comentario sobre el elemento:');
 -define('_NOTIFY_NC_TITLE',                    'Comentario de Nucleus:');
 -define('_NOTIFY_USERID',                      'ID de usuario:');
 -define('_NOTIFY_USER',                                'Usuario:');
 -define('_NOTIFY_COMMENT',                     'Comentario:');
 -define('_NOTIFY_VOTE',                                'Voto:');
 +define('_NOTIFY_NC_MSG',                      'Comment per sull\'articolo:');
 +define('_NOTIFY_NC_TITLE',                    'Commento Nucleus:');
 +define('_NOTIFY_USERID',                      'ID Utente:');
 +define('_NOTIFY_USER',                                'Utente:');
 +define('_NOTIFY_COMMENT',                     'Commento:');
 +define('_NOTIFY_VOTE',                                'Vota:');
  define('_NOTIFY_HOST',                                'Host:');
  define('_NOTIFY_IP',                          'IP:');
++<<<<<<< HEAD
 +define('_NOTIFY_MEMBER',                      'Membro:');
 +define('_NOTIFY_TITLE',                               'Titolo:');
 +define('_NOTIFY_CONTENTS',                    'Contenuti:');
 +
 +// member mail message
 +define('_MMAIL_MSG',                          'Ti &egrave; stato inviato un messaggio da');
 +define('_MMAIL_FROMANON',                     'un visitatore anonimo');
 +define('_MMAIL_FROMNUC',                      'il messaggio ti &egrave; stato inviato utilizzando i servizi di nucleus utilizzato dal sito ');
 +define('_MMAIL_TITLE',                                'Un messaggio da');
 +define('_MMAIL_MAIL',                         'Messaggio:');
++=======
+ define('_NOTIFY_MEMBER',                      'Miembro:');
+ define('_NOTIFY_TITLE',                               'Título:');
+ define('_NOTIFY_CONTENTS',                    'Contenido:');
+ // member mail message
+ define('_MMAIL_MSG',                          'Un mensaje enviado por');
+ define('_MMAIL_FROMANON',                     'un visitante anónimo');
+ define('_MMAIL_FROMNUC',                      'Insertado desde una bitácora de Nucleus en');
+ define('_MMAIL_TITLE',                                'Un mensaje de');
+ define('_MMAIL_MAIL',                         'Mensaje:');
++>>>>>>> skinnable-master
  
  // END introduced after v1.5 END
  
  // START introduced after v1.1 START
  
  // bookmarklet buttons
++<<<<<<< HEAD
 +define('_BMLET_ADD',                          'Aggiungi un articolo');
 +define('_BMLET_EDIT',                         'Modifica un articolo');
 +define('_BMLET_DELETE',                               'Cancella un articolo');
 +define('_BMLET_BODY',                         'Corpo');
 +define('_BMLET_MORE',                         'Corpo (esteso)');
 +define('_BMLET_OPTIONS',                      'Opzioni');
 +define('_BMLET_PREVIEW',                      'Anteprima');
++=======
+ define('_BMLET_ADD',                          'Introducir entrada');
+ define('_BMLET_EDIT',                         'Editar entrada');
+ define('_BMLET_DELETE',                               'Eliminar entrada');
+ define('_BMLET_BODY',                         'Cuerpo');
+ define('_BMLET_MORE',                         'Más');
+ define('_BMLET_OPTIONS',                      'Opciones');
+ define('_BMLET_PREVIEW',                      'Previsualizar');
++>>>>>>> skinnable-master
  
  // used in bookmarklet
 -define('_ITEM_UPDATED',                               'La entrada ha sido actualizada');
 -define('_ITEM_DELETED',                               'La entrada ha sido eliminada');
 +define('_ITEM_UPDATED',                               'L\'articolo &egrave; stato aggiornato');
 +define('_ITEM_DELETED',                               'L\'articolo &egrave; stato cancellato');
  
  // plugins
++<<<<<<< HEAD
 +define('_CONFIRMTXT_PLUGIN',          'Sei sicuro di volere eliminare il modulo aggiuntivo chiamato');
 +define('_ERROR_NOSUCHPLUGIN',         'Modulo aggiuntivo inesistente');
 +define('_ERROR_DUPPLUGIN',                    'Questo modulo aggiuntivo &egrave; gi&agrave; stato installato');
 +define('_ERROR_PLUGFILEERROR',                'Modulo aggiuntivo inesistente, o permessi impostati non correttamente');
 +define('_PLUGS_NOCANDIDATES',         'Non &egrave; stato trovato alcun modulo aggiuntivo');
 +
 +define('_PLUGS_TITLE_MANAGE',         'Gestisci i moduli aggiuntivi');
 +define('_PLUGS_TITLE_INSTALLED',      'Moduli attualmente installati');
 +define('_PLUGS_TITLE_UPDATE',         'Aggiorna elenco sottoscrittori');
 +define('_PLUGS_TEXT_UPDATE',          'Nucleus mantiene una cache degli eventi sottoscritti dai moduli aggiuntivi. Quando aggiorni un modulo aggiuntivo sovrascrivendone il file, devi eseguire questa opzione per essere sicuro che vengano aggiornate le sottoscrizioni corrette');
 +define('_PLUGS_TITLE_NEW',                    'Installa un nuovo modulo aggiuntivo');
 +define('_PLUGS_ADD_TEXT',                     'Qui sotto sono elencati tutti i file contenuti nella directory dei moduli aggiuntivi. Dovrebbero essere elencati solo i moduli non ancora installati. Prima di procedere con l\'installazione di uno qualsiasi dei file elencati accertati che lo stesso sia <strong>sicuramente</strong> un modulo aggiuntivo valido.');
 +define('_PLUGS_BTN_INSTALL',          'Installa');
 +define('_BACKTOOVERVIEW',                     'Torna alla pagina principale dei moduli aggiuntivi');
++=======
+ define('_CONFIRMTXT_PLUGIN',          'Seguro que se desea eliminar el plugin llamado');
+ define('_ERROR_NOSUCHPLUGIN',         'No existe ese plugin');
+ define('_ERROR_DUPPLUGIN',                    'Ese plugin ya ha sido instalado');
+ define('_ERROR_PLUGFILEERROR',                'No existe ese plugin, o los permisos no son los correctos');
+ define('_PLUGS_NOCANDIDATES',         'No se han encontrado candidatos para el plugin');
+ define('_PLUGS_TITLE_MANAGE',         'Gestionar plugins');
+ define('_PLUGS_TITLE_INSTALLED',      'Actualmente instalado');
+ define('_PLUGS_TITLE_UPDATE',         'Actualizar la lista de suscripción');
+ define('_PLUGS_TEXT_UPDATE',          'Nucleus mantiene una caché de las suscripciones a eventos de los plugins. Cuando se actualiza un plugin sustituyendo su archivo, se debe ejecutar esta actualización para asegurar que las suscripciones de la caché son correctas');
+ define('_PLUGS_TITLE_NEW',                    'Instalar un nuevo plugin');
+ define('_PLUGS_ADD_TEXT',                     'A continuación hay una lista de todos los archivos de tu directorio de plugins, algunos podrían ser plugins sin instalación. Asegúrate de estar <strong>totalmente seguro</strong> de que se trata de un plugin antes de introducirlo.');
+ define('_PLUGS_BTN_INSTALL',          'Instalar plugin');
+ define('_BACKTOOVERVIEW',                     'Volver a principal');
++>>>>>>> skinnable-master
  
  // editlink
 -define('_TEMPLATE_EDITLINK',          'Editar el enlace de la entrada');
 +define('_TEMPLATE_EDITLINK',          'Link per la modifica dell\'articolo');
  
  // add left / add right tooltips
 -define('_ADD_LEFT_TT',                                'Insertar cuadro a la izquierda');
 -define('_ADD_RIGHT_TT',                               'Insertar cuadro a la derecha');
 +define('_ADD_LEFT_TT',                                'Aggiungi un riquadro laterale a sinistra');
 +define('_ADD_RIGHT_TT',                               'Aggiungi un riquadro laterale a destra');
  
  // add/edit item: new category (in dropdown box)
++<<<<<<< HEAD
 +define('_ADD_NEWCAT',                         'Nuova categoria...');
 +
 +// new settings
 +define('_SETTINGS_PLUGINURL',         'URL moduli aggiuntivi');
 +define('_SETTINGS_MAXUPLOADSIZE',     'Max. grandezza file caricabili (in byte)');
 +define('_SETTINGS_NONMEMBERMSGS',     'Abilita gli utenti non registrati ad inviare messaggi');
 +define('_SETTINGS_PROTECTMEMNAMES',   'Proteggi i nomi degli utenti registrati');
++=======
+ define('_ADD_NEWCAT',                         'Nueva categoría');
+ // new settings
+ define('_SETTINGS_PLUGINURL',         'URL del plugin');
+ define('_SETTINGS_MAXUPLOADSIZE',     'Max. tamaño de archivo para subida (bytes)');
+ define('_SETTINGS_NONMEMBERMSGS',     'Permitir a los no miembros que envien mensajes');
+ define('_SETTINGS_PROTECTMEMNAMES',   'Proteger los nombres de los miembros');
++>>>>>>> skinnable-master
  
  // overview screen
 -define('_OVERVIEW_PLUGINS',                   'Gestionar plugins...');
 +define('_OVERVIEW_PLUGINS',                   'Gestisci i moduli aggiuntivi...');
  
  // actionlog
 -define('_ACTIONLOG_NEWMEMBER',                'Registro de un nuevo miembro:');
 +define('_ACTIONLOG_NEWMEMBER',                'Registrazione nuovo membro:');
  
  // membermail (when not logged in)
 -define('_MEMBERMAIL_MAIL',                    'Tu email:');
 +define('_MEMBERMAIL_MAIL',                    'Il tuo indirizzo email:');
  
  // file upload
++<<<<<<< HEAD
 +define('_ERROR_DISALLOWEDUPLOAD2',    'Non hai diritti di amministrazione su nessuno dei blog che hanno il membro di destinazione nel loro gruppo. Per questo motivo non sei abilitato a caricare file nella directory media di questi mebri.');
 +
 +// plugin list
 +define('_LISTS_INFO',                         'Informazioni');
 +define('_LIST_PLUGS_AUTHOR',          'Da:');
 +define('_LIST_PLUGS_VER',                     'Versione:');
 +define('_LIST_PLUGS_SITE',                    'Visita il sito');
 +define('_LIST_PLUGS_DESC',                    'Descrizione:');
 +define('_LIST_PLUGS_SUBS',                    'Sottoscrive i seguenti eventi:');
 +define('_LIST_PLUGS_UP',                      'sposta sopra');
 +define('_LIST_PLUGS_DOWN',                    'sposta sotto');
 +define('_LIST_PLUGS_UNINSTALL',               'disinstalla');
 +define('_LIST_PLUGS_ADMIN',                   'amministra');
 +define('_LIST_PLUGS_OPTIONS',         'modifica&nbsp;opzioni');
++=======
+ define('_ERROR_DISALLOWEDUPLOAD2',    'Sin permiso de administración sobre ninguna de las bitácoras que tiene el miembro de destino del equipo. Por tanto, no es posible subir archivos al directorio de medios de este miembro');
+ // plugin list
+ define('_LISTS_INFO',                         'Información');
+ define('_LIST_PLUGS_AUTHOR',          'Por:');
+ define('_LIST_PLUGS_VER',                     'Versión:');
+ define('_LIST_PLUGS_SITE',                    'Visitar sitio');
+ define('_LIST_PLUGS_DESC',                    'Descripción:');
+ define('_LIST_PLUGS_SUBS',                    'Suscribir a los siguientes eventos:');
+ define('_LIST_PLUGS_UP',                      'desplazar arriba');
+ define('_LIST_PLUGS_DOWN',                    'desplazar abajo');
+ define('_LIST_PLUGS_UNINSTALL',               'desinstalar');
+ define('_LIST_PLUGS_ADMIN',                   'admin');
+ define('_LIST_PLUGS_OPTIONS',         'editar&nbsp;opciones');
++>>>>>>> skinnable-master
  
  // plugin option list
 -define('_LISTS_VALUE',                                'Valor');
 +define('_LISTS_VALUE',                                'Valore');
  
  // plugin options
++<<<<<<< HEAD
 +define('_ERROR_NOPLUGOPTIONS',                'questo modulo non ha alcuna opzione impostata');
 +define('_PLUGS_BACK',                         'Torna alla pagina principale dei moduli aggiuntivi');
 +define('_PLUGS_SAVE',                         'Salva le opzioni');
 +define('_PLUGS_OPTIONS_UPDATED',      'Opzioni del modulo aggiuntivo modificate');
 +
 +define('_OVERVIEW_MANAGEMENT',                'Amministrazione');
 +define('_OVERVIEW_MANAGE',                    'Amministrazione Nucleus...');
 +define('_MANAGE_GENERAL',                     'Gestione Generale');
 +define('_MANAGE_SKINS',                               'Temi e Modelli');
 +define('_MANAGE_EXTRA',                               'Caratteristiche aggiuntive');
 +
 +define('_BACKTOMANAGE',                               'Torna all\'amministrazione di Nucleus');
++=======
+ define('_ERROR_NOPLUGOPTIONS',                'este plugin no tiene establecida ninguna opción');
+ define('_PLUGS_BACK',                         'Volver a la lista de plugins');
+ define('_PLUGS_SAVE',                         'Guardar opciones');
+ define('_PLUGS_OPTIONS_UPDATED',      'Opciones de plugin actualizadas');
+ define('_OVERVIEW_MANAGEMENT',                'Gestión');
+ define('_OVERVIEW_MANAGE',                    'Gestión de Nucleus...');
+ define('_MANAGE_GENERAL',                     'Gestión general');
+ define('_MANAGE_SKINS',                               '"Skins" y plantillas');
+ define('_MANAGE_EXTRA',                               'Características extra');
+ define('_BACKTOMANAGE',                               'Volver a la gestión de Nucleus');
++>>>>>>> skinnable-master
  
  
  // END introduced after v1.1 END
  
  
  // global stuff
++<<<<<<< HEAD
 +define('_LOGOUT',                                     'Disconnettiti');
 +define('_LOGIN',                                      'Connettiti');
 +define('_YES',                                                'Si');
 +define('_NO',                                         'No');
 +define('_SUBMIT',                                     'Invia');
 +define('_ERROR',                                      'Errore');
 +define('_ERRORMSG',                                   'Si &egrave; verificato un errore!');
 +define('_BACK',                                               'Go Back');
 +define('_NOTLOGGEDIN',                                'Non sei collegato');
 +define('_LOGGEDINAS',                         'Sei collegato come');
 +define('_ADMINHOME',                          'Home Page Amministrativa');
 +define('_NAME',                                               'Nome');
 +define('_BACKHOME',                                   'Torna alla pagina di amministrazione');
 +define('_BADACTION',                          'E\' stato richiesto di eseguire un\'azione non esistente');
 +define('_MESSAGE',                                    'Messaggio');
 +define('_HELP_TT',                                    'Aiuto!');
 +define('_YOURSITE',                                   'Il tuo sito');
++=======
+ define('_LOGOUT',                                     'Salir');
+ define('_LOGIN',                                      'Entrar');
+ define('_YES',                                                'Sí');
+ define('_NO',                                         'No');
+ define('_SUBMIT',                                     'Enviar');
+ define('_ERROR',                                      'Error');
+ define('_ERRORMSG',                                   'Ha sucedido un error!');
+ define('_BACK',                                               'Volver');
+ define('_NOTLOGGEDIN',                                'No registrado');
+ define('_LOGGEDINAS',                         'Registrado como');
+ define('_ADMINHOME',                          'Administración');
+ define('_NAME',                                               'Nombre');
+ define('_BACKHOME',                                   'Volver a la administración');
+ define('_BADACTION',                          'No existe la acción requerida');
+ define('_MESSAGE',                                    'Mensaje');
+ define('_HELP_TT',                                    'Ayuda!');
+ define('_YOURSITE',                                   'Ver web');
++>>>>>>> skinnable-master
 +
  
 +define('_POPUP_CLOSE',                                'Chiudi la finestra');
  
 -define('_POPUP_CLOSE',                                'Cerrar ventana');
++<<<<<<< HEAD
 +define('_LOGIN_PLEASE',                               'Connettiti per poter utilizzare quest\'opzione');
  
 +// commentform
 +define('_COMMENTFORM_YOUARE',         'Sei collegato come');
 +define('_COMMENTFORM_SUBMIT',         'Aggiungi un commento');
 +define('_COMMENTFORM_COMMENT',                'Il tuo commento');
 +define('_COMMENTFORM_NAME',                   'Nome');
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
 +define('_COMMENTFORM_REMEMBER',               'Ricordami');
++=======
+ define('_LOGIN_PLEASE',                               'Es necesario regístrarse primero');
+ // commentform
+ define('_COMMENTFORM_YOUARE',         'Eres');
+ define('_COMMENTFORM_SUBMIT',         'Introducir comentario');
+ define('_COMMENTFORM_COMMENT',                'Comentario');
+ define('_COMMENTFORM_NAME',                   'Nombre');
+ define('_COMMENTFORM_REMEMBER',               'Recordar usuario');
++>>>>>>> skinnable-master
  
  // loginform
 -define('_LOGINFORM_NAME',                     'Usuario');
 -define('_LOGINFORM_PWD',                      'Clave');
 -define('_LOGINFORM_YOUARE',                   'Registrado como');
 -define('_LOGINFORM_SHARED',                   'Ordenador compartido');
 +define('_LOGINFORM_NAME',                     'Nome utente');
 +define('_LOGINFORM_PWD',                      'Password');
 +define('_LOGINFORM_YOUARE',                   'Collegato come');
 +define('_LOGINFORM_SHARED',                   'Computer condiviso');
  
  // member mailform
 -define('_MEMBERMAIL_SUBMIT',          'Enviar mensaje');
 +define('_MEMBERMAIL_SUBMIT',          'Invia messaggio');
  
  // search form
 -define('_SEARCHFORM_SUBMIT',          'Buscar');
 +define('_SEARCHFORM_SUBMIT',          'Cerca');
  
  // add item form
++<<<<<<< HEAD
 +define('_ADD_ADDTO',                          'Aggiungi un nuovo articolo in');
 +define('_ADD_CREATENEW',                      'Crea un nuovo articolo');
 +define('_ADD_BODY',                                   'Corpo');
 +define('_ADD_TITLE',                          'Titolo');
 +define('_ADD_MORE',                                   'Corpo esteso (opzionale)');
 +define('_ADD_CATEGORY',                               'Categoria');
 +define('_ADD_PREVIEW',                                'Anteprima');
 +define('_ADD_DISABLE_COMMENTS',               'Disabilitare i commenti?');
 +define('_ADD_DRAFTNFUTURE',                   'Bozza &amp; articoli futuri');
 +define('_ADD_ADDITEM',                                'Aggiungi un articolo');
 +define('_ADD_ADDNOW',                         'Aggiungi ora');
 +define('_ADD_ADDLATER',                               'Aggiungi dopo');
 +define('_ADD_PLACE_ON',                               'Place on');
 +define('_ADD_ADDDRAFT',                               'Aggiungi alle bozze');
 +define('_ADD_NOPASTDATES',                    '(date ed orari passati NON sono validi, in tal caso verr&agrave; automaticamente aggiunta la data attuale)');
 +define('_ADD_BOLD_TT',                                'Grassetto');
 +define('_ADD_ITALIC_TT',                      'Inclinato');
 +define('_ADD_HREF_TT',                                'Crea un link');
 +define('_ADD_MEDIA_TT',                               'Aggiungi elemento media');
 +define('_ADD_PREVIEW_TT',                     'Mostra/nascondi anteprima');
 +define('_ADD_CUT_TT',                         'Taglia');
 +define('_ADD_COPY_TT',                                'Copia');
 +define('_ADD_PASTE_TT',                               'Incolla');
 +
 +
 +// edit item form
 +define('_EDIT_ITEM',                          'Modifica un articolo');
 +define('_EDIT_SUBMIT',                                'Modifica articolo');
 +define('_EDIT_ORIG_AUTHOR',                   'Autore originale');
 +define('_EDIT_BACKTODRAFTS',          'Rimetti nelle bozze');
 +define('_EDIT_COMMENTSNOTE',          '(nota: disabilitare i commenti non canceller&agrave;/nasconder&agrave; i commenti precedentemente inseriti)');
 +
 +// used on delete screens
 +define('_DELETE_CONFIRM',                     'Conferma la cancellazione');
 +define('_DELETE_CONFIRM_BTN',         'Conferma cancellazione');
 +define('_CONFIRMTXT_ITEM',                    'Stai per eliminare il seguente articolo:');
 +define('_CONFIRMTXT_COMMENT',         'Stai per eliminare il seguente commento:');
 +define('_CONFIRMTXT_TEAM1',                   'Stai per cancellare ');
 +define('_CONFIRMTXT_TEAM2',                   ' dal gruppo membri del blog ');
 +define('_CONFIRMTXT_BLOG',                    'Il blog che stai per eliminare &egrave;: ');
 +define('_WARNINGTXT_BLOGDEL',         'Attenzione! L\'eliminazione di un blog porter&agrave; alla cancellazione di TUTTI gli articoli ed i commenti del blog. Per maggiore sicurezza sei pregato di confermare l\'azione di cancellazione.!<br />Non interrompere Nucleus mentre effettuer&agrave; l\'eliminazione del blog.');
 +define('_CONFIRMTXT_MEMBER',          'Stai per cancellare il seguente utente: ');
 +define('_CONFIRMTXT_TEMPLATE',                'Stai per cancellare il modello chiamato ');
 +define('_CONFIRMTXT_SKIN',                    'Stai per cancellare il tema chiamato ');
 +define('_CONFIRMTXT_BAN',                     'Stai per cancellare il ban per il seguente range di IP');
 +define('_CONFIRMTXT_CATEGORY',                'Stai per cancellare la categoria ');
 +
 +// some status messages
 +define('_DELETED_ITEM',                               'Articolo cancellato');
 +define('_DELETED_MEMBER',                     'Utente cancellato');
 +define('_DELETED_COMMENT',                    'Commento cancellato');
 +define('_DELETED_BLOG',                               'Blog eliminato');
 +define('_DELETED_CATEGORY',                   'Categoria cancellata');
 +define('_ITEM_MOVED',                         'Articolo spostato');
 +define('_ITEM_ADDED',                         'Articolo aggiunto');
 +define('_COMMENT_UPDATED',                    'Commento aggiornato');
 +define('_SKIN_UPDATED',                               'le modifiche effettuate al tema sono state salvate');
 +define('_TEMPLATE_UPDATED',                   'le modifiche effettuate al modello sono state salvate');
 +
 +// errors
 +define('_ERROR_COMMENT_LONGWORD',     'Non utilizzare parole pi&ugrave; lunghe di 90 caratteri nei commenti');
 +define('_ERROR_COMMENT_NOCOMMENT',    'Inserisci un commento');
 +define('_ERROR_COMMENT_NOUSERNAME',   'Nome utente non valido');
 +define('_ERROR_COMMENT_TOOLONG',      'Il commento inserito &egrave; troppo lungo (max. 5000 caratteri)');
 +define('_ERROR_COMMENTS_DISABLED',    'I commenti per questo blog sono attualmente disabilitati.');
 +define('_ERROR_COMMENTS_NONPUBLIC',   'Devi essere collegato come memro per poter aggiungere commenti in questo blog');
 +define('_ERROR_COMMENTS_MEMBERNICK','Il nome che hai scelto di utilizzare per pubblicare i tuoi commenti &egrave; gi&agrave; usato da un membro del blog. Scegli un nome diverso.');
 +define('_ERROR_SKIN',                         'Errore Skin');
 +define('_ERROR_ITEMCLOSED',                   'Questo articolo &egrave; stato chiuso, non &egrave; possibile aggiungervi commenti/voti');
 +define('_ERROR_NOSUCHITEM',                   'Articolo inesistente');
 +define('_ERROR_NOSUCHBLOG',                   'Blog inesistente');
 +define('_ERROR_NOSUCHSKIN',                   'Tema inesistente');
 +define('_ERROR_NOSUCHMEMBER',         'membro inesistente');
 +define('_ERROR_NOTONTEAM',                    'Non sei nel gruppo membri di questo blog.');
 +define('_ERROR_BADDESTBLOG',          'Il blog di destinazione non esiste');
 +define('_ERROR_NOTONDESTTEAM',                'Articolo impossibile da spostare in quanto non sei nel gruppo membri del blog di destinazione');
 +define('_ERROR_NOEMPTYITEMS',         'Impossibile aggiungere articoli vuoti!');
 +define('_ERROR_BADMAILADDRESS',               'Indirizzo email non valido');
 +define('_ERROR_BADNOTIFY',                    'Uno o pi&ugrave; degli indirizzi di notifica forniti non &egrave; un indirizzo email valido');
 +define('_ERROR_BADNAME',                      'Nome non valido (sono permessi solo caratteri a-z e 0-9 e niente spazi iniziali/finali)');
 +define('_ERROR_NICKNAMEINUSE',                'Un altro membro sta gi &agrave; utilizzando il nickname che hai scelto');
 +define('_ERROR_PASSWORDMISMATCH',     'Le due password devono coincidere');
 +define('_ERROR_PASSWORDTOOSHORT',     'La password deve essere lunga ameno 6 caratteri');
 +define('_ERROR_PASSWORDMISSING',      'Il campo della password non pu&ograve; essere lasciato vuoto');
 +define('_ERROR_REALNAMEMISSING',      'Devi inserire un nome reale');
 +define('_ERROR_ATLEASTONEADMIN',      'Deve sempre esistere almeno un utente super-amministratore che possa connettersi all\'area di amministrazione.');
 +define('_ERROR_ATLEASTONEBLOGADMIN','Eseguendo questa azione potresti rendere il tuo weblog inutilizzabile. Assicurati che ci sia sempre almeno un utente amministratore del blog.');
 +define('_ERROR_ALREADYONTEAM',                'Non &egrave; possibile aggiungere un membro che &egrave; gi&agrave; parte del gruppo');
 +define('_ERROR_BADSHORTBLOGNAME',     'Il nome breve del blog pu&ograve; contenere solo caratteri a-z e 0-9, senza spazi');
 +define('_ERROR_DUPSHORTBLOGNAME',     'Il nome-breve scelto &egrave; gi&agrave; utilizzato da un altro blog. Questi nomi devono essere univoci');
 +define('_ERROR_UPDATEFILE',                   'Cannot get write access to the update-file. Make sure the file permissions are set ok (try chmodding it to 666). Also note that the location is relative to the admin-area directory, so you might want to use an absolute path (something like /your/path/to/nucleus/)');
 +define('_ERROR_DELDEFBLOG',                   'E\' Impossibile cancellare il blog di default');
 +define('_ERROR_DELETEMEMBER',         'questo membro on pu&ograve; essere cancellato, probabilmente perch&eacute; &egrave; autore articoli o commenti');
 +define('_ERROR_BADTEMPLATENAME',      'Il nome scelto per il modello non &egrave; valido, utilizza solo caratteri a-z e 0-9 e niente spazi iniziali/finali');
 +define('_ERROR_DUPTEMPLATENAME',      'Gi&agrave; esiste un altro modello con questo nome');
 +define('_ERROR_BADSKINNAME',          'Il nome scelto per il tema non &egrave; valido (sono permessi solo caratteri a-z e 0-9 e niente spazi iniziali/finali)');
 +define('_ERROR_DUPSKINNAME',          'Gi&agrave; esiste un altro tema con questo nome');
 +define('_ERROR_DEFAULTSKIN',          'Deve sempre esistere un tema chiamato &quot;default&quot;');
 +define('_ERROR_SKINDEFDELETE',                'Impossibile eliminare il tema selezionao poich&eacute; &egrave; il tema di default del seguente weblog: ');
 +define('_ERROR_DISALLOWED',                   'Non hai le abilitazioni necessarie per effettuare questa azione');
 +define('_ERROR_DELETEBAN',                    'Si &egrave; verificato un errore durante l\'eliminazione del ban (ban inesistente)');
 +define('_ERROR_ADDBAN',                               'Si &egrave; verificato un errore durante l\'aggiunta di un nuovo ban. Il ban potrebbe NON essere stato correttamente aggiunto in tutti i tuoi blog.');
 +define('_ERROR_BADACTION',                    'L\'azione richiesta non esiste');
 +define('_ERROR_MEMBERMAILDISABLED',   'L\'invio di email tra membri &egrave; disabilitato');
 +define('_ERROR_MEMBERCREATEDISABLED','La creazione di nuovi account utente &egrave; disabilitata');
 +define('_ERROR_INCORRECTEMAIL',               'indirizzo email non corretto');
 +define('_ERROR_VOTEDBEFORE',          'Hai gi&agrave; espresso il tuo voto per questo articolo');
 +define('_ERROR_BANNED1',                      'Non posso eseguire l\'azione richiesta in quanto il tuo indirizzo IP (intervallo ip ');
 +define('_ERROR_BANNED2',                      ') risulta bannato. Il messaggio &egrave;: \'');
 +define('_ERROR_BANNED3',                      '\'');
 +define('_ERROR_LOGINNEEDED',          'Devi essere collegato al blog per effettuare questa azione');
 +define('_ERROR_CONNECT',                      'Errore di connessione');
 +define('_ERROR_FILE_TOO_BIG',         'Il file &egrave; troppo grande!');
 +define('_ERROR_BADFILETYPE',          'Il caricamento di questo tipo di file non &egrave; permesso');
 +define('_ERROR_BADREQUEST',                   'Richiesta di caricamento errata');
 +define('_ERROR_DISALLOWEDUPLOAD',     'Non sei presente in nessuno dei gruppi del blog, per questo motivo non puoi caricare file');
 +define('_ERROR_BADPERMISSIONS',               'I permessi per il file/la directry non sono stati impostati correttamente');
 +define('_ERROR_UPLOADMOVEP',          'Si &egrave; verificato un errore durante lo spostamento del file');
 +define('_ERROR_UPLOADCOPY',                   'Si &egrave; verificato un errore durante la copia del file');
 +define('_ERROR_UPLOADDUPLICATE',      'E\' gi&agrave; present eun altro file con questo nome. Prova a rinominare il file prima di caricarlo.');
 +define('_ERROR_LOGINDISALLOWED',      'Non sei ablitato all\'accesso all\'area amministrativa del blog. Puoi connetterti come altro utente');
 +define('_ERROR_DBCONNECT',                    'Non &egrave; possibile connettersi al server mySQL');
 +define('_ERROR_DBSELECT',                     'Non &egrave; possibile selezionare il database di Nucleus.');
 +define('_ERROR_NOSUCHLOCALE',         'Il file della lingua non esiste');
 +define('_ERROR_NOSUCHCATEGORY',               'La categoria non esiste');
 +define('_ERROR_DELETELASTCATEGORY',   'Ci deve essere almeno una categoria');
 +define('_ERROR_DELETEDEFCATEGORY',    'Non puoi cancellare la categoria di default');
 +define('_ERROR_BADCATEGORYNAME',      'Nome della categoria non valido');
 +define('_ERROR_DUPCATEGORYNAME',      'Una categoria con questo nome &egrave; gi&agrave; presente');
++=======
+ define('_ADD_ADDTO',                          'Introducir nueva entrada a');
+ define('_ADD_CREATENEW',                      'Crear nueva entrada');
+ define('_ADD_BODY',                                   'Cuerpo');
+ define('_ADD_TITLE',                          'Título');
+ define('_ADD_MORE',                                   'Extensión (opcional)');
+ define('_ADD_CATEGORY',                               'Categoría');
+ define('_ADD_PREVIEW',                                'Previsualizar');
+ define('_ADD_DISABLE_COMMENTS',               'Deshabilitar comentarios?');
+ define('_ADD_DRAFTNFUTURE',                   'Borrador y futuras entradas');
+ define('_ADD_ADDITEM',                                'Introducir entrada');
+ define('_ADD_ADDNOW',                         'Introducir ahora');
+ define('_ADD_PLACE_ON',                               'Colocar en');
+ define('_ADD_ADDDRAFT',                               'Introducir en el borrador');
+ define('_ADD_NOPASTDATES',                    '(las fechas y horas pasadas no son válidas, se usará el momento actual)');
+ define('_ADD_BOLD_TT',                                'Negrita');
+ define('_ADD_ITALIC_TT',                      'Itálica');
+ define('_ADD_HREF_TT',                                'Crear enlace');
+ define('_ADD_MEDIA_TT',                               'Introducir imagen o multimedia');
+ define('_ADD_PREVIEW_TT',                     'Mostrar/ocultar previsualización');
+ define('_ADD_CUT_TT',                         'Cortar');
+ define('_ADD_COPY_TT',                                'Copiar');
+ define('_ADD_PASTE_TT',                               'Pegar');
+ // edit item form
+ define('_EDIT_ITEM',                          'Editar entrada');
+ define('_EDIT_SUBMIT',                                'Editar entrada');
+ define('_EDIT_ORIG_AUTHOR',                   'Autor original');
+ define('_EDIT_BACKTODRAFTS',          'Enviar al borrador');
+ define('_EDIT_COMMENTSNOTE',          '(nota: deshabilitar los comentarios no ocultará los existentes)');
+ // used on delete screens
+ define('_DELETE_CONFIRM',                     'Confirmar la eliminación');
+ define('_DELETE_CONFIRM_BTN',         'Confirmar la eliminación');
+ define('_CONFIRMTXT_ITEM',                    'A punto de eliminar la siguiente entrada:');
+ define('_CONFIRMTXT_COMMENT',         'A punto de eliminar el siguiente comentario:');
+ define('_CONFIRMTXT_TEAM1',                   'A punto de eliminar ');
+ define('_CONFIRMTXT_TEAM2',                   ' del equipo para la bitácora ');
+ define('_CONFIRMTXT_BLOG',                    'La bitácora a eliminar es: ');
+ define('_WARNINGTXT_BLOGDEL',         'Cuidado! Eliminar una bitácora eliminará TODAS sus entradas y comentarios. Confirmar definitivamente la eliminación!<br />No interrumpir el sistema durante la eliminación.');
+ define('_CONFIRMTXT_MEMBER',          'A punto de eliminar al siguiente miembro: ');
+ define('_CONFIRMTXT_TEMPLATE',                'A punto de eliminar la plantilla llamada ');
+ define('_CONFIRMTXT_SKIN',                    'A punto de eliminar la piel llamada ');
+ define('_CONFIRMTXT_BAN',                     'A punto de eliminar la restricción para el rango IP');
+ define('_CONFIRMTXT_CATEGORY',                'A punto de eliminar la categoría ');
+ // some status messages
+ define('_DELETED_ITEM',                               'Entrada eliminada');
+ define('_DELETED_MEMBER',                     'Miembro eliminado');
+ define('_DELETED_COMMENT',                    'Comentario eliminado');
+ define('_DELETED_BLOG',                               'Bitácora eliminada');
+ define('_DELETED_CATEGORY',                   'Categoría eliminada');
+ define('_ITEM_MOVED',                         'Entrada movida');
+ define('_ITEM_ADDED',                         'Entrada introducida');
+ define('_COMMENT_UPDATED',                    'Comentario actualizado');
+ define('_SKIN_UPDATED',                               'Datos de la piel actualizados');
+ define('_TEMPLATE_UPDATED',                   'Datos de la plantilla guardados');
+ // errors
+ define('_ERROR_COMMENT_LONGWORD',     'No usar palabras de longitud mayor a 90 carácteres en los comentarios');
+ define('_ERROR_COMMENT_NOCOMMENT',    'Introducir el comentario');
+ define('_ERROR_COMMENT_NOUSERNAME',   'Usuario incorrecto');
+ define('_ERROR_COMMENT_TOOLONG',      'Comentario  demasiado largo (máximo : 5000 carácteres)');
+ define('_ERROR_COMMENTS_DISABLED',    'Comentarios deshabilitados para esta bitácora.');
+ define('_ERROR_COMMENTS_NONPUBLIC',   'Registrarse primero como miembro para introducir comentarios a esta bitácora');
+ define('_ERROR_COMMENTS_MEMBERNICK','El nombre indicado para introducir comentarios está siendo usado por otro miembro. Probar con otro distinto.');
+ define('_ERROR_SKIN',                         'Error de piel');
+ define('_ERROR_ITEMCLOSED',                   'Esta entrada ha sido cerrada, no es posible introducir nuevos comentarios o votar');
+ define('_ERROR_NOSUCHITEM',                   'La entrada indicada no existe');
+ define('_ERROR_NOSUCHBLOG',                   'La bitácora indicada no existe');
+ define('_ERROR_NOSUCHSKIN',                   'La piel indicada no existe');
+ define('_ERROR_NOSUCHMEMBER',         'El miembro indicado no existe');
+ define('_ERROR_NOTONTEAM',                    'El usuario no pertenece al equipo de esta bitácora.');
+ define('_ERROR_BADDESTBLOG',          'La bitácora de destino no existe');
+ define('_ERROR_NOTONDESTTEAM',                'No es posible mover la entrada, ya que el usuario no pertenece al equipo de la bitácora de destino');
+ define('_ERROR_NOEMPTYITEMS',         'No es posible introducir entradas vacias!');
+ define('_ERROR_BADMAILADDRESS',               'Dirección de correo incorrecta');
+ define('_ERROR_BADNOTIFY',                    'Una o más de las direcciones de notificación no son direcciones correctas');
+ define('_ERROR_BADNAME',                      'El nombre no es válido (sólo a-z y 0-9 permitidos, sin espacios al principio ni al final)');
+ define('_ERROR_NICKNAMEINUSE',                'Otro miembro está usando ya ese nombre');
+ define('_ERROR_PASSWORDMISMATCH',     'Las claves deben coincidir');
+ define('_ERROR_PASSWORDTOOSHORT',     'La clave debe tener al menos 6 carácteres');
+ define('_ERROR_PASSWORDMISSING',      'La clave no puede estar vacia');
+ define('_ERROR_REALNAMEMISSING',      'El nombre real introducido no es válido');
+ define('_ERROR_ATLEASTONEADMIN',      'Debe existir siempre al menos un superadministrador que pueda registrarse en la zona de administración.');
+ define('_ERROR_ATLEASTONEBLOGADMIN','Ejecutar esta acción dejaría la bitácora inmantenible. Debe existir siempre al menos un administrador.');
+ define('_ERROR_ALREADYONTEAM',                'No es posible introducir un miembro que ya pertenezca al equipo');
+ define('_ERROR_BADSHORTBLOGNAME',     'El nombre corto de la bitácora sólo debe contener a-z y 0-9, y sin espacios');
+ define('_ERROR_DUPSHORTBLOGNAME',     'Otra bitácora ya tiene ese nombre corto. Los nombres cortos deben ser únicos');
+ define('_ERROR_UPDATEFILE',                   'Sin permiso de escritura para actualizar el archivo. Los permisos deben ser correctos (probar chmod 666). La localización debe ser relativa al directorio de administración, por lo que quizás convendría usar un camino absoluto (como /camino/hasta/nucleus/)');
+ define('_ERROR_DELDEFBLOG',                   'No es posible eliminar la bitácora principal');
+ define('_ERROR_DELETEMEMBER',         'Este miembro no puede ser eliminado, probablemente porque es el autor de entradas o comentarios');
+ define('_ERROR_BADTEMPLATENAME',      'Nombre incorrecto para la plantilla, usar sólo a-z y 0-9, y sin espacios');
+ define('_ERROR_DUPTEMPLATENAME',      'Ya existe otra plantilla con ese nombre');
+ define('_ERROR_BADSKINNAME',          'Nombre incorrecto para la piel (sólo a-z, 0-9 están permitidos, y sin espacios)');
+ define('_ERROR_DUPSKINNAME',          'Ya existe otra piel con ese nombre');
+ define('_ERROR_DEFAULTSKIN',          'Siempre debe existir una piel llamada "default"');
+ define('_ERROR_SKINDEFDELETE',                'No es posible eliminar la piel ya que es la piel predeterminada para la siguiente bitácora: ');
+ define('_ERROR_DISALLOWED',                   'Sin suficiente permiso para ejecutar esa acción');
+ define('_ERROR_DELETEBAN',                    'Error al eliminar la restricción (la restricción no existe)');
+ define('_ERROR_ADDBAN',                               'Error al introducir restricción. La restricción podría no haberse introducido correctamente en las bitácoras.');
+ define('_ERROR_BADACTION',                    'La acción indicada no existe');
+ define('_ERROR_MEMBERMAILDISABLED',   'Los mensajes de miembro a miembro están deshabilitados');
+ define('_ERROR_MEMBERCREATEDISABLED','La creación de cuentas para miembros está deshabilitada');
+ define('_ERROR_INCORRECTEMAIL',               'Dirección de correo incorrecta');
+ define('_ERROR_VOTEDBEFORE',          'El voto del usuario para esta entrada ya existe');
+ define('_ERROR_BANNED1',                      'No es posible ejecutar la acción ya que el (rango IP ');
+ define('_ERROR_BANNED2',                      ') está restringido. El mensaje era: \'');
+ define('_ERROR_BANNED3',                      '\'');
+ define('_ERROR_LOGINNEEDED',          'El usuario debe estar registrado para hacer eso');
+ define('_ERROR_CONNECT',                      'Error de conexión');
+ define('_ERROR_FILE_TOO_BIG',         'El archivo es demasiado grande!');
+ define('_ERROR_BADFILETYPE',          'Tipo de archivo no permitido');
+ define('_ERROR_BADREQUEST',                   'Error en el envío del archivo');
+ define('_ERROR_DISALLOWEDUPLOAD',     'El usuario no pertenece al equipo de ninguna bitácora. No es posible enviar archivos');
+ define('_ERROR_BADPERMISSIONS',               'Los permisos no son correctos');
+ define('_ERROR_UPLOADMOVEP',          'Error al mover el archivo enviado');
+ define('_ERROR_UPLOADCOPY',                   'Error al copiar el archivo enviado');
+ define('_ERROR_UPLOADDUPLICATE',      'Ya existe otro archivo con ese nombre. Intentar renombrarlo antes de enviarlo.');
+ define('_ERROR_LOGINDISALLOWED',      'Sin permiso para entrar en la administración. Es posible registrarse como otro usuario');
+ define('_ERROR_DBCONNECT',                    'No es posible conectar con MySQL server');
+ define('_ERROR_DBSELECT',                     'No es posible seleccionar la base de datos de Nucleus.');
+ define('_ERROR_NOSUCHLOCALE',         'No existe el archivo para el idioma');
+ define('_ERROR_NOSUCHCATEGORY',               'No existe la categoría');
+ define('_ERROR_DELETELASTCATEGORY',   'Debe haber al menos una categoría');
+ define('_ERROR_DELETEDEFCATEGORY',    'No es posible eliminar la categoría principal');
+ define('_ERROR_BADCATEGORYNAME',      'Nombre de categoría incorrecto');
+ define('_ERROR_DUPCATEGORYNAME',      'Ya existe otra categoría con ese nombre');
++>>>>>>> skinnable-master
  
  // some warnings (used for mediadir setting)
 -define('_WARNING_NOTADIR',                    'Cuidado: El valor actual no es un directorio!');
 -define('_WARNING_NOTREADABLE',                'Cuidado: El valor actual es un directorio sin permiso de lectura!');
 -define('_WARNING_NOTWRITABLE',                'Cuidado: El valor actual NO es un directorio con permiso de escritura!');
 +define('_WARNING_NOTADIR',                    'Attenzione: il valore inserito non &egrave; una directory!');
 +define('_WARNING_NOTREADABLE',                'Attenzione: il valore inserito &egrave; una directory non leggibile dal webserver!');
 +define('_WARNING_NOTWRITABLE',                'Attenzione: il valore inserito NON &egrave; una directory scrivibile dal webserver!');
  
  // media and upload
++<<<<<<< HEAD
 +define('_MEDIA_UPLOADLINK',                   'Carica un nuovo file');
 +define('_MEDIA_MODIFIED',                     'modificato');
 +define('_MEDIA_FILENAME',                     'nome file');
 +define('_MEDIA_DIMENSIONS',                   'dimensioni');
 +define('_MEDIA_INLINE',                               'Inline');
 +define('_MEDIA_POPUP',                                'Popup');
 +define('_UPLOAD_TITLE',                               'Seleziona il file');
 +define('_UPLOAD_MSG',                         'Seleziona il file che vuoi caricare e fai clic sul pulsante \'Carica\'.');
 +define('_UPLOAD_BUTTON',                      'Carica');
 +
 +// some status messages
 +//define('_MSG_ACCOUNTCREATED',               '\'account &egrave; stato creato, la password ti verr&agrave; spedita via email');
 +//define('_MSG_PASSWORDSENT',                 'La password &egrave; stata spedita per email.');
 +define('_MSG_LOGINAGAIN',                     'Devi effettuare nuovamente la connessione poch&eacute; le tue impostazioni sono state modificate');
 +define('_MSG_SETTINGSCHANGED',                'Impostazioni Modificate');
 +define('_MSG_ADMINCHANGED',                   'Amministratore Modificato');
 +define('_MSG_NEWBLOG',                                'Il nuovo blog &egrave; stato creato');
 +define('_MSG_ACTIONLOGCLEARED',               'Il log delle azioni &egrave; stato azzerato');
 +
 +// actionlog in admin area
 +define('_ACTIONLOG_DISALLOWED',               'Azione disabilitata: ');
 +define('_ACTIONLOG_PWDREMINDERSENT','Una nuova password &egrave; stata inviata per ');
 +define('_ACTIONLOG_TITLE',                    'Log delle azioni');
 +define('_ACTIONLOG_CLEAR_TITLE',      'Azzera il log delle azioni');
 +define('_ACTIONLOG_CLEAR_TEXT',               'Azzera il log delle azioni ora!');
 +
 +// team management
 +define('_TEAM_TITLE',                         'Gestisci i gruppi dei blog ');
 +define('_TEAM_CURRENT',                               'Gruppo attuale');
 +define('_TEAM_ADDNEW',                                'Aggiungi un nuovo membro al gruppo');
 +define('_TEAM_CHOOSEMEMBER',          'Scegli un membro');
 +define('_TEAM_ADMIN',                         'Privilegi di amministrazione? ');
 +define('_TEAM_ADD',                                   'Aggiungi al gruppo');
 +define('_TEAM_ADD_BTN',                               'Aggiungi al gruppo');
 +
 +// blogsettings
 +define('_EBLOG_TITLE',                                'Modifica le Impostazioni del Blog');
 +define('_EBLOG_TEAM_TITLE',                   'modifica gruppo');
 +define('_EBLOG_TEAM_TEXT',                    'Clicca qui per modificare il tuo gruppo...');
 +define('_EBLOG_SETTINGS_TITLE',               'Impostazioni blog');
 +define('_EBLOG_NAME',                         'Nome blog');
 +define('_EBLOG_SHORTNAME',                    'Nome blog (breve)');
 +define('_EBLOG_SHORTNAME_EXTRA',      '<br />(deve contenere solo caratteri a-z senza spazi)');
 +define('_EBLOG_DESC',                         'Descrizione blog');
 +define('_EBLOG_URL',                          'URL');
 +define('_EBLOG_DEFSKIN',                      'Tema di default');
 +define('_EBLOG_DEFCAT',                               'Categoria di default');
 +define('_EBLOG_LINEBREAKS',                   'Converti gli &quot;a capo&quot;');
 +define('_EBLOG_DISABLECOMMENTS',      'Commenti abilitati?<br /><small>(Non sar&agrave; possibile inserire commenti agli articoli con questa opzione disabilitata.)</small>');
 +define('_EBLOG_ANONYMOUS',                    'Abilitare i non-iscritti a scrivere commenti?');
 +define('_EBLOG_NOTIFY',                               'Indirizzo\i per la notifica (usa ; come separatore)');
 +define('_EBLOG_NOTIFY_ON',                    'Notifica i seguenti eventi');
 +define('_EBLOG_NOTIFY_COMMENT',               'Nuovi commenti');
 +define('_EBLOG_NOTIFY_KARMA',         'Nuovi voti karma');
 +define('_EBLOG_NOTIFY_ITEM',          'Nuovi articoli');
 +define('_EBLOG_PING',                         'Inviare un ping a Weblogs.com dopo un aggiornamento?');
 +define('_EBLOG_MAXCOMMENTS',          'Max numero di commenti');
 +define('_EBLOG_UPDATE',                               'Update file');
 +define('_EBLOG_OFFSET',                               'Compensazione orario');
 +define('_EBLOG_STIME',                                'L\'ora attuale del server &egrave;');
 +define('_EBLOG_BTIME',                                'L\'ora attuale del blog &egrave;');
 +define('_EBLOG_CHANGE',                               'Modifica le impostazioni');
 +define('_EBLOG_CHANGE_BTN',                   'Modifica impostazioni');
 +define('_EBLOG_ADMIN',                                'Amministratore blog');
 +define('_EBLOG_ADMIN_MSG',                    'Ti verranno assegnati privilegi di amministrazione');
 +define('_EBLOG_CREATE_TITLE',         'Crea un nuovo weblog');
 +define('_EBLOG_CREATE_TEXT',          'Per creare un nuovo weblog compila il modulo riportato qui sotto. <br /><br /> <b>Nota:</b> sono presenti solo le opzioni necessarie alla creazione di un nuovo weblog. Se vuoi impostare opzioni aggiuntive, utilizza la pagina delle impostazioni del blog dopo la sua creazioni.');
 +define('_EBLOG_CREATE',                               'Crea il nuovo weblog!');
 +define('_EBLOG_CREATE_BTN',                   'Crea weblog');
 +define('_EBLOG_CAT_TITLE',                    'Categorie');
 +define('_EBLOG_CAT_NAME',                     'Nome categoria');
 +define('_EBLOG_CAT_DESC',                     'Descrizione categoria');
 +define('_EBLOG_CAT_CREATE',                   'Crea una nuova categoria');
 +define('_EBLOG_CAT_UPDATE',                   'Aggiorna la categoria');
 +define('_EBLOG_CAT_UPDATE_BTN',               'Aggiorna categoria');
 +
 +// templates
 +define('_TEMPLATE_TITLE',                     'Modifica i modelli');
 +define('_TEMPLATE_AVAILABLE_TITLE',   'Modelli disponibili');
 +define('_TEMPLATE_NEW_TITLE',         'Nuovo modello');
 +define('_TEMPLATE_NAME',                      'Nome del modello');
 +define('_TEMPLATE_DESC',                      'Descrizione del modello');
 +define('_TEMPLATE_CREATE',                    'Crea un modello');
 +define('_TEMPLATE_CREATE_BTN',                'Crea modello');
 +define('_TEMPLATE_EDIT_TITLE',                'Modifica il modello');
 +define('_TEMPLATE_BACK',                      'Torna alla pagina principale della gestione dei modelli');
 +define('_TEMPLATE_EDIT_MSG',          'Non tutte le parti del modello sono necessarie al suo corretto funzionamento; lascia vuote quelle che non intendi utilizzare.');
 +define('_TEMPLATE_SETTINGS',          'Impostazioni del modello');
 +define('_TEMPLATE_ITEMS',                     'Articoli');
 +define('_TEMPLATE_ITEMHEADER',                'Intestazione articolo');
 +define('_TEMPLATE_ITEMBODY',          'Corpo articolo');
 +define('_TEMPLATE_ITEMFOOTER',                'Fine articolo');
 +define('_TEMPLATE_MORELINK',          'Link alla parte estesa dell\'articolo');
 +define('_TEMPLATE_NEW',                               'Indicazione di un nuovo articolo');
 +define('_TEMPLATE_COMMENTS_ANY',      'Commenti (se presenti)');
 +define('_TEMPLATE_CHEADER',                   'Intestazione commenti');
 +define('_TEMPLATE_CBODY',                     'Corpo commenti');
 +define('_TEMPLATE_CFOOTER',                   'Fine commenti');
 +define('_TEMPLATE_CONE',                      'Un commento');
 +define('_TEMPLATE_CMANY',                     'Due (o pi&ugrave;) commenti');
 +define('_TEMPLATE_CMORE',                     '&quot;Leggi tutti&quot; i commenti');
 +define('_TEMPLATE_CMEXTRA',                   'Voce extra per utenti iscritti');
 +define('_TEMPLATE_COMMENTS_NONE',     'Commenti (se non presenti)');
 +define('_TEMPLATE_CNONE',                     'Nessun commento');
 +define('_TEMPLATE_COMMENTS_TOOMUCH','Commenti (se presenti, ma troppi da mostrarli tutti insieme)');
 +define('_TEMPLATE_CTOOMUCH',          'Molti commenti');
 +define('_TEMPLATE_ARCHIVELIST',               'Liste archivio');
 +define('_TEMPLATE_AHEADER',                   'Intestazione lista archivio');
 +define('_TEMPLATE_AITEM',                     'Elemento lista archivio');
 +define('_TEMPLATE_AFOOTER',                   'Fine lista archivio');
 +define('_TEMPLATE_DATETIME',          'Data ed ora');
 +define('_TEMPLATE_DHEADER',                   'Intestazione data');
 +define('_TEMPLATE_DFOOTER',                   'Fine data');
 +define('_TEMPLATE_DFORMAT',                   'Formato data');
 +define('_TEMPLATE_TFORMAT',                   'Formato ora');
 +define('_TEMPLATE_LOCALE',                    'Locale');
 +define('_TEMPLATE_IMAGE',                     'Imagini popup');
 +define('_TEMPLATE_PCODE',                     'Codice per link popup');
 +define('_TEMPLATE_ICODE',                     'Codice per Immagine in linea');
 +define('_TEMPLATE_MCODE',                     'Codice per Link elemento media');
 +define('_TEMPLATE_SEARCH',                    'Ricerca');
 +define('_TEMPLATE_SHIGHLIGHT',                'Evidenziazione');
 +define('_TEMPLATE_SNOTFOUND',         'Nessun risultato per la ricerca');
 +define('_TEMPLATE_UPDATE',                    'Aggiorna');
 +define('_TEMPLATE_UPDATE_BTN',                'Aggiorna il modello');
 +define('_TEMPLATE_RESET_BTN',         'Azzera dati');
 +define('_TEMPLATE_CATEGORYLIST',      'Liste categorie');
 +define('_TEMPLATE_CATHEADER',         'Testata lista categoria');
 +define('_TEMPLATE_CATITEM',                   'Elemento lista categoria');
 +define('_TEMPLATE_CATFOOTER',         'Fine lista categoria');
 +
 +// skins
 +define('_SKIN_EDIT_TITLE',                    'Modifica il tema');
 +define('_SKIN_AVAILABLE_TITLE',               'Temi disponibili');
 +define('_SKIN_NEW_TITLE',                     'Nuovo tema');
 +define('_SKIN_NAME',                          'Nome');
 +define('_SKIN_DESC',                          'Descrizione');
 +define('_SKIN_TYPE',                          'Content Type');
 +define('_SKIN_CREATE',                                'Cre');
 +define('_SKIN_CREATE_BTN',                    'Crea tema');
 +define('_SKIN_EDITONE_TITLE',         'Modifica il tema');
 +define('_SKIN_BACK',                          'Torna alla pagina principale della gestione dei temi');
 +define('_SKIN_PARTS_TITLE',                   'Parti del tema');
 +define('_SKIN_PARTS_MSG',                     'Non tutte le parti del tema sono necessarie. Lascia vuote quelle che non ti servono. Seleziona la parte da modificare dall\'elenco qui sotto:');
 +define('_SKIN_PART_MAIN',                     'Indice principale');
 +define('_SKIN_PART_ITEM',                     'Pagine articolo');
 +define('_SKIN_PART_ALIST',                    'Lista archivio');
 +define('_SKIN_PART_ARCHIVE',          'Archivio');
 +define('_SKIN_PART_SEARCH',                   'Cerca');
 +define('_SKIN_PART_ERROR',                    'Errori');
 +define('_SKIN_PART_MEMBER',                   'Dettagli utente');
 +define('_SKIN_PART_POPUP',                    'Popup immagine');
 +define('_SKIN_GENSETTINGS_TITLE',     'Impostazioni generali');
 +define('_SKIN_CHANGE',                                'Cambia');
 +define('_SKIN_CHANGE_BTN',                    'Cambia queste impostazioni');
 +define('_SKIN_UPDATE_BTN',                    'Aggiorna il tema');
 +define('_SKIN_RESET_BTN',                     'Reimposta Dati');
 +define('_SKIN_EDITPART_TITLE',                'Modifica tema');
 +define('_SKIN_GOBACK',                                'Torna indietro');
 +define('_SKIN_ALLOWEDVARS',                   'Variabili Disponibili (clicca sul nome della variabile per maggiori informazioni):');
 +
 +// global settings
 +define('_SETTINGS_TITLE',                     'Impostazioni generali');
 +define('_SETTINGS_SUB_GENERAL',               'Impostazioni generali');
 +define('_SETTINGS_DEFBLOG',                   'Blog di default');
 +define('_SETTINGS_ADMINMAIL',         'Email amministratore');
 +define('_SETTINGS_SITENAME',          'Nome sito');
 +define('_SETTINGS_SITEURL',                   'URL del sito (deve terminare con uno slash)');
 +define('_SETTINGS_ADMINURL',          'URL dell\'area di amministrazione (deve terminare con uno slash)');
 +define('_SETTINGS_DIRS',                      'Directory di Nucleus');
 +define('_SETTINGS_MEDIADIR',          'Directory media (upload)');
 +define('_SETTINGS_SEECONFIGPHP',      '(vedi config.php)');
 +define('_SETTINGS_MEDIAURL',          'Url della directory media (deve terminare con uno slash)');
 +define('_SETTINGS_ALLOWUPLOAD',               'Consenti il caricamento dei file?');
 +define('_SETTINGS_ALLOWUPLOADTYPES','Consenti il caricamento dei seguenti tipi di file');
 +define('_SETTINGS_CHANGELOGIN',               'Abilita gli utenti alla modifica della login/password');
 +define('_SETTINGS_COOKIES_TITLE',     'Impostazioni cookie');
 +define('_SETTINGS_COOKIELIFE',                'Durata del cookie');
 +define('_SETTINGS_COOKIESESSION',     'Sessione');
 +define('_SETTINGS_COOKIEMONTH',               'Un mese');
 +define('_SETTINGS_COOKIEPATH',                'Percorso cookie (avanzato)');
 +define('_SETTINGS_COOKIEDOMAIN',      'Dominio cookie (avanzato)');
 +define('_SETTINGS_COOKIESECURE',      'Cookie sicuro (avanzato)');
 +define('_SETTINGS_LASTVISIT',         'Salva il cookie dell\'ultima visita');
 +define('_SETTINGS_ALLOWCREATE',               'Consenti ai visitatori di creare un account utente');
 +define('_SETTINGS_NEWLOGIN',          'Abilita il login all\'area amministrativa per gli account creati dagli utenti');
 +define('_SETTINGS_NEWLOGIN2',         '(questa impostazione verr&agrave; applicata solo ai nuovi account)');
 +define('_SETTINGS_MEMBERMSGS',                'Abilita i servizi tra i membri del blog');
 +define('_SETTINGS_LOCALE',            'Linguaggio di default');
 +define('_SETTINGS_DISABLESITE',               'Disabilita il weblog');
 +define('_SETTINGS_DBLOGIN',                   'Connessione mySQL &amp; database');
 +define('_SETTINGS_UPDATE',                    'Aggiorna le impostazioni');
 +define('_SETTINGS_UPDATE_BTN',                'Aggiorna impostazioni');
 +define('_SETTINGS_DISABLEJS',         'Disabilita la barra degli strumenti in JavaScript');
 +define('_SETTINGS_MEDIA',                     'Impostazioni media/caricamento');
 +define('_SETTINGS_MEDIAPREFIX',               'Aggiungi un prefisso con la data ai file caricati');
 +define('_SETTINGS_MEMBERS',                   'Impostazioni utente');
 +
 +// bans
 +define('_BAN_TITLE',                          'Lista ban per');
 +define('_BAN_NONE',                                   'Nessun ban per questo weblog');
 +define('_BAN_NEW_TITLE',                      'Aggiungi un nuovo ban');
 +define('_BAN_NEW_TEXT',                               'Aggiungi un nuovo ban ora');
 +define('_BAN_REMOVE_TITLE',                   'Rimuovi ban');
 +define('_BAN_IPRANGE',                                'Range IP');
 +define('_BAN_BLOGS',                          'In quali blog?');
 +define('_BAN_DELETE_TITLE',                   'Cancella ban');
 +define('_BAN_ALLBLOGS',                               'Tutti i blog nei quali hai privilegi di amministrazione.');
 +define('_BAN_REMOVED_TITLE',          'Ban rimosso');
 +define('_BAN_REMOVED_TEXT',                   'Il ban &egrave; stato rimosso dai seguenti blog:');
 +define('_BAN_ADD_TITLE',                      'Aggiungi ban');
 +define('_BAN_IPRANGE_TEXT',                   'Scegli il range di IP che vuoi bloccare. Minori sono i numeri inseriti, maggiori saranno gli indirizzi bloccati.');
 +define('_BAN_BLOGS_TEXT',                     'Puoi selezionare di aggiungere un ban in un blog solamente, oppure puoi selezionare di bloccare gli IP sopra indicati in tutti i blog nei quali hai i diritti di amministrazione. Effettua la tua scelta qui sotto.');
 +define('_BAN_REASON_TITLE',                   'Motivo del ban');
 +define('_BAN_REASON_TEXT',                    'Puoi fornire una spiegazione al ban. Questa verr&agrave; visualizzata ai proprietari degli IP che tenteranno di aggiungere un commento o un voto karma negli articoli dei blog sopra selezionati. La lunghezza massima della spiegazione &egrave; di 256 caratteri.');
 +define('_BAN_ADD_BTN',                                'Aggiungi ban');
 +
 +// LOGIN screen
 +define('_LOGIN_MESSAGE',                      'Messaggio');
 +define('_LOGIN_NAME',                         'Nome');
 +define('_LOGIN_PASSWORD',                     'Password');
++=======
+ define('_MEDIA_UPLOADLINK',                   'Enviar un nuevo archivo');
+ define('_MEDIA_MODIFIED',                     'modificado');
+ define('_MEDIA_FILENAME',                     'nombre de archivo');
+ define('_MEDIA_DIMENSIONS',                   'dimensiones');
+ define('_MEDIA_INLINE',                               'Conectado');
+ define('_MEDIA_POPUP',                                'Ventana popup');
+ define('_UPLOAD_TITLE',                               'Seleccionar archivo');
+ define('_UPLOAD_MSG',                         'Seleccionar el archivo a enviar, y pulsar el botón \'Enviar\'.');
+ define('_UPLOAD_BUTTON',                      'Enviar');
+ // some status messages
+ define('_MSG_ACCOUNTCREATED',         'Cuenta creada, la clave será enviada por correo');
+ define('_MSG_PASSWORDSENT',                   'La clave ha sido enviada por correo.');
+ define('_MSG_LOGINAGAIN',                     'Es necesario registrarse de nuevo ya que los datos del usuario han sido modificados');
+ define('_MSG_SETTINGSCHANGED',                'Preferencias modificadas');
+ define('_MSG_ADMINCHANGED',                   'Administrador modificado');
+ define('_MSG_NEWBLOG',                                'Nueva bitácora creada');
+ define('_MSG_ACTIONLOGCLEARED',               'Registro de actividades vaciado');
+ // actionlog in admin area
+ define('_ACTIONLOG_DISALLOWED',               'Acción no permitida: ');
+ define('_ACTIONLOG_PWDREMINDERSENT','Nueva clave enviada a ');
+ define('_ACTIONLOG_TITLE',                    'Registro de actividades');
+ define('_ACTIONLOG_CLEAR_TITLE',      'Limpiar el registro de actividades');
+ define('_ACTIONLOG_CLEAR_TEXT',               'Limpiar el registro de actividades ahora');
+ // team management
+ define('_TEAM_TITLE',                         'Modificar el equipo de la bitácora ');
+ define('_TEAM_CURRENT',                               'Equipo actual');
+ define('_TEAM_ADDNEW',                                'Introducir un nuevo miembro en el equipo');
+ define('_TEAM_CHOOSEMEMBER',          'Seleccionar miembro');
+ define('_TEAM_ADMIN',                         'Privilegios de administración? ');
+ define('_TEAM_ADD',                                   'Introducir en el equipo');
+ define('_TEAM_ADD_BTN',                               'Introducir en el equipo');
+ // blogsettings
+ define('_EBLOG_TITLE',                                'Modificar las preferencias de la bitácora');
+ define('_EBLOG_TEAM_TITLE',                   'Modificar el equipo');
+ define('_EBLOG_TEAM_TEXT',                    'Pulsa aquí para modificar el equipo.');
+ define('_EBLOG_SETTINGS_TITLE',               'Preferencias de la bitácora');
+ define('_EBLOG_NAME',                         'Nombre de la bitácora');
+ define('_EBLOG_SHORTNAME',                    'Nombre corto de la bitácora');
+ define('_EBLOG_SHORTNAME_EXTRA',      '<br />(debe contener sólo letras y sin espacios)');
+ define('_EBLOG_DESC',                         'Descripción de la bitácora');
+ define('_EBLOG_URL',                          'URL');
+ define('_EBLOG_DEFSKIN',                      'Piel por defecto');
+ define('_EBLOG_DEFCAT',                               'Categoría por defecto');
+ define('_EBLOG_LINEBREAKS',                   'Convertir saltos de línea');
+ define('_EBLOG_DISABLECOMMENTS',      'Habilitar comentarios?<br /><small>(Deshabilitar los comentarios implica no poder introducir nuevos.)</small>');
+ define('_EBLOG_ANONYMOUS',                    'Se permite la introducción de comentarios por no miembros?');
+ define('_EBLOG_NOTIFY',                               'Dirección(es) de notificación (usa ; como separador)');
+ define('_EBLOG_NOTIFY_ON',                    'Notificar');
+ define('_EBLOG_NOTIFY_COMMENT',               'Nuevos comentarios');
+ define('_EBLOG_NOTIFY_KARMA',         'Nuevos votos');
+ define('_EBLOG_NOTIFY_ITEM',          'Nuevas entradas');
+ define('_EBLOG_PING',                         'Ping Weblogs.com al actualizar?');
+ define('_EBLOG_MAXCOMMENTS',          'Máxima cantidad de comentarios');
+ define('_EBLOG_UPDATE',                               'Actualizar archivo');
+ define('_EBLOG_OFFSET',                               'Zona horaria');
+ define('_EBLOG_STIME',                                'La hora actual del servidor es');
+ define('_EBLOG_BTIME',                                'La hora actual de la bitácora es');
+ define('_EBLOG_CHANGE',                               'Modificar las preferencias');
+ define('_EBLOG_CHANGE_BTN',                   'Modificar preferencias');
+ define('_EBLOG_ADMIN',                                'Administración de la bitácora');
+ define('_EBLOG_ADMIN_MSG',                    'Se asignarán privilegios de administrador al usuario');
+ define('_EBLOG_CREATE_TITLE',         'Crear nueva bitácora');
+ define('_EBLOG_CREATE_TEXT',          'Rellenar el siguiente formulario para crear una nueva bitácora. <br /><br /> <b>Nota:</b> Sólo las opciones necesarios están listadas. Para opciones extra, entrar en la página de preferencias de la bitácora después de crearla.');
+ define('_EBLOG_CREATE',                               'Crear!');
+ define('_EBLOG_CREATE_BTN',                   'Crear bitácora');
+ define('_EBLOG_CAT_TITLE',                    'Categorías');
+ define('_EBLOG_CAT_NAME',                     'Nombre de la categoría');
+ define('_EBLOG_CAT_DESC',                     'Descripción de la categoría');
+ define('_EBLOG_CAT_CREATE',                   'Crear nueva categoría');
+ define('_EBLOG_CAT_UPDATE',                   'Actualizar categoría');
+ define('_EBLOG_CAT_UPDATE_BTN',               'Actualizar categoría');
+ // templates
+ define('_TEMPLATE_TITLE',                     'Modificar plantillas');
+ define('_TEMPLATE_AVAILABLE_TITLE',   'Plantillas disponibles');
+ define('_TEMPLATE_NEW_TITLE',         'Nueva plantilla');
+ define('_TEMPLATE_NAME',                      'Nombre de plantilla');
+ define('_TEMPLATE_DESC',                      'Descripción de la plantilla');
+ define('_TEMPLATE_CREATE',                    'Crear plantilla');
+ define('_TEMPLATE_CREATE_BTN',                'Crear plantilla');
+ define('_TEMPLATE_EDIT_TITLE',                'Editar plantilla');
+ define('_TEMPLATE_BACK',                      'Volver a la página de la plantilla');
+ define('_TEMPLATE_EDIT_MSG',          'No todas las partes de la plantilla son necesarias, es posible dejar en blanco las innecesarias.');
+ define('_TEMPLATE_SETTINGS',          'Preferencias de las plantillas');
+ define('_TEMPLATE_ITEMS',                     'Entradas');
+ define('_TEMPLATE_ITEMHEADER',                'Cabecera de entrada');
+ define('_TEMPLATE_ITEMBODY',          'Cuerpo de la entrada');
+ define('_TEMPLATE_ITEMFOOTER',                'Pie de la entrada');
+ define('_TEMPLATE_MORELINK',          'Enlazar a extensión de la entrada');
+ define('_TEMPLATE_NEW',                               'Indicación de nueva entrada');
+ define('_TEMPLATE_COMMENTS_ANY',      'Comentarios (si los hay)');
+ define('_TEMPLATE_CHEADER',                   'Cabecera de los comentarios');
+ define('_TEMPLATE_CBODY',                     'Cuerpo de los comentarios');
+ define('_TEMPLATE_CFOOTER',                   'Pie de los comentarios');
+ define('_TEMPLATE_CONE',                      'Un comentario');
+ define('_TEMPLATE_CMANY',                     'Dos (o más) comentarios');
+ define('_TEMPLATE_CMORE',                     'Comentarios Leer más');
+ define('_TEMPLATE_CMEXTRA',                   'Miembro Extra');
+ define('_TEMPLATE_COMMENTS_NONE',     'Comentarios (si no hay)');
+ define('_TEMPLATE_CNONE',                     'Sin comentarios');
+ define('_TEMPLATE_COMMENTS_TOOMUCH','Comentarios (si los hay, pero son demasiados para mostrar directamente)');
+ define('_TEMPLATE_CTOOMUCH',          'Demasiados comentarios');
+ define('_TEMPLATE_ARCHIVELIST',               'Listas de archivos');
+ define('_TEMPLATE_AHEADER',                   'Cabecera de la lista de archivos');
+ define('_TEMPLATE_AITEM',                     'Elemento de la lista de archivos');
+ define('_TEMPLATE_AFOOTER',                   'Pie de la lista de archivos');
+ define('_TEMPLATE_DATETIME',          'Fecha y hora');
+ define('_TEMPLATE_DHEADER',                   'Cabecera de la fecha');
+ define('_TEMPLATE_DFOOTER',                   'Pie de la fecha');
+ define('_TEMPLATE_DFORMAT',                   'Formato de la fecha');
+ define('_TEMPLATE_TFORMAT',                   'Formato de hora');
+ define('_TEMPLATE_LOCALE',                    'Local');
+ define('_TEMPLATE_IMAGE',                     'Ventanas de imagen');
+ define('_TEMPLATE_PCODE',                     'Código de enlace popup');
+ define('_TEMPLATE_ICODE',                     'Código de imagen insertada');
+ define('_TEMPLATE_MCODE',                     'Código de enlace a imagen o multimedia');
+ define('_TEMPLATE_SEARCH',                    'Buscar');
+ define('_TEMPLATE_SHIGHLIGHT',                'Resaltar');
+ define('_TEMPLATE_SNOTFOUND',         'Nada encontrado en la búsqueda');
+ define('_TEMPLATE_UPDATE',                    'Actualizar');
+ define('_TEMPLATE_UPDATE_BTN',                'Actualizar plantilla');
+ define('_TEMPLATE_RESET_BTN',         'Inicializar datos');
+ define('_TEMPLATE_CATEGORYLIST',      'Lista de categorías');
+ define('_TEMPLATE_CATHEADER',         'Cabecera de lista de categorías');
+ define('_TEMPLATE_CATITEM',                   'Elemento de lista de categorías');
+ define('_TEMPLATE_CATFOOTER',         'Pie de lista de categorías');
+ // skins
+ define('_SKIN_EDIT_TITLE',                    'Modificar pieles');
+ define('_SKIN_AVAILABLE_TITLE',               'Pieles disponibles');
+ define('_SKIN_NEW_TITLE',                     'Nueva piel');
+ define('_SKIN_NAME',                          'Nombre');
+ define('_SKIN_DESC',                          'Descripción');
+ define('_SKIN_TYPE',                          'Tipo de contenido');
+ define('_SKIN_CREATE',                                'Crear');
+ define('_SKIN_CREATE_BTN',                    'Crear piel');
+ define('_SKIN_EDITONE_TITLE',         'Modificar piel');
+ define('_SKIN_BACK',                          'Volver a la página de la piel');
+ define('_SKIN_PARTS_TITLE',                   'Partes de la piel');
+ define('_SKIN_PARTS_MSG',                     'No todos los tipos son necesarios para cada piel. Dejar en blanco los innecesarios. Selecciona el tipo de piel a modificar:');
+ define('_SKIN_PART_MAIN',                     'Índice principal');
+ define('_SKIN_PART_ITEM',                     'Páginas del elemento');
+ define('_SKIN_PART_ALIST',                    'Lista de archivo');
+ define('_SKIN_PART_ARCHIVE',          'Archivo');
+ define('_SKIN_PART_SEARCH',                   'Buscar');
+ define('_SKIN_PART_ERROR',                    'Errores');
+ define('_SKIN_PART_MEMBER',                   'Detalles del miembro');
+ define('_SKIN_PART_POPUP',                    'Imágenes de popup');
+ define('_SKIN_GENSETTINGS_TITLE',     'Preferencias generales');
+ define('_SKIN_CHANGE',                                'Modificar');
+ define('_SKIN_CHANGE_BTN',                    'Modificar estas preferencias');
+ define('_SKIN_UPDATE_BTN',                    'Actualizar piel');
+ define('_SKIN_RESET_BTN',                     'Inicializar datos');
+ define('_SKIN_EDITPART_TITLE',                'Modificar piel');
+ define('_SKIN_GOBACK',                                'Volver');
+ define('_SKIN_ALLOWEDVARS',                   'Variables permitidas (hacer clic para mayor información):');
+ // global settings
+ define('_SETTINGS_TITLE',                     'Preferencias generales');
+ define('_SETTINGS_SUB_GENERAL',               'Preferencias generales');
+ define('_SETTINGS_DEFBLOG',                   'Bitácora principal');
+ define('_SETTINGS_ADMINMAIL',         'Administrador de correo');
+ define('_SETTINGS_SITENAME',          'Nombre de la web');
+ define('_SETTINGS_SITEURL',                   'URL de la web ( debe terminar con una barra / )');
+ define('_SETTINGS_ADMINURL',          'URL de la administración ( debe terminar con una barra / )');
+ define('_SETTINGS_DIRS',                      'Directorios de Nucleus');
+ define('_SETTINGS_MEDIADIR',          'Directorios de imagenes y multimedia');
+ define('_SETTINGS_SEECONFIGPHP',      '(ver config.php)');
+ define('_SETTINGS_MEDIAURL',          'URL para imágenes o multimedia ( debe terminar con una barra / )');
+ define('_SETTINGS_ALLOWUPLOAD',               'Permitir el envío de archivos?');
+ define('_SETTINGS_ALLOWUPLOADTYPES','Tipos de archivo permitidos para envío');
+ define('_SETTINGS_CHANGELOGIN',               'Permitir a los miembros modificar sus datos de registro / clave');
+ define('_SETTINGS_COOKIES_TITLE',     'Preferencias de cookies');
+ define('_SETTINGS_COOKIELIFE',                'Tiempo de vida de la cookie de registro');
+ define('_SETTINGS_COOKIESESSION',     'Cookies de sesión');
+ define('_SETTINGS_COOKIEMONTH',               'Tiempo de vida de un mes');
+ define('_SETTINGS_COOKIEPATH',                'Camino de las cookies (avanzado)');
+ define('_SETTINGS_COOKIEDOMAIN',      'Dominio de las cookies (avanzado)');
+ define('_SETTINGS_COOKIESECURE',      'Cookies seguras (avanzado)');
+ define('_SETTINGS_LASTVISIT',         'Guardar las cookies de la última visita');
+ define('_SETTINGS_ALLOWCREATE',               'Permitir a los visitantes crear una cuenta de miembro');
+ define('_SETTINGS_NEWLOGIN',          'Registro permitido para las cuentas creadas por el usuario');
+ define('_SETTINGS_NEWLOGIN2',         '(sólo para cuentas nuevas)');
+ define('_SETTINGS_MEMBERMSGS',                'Permite un servicio de miembro a miembro');
+ define('_SETTINGS_LOCALE',            'Idioma por defecto');
+ define('_SETTINGS_DISABLESITE',               'Deshabilitar web');
+ define('_SETTINGS_DBLOGIN',                   'MySQL Registro y base de datos');
+ define('_SETTINGS_UPDATE',                    'Actualizar preferencias');
+ define('_SETTINGS_UPDATE_BTN',                'Actualizar preferencias');
+ define('_SETTINGS_DISABLEJS',         'Deshabilitar la barra de herramientas de JavaScript');
+ define('_SETTINGS_MEDIA',                     'Preferencias de envío / imágenes / multimedia');
+ define('_SETTINGS_MEDIAPREFIX',               'Prefijar los archivos enviados con la fecha');
+ define('_SETTINGS_MEMBERS',                   'Preferencias de los miembros');
+ // bans
+ define('_BAN_TITLE',                          'Lista de restricciones para');
+ define('_BAN_NONE',                                   'No hay restricciones para esta bitácora');
+ define('_BAN_NEW_TITLE',                      'Introducir nueva restricción');
+ define('_BAN_NEW_TEXT',                               'Introducir una nueva restricción ahora');
+ define('_BAN_REMOVE_TITLE',                   'Eliminar restricción');
+ define('_BAN_IPRANGE',                                'Rango IP');
+ define('_BAN_BLOGS',                          'Qué bitácoras?');
+ define('_BAN_DELETE_TITLE',                   'Eliminar restricción');
+ define('_BAN_ALLBLOGS',                               'Bitácoras para las que el usuario tiene privilegios de administrador.');
+ define('_BAN_REMOVED_TITLE',          'Restricción eliminada');
+ define('_BAN_REMOVED_TEXT',                   'Restricción eliminada para las siguientes bitácoras:');
+ define('_BAN_ADD_TITLE',                      'Introducir restricción');
+ define('_BAN_IPRANGE_TEXT',                   'Seleccionar el rango IP a restringir. A menor cantidad de números, más direcciones restringidas.');
+ define('_BAN_BLOGS_TEXT',                     'Es posible optar por restringir la IP para una sóla bitácora, o restringir la IP en todas las bitácoras en las que el usuario tenga privilegios de administrador.');
+ define('_BAN_REASON_TITLE',                   'Razón');
+ define('_BAN_REASON_TEXT',                    'Es posible incluir una razón para la restricción, que será mostrada cuando el usuario con esa IP intente añadir un comentario o votar. La longitud máxima es de 256 carácteres.');
+ define('_BAN_ADD_BTN',                                'Introducir restricción');
+ // LOGIN screen
+ define('_LOGIN_MESSAGE',                      'Mensaje');
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
 -define('_LOGIN_FORGOT',                               'Has olvidado la clave?');
 +define('_LOGIN_FORGOT',                               'Hai dimenticato la password?');
  
  // membermanagement
++<<<<<<< HEAD
 +define('_MEMBERS_TITLE',                      'Gestione utenti');
 +define('_MEMBERS_CURRENT',                    'Utenti registrati');
 +define('_MEMBERS_NEW',                                'Nuovo utente');
 +define('_MEMBERS_DISPLAY',                    'Nome utente');
 +define('_MEMBERS_DISPLAY_INFO',               '(questo &egrave; il nome che dovrai utilizzare per la connessione)');
 +define('_MEMBERS_REALNAME',                   'Nome reale');
 +define('_MEMBERS_PWD',                                'Password');
 +define('_MEMBERS_REPPWD',                     'Reinserisci la password');
 +define('_MEMBERS_EMAIL',                      'Indirizzo email');
 +define('_MEMBERS_EMAIL_EDIT',         '(modificando l\'indirizzo email verr&agrave; automaticamente spedita una nuova password all\'indirizzo inserito)');
 +define('_MEMBERS_URL',                                'Indirizzo sito web (URL)');
 +define('_MEMBERS_SUPERADMIN',         'Privilegi di amministrazione');
 +define('_MEMBERS_CANLOGIN',                   'Pu&ograve; connettersi all\'area amministrativa del sito');
 +define('_MEMBERS_NOTES',                      'Note');
 +define('_MEMBERS_NEW_BTN',                    'Aggiungi utente');
 +define('_MEMBERS_EDIT',                               'Modifica dati utente');
 +define('_MEMBERS_EDIT_BTN',                   'Invia le modifiche');
 +define('_MEMBERS_BACKTOOVERVIEW',     'Torna alla pagina principale della gestione degli utenti');
 +define('_MEMBERS_LOCALE',                     'Linguaggio');
 +define('_MEMBERS_USESITELANG',                '- usa le impostazioni standard del weblog -');
 +
 +// List of blogs (TT = tooltip)
 +define('_BLOGLIST_TT_VISIT',          'Visita il sito');
 +define('_BLOGLIST_ADD',                               'Aggiungi un articolo');
 +define('_BLOGLIST_TT_ADD',                    'Aggiungi un nuovo articolo in questo weblog');
 +define('_BLOGLIST_EDIT',                      'Modifica/elimina gli articoli');
 +define('_BLOGLIST_TT_EDIT',                   '');
 +define('_BLOGLIST_BMLET',                     'Bookmarklet');
 +define('_BLOGLIST_TT_BMLET',          'Gestisci il tuo blog con un solo click');
 +define('_BLOGLIST_SETTINGS',          'Impostazioni');
 +define('_BLOGLIST_TT_SETTINGS',               'Modifica le impostazioni e gestisci gli utenti');
 +define('_BLOGLIST_BANS',                      'Ban');
 +define('_BLOGLIST_TT_BANS',                   'Visualizza, aggiungi o rimuovi IP da BANnare');
 +define('_BLOGLIST_DELETE',                    'Cancella tutto');
 +define('_BLOGLIST_TT_DELETE',         'Elimina questo weblog');
 +
 +// OVERVIEW screen
 +define('_OVERVIEW_YRBLOGS',                   'I tuoi weblog');
 +define('_OVERVIEW_YRDRAFTS',          'Le tue bozze');
 +define('_OVERVIEW_YRSETTINGS',                'Le tue impostazioni');
 +define('_OVERVIEW_GSETTINGS',         'Impostazioni generali');
 +define('_OVERVIEW_NOBLOGS',                   'Non sei presente nelle liste degli utenti di alcun weblog');
 +define('_OVERVIEW_NODRAFTS',          'Nessuna bozza presente');
 +define('_OVERVIEW_EDITSETTINGS',      'Modifica le tue impostazioni...');
 +define('_OVERVIEW_BROWSEITEMS',               'Gestisci i tuoi articoli...');
 +define('_OVERVIEW_BROWSECOMM',                'Gestisci i tuoi commenti...');
 +define('_OVERVIEW_VIEWLOG',                   'Visualizza i log delle azioni...');
 +define('_OVERVIEW_MEMBERS',                   'Gestisci i membri...');
 +define('_OVERVIEW_NEWLOG',                    'Crea un nuovo weblog...');
 +define('_OVERVIEW_SETTINGS',          'Modifica le impostazioni...');
 +define('_OVERVIEW_TEMPLATES',         'Modifica i modelli...');
 +define('_OVERVIEW_SKINS',                     'Modifica i temi...');
 +define('_OVERVIEW_BACKUP',                    'Salva/ripristina...');
 +
 +// ITEMLIST
 +define('_ITEMLIST_BLOG',                      'Articoli del blog');
 +define('_ITEMLIST_YOUR',                      'I tuoi articolo');
 +
 +// Comments
 +define('_COMMENTS',                                   'Commenti');
 +define('_NOCOMMENTS',                         'Non sono presenti commenti per questo articolo');
 +define('_COMMENTS_YOUR',                      'I tuoi commenti');
 +define('_NOCOMMENTS_YOUR',                    'Non hai scritto alcun commento');
 +
 +// LISTS (general)
 +define('_LISTS_NOMORE',                               'Nessun risultato/Non ci sono altri risultati');
 +define('_LISTS_PREV',                         'Precedente');
 +define('_LISTS_NEXT',                         'Prossimo');
 +define('_LISTS_SEARCH',                               'Cerca');
 +define('_LISTS_CHANGE',                               'Cambia');
 +define('_LISTS_PERPAGE',                      'articoli/pagina');
 +define('_LISTS_ACTIONS',                      'Azioni');
 +define('_LISTS_DELETE',                               'Cancella');
 +define('_LISTS_EDIT',                         'Modifica');
 +define('_LISTS_MOVE',                         'Sposta');
 +define('_LISTS_CLONE',                                'Clona');
 +define('_LISTS_TITLE',                                'Titolo');
 +define('_LISTS_BLOG',                         'Blog');
 +define('_LISTS_NAME',                         'Nome');
 +define('_LISTS_DESC',                         'Descrizione');
 +define('_LISTS_TIME',                         'Ora');
 +define('_LISTS_COMMENTS',                     'Commenti');
++=======
+ define('_MEMBERS_TITLE',                      'Gestión de los miembros');
+ define('_MEMBERS_CURRENT',                    'Miembros actuales');
+ define('_MEMBERS_NEW',                                'Nuevo miembro');
+ define('_MEMBERS_DISPLAY',                    'Nombre mostrado');
+ define('_MEMBERS_DISPLAY_INFO',               '(Este es el nombre usado para registrarse)');
+ define('_MEMBERS_REALNAME',                   'Nombre real');
+ define('_MEMBERS_PWD',                                'Clave');
+ define('_MEMBERS_REPPWD',                     'Repetir la clave');
+ define('_MEMBERS_EMAIL',                      'Dirección de correo');
+ define('_MEMBERS_EMAIL_EDIT',         '(Cuando se cambie la dirección de correo, una nueva clave será enviada automáticamente a esa dirección)');
+ define('_MEMBERS_URL',                                'Dirección de la web (URL)');
+ define('_MEMBERS_SUPERADMIN',         'Privilegios de administrador');
+ define('_MEMBERS_CANLOGIN',                   'El usuario puede entrar en la administración');
+ define('_MEMBERS_NOTES',                      'Notas');
+ define('_MEMBERS_NEW_BTN',                    'Introducir miembro');
+ define('_MEMBERS_EDIT',                               'Modificar miembro');
+ define('_MEMBERS_EDIT_BTN',                   'Modificar las preferencias');
+ define('_MEMBERS_BACKTOOVERVIEW',     'Volver a la página del miembro');
+ define('_MEMBERS_LOCALE',                     'Idioma');
+ define('_MEMBERS_USESITELANG',                '- usar las preferencias de la web -');
+ // List of blogs (TT = tooltip)
+ define('_BLOGLIST_TT_VISIT',          'Visitar web');
+ define('_BLOGLIST_ADD',                               'Introducir entrada');
+ define('_BLOGLIST_TT_ADD',                    'Introducir una nueva entrada en esta bitácora');
+ define('_BLOGLIST_EDIT',                      'Modificar/Eliminar entradas');
+ define('_BLOGLIST_TT_EDIT',                   '');
+ define('_BLOGLIST_BMLET',                     'Bookmarklet');
+ define('_BLOGLIST_TT_BMLET',          '');
+ define('_BLOGLIST_SETTINGS',          'Preferencias');
+ define('_BLOGLIST_TT_SETTINGS',               'Modificar preferencias o gestionar equipo');
+ define('_BLOGLIST_BANS',                      'Restricciones');
+ define('_BLOGLIST_TT_BANS',                   'Ver, introducir o eliminar IPs restringidas');
+ define('_BLOGLIST_DELETE',                    'Eliminar todo');
+ define('_BLOGLIST_TT_DELETE',         'Eliminar esta bitácora');
+ // OVERVIEW screen
+ define('_OVERVIEW_YRBLOGS',                   'Tus bitácoras');
+ define('_OVERVIEW_YRDRAFTS',          'Tus borradores');
+ define('_OVERVIEW_YRSETTINGS',                'Preferencias personales');
+ define('_OVERVIEW_GSETTINGS',         'Preferencias generales');
+ define('_OVERVIEW_NOBLOGS',                   'El usuario no está en ningún equipo de bitácora');
+ define('_OVERVIEW_NODRAFTS',          'No hay borradores');
+ define('_OVERVIEW_EDITSETTINGS',      'Modificar preferencias personales...');
+ define('_OVERVIEW_BROWSEITEMS',               'Examinar entradas...');
+ define('_OVERVIEW_BROWSECOMM',                'Examinar comentarios...');
+ define('_OVERVIEW_VIEWLOG',                   'Ver el registro de actividades...');
+ define('_OVERVIEW_MEMBERS',                   'Gestionar los miembros...');
+ define('_OVERVIEW_NEWLOG',                    'Crear nueva bitácora...');
+ define('_OVERVIEW_SETTINGS',          'Modificar preferencias...');
+ define('_OVERVIEW_TEMPLATES',         'Modificar plantillas...');
+ define('_OVERVIEW_SKINS',                     'Modificar pieles...');
+ define('_OVERVIEW_BACKUP',                    'Copia de seguridad / Restauración...');
+ // ITEMLIST
+ define('_ITEMLIST_BLOG',                      'Entradas para la bitácora'); 
+ define('_ITEMLIST_YOUR',                      'Entradas');
+ // Comments
+ define('_COMMENTS',                                   'Comentarios');
+ define('_NOCOMMENTS',                         'Entrada sin comentarios');
+ define('_COMMENTS_YOUR',                      'Comentarios');
+ define('_NOCOMMENTS_YOUR',                    'No se ha escrito ningún comentario');
+ // LISTS (general)
+ define('_LISTS_NOMORE',                               'No hay resultados (adicionales)');
+ define('_LISTS_PREV',                         'Anterior');
+ define('_LISTS_NEXT',                         'Siguiente');
+ define('_LISTS_SEARCH',                               'Buscar');
+ define('_LISTS_CHANGE',                               'Modificar');
+ define('_LISTS_PERPAGE',                      'Entradas por página');
+ define('_LISTS_ACTIONS',                      'Acciones');
+ define('_LISTS_DELETE',                               'Eliminar');
+ define('_LISTS_EDIT',                         'Modificar');
+ define('_LISTS_MOVE',                         'Mover');
+ define('_LISTS_CLONE',                                'Clonar');
+ define('_LISTS_TITLE',                                'Título');
+ define('_LISTS_BLOG',                         'Bitácora');
+ define('_LISTS_NAME',                         'Nombre');
+ define('_LISTS_DESC',                         'Descripción');
+ define('_LISTS_TIME',                         'Tiempo');
+ define('_LISTS_COMMENTS',                     'Comentarios');
++>>>>>>> skinnable-master
  define('_LISTS_TYPE',                         'Tipo');
  
  
 -// member list 
 -define('_LIST_MEMBER_NAME',                   'Nombre mostrado');
 -define('_LIST_MEMBER_RNAME',          'Nombre real');
 -define('_LIST_MEMBER_ADMIN',          'Superadministrador? ');
 -define('_LIST_MEMBER_LOGIN',          'Puede registrarse? ');
 -define('_LIST_MEMBER_URL',                    'Web');
 +// member list
 +define('_LIST_MEMBER_NAME',                   'Nome Utente');
 +define('_LIST_MEMBER_RNAME',          'Nome Reale');
 +define('_LIST_MEMBER_ADMIN',          'Super-admin? ');
 +define('_LIST_MEMBER_LOGIN',          'Pu&ograve; connettersi? ');
 +define('_LIST_MEMBER_URL',                    'Sito Web');
  
  // banlist
++<<<<<<< HEAD
 +define('_LIST_BAN_IPRANGE',                   'Range IP');
 +define('_LIST_BAN_REASON',                    'Motivo');
++=======
+ define('_LIST_BAN_IPRANGE',                   'Rango IP');
+ define('_LIST_BAN_REASON',                    'Razón');
++>>>>>>> skinnable-master
  
  // actionlist
 -define('_LIST_ACTION_MSG',                    'Mensaje');
 +define('_LIST_ACTION_MSG',                    'Messaggio');
  
  // commentlist
++<<<<<<< HEAD
 +define('_LIST_COMMENT_BANIP',         'Ban IP');
 +define('_LIST_COMMENT_WHO',                   'Autore');
 +define('_LIST_COMMENT',                               'Commento');
 +define('_LIST_COMMENT_HOST',          'Host');
 +
 +// itemlist
 +define('_LIST_ITEM_INFO',                     'Informazioni');
 +define('_LIST_ITEM_CONTENT',          'Titolo e testo');
++=======
+ define('_LIST_COMMENT_BANIP',         'Restricción de IP');
+ define('_LIST_COMMENT_WHO',                   'Autor');
+ define('_LIST_COMMENT',                               'Comentario');
+ define('_LIST_COMMENT_HOST',          'Host');
+ // itemlist
+ define('_LIST_ITEM_INFO',                     'Info');
+ define('_LIST_ITEM_CONTENT',          'Título y texto');
++>>>>>>> skinnable-master
  
  
  // teamlist
 -define('_LIST_TEAM_ADMIN',                    'Administrador ');
 -define('_LIST_TEAM_CHADMIN',          'Modificar administrador');
 +define('_LIST_TEAM_ADMIN',                    'Amministratore ');
 +define('_LIST_TEAM_CHADMIN',          'Modifica amministratore');
  
  // edit comments
++<<<<<<< HEAD
 +define('_EDITC_TITLE',                                'Modifica commenti');
 +define('_EDITC_WHO',                          'Autore');
 +define('_EDITC_HOST',                         'Da dove?');
 +define('_EDITC_WHEN',                         'Quando?');
 +define('_EDITC_TEXT',                         'Testo');
 +define('_EDITC_EDIT',                         'Modifica commento');
 +define('_EDITC_MEMBER',                               'utente');
 +define('_EDITC_NONMEMBER',                    'utente non registrato');
 +
 +// move item
 +define('_MOVE_TITLE',                         'Sposta in quale blog?');
 +define('_MOVE_BTN',                                   'Sposta articolo');
++=======
+ define('_EDITC_TITLE',                                'Modificar comentarios');
+ define('_EDITC_WHO',                          'Autor');
+ define('_EDITC_HOST',                         'Desde dónde?');
+ define('_EDITC_WHEN',                         'Cuándo?');
+ define('_EDITC_TEXT',                         'Texto');
+ define('_EDITC_EDIT',                         'Modificar comentario');
+ define('_EDITC_MEMBER',                               'miembro');
+ define('_EDITC_NONMEMBER',                    'no miembro');
+ // move item
+ define('_MOVE_TITLE',                         'Mover a qué bitácora?');
+ define('_MOVE_BTN',                                   'Mover entrada');
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: es_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: es_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: fa_Arab_IR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: fa_Arab_IR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
   /********************************************
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: fi_Latn_FI.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: fi_Latn_FI.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -354,10 -430,6 +434,13 @@@ define('_ARCHIVETYPE_MONTH',             'kuukausi
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Vanhentunut tai virheellinen tunniste.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Laajennuksen asennus ei onnistunut, syynä ');
 +define('_ERROR_DELREQPLUGIN',         'Laajennuksen poistaminen ei onnistunut, syynä ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Evästeen tunniste');
  
@@@ -454,7 -526,7 +537,11 @@@ define('_WARNING_EXTAUTH',                        'Varoitus
  define('_MEMBERS_BYPASS',                     'Käytä ulkoista varmennusta');
  
  // 'always include in search' blog setting (yes/no) [in v2.5beta, the 'always' part wasn't clear]
++<<<<<<< HEAD
 +define('_EBLOG_SEARCH',                               'Sisällytä <em>aina</em> hakuun');
++=======
+ define('_EBLOG_SEARCH',                               'Sisällytä hakuun');
++>>>>>>> skinnable-master
  
  // END changed/added after v2.5beta
  
@@@ -476,9 -548,6 +563,12 @@@ define('_MEDIA_COLLECTION_LABEL', 'Vali
  define('_ADD_ALIGNLEFT_TT',                   'Tasaa vasemmalle');
  define('_ADD_ALIGNRIGHT_TT',          'Tasaa oikealle');
  define('_ADD_ALIGNCENTER_TT',         'Keskitä');
++<<<<<<< HEAD
 +
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Sisällytä hakuun');
++=======
++>>>>>>> skinnable-master
  
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Lähetys epäonnistui');
@@@ -768,7 -837,6 +858,10 @@@ define('_COMMENTFORM_YOUARE',             'Olet')
  define('_COMMENTFORM_SUBMIT',         'Lisää kommentti');
  define('_COMMENTFORM_COMMENT',                'Kommenttisi');
  define('_COMMENTFORM_NAME',                   'Nimi');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'Sähköpostiosoite tai WWW-osoite');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Muista minut');
  
  // loginform
@@@ -795,7 -863,6 +888,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Komme
  define('_ADD_DRAFTNFUTURE',                   'Vedos &amp; tulevat artikkelit');
  define('_ADD_ADDITEM',                                'Lisää artikkeli');
  define('_ADD_ADDNOW',                         'Lisää nyt');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Lisää myöhemmin');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Place on');
  define('_ADD_ADDDRAFT',                               'Lisää vedoksiin');
  define('_ADD_NOPASTDATES',                    '(Menneet päiväykset ja kellonajat EIVÄT kelpaa, käytä meneillään olevaa aikaa.)');
@@@ -1272,3 -1337,19 +1366,22 @@@ define('_EDITC_NONMEMBER',                    'ei-käyttä
  // move item
  define('_MOVE_TITLE',                         'Siirrä mihin blogiin?');
  define('_MOVE_BTN',                                   'Siirrä artikkeli');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: fi_Latn_FI.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: fi_Latn_FI.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: fr_Latn_FR.ISO-8859-15.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: fr_Latn_FR.ISO-8859-15.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -333,128 -408,125 +412,235 @@@ define('_ERROR_COMMENTS_SPAM',      'Yo
  
  // START changed/added after 3.15 START
  
++<<<<<<< HEAD
 +define('_LIST_PLUG_SUBS_NEEDUPDATE','Paina \'Päivitä laajennuslista\'-nappulaa päivittääksesi listan kaikista laajennuksista.');
 +define('_LIST_PLUGS_DEP',                     'Laajennus vaatii:');
++=======
+ define('_LIST_PLUG_SUBS_NEEDUPDATE',  'Veuillez utiliser le bouton \'Mettre à jour la liste des installations\' pour mettre à jour la liste des modules installés.');
+ define('_LIST_PLUGS_DEP',             'Ce module nécessite:');
++>>>>>>> skinnable-master
  
  // END changed/added after 3.15
  
  // START changed/added after 3.1 START
  
  // comments list per weblog
++<<<<<<< HEAD
 +define('_COMMENTS_BLOG',                      'Kaikki kommentit kohteessa ');
 +define('_NOCOMMENTS_BLOG',                    'Ei kommentteja');
 +define('_BLOGLIST_COMMENTS',          'Kommentit');
 +define('_BLOGLIST_TT_COMMENTS',               'Lista kommenteista');
++=======
+ define('_COMMENTS_BLOG',              'Tous les commentaires du blog');
+ define('_NOCOMMENTS_BLOG',            'Aucun commentaire n\'a été fait sur les billets de ce blog');
+ define('_BLOGLIST_COMMENTS',          'Commentaires');
+ define('_BLOGLIST_TT_COMMENTS',               'Liste de tous les commentaires apportés aux billets de blog');
++>>>>>>> skinnable-master
  
  
  // for use in archivetype-skinvar
 -define('_ARCHIVETYPE_DAY',            'jour');
 -define('_ARCHIVETYPE_MONTH',          'mois');
 +define('_ARCHIVETYPE_DAY',                    'päivä');
 +define('_ARCHIVETYPE_MONTH',          'kuukausi');
  
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
++<<<<<<< HEAD
 +define('_ERROR_BADTICKET',                    'Vanhentunut tai virheellinen tunniste.');
 +
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Laajennuksen asennus ei onnistunut, syynä ');
 +define('_ERROR_DELREQPLUGIN',         'Laajennuksen poistaminen ei onnistunut, syynä ');
 +
 +// cookie prefix
 +define('_SETTINGS_COOKIEPREFIX',      'Evästeen tunniste');
 +
 +// account activation
 +define('_ERROR_NOLOGON_NOACTIVATE',   'Aktivointiin tarvittavaa linkkiä ei voida lähettää. Sisäänkirjautumista ei ole sallittu.');
 +define('_ERROR_ACTIVATE',                     'Aktivointiin tarvittavaa avainta ei ole olemassa, se ei ole voimassa tai se on mennyt vanhaksi.');
 +define('_ACTIONLOG_ACTIVATIONLINK', 'Aktivointilinkki on lähetetty');
 +define('_MSG_ACTIVATION_SENT',                'Aktivointilinkki on lähetetty sähköpostitse.');
 +
 +// activation link emails
 +define('_ACTIVATE_REGISTER_MAIL',     "Terve <%memberName%>,\n\nSinun tulee aktivoida käyttäjätilisi sivustolla <%siteName%> (<%siteUrl%>).\nVoit tehdä tämän valitsemalla oheisen linkin: \n\n\t<%activationUrl%>\n\nSinulla on kaksi päivää aikaa tehdä näin. Tämän jälkeen aktivointilinkki menee vanhaksi.");
 +define('_ACTIVATE_REGISTER_MAILTITLE',        "Aktivoi tilisi nimelle '<%memberName%>'");
 +define('_ACTIVATE_REGISTER_TITLE',    'Tervetuloa <%memberName%>');
 +define('_ACTIVATE_REGISTER_TEXT',     'Olet melkein valmis. Valitse salasana tilille.');
 +define('_ACTIVATE_FORGOT_MAIL',               "Terve <%memberName%>,\n\nOheisella linkillä voit vaihtaa uuden salasanan tilillesi sivustolle <%siteName%> (<%siteUrl%>), valitsemalla uusi salasana.\n\n\t<%activationUrl%>\n\nSinulla on kaksi päivää aikaa käyttää linkkiä, tämän jälkeen linkki vanhenee.");
 +define('_ACTIVATE_FORGOT_MAILTITLE',"Aktivoi '<%memberName%>' tilisi uudestaan");
 +define('_ACTIVATE_FORGOT_TITLE',      'Tervetuloa <%memberName%>');
 +define('_ACTIVATE_FORGOT_TEXT',               'Valitse uusi salasana tilillesi:');
 +define('_ACTIVATE_CHANGE_MAIL',               "Terve <%memberName%>,\n\nKoska sähköpostiosoitteesi on vaihtunut, sinun tulee aktivoida tilisi uudelleen sivustolle <%siteName%> (<%siteUrl%>).\nVoit tehdä tämän oheisella linkillä: \n\n\t<%activationUrl%>\n\nSinulla on kaksi päivää aikaa tehdä näin, tämän jälkeen linkki menee vanhaksi.");
 +define('_ACTIVATE_CHANGE_MAILTITLE',"Aktivoi tilisi '<%memberName%>' uudestaan");
 +define('_ACTIVATE_CHANGE_TITLE',      'Tervetuloa <%memberName%>');
 +define('_ACTIVATE_CHANGE_TEXT',               'Osoitteesi on tarkistettu. Kiitokset!');
 +define('_ACTIVATE_SUCCESS_TITLE',     'Onnistunut aktivointi');
 +define('_ACTIVATE_SUCCESS_TEXT',      'Tilisi on aktivoitu onnistuneesti.');
 +define('_MEMBERS_SETPWD',                     'Aseta salasana');
 +define('_MEMBERS_SETPWD_BTN',         'Aseta salasana');
 +define('_QMENU_ACTIVATE',                     'Tilin aktivointi');
 +define('_QMENU_ACTIVATE_TEXT',                '<p>Kun olet aktivoinut tilisi, voit alkaa käyttää sitä <a href="index.php?action=showlogin">kirjautumalla sisään</a>.</p>');
 +
 +define('_PLUGS_BTN_UPDATE',                   'Päivitä laajennuslista');
 +
 +// global settings 
 +define('_SETTINGS_JSTOOLBAR',         'Javascript valikon tyyli');
 +define('_SETTINGS_JSTOOLBAR_FULL',    'Täydellinen valikko (IE)');
 +define('_SETTINGS_JSTOOLBAR_SIMPLE','Yksinkertainen valikko (Non-IE)');
 +define('_SETTINGS_JSTOOLBAR_NONE',    'Poista valikko käytöstä');
 +define('_SETTINGS_URLMODE_HELP',      '(Lisätietoja: <a href="documentation/tips.html#searchengines-fancyurls">How to activate fancy URLs</a>)');
 +
 +// extra plugin settings part when editing categories/members/blogs/...
 +define('_PLUGINS_EXTRA',                      'Laajennuksen lisäasetukset');
 +
 +// itemlist info column keys
 +define('_LIST_ITEM_BLOG',                     'blog:');
 +define('_LIST_ITEM_CAT',                      'cat:');
 +define('_LIST_ITEM_AUTHOR',                   'author:');
 +define('_LIST_ITEM_DATE',                     'date:');
 +define('_LIST_ITEM_TIME',                     'time:');
++=======
+ define('_ERROR_BADTICKET',            'Ticket invalide ou expiré.');
+ // cookie prefix
+ define('_SETTINGS_COOKIEPREFIX',      'Préfixe du cookie');
+ // account activation
+ define('_ERROR_NOLOGON_NOACTIVATE',   'Impossible d\'envoyer le lien d\'activation. Vous n\'êtes pas autorisé à vous authentifier.');
+ define('_ERROR_ACTIVATE',             'La clef d\'activation key n\'existe pas, est invalide, ou a expiré.');
+ define('_ACTIONLOG_ACTIVATIONLINK',   'Lien d\'activation envoyé');
+ define('_MSG_ACTIVATION_SENT',                'Lien d\'activation a été envoyé par mail.');
+ // activation link emails
+ define('_ACTIVATE_REGISTER_MAIL',     "Bonjour <%memberName%>,\n\nvous devez activer votre compte sur <%siteName%> (<%siteUrl%>).\nVous pouvez le faire en suivant le lien ci-dessous :\n\n\t<%activationUrl%>\n\nPassés 2 jours le lien d\'activation sera invalide.");
+ define('_ACTIVATE_REGISTER_MAILTITLE',        "Activez votre compte '<%memberName%>'");
+ define('_ACTIVATE_REGISTER_TITLE',    'Bienvenue <%memberName%>');
+ define('_ACTIVATE_REGISTER_TEXT',     'Une dernière étape : choisissez un mot de passe pour votre compte.');
+ define('_ACTIVATE_FORGOT_MAIL',               "Bonjour <%memberName%>,\n\nEn suivant le lien ci-dessous, vous pouvez choisir un nouveau mot de passe pour votre compte sur <%siteName%> (<%siteUrl%>).\n\n\t<%activationUrl%>\n\nPassés 2 jours le lien d\'activation sera invalide.");
+ define('_ACTIVATE_FORGOT_MAILTITLE',  "Procédez à la réactivation de votre compte '<%memberName%>'");
+ define('_ACTIVATE_FORGOT_TITLE',      'Bienvenue <%memberName%>');
+ define('_ACTIVATE_FORGOT_TEXT',               'Vous pouvez choisir un nouveau mot de passe pour votre compte ci-dessous :');
+ define('_ACTIVATE_CHANGE_MAIL',               "Bonjour <%memberName%>,\n\nMaintenant que votre adresse email a été changée, vous devez réactivation de votre compte sur <%siteName%> (<%siteUrl%>).\nVous pouvez le faire en suivant le lien ci-dessous :\n\n\t<%activationUrl%>\n\nPassés 2 jours le lien d\'activation sera invalide.");
+ define('_ACTIVATE_CHANGE_MAILTITLE',  "Procédez à la réactivation de votre compte '<%memberName%>'");
+ define('_ACTIVATE_CHANGE_TITLE',      'Bienvenue <%memberName%>');
+ define('_ACTIVATE_CHANGE_TEXT',               'Votre changement d\'adresse email a été validé. Merci !');
+ define('_ACTIVATE_SUCCESS_TITLE',     'Activation réussie');
+ define('_ACTIVATE_SUCCESS_TEXT',      'Votre compte a été réactivé.');
+ define('_MEMBERS_SETPWD',             'Choisissez un mot de passe');
+ define('_MEMBERS_SETPWD_BTN',         'Choisissez un mot de passe');
+ define('_QMENU_ACTIVATE',             'Activation de compte');
+ define('_QMENU_ACTIVATE_TEXT',                '<p>Dès l\'activation de votre compte, vous pouvez commencer à l\'utiliser en <a href="index.php?action=showlogin">vous authentifiant</a>.</p>');
+ define('_PLUGS_BTN_UPDATE',           'Mettre à jour la liste des installations');
+ // global settings
+ define('_SETTINGS_JSTOOLBAR',         'Type de barre d\'édition');
+ define('_SETTINGS_JSTOOLBAR_FULL',    'Barre d\'édition complète (IE)');
+ define('_SETTINGS_JSTOOLBAR_SIMPLE',  'Barre d\'édition simplifiée (Non-IE)');
+ define('_SETTINGS_JSTOOLBAR_NONE',    'Désactiver la barre d\'édition');
+ define('_SETTINGS_URLMODE_HELP',      '(Info: <a href="documentation/tips.html#searchengines-fancyurls">activer l\'utilisation des URLs pour la recherche</a>)');
+ // extra plugin settings part when editing categories/members/blogs/...
+ define('_PLUGINS_EXTRA',              'Autres paramètres du module');
+ // itemlist info column keys
+ define('_LIST_ITEM_BLOG',             'blog:');
+ define('_LIST_ITEM_CAT',              'thème:');
+ define('_LIST_ITEM_AUTHOR',           'auteur:');
+ define('_LIST_ITEM_DATE',             'date:');
+ define('_LIST_ITEM_TIME',             'heure:');
++>>>>>>> skinnable-master
  
  // indication of registered members in comments list
 -define('_LIST_COMMENTS_MEMBER',       '(participant)');
 +define('_LIST_COMMENTS_MEMBER',       '(jäsen)');
  
  // batch operations
++<<<<<<< HEAD
 +define('_BATCH_WITH_SEL',                     'Valituille:');
 +define('_BATCH_EXEC',                         'Suorita');
 +
 +// quickmenu
 +define('_QMENU_HOME',                         'Pääsivu');
 +define('_QMENU_ADD',                          'Lisää artikkeli');
 +define('_QMENU_ADD_SELECT',                   '-- valitse --');
 +define('_QMENU_USER_SETTINGS',                'Tiedot');
 +define('_QMENU_USER_ITEMS',                   'Artikkelit');
 +define('_QMENU_USER_COMMENTS',                'Kommentit');
 +define('_QMENU_MANAGE',                               'Hallinta');
 +define('_QMENU_MANAGE_LOG',                   'Toimintaloki');
 +define('_QMENU_MANAGE_SETTINGS',              'Asetukset');
 +define('_QMENU_MANAGE_MEMBERS',               'Käyttäjät');
 +define('_QMENU_MANAGE_NEWBLOG',               'Uusi blogi');
 +define('_QMENU_MANAGE_BACKUPS',               'Varmuuskopiot');
 +define('_QMENU_MANAGE_PLUGINS',               'Laajennukset');
 +define('_QMENU_LAYOUT',                               'Ulkoasu');
 +define('_QMENU_LAYOUT_SKINS',         'Sivurungot');
 +define('_QMENU_LAYOUT_TEMPL',         'Asettelut');
 +define('_QMENU_LAYOUT_IEXPORT',               'Tuo/Vie');
 +define('_QMENU_PLUGINS',                      'Laajennukset');
 +
 +// quickmenu on logon screen
 +define('_QMENU_INTRO',                                'Esittely');
 +define('_QMENU_INTRO_TEXT',                   '<p>Tämä on kirjautumisruutu Nucleus-sisällönhallintajärjestelmän ylläpitoalueelle.</p><p>Jos sinulla on tili sivustolle, voit kirjautua sisään ja lisätä uusia artikkeleita tai muuttaa asetuksia.</p>');
 +
 +// helppages for plugins
 +define('_ERROR_PLUGNOHELPFILE',               'Avustustiedostoa laajennukselle ei löytynyt');
 +define('_PLUGS_HELP_TITLE',                   'Laajennuksen avustussivu');
 +define('_LIST_PLUGS_HELP',                    'apua');
++=======
+ define('_BATCH_WITH_SEL',             'Ayant pour sélection:');
+ define('_BATCH_EXEC',                 'Executer');
+ // quickmenu
+ define('_QMENU_HOME',                 'Accueil');
+ define('_QMENU_ADD',                  'Ajouter un billet');
+ define('_QMENU_ADD_SELECT',           '-- sélectionnez --');
+ define('_QMENU_USER_SETTINGS',                'Préférences');
+ define('_QMENU_USER_ITEMS',           'Billets');
+ define('_QMENU_USER_COMMENTS',                'Commentaires');
+ define('_QMENU_MANAGE',                       'Paramètres');
+ define('_QMENU_MANAGE_LOG',           'Log');
+ define('_QMENU_MANAGE_SETTINGS',      'Configuration');
+ define('_QMENU_MANAGE_MEMBERS',               'Participants');
+ define('_QMENU_MANAGE_NEWBLOG',               'Nouveau blog');
+ define('_QMENU_MANAGE_BACKUPS',               'Sauvegardes');
+ define('_QMENU_MANAGE_PLUGINS',               'Modules');
+ define('_QMENU_LAYOUT',                       'Mise en page');
+ define('_QMENU_LAYOUT_SKINS',         'Habillages');
+ define('_QMENU_LAYOUT_TEMPL',         'Modèles');
+ define('_QMENU_LAYOUT_IEXPORT',               'Importer/Exporter');
+ define('_QMENU_PLUGINS',              'Modules');
+ // quickmenu on logon screen
+ define('_QMENU_INTRO',                        'Introduction');
+ define('_QMENU_INTRO_TEXT',           '<p>Ceci est la page d\'authentification de Nucleus CMS, le système permettant la mise à jour du contenu de ce site.</p><p>Pour mettre en ligne de nouveaux billets, authentifiez-vous.</p>');
+ // helppages for plugins
+ define('_ERROR_PLUGNOHELPFILE',               'Impossible de trouver le fichier d\'aide correspondant à ce module');
+ define('_PLUGS_HELP_TITLE',           'Page d\'aide pour le module');
+ define('_LIST_PLUGS_HELP',            'aide');
++>>>>>>> skinnable-master
  
  // END changed/started after 3.1
  
  // START changed/added after v2.5beta START
  
  // general settings (security)
++<<<<<<< HEAD
 +define('_SETTINGS_EXTAUTH',                   'Salli ulkoinen varmennus');
 +define('_WARNING_EXTAUTH',                    'Varoitus: salli vain jos tarvitset tätä.');
 +
 +// member profile
 +define('_MEMBERS_BYPASS',                     'Käytä ulkoista varmennusta');
++=======
+ define('_SETTINGS_EXTAUTH',           'Activer le système d\'authentification externe');
+ define('_WARNING_EXTAUTH',            'Attention: à n\'activer que si nécessaire.');
+ // member profile
+ define('_MEMBERS_BYPASS',             'Utiliser le système d\'authentification externe');
++>>>>>>> skinnable-master
  
  // 'always include in search' blog setting (yes/no) [in v2.5beta, the 'always' part wasn't clear]
 -define('_EBLOG_SEARCH',                       '<em>Toujours</em> inclure dans la recherche');
 +define('_EBLOG_SEARCH',                               'Sisällytä <em>aina</em> hakuun');
  
  // END changed/added after v2.5beta
  
  // START introduced after v2.0 START
  
  // media library
++<<<<<<< HEAD
 +define('_MEDIA_VIEW',                         'Tarkastele');
 +define('_MEDIA_VIEW_TT',                      'Tarkastele tiedostoa (avautuu uuteen ikkunaan)');
 +define('_MEDIA_FILTER_APPLY',         'Ota suodatin käyttöön');
 +define('_MEDIA_FILTER_LABEL',         'Suodatin: ');
 +define('_MEDIA_UPLOAD_TO',                    'Lähetä...');
 +define('_MEDIA_UPLOAD_NEW',                   'Lähetä uusi tiedosto...');
 +define('_MEDIA_COLLECTION_SELECT',    'Valitse');
 +define('_MEDIA_COLLECTION_TT',                'Vaihda tähän kategoriaan');
 +define('_MEDIA_COLLECTION_LABEL',     'Valittu kokoelma: ');
 +
 +// tooltips on toolbar
 +define('_ADD_ALIGNLEFT_TT',                   'Tasaa vasemmalle');
 +define('_ADD_ALIGNRIGHT_TT',          'Tasaa oikealle');
 +define('_ADD_ALIGNCENTER_TT',         'Keskitä');
++=======
+ define('_MEDIA_VIEW',                 'afficher');
+ define('_MEDIA_VIEW_TT',              'Afficher la page (ouvrir une nouvelle fenêtre)');
+ define('_MEDIA_FILTER_APPLY',         'Appliquer le filtre');
+ define('_MEDIA_FILTER_LABEL',         'Filtre: ');
+ define('_MEDIA_UPLOAD_TO',            'Télécharger dans...');
+ define('_MEDIA_UPLOAD_NEW',           'Télécharger un nouveau fichier...');
+ define('_MEDIA_COLLECTION_SELECT',    'Sélectionner');
+ define('_MEDIA_COLLECTION_TT',                'Changer de bibliothèque');
+ define('_MEDIA_COLLECTION_LABEL',     'Bibliothèque actuelle: ');
+ // tooltips on toolbar
+ define('_ADD_ALIGNLEFT_TT',           'Aligner à gauche');
+ define('_ADD_ALIGNRIGHT_TT',          'Aligner à droite');
+ define('_ADD_ALIGNCENTER_TT',         'Centrer');
++>>>>>>> skinnable-master
  
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Sisällytä hakuun');
  
  // generic upload failure
++<<<<<<< HEAD
 +define('_ERROR_UPLOADFAILED',         'Lähetys epäonnistui');
++=======
+ define('_ERROR_UPLOADFAILED',         'Echec du téléchargement');
++>>>>>>> skinnable-master
  
  // END introduced after v2.0 END
  
  // START introduced after v1.5 START
  
  // posting to the past/edit timestamps
++<<<<<<< HEAD
 +define('_EBLOG_ALLOWPASTPOSTING',     'Salli menneille päiville postitus');
 +define('_ADD_CHANGEDATE',                     'Päivitä aikaleima');
 +define('_BMLET_CHANGEDATE',                   'Päivitä aikaleima');
++=======
+ define('_EBLOG_ALLOWPASTPOSTING',     'Permettre d\'antidater');
+ define('_ADD_CHANGEDATE',             'Mise à  jour  de la date');
+ define('_BMLET_CHANGEDATE',           'Mise à  jour de la date');
++>>>>>>> skinnable-master
  
  // skin import/export
 -define('_OVERVIEW_SKINIMPORT',                'Habillage import/export...');
 +define('_OVERVIEW_SKINIMPORT',                'Tuominen / vieminen...');
  
  // skin settings
++<<<<<<< HEAD
 +define('_PARSER_INCMODE_NORMAL',      'Normaali');
 +define('_PARSER_INCMODE_SKINDIR',     'Käytä sivurunkohakemistoa');
 +define('_SKIN_INCLUDE_MODE',          'Moodi');
 +define('_SKIN_INCLUDE_PREFIX',                'Etuliite');
++=======
+ define('_PARSER_INCMODE_NORMAL',      'Normal');
+ define('_PARSER_INCMODE_SKINDIR',     'Utiliser un dossier d\'habillage');
+ define('_SKIN_INCLUDE_MODE',          'Type d\'inclusion');
+ define('_SKIN_INCLUDE_PREFIX',                'Préfixe d\'inclusion');
++>>>>>>> skinnable-master
  
  // global settings
 -define('_SETTINGS_BASESKIN',          'Habillage de base');
 -define('_SETTINGS_SKINSURL',          'URL pour l\'habillage');
 -define('_SETTINGS_ACTIONSURL',                'URL complet pour action.php');
 +define('_SETTINGS_BASESKIN',          'Perussivurunko');
 +define('_SETTINGS_SKINSURL',          'Perussivurunkojen URL');
 +define('_SETTINGS_ACTIONSURL',                'Koko URL action.php:lle');
  
  // category moves (batch)
++<<<<<<< HEAD
 +define('_ERROR_MOVEDEFCATEGORY',      'Vakiokategoriaa ei voi siirtää');
 +define('_ERROR_MOVETOSELF',                   'Kategoriaa ei voi voida siirtää (kohdeblogi on sama kuin lähdeblogi)');
 +define('_MOVECAT_TITLE',                      'Valitse blogi johon kategoria siirretään');
 +define('_MOVECAT_BTN',                                'Siirrä kategoria');
++=======
+ define('_ERROR_MOVEDEFCATEGORY',      'Impossible de déplacer le thème par défaut');
+ define('_ERROR_MOVETOSELF',           'Impossible de déplacer le thème (le blog de destination est identique au blog source)');
+ define('_MOVECAT_TITLE',              'Sélectionner le blog dans lequel vous souhaitez déplacer ce thème');
+ define('_MOVECAT_BTN',                        'Déplacer le thème');
++>>>>>>> skinnable-master
  
  // URLMode setting
 -define('_SETTINGS_URLMODE',           'Type de lien');
 -define('_SETTINGS_URLMODE_NORMAL',    'Normal');
 -define('_SETTINGS_URLMODE_PATHINFO',  'Fancy');
 +define('_SETTINGS_URLMODE',                   'URL moodi');
 +define('_SETTINGS_URLMODE_NORMAL',    'Normaali');
 +define('_SETTINGS_URLMODE_PATHINFO','Tarkka');
  
  // Batch operations
++<<<<<<< HEAD
 +define('_BATCH_NOSELECTION',          'Ei valintoja, joihin kohdistuu toimintoja');
 +define('_BATCH_ITEMS',                                'Joukkotoiminne blogiartikkeleille');
 +define('_BATCH_CATEGORIES',                   'Joukkotoiminne kategorioille');
 +define('_BATCH_MEMBERS',                      'Joukkotoiminne jäsenille');
 +define('_BATCH_TEAM',                         'Joukkotoiminne hallintaryhmille');
 +define('_BATCH_COMMENTS',                     'Joukkotoiminne kommenteille');
 +define('_BATCH_UNKNOWN',                      'Tuntematon joukkotoiminne: ');
 +define('_BATCH_EXECUTING',                    'Suorittaa..');
 +define('_BATCH_ONCATEGORY',                   'kategorialle');
 +define('_BATCH_ONITEM',                               'blogiartikkelille');
 +define('_BATCH_ONCOMMENT',                    'kommentille');
 +define('_BATCH_ONMEMBER',                     'jäsenelle');
 +define('_BATCH_ONTEAM',                               'hallintaryhmän jäsenelle');
 +define('_BATCH_SUCCESS',                      'Onnistui!');
 +define('_BATCH_DONE',                         'Valmis!');
 +define('_BATCH_DELETE_CONFIRM',               'Vahvista joukkopoistaminen');
 +define('_BATCH_DELETE_CONFIRM_BTN',   'Vahvista joukkopoistaminen');
 +define('_BATCH_SELECTALL',                    'valitse kaikki');
 +define('_BATCH_DESELECTALL',          'poista valinnat');
 +
 +// batch operations: options in dropdowns
 +define('_BATCH_ITEM_DELETE',          'Poista');
 +define('_BATCH_ITEM_MOVE',                    'Siirrä');
 +define('_BATCH_MEMBER_DELETE',                'Poista');
 +define('_BATCH_MEMBER_SET_ADM',               'Anna järjestelmänvalvojan oikeudet');
 +define('_BATCH_MEMBER_UNSET_ADM',     'Ota pois järjestelmänvalvojan oikeudet');
 +define('_BATCH_TEAM_DELETE',          'Poista hallintaryhmästä');
 +define('_BATCH_TEAM_SET_ADM',         'Anna järjestelmänvalvojan oikeudet');
 +define('_BATCH_TEAM_UNSET_ADM',               'Ota pois järjestelmänvalvojan oikeudet');
 +define('_BATCH_CAT_DELETE',                   'Poista');
 +define('_BATCH_CAT_MOVE',                     'Siirrää toiseen blogiin');
 +define('_BATCH_COMMENT_DELETE',               'Poista');
 +
 +// itemlist: Add new item...
 +define('_ITEMLIST_ADDNEW',                    'Lisää uusi blogiartikkeli...');
 +define('_ADD_PLUGIN_EXTRAS',          'Laajennuksen lisävalinnat');
 +
 +// errors
 +define('_ERROR_CATCREATEFAIL',                'Ei pystytty luomaan uutta kategoriaa');
 +define('_ERROR_NUCLEUSVERSIONREQ',    'Tämä laajennus vaatii uudemman Nucleuksen version: ');
++=======
+ define('_BATCH_NOSELECTION',          'Aucune action sélectionnée');
+ define('_BATCH_ITEMS',                        'Action sur les billets');
+ define('_BATCH_CATEGORIES',           'Action sur les thèmes');
+ define('_BATCH_MEMBERS',              'Action sur les participants');
+ define('_BATCH_TEAM',                 'Action sur les participants d\'un blog');
+ define('_BATCH_COMMENTS',             'Action sur les commentaires');
+ define('_BATCH_UNKNOWN',              'Action inconnue: ');
+ define('_BATCH_EXECUTING',            'En cours');
+ define('_BATCH_ONCATEGORY',           'sur un thème');
+ define('_BATCH_ONITEM',                       'sur un élément');
+ define('_BATCH_ONCOMMENT',            'sur un commentaire');
+ define('_BATCH_ONMEMBER',             'sur un participant');
+ define('_BATCH_ONTEAM',                       'sur le participant du blog');
+ define('_BATCH_SUCCESS',              'Action réussie!');
+ define('_BATCH_DONE',                 'Terminé!');
+ define('_BATCH_DELETE_CONFIRM',               'Confirmer la suppression');
+ define('_BATCH_DELETE_CONFIRM_BTN',   'Confirmer');
+ define('_BATCH_SELECTALL',            'Tout sélectionner');
+ define('_BATCH_DESELECTALL',          'Annuler la sélection');
+ // batch operations: options in dropdowns
+ define('_BATCH_ITEM_DELETE',          'Supprimer');
+ define('_BATCH_ITEM_MOVE',            'Déplacer');
+ define('_BATCH_MEMBER_DELETE',                'Supprimer');
+ define('_BATCH_MEMBER_SET_ADM',               'Donner les droits d\'administrateur');
+ define('_BATCH_MEMBER_UNSET_ADM',     'Retirer les droits d\'administrateur');
+ define('_BATCH_TEAM_DELETE',          'Retirer de l\'équipe');
+ define('_BATCH_TEAM_SET_ADM',         'Donner les droits d\'administrateur');
+ define('_BATCH_TEAM_UNSET_ADM',               'Retirer les droits d\'administrateur');
+ define('_BATCH_CAT_DELETE',           'Supprimer');
+ define('_BATCH_CAT_MOVE',             'Déplacer vers un autre blog');
+ define('_BATCH_COMMENT_DELETE',               'Supprimer');
+ // itemlist: Add new item...
+ define('_ITEMLIST_ADDNEW',            'Ajouter un nouveau billet...');
+ define('_ADD_PLUGIN_EXTRAS',          'Options supplémentaires des modules');
+ // errors
+ define('_ERROR_CATCREATEFAIL',                'Impossible de créer le nouveau thème');
+ define('_ERROR_NUCLEUSVERSIONREQ',    'Ce module requiert une version ultérieure de Nucleus: ');
++>>>>>>> skinnable-master
  
  // backlinks
 -define('_BACK_TO_BLOGSETTINGS',               'Retour au menu de configuration des blogs');
 +define('_BACK_TO_BLOGSETTINGS',               'Takaisin blogiasetuksiin');
  
  // skin import export
++<<<<<<< HEAD
 +define('_SKINIE_TITLE_IMPORT',                'Tuo');
 +define('_SKINIE_TITLE_EXPORT',                'Vie');
 +define('_SKINIE_BTN_IMPORT',          'Tuo valitut sivurungot / asettelut');
 +define('_SKINIE_BTN_EXPORT',          'Vie valitut sivurungot / asettelut');
 +define('_SKINIE_LOCAL',                               'Tuo paikallisesta tiedostosta:');
 +define('_SKINIE_NOCANDIDATES',                'Ei ehdokkaita tuotavaksi sivurunko -hakemistossa');
 +define('_SKINIE_FROMURL',                     'Tuo URL:sta:');
 +define('_SKINIE_EXPORT_INTRO',                'Valitse sivurungot ja asettelut, jotka haluavat viedä');
 +define('_SKINIE_EXPORT_SKINS',                'Sivurungot');
 +define('_SKINIE_EXPORT_TEMPLATES',    'Asettelut');
 +define('_SKINIE_EXPORT_EXTRA',                'Lisätietoa');
 +define('_SKINIE_CONFIRM_OVERWRITE',   'Ylikirjoita sivurungot, jotka ovat jo olemassa (katso nimien päällekkäisyydet)');
 +define('_SKINIE_CONFIRM_IMPORT',      'Kyllä, haluan tuoda tämän ');
 +define('_SKINIE_CONFIRM_TITLE',               'Valmis tuomaan sivurungon ja asettelut');
 +define('_SKINIE_INFO_SKINS',          'Sivurungot tiedostossa:');
 +define('_SKINIE_INFO_TEMPLATES',      'Asettelut tiedostossa:');
 +define('_SKINIE_INFO_GENERAL',                'Tietoa:');
 +define('_SKINIE_INFO_SKINCLASH',      'Sivirunkonimien päällekkäisyydet:');
 +define('_SKINIE_INFO_TEMPLCLASH',     'Asettelunimien päällekkäisyydet:');
 +define('_SKINIE_INFO_IMPORTEDSKINS','Tuodut sivurungot:');
 +define('_SKINIE_INFO_IMPORTEDTEMPLS','Tuodut asettelut:');
 +define('_SKINIE_DONE',                                'Tuominen valmis');
 +
 +define('_AND',                                                'ja');
 +define('_OR',                                         'tai');
++=======
+ define('_SKINIE_TITLE_IMPORT',                'Importation');
+ define('_SKINIE_TITLE_EXPORT',                'Exportation');
+ define('_SKINIE_BTN_IMPORT',          'Importer');
+ define('_SKINIE_BTN_EXPORT',          'Exporter les habillages/modèles sélectionnés');
+ define('_SKINIE_LOCAL',                       'Importer depuis un fichier local:');
+ define('_SKINIE_NOCANDIDATES',                'Aucun habillage trouvé dans le répertoire skins');
+ define('_SKINIE_FROMURL',             'Importer à partir d\'un lien:');
+ define('_SKINIE_EXPORT_INTRO',                'Sélectionnez ci-dessous les habillages et modèles que vous souhaitez exporter:');
+ define('_SKINIE_EXPORT_SKINS',                'Habillages');
+ define('_SKINIE_EXPORT_TEMPLATES',    'Modèles');
+ define('_SKINIE_EXPORT_EXTRA',                'Notes');
+ define('_SKINIE_CONFIRM_OVERWRITE',   'Ecraser l\'ancienne version?');
+ define('_SKINIE_CONFIRM_IMPORT',      'Oui, je veux importer ceci');
+ define('_SKINIE_CONFIRM_TITLE',               'A propos de l\'importation d\'habillage et de modèle');
+ define('_SKINIE_INFO_SKINS',          'Habillages dans le fichier:');
+ define('_SKINIE_INFO_TEMPLATES',      'Modèles dans le fichier:');
+ define('_SKINIE_INFO_GENERAL',                'Notes:');
+ define('_SKINIE_INFO_SKINCLASH',      'Nom de l\'habillage:');
+ define('_SKINIE_INFO_TEMPLCLASH',     'Nom du modèle:');
+ define('_SKINIE_INFO_IMPORTEDSKINS',  'Habillage importé:');
+ define('_SKINIE_INFO_IMPORTEDTEMPLS', 'Modèle importé:');
+ define('_SKINIE_DONE',                        'Importation réussie');
+ define('_AND',                                'et');
+ define('_OR',                         'ou');
++>>>>>>> skinnable-master
  
  // empty fields on template edit
 -define('_EDITTEMPLATE_EMPTY',         'Champ vide (cliquer pour modifier)');
 +define('_EDITTEMPLATE_EMPTY',         'tyhjä kenttä (klikkaa editoidaksesi)');
  
  // skin overview list
++<<<<<<< HEAD
 +define('_LIST_SKINS_INCMODE',         'IncludeMode:');
 +define('_LIST_SKINS_INCPREFIX',               'IncludePrefix:');
 +define('_LIST_SKINS_DEFINED',         'Määritellyt osat:');
 +
 +// backup
 +define('_BACKUPS_TITLE',                      'Varmuuskopioi / Palauta');
 +define('_BACKUP_TITLE',                               'Varmuuskopioi');
 +define('_BACKUP_INTRO',                               'Klikkaa alla olevaa painiketta luodaksesi varmuuskopion Nucleus-tietokannastasi. Tallennusikkuna tulee esiin ja voit valita minne haluat tallettaa varmuuskopiotiedoston. Säilö se varmaan paikkaan.');
 +define('_BACKUP_ZIP_YES',                     'Yritä käyttää tiedonpakkausta');
 +define('_BACKUP_ZIP_NO',                      'Älä käytä tiedonpakkausta');
 +define('_BACKUP_BTN',                         'Luo varmuuskopio');
 +define('_BACKUP_NOTE',                                '<b>Huomaa:</b> Vain tietokannan sisältö on talletettuna varmuuskopioon. Mediatiedostot ja asetukset tiedostossa config.php <b>eivät</b> täten sisälly varmuuskopioon.');
 +define('_RESTORE_TITLE',                      'Palauta');
 +define('_RESTORE_NOTE',                               '<b>VAROITUS:</b> Varmuuskopiosta palauttaminen tulee <b>TYHJENTÄMÄÄN</b> kaiken nykyisen Nucleus-tietokannan kokonaan! Älä jatka ellet ole ehdottoman varma siitä mitä olet tekemässä! <br />  <b>Huom!</b> Varmista, että Nucleuksen versio, jossa varmuuskopion loit, pitäisi olla sama kuin versio, jota käytät juuri nyt! Muuten se ei toimi.');
 +define('_RESTORE_INTRO',                      'Valitse varmuuskopiotiedosto alta (se tullaan lataamaan serverille) ja klikkaa "Palauta tiedostosta" -painiketta aloittaaksesi.');
 +define('_RESTORE_IMSURE',                     'Kyllä, olen varma, että haluan tehdä tämän!');
 +define('_RESTORE_BTN',                                'Palauta tiedostosta');
 +define('_RESTORE_WARNING',                    '(varmista, että olet palauttamassa oikeaa varmuuskopiota. Kenties kannattaisi tehdä uusi varmuuskopio ennen kuin aloitat...)');
 +define('_ERROR_BACKUP_NOTSURE',               'Sinun täytyy ruksittaa \'Olen varma, että haluan tehdä tämän\' -kohta');
 +define('_RESTORE_COMPLETE',                   'Palautus valmis');
 +
 +// new item notification
 +define('_NOTIFY_NI_MSG',                      'Uusi blogiartikkeli on postitettu:');
 +define('_NOTIFY_NI_TITLE',                    'Uusi blogiartikkeli!');
 +define('_NOTIFY_KV_MSG',                      'Karma-äänestä blogiartikkelia:');
 +define('_NOTIFY_KV_TITLE',                    'Nucleus karma:');
 +define('_NOTIFY_NC_MSG',                      'Kommentoi blogiartikkelia:');
 +define('_NOTIFY_NC_TITLE',                    'Nucleus kommentti:');
 +define('_NOTIFY_USERID',                      'Käyttäjän ID:');
 +define('_NOTIFY_USER',                                'Käyttäjä:');
 +define('_NOTIFY_COMMENT',                     'Kommentti:');
 +define('_NOTIFY_VOTE',                                'Äänestys:');
 +define('_NOTIFY_HOST',                                'Host:');
 +define('_NOTIFY_IP',                          'IP:');
 +define('_NOTIFY_MEMBER',                      'Jäsen:');
 +define('_NOTIFY_TITLE',                               'Otsikko:');
 +define('_NOTIFY_CONTENTS',                    'Sisältö:');
 +
 +// member mail message
 +define('_MMAIL_MSG',                          'Viesti sinulle, jonka on lähettänyt');
 +define('_MMAIL_FROMANON',                     'nimetön vierailija');
 +define('_MMAIL_FROMNUC',                      'Postitettu Nucleus weblogista osoitteessa');
 +define('_MMAIL_TITLE',                                'Viesti jäseneltä');
 +define('_MMAIL_MAIL',                         'Viesti:');
++=======
+ define('_LIST_SKINS_INCMODE',         'Type d\'inclusion:');
+ define('_LIST_SKINS_INCPREFIX',               'Préfixe d\'inclusion:');
+ define('_LIST_SKINS_DEFINED',         'Habillages définis:');
+ // backup
+ define('_BACKUPS_TITLE',              'Sauvegarde / Récupération');
+ define('_BACKUP_TITLE',                       'Sauvegarde');
+ define('_BACKUP_INTRO',                       'Cliquez sur le bouton ci-dessous pour créer une sauvegarde de votre base de données Nucleus. Enregistrez-la dans un fichier. Gardez-le en lieu sûr.');
+ define('_BACKUP_ZIP_YES',             'Essayer d\'utiliser la compression');
+ define('_BACKUP_ZIP_NO',              'Ne pas utiliser la compression');
+ define('_BACKUP_BTN',                 'Sauvegarder!');
+ define('_BACKUP_NOTE',                        '<b>NB:</b> Seul le contenu de la base de données est sauvegardé. Les fichiers Media importés et la configuration de config.php <b>NE SONT PAS</b> inclus dans la sauvegarde.');
+ define('_RESTORE_TITLE',              'Récupération');
+ define('_RESTORE_NOTE',                       '<b>ATTENTION:</b> Restaurer une sauvegarde <b>EFFACERA</b> toutes les données contenues dans la base de données Nucleus! N\'agissez qu\'en connaissance de cause!<br /><b>NB:</b> Vérifiez que la version de Nucleus de votre sauvegarde soit la même que celle que vous utilisez actuellement autrement cela ne fonctionnera pas.');
+ define('_RESTORE_INTRO',              'Sélectionnez le fichier de récupération ci-dessous (il sera téléchargé sur le serveur) et cliquez sur le bouton "Récupération" pour procéder.');
+ define('_RESTORE_IMSURE',             'Oui, je suis sûr!');
+ define('_RESTORE_BTN',                        'Récupération');
+ define('_RESTORE_WARNING',            '(Vérifiez que vous restaurez le bon fichier de sauvegarde. Faites une nouvelle sauvegarde avant de commencer si vous n\'êtes pas sûr.)');
+ define('_ERROR_BACKUP_NOTSURE',               'Vous devez cliquer sur le bouton \'je suis sûr\'');
+ define('_RESTORE_COMPLETE',           'Récupération terminée');
+ // new item notification
+ define('_NOTIFY_NI_MSG',              'Nouveau billet:');
+ define('_NOTIFY_NI_TITLE',            'Nouveau!');
+ define('_NOTIFY_KV_MSG',              'Votes Karma pour le billet:');
+ define('_NOTIFY_KV_TITLE',            'Nucleus karma:');
+ define('_NOTIFY_NC_MSG',              'Commentaires sur le billet:');
+ define('_NOTIFY_NC_TITLE',            'Commentaire Nucleus:');
+ define('_NOTIFY_USERID',              'Utilisateur:');
+ define('_NOTIFY_USER',                        'Utilisateur:');
+ define('_NOTIFY_COMMENT',             'Commentaire:');
+ define('_NOTIFY_VOTE',                        'Vote:');
+ define('_NOTIFY_HOST',                        'Hôte:');
+ define('_NOTIFY_IP',                  'IP:');
+ define('_NOTIFY_MEMBER',              'Participant:');
+ define('_NOTIFY_TITLE',                       'Titre:');
+ define('_NOTIFY_CONTENTS',            'Contenu:');
+ // member mail message
+ define('_MMAIL_MSG',                  'Vous avez reçu un message de');
+ define('_MMAIL_FROMANON',             'un visiteur anonyme');
+ define('_MMAIL_FROMNUC',              'Posté depuis un weblog Nucleus à');
+ define('_MMAIL_TITLE',                        'Un message de');
+ define('_MMAIL_MAIL',                 'Message:');
++>>>>>>> skinnable-master
  
  // END introduced after v1.5 END
  
  // START introduced after v1.1 START
  
  // bookmarklet buttons
++<<<<<<< HEAD
 +define('_BMLET_ADD',                          'Lisää artikkeli');
 +define('_BMLET_EDIT',                         'Muokkaa artikkelia');
 +define('_BMLET_DELETE',                               'Poista artikkeli');
 +define('_BMLET_BODY',                         'Sisältö');
 +define('_BMLET_MORE',                         'Laajennettu');
 +define('_BMLET_OPTIONS',                      'Optiot');
 +define('_BMLET_PREVIEW',                      'Esikatselu');
 +
 +// used in bookmarklet
 +define('_ITEM_UPDATED',                               'Artikkeli päivitetty');
 +define('_ITEM_DELETED',                               'Artikkeli poistettu');
 +
 +// plugins
 +define('_CONFIRMTXT_PLUGIN',          'Oletko varma, että haluat poistaa laajennuksen nimeltä');
 +define('_ERROR_NOSUCHPLUGIN',         'Kyseistä laajennusta ei ole');
 +define('_ERROR_DUPPLUGIN',                    'Tämä laajennus on jo asennettu');
 +define('_ERROR_PLUGFILEERROR',                'Kyseistä laajennusta ei ole, tai oikeudet ovat väärin asetetut');
 +define('_PLUGS_NOCANDIDATES',         'Haluttuja laajennuksia ei löytynyt');
 +
 +define('_PLUGS_TITLE_MANAGE',         'Laajennustenhallinta');
 +define('_PLUGS_TITLE_INSTALLED',      'Asennetut laajennukset');
 +define('_PLUGS_TITLE_UPDATE',         'Päivitä tapahtumalistaa');
 +define('_PLUGS_TEXT_UPDATE',          'Nucleus pitää yllä listaa laajennusten tapahtumatilauksista. Kun päivität laajennuksen ylikirjoittamalla sen tiedoston, sinun täytyisi ajaa tämä päivitys varmistaaksesi, että listassa olisi oikeat tilaukset');
 +define('_PLUGS_TITLE_NEW',                    'Asenna uusi laajennus');
 +define('_PLUGS_ADD_TEXT',                     'Alla on lista kaikista tiedostoista Plugins -hakemistossasi, jotka voivat olla laajennuksia, joita ei vielä ole asennettu. Varmista että olet <strong>aivan varma</strong>, että kyseessä on laajennus, ennen kuin lisäät sen.');
 +define('_PLUGS_BTN_INSTALL',          'Asenna laajennus');
 +define('_BACKTOOVERVIEW',                     'Takaisin');
++=======
+ define('_BMLET_ADD',                  'Ajouter un  billet');
+ define('_BMLET_EDIT',                 'Modifier un billet');
+ define('_BMLET_DELETE',                       'Effacer un billet');
+ define('_BMLET_BODY',                 'Corps');
+ define('_BMLET_MORE',                 'Développement');
+ define('_BMLET_OPTIONS',              'Options');
+ define('_BMLET_PREVIEW',              'Prévisualisation');
+ // used in bookmarklet
+ define('_ITEM_UPDATED',                       'Billet mis à jour');
+ define('_ITEM_DELETED',                       'Billet effacé');
+ // plugins
+ define('_CONFIRMTXT_PLUGIN',          'Etes-vous sur de vouloir supprimer ce module?');
+ define('_ERROR_NOSUCHPLUGIN',         'Pas de module correspondant');
+ define('_ERROR_DUPPLUGIN',            'Désolé, ce module est déjà installé');
+ define('_ERROR_PLUGFILEERROR',                'Ce module n\'existe pas, ou les permissions sont mal configurées');
+ define('_PLUGS_NOCANDIDATES',         'Pas de module valide trouvé');
+ define('_PLUGS_TITLE_MANAGE',         'Gérer les modules');
+ define('_PLUGS_TITLE_INSTALLED',      'Déjà installés');
+ define('_PLUGS_TITLE_UPDATE',         'Mettre à jour la liste des installations');
+ define('_PLUGS_TEXT_UPDATE',          'Nucleus garde un cache des inscriptions des modules. Quand vous mettez à jour un module en remplaçant son fichier, vous devez utiliser cette fonction pour mettre à jour le cache.');
+ define('_PLUGS_TITLE_NEW',            'Installer un nouveau module');
+ define('_PLUGS_ADD_TEXT',             'Vous trouverez ci-dessous la liste de tous les fichiers contenus dans votre répertoire de plugins. Il peut s\'agir de modules non-installés. Soyez <strong>vraiment</strong> sûr qu\'il s\'agit d\'un module avant de l\'ajouter.');
+ define('_PLUGS_BTN_INSTALL',          'Installer le module');
+ define('_BACKTOOVERVIEW',             'Retour au sommaire');
++>>>>>>> skinnable-master
  
  // editlink
 -define('_TEMPLATE_EDITLINK',          'Modifier le lien du billet');
 +define('_TEMPLATE_EDITLINK',          'Muokkaa artikkelia -linkki');
  
  // add left / add right tooltips
++<<<<<<< HEAD
 +define('_ADD_LEFT_TT',                                'Lisää vasen palsta');
 +define('_ADD_RIGHT_TT',                               'Lisää oikea palsta');
 +
 +// add/edit item: new category (in dropdown box)
 +define('_ADD_NEWCAT',                         'Uusi kategoria');
 +
 +// new settings
 +define('_SETTINGS_PLUGINURL',         'Laajennuksen osoite (URL)');
 +define('_SETTINGS_MAXUPLOADSIZE',     'Lähetetyn tiedoston maksimikoko (bitteinä)');
 +define('_SETTINGS_NONMEMBERMSGS',     'Salli ei-jäsenten lähettää viestejä');
 +define('_SETTINGS_PROTECTMEMNAMES',   'Suojaa jäsenten nimet');
 +
 +// overview screen
 +define('_OVERVIEW_PLUGINS',                   'Laajennuksien hallinta');
++=======
+ define('_ADD_LEFT_TT',                        'Ajouter un cadre à gauche');
+ define('_ADD_RIGHT_TT',                       'Ajouter un cadre à droite');
+ // add/edit item: new category (in dropdown box)
+ define('_ADD_NEWCAT',                 'Nouveau thème...');
+ // new settings
+ define('_SETTINGS_PLUGINURL',         'URL des modules');
+ define('_SETTINGS_MAXUPLOADSIZE',     'Taille maxi. du fichier téléchargé (bytes)');
+ define('_SETTINGS_NONMEMBERMSGS',     'Autoriser les non-participants à envoyer des messages');
+ define('_SETTINGS_PROTECTMEMNAMES',   'Protéger les noms des participants');
+ // overview screen
+ define('_OVERVIEW_PLUGINS',           'Gérer les modules...');
++>>>>>>> skinnable-master
  
  // actionlog
 -define('_ACTIONLOG_NEWMEMBER',                'Inscription d\'un nouveau participant:');
 +define('_ACTIONLOG_NEWMEMBER',                'Uuden jäsenen rekisteröinti:');
  
  // membermail (when not logged in)
 -define('_MEMBERMAIL_MAIL',            'Votre adresse email:');
 +define('_MEMBERMAIL_MAIL',                    'Sähköpostiosoitteesi:');
  
  // file upload
++<<<<<<< HEAD
 +define('_ERROR_DISALLOWEDUPLOAD2',    'Sinulla ei ole ylläpitäjän oikeuksia mihinkään blogiin, joilla on kohdejäsen listallaan. Täten, et ole oikeutettu lähettämään tiedostoja tämän jäsenen media -hakemistoon');
 +
 +// plugin list
 +define('_LISTS_INFO',                         'Tiedot');
 +define('_LIST_PLUGS_AUTHOR',          'Tekijä:');
 +define('_LIST_PLUGS_VER',                     'Versio:');
 +define('_LIST_PLUGS_SITE',                    'WWW-sivut');
 +define('_LIST_PLUGS_DESC',                    'Kuvaus');
 +define('_LIST_PLUGS_SUBS',                    'Liittyy seuraaviin tapahtumiin:');
 +define('_LIST_PLUGS_UP',                      'Siirrä ylös');
 +define('_LIST_PLUGS_DOWN',                    'Siirrä alas');
 +define('_LIST_PLUGS_UNINSTALL',               'Poista&nbsp;installointi');
 +define('_LIST_PLUGS_ADMIN',                   'Ylläpito');
 +define('_LIST_PLUGS_OPTIONS',         'Säädä&nbsp;asetuksia');
++=======
+ define('_ERROR_DISALLOWEDUPLOAD2',    'Vous n\'avez pas les droits d\'admin sur les blogs de ce participant. Vous n\'êtes donc pas autorisé à télécharger de fichier sur le répertoire media de ce participant.');
+ // plugin list
+ define('_LISTS_INFO',                 'Information');
+ define('_LIST_PLUGS_AUTHOR',          'de:');
+ define('_LIST_PLUGS_VER',             'Version:');
+ define('_LIST_PLUGS_SITE',            'Visiter le site');
+ define('_LIST_PLUGS_DESC',            'Description:');
+ define('_LIST_PLUGS_SUBS',            'Inscription aux évènements suivants:');
+ define('_LIST_PLUGS_UP',              'monter');
+ define('_LIST_PLUGS_DOWN',            'descendre');
+ define('_LIST_PLUGS_UNINSTALL',               'désinstaller');
+ define('_LIST_PLUGS_ADMIN',           'admin');
+ define('_LIST_PLUGS_OPTIONS',         'modifier les options');
++>>>>>>> skinnable-master
  
  // plugin option list
 -define('_LISTS_VALUE',                        'Valeur');
 +define('_LISTS_VALUE',                                'Arvo');
  
  // plugin options
++<<<<<<< HEAD
 +define('_ERROR_NOPLUGOPTIONS',                'Tällä laajennuksella ei ole asetuksia säädettävänä
 +');
 +define('_PLUGS_BACK',                         'Takaisin Laajennukset -sivulle');
 +define('_PLUGS_SAVE',                         'Tallenna asetukset');
 +define('_PLUGS_OPTIONS_UPDATED',      'Laajennuksen asetukset päivitetty');
 +
 +define('_OVERVIEW_MANAGEMENT',                'Hallinta');
 +define('_OVERVIEW_MANAGE',                    'Nucleuksen hallinta...');
 +define('_MANAGE_GENERAL',                     'Yleinen hallinta');
 +define('_MANAGE_SKINS',                               'Sivurungot ja asettelut');
 +define('_MANAGE_EXTRA',                               'Lisäominaisuudet');
++=======
+ define('_ERROR_NOPLUGOPTIONS',                'ce plugin n\'a pas d\'option');
+ define('_PLUGS_BACK',                 'Retour au menu des modules');
+ define('_PLUGS_SAVE',                 'Sauvegarder les options');
+ define('_PLUGS_OPTIONS_UPDATED',      'Options du module mises à jour');
+ define('_OVERVIEW_MANAGEMENT',                'Gestion');
+ define('_OVERVIEW_MANAGE',            'Gestion de Nucleus...');
+ define('_MANAGE_GENERAL',             'Gestion globale');
+ define('_MANAGE_SKINS',                       'Habillages et modèles');
+ define('_MANAGE_EXTRA',                       'Options supplémentaires');
++>>>>>>> skinnable-master
  
 -define('_BACKTOMANAGE',                       'Retour au menu de gestion de Nucleus');
 +define('_BACKTOMANAGE',                               'Takaisin Nucleuksen hallintaan');
  
  
  // END introduced after v1.1 END
  
  
  // global stuff
++<<<<<<< HEAD
 +define('_LOGOUT',                                     'Kirjaudu ulos');
 +define('_LOGIN',                                      'Kirjaudu sisään');
 +define('_YES',                                                'Kyllä');
 +define('_NO',                                         'Ei');
 +define('_SUBMIT',                                     'Lähetä');
 +define('_ERROR',                                      'Virhe');
 +define('_ERRORMSG',                                   'Virhe esiintyi!');
 +define('_BACK',                                               'Takaisin');
 +define('_NOTLOGGEDIN',                                'Et ole kirjautunut sisään');
 +define('_LOGGEDINAS',                         'Olet kirjautunut sisään tunnuksella');
 +define('_ADMINHOME',                          'Järjestelmänvalvoja-asetukset');
 +define('_NAME',                                               'Nimi');
 +define('_BACKHOME',                                   'Takaisin järjestelmänvalvoja-asetuksiin');
 +define('_BADACTION',                          'Pyydettyä toimintoa ei ole');
 +define('_MESSAGE',                                    'Viesti');
 +define('_HELP_TT',                                    'Apua!');
 +define('_YOURSITE',                                   'Sivustosi');
 +
 +
 +define('_POPUP_CLOSE',                                'Sulje ikkuna');
 +
 +define('_LOGIN_PLEASE',                               'Kirjaudu ensin sisään');
 +
 +// commentform
 +define('_COMMENTFORM_YOUARE',         'Olet');
 +define('_COMMENTFORM_SUBMIT',         'Lisää kommentti');
 +define('_COMMENTFORM_COMMENT',                'Kommenttisi');
 +define('_COMMENTFORM_NAME',                   'Nimi');
 +define('_COMMENTFORM_MAIL',                   'Sähköpostiosoite tai WWW-osoite');
 +define('_COMMENTFORM_REMEMBER',               'Muista minut');
 +
 +// loginform
 +define('_LOGINFORM_NAME',                     'Tunnus');
 +define('_LOGINFORM_PWD',                      'Salasana');
 +define('_LOGINFORM_YOUARE',                   'Olet kirjautuneena<br />sisään tunnuksella<br />');
 +define('_LOGINFORM_SHARED',                   'Usean käyttäjän tietokone');
++=======
+ define('_LOGOUT',                     'Déconnexion');
+ define('_LOGIN',                      'Connexion');
+ define('_YES',                                'Oui');
+ define('_NO',                         'Non');
+ define('_SUBMIT',                     'Envoyer');
+ define('_ERROR',                      'Erreur');
+ define('_ERRORMSG',                   'Une erreur est survenue!');
+ define('_BACK',                               'Retour');
+ define('_NOTLOGGEDIN',                        'Non connecté');
+ define('_LOGGEDINAS',                 'Connecté en tant que');
+ define('_ADMINHOME',                  'Accueil');
+ define('_NAME',                               'Nom');
+ define('_BACKHOME',                   'Retour à l\'accueil');
+ define('_BADACTION',                  'Action inconnue');
+ define('_MESSAGE',                    'Message');
+ define('_HELP_TT',                    'Aide!');
+ define('_YOURSITE',                   'Votre site');
+ define('_POPUP_CLOSE',                        'Fermer la fenêtre');
+ define('_LOGIN_PLEASE',                       'Connectez-vous d\'abord, SVP');
+ // commentform
+ define('_COMMENTFORM_YOUARE',         'Vous êtes');
+ define('_COMMENTFORM_SUBMIT',         'Ajouter un commentaire');
+ define('_COMMENTFORM_COMMENT',                'Votre commentaire');
+ define('_COMMENTFORM_NAME',           'Nom');
+ define('_COMMENTFORM_REMEMBER',               'Retenir votre nom');
+ // loginform
+ define('_LOGINFORM_NAME',             'Nom d\'utilisateur');
+ define('_LOGINFORM_PWD',              'Mot de passe');
+ define('_LOGINFORM_YOUARE',           'Connecté en tant que');
+ define('_LOGINFORM_SHARED',           'Ordinateur partagé');
++>>>>>>> skinnable-master
  
  // member mailform
 -define('_MEMBERMAIL_SUBMIT',          'Envoyer un message');
 +define('_MEMBERMAIL_SUBMIT',          'Lähetä viesti');
  
  // search form
 -define('_SEARCHFORM_SUBMIT',          'Rechercher');
 +define('_SEARCHFORM_SUBMIT',          'Etsi');
  
  // add item form
++<<<<<<< HEAD
 +define('_ADD_ADDTO',                          'Uusi artikkeli blogiin ');
 +define('_ADD_CREATENEW',                      'Luo uusi artikkeli');
 +define('_ADD_BODY',                                   'Sisältö');
 +define('_ADD_TITLE',                          'Otsikko');
 +define('_ADD_MORE',                                   'Laajennettu (optionaalinen)');
 +define('_ADD_CATEGORY',                               'Kategoria');
 +define('_ADD_PREVIEW',                                'Esikatselu');
 +define('_ADD_DISABLE_COMMENTS',               'Kommentit pois käytöstä?');
 +define('_ADD_DRAFTNFUTURE',                   'Vedos &amp; tulevat artikkelit');
 +define('_ADD_ADDITEM',                                'Lisää artikkeli');
 +define('_ADD_ADDNOW',                         'Lisää nyt');
 +define('_ADD_ADDLATER',                               'Lisää myöhemmin');
 +define('_ADD_PLACE_ON',                               'Place on');
 +define('_ADD_ADDDRAFT',                               'Lisää vedoksiin');
 +define('_ADD_NOPASTDATES',                    '(Menneet päiväykset ja kellonajat EIVÄT kelpaa, käytä meneillään olevaa aikaa.)');
 +define('_ADD_BOLD_TT',                                'Lihavoitu');
 +define('_ADD_ITALIC_TT',                      'Kursivoitu');
 +define('_ADD_HREF_TT',                                'Luo linkki');
 +define('_ADD_MEDIA_TT',                               'Lisää media');
 +define('_ADD_PREVIEW_TT',                     'Näytä/Piilota esikatselu');
 +define('_ADD_CUT_TT',                         'Leikkaa');
 +define('_ADD_COPY_TT',                                'Kopioi');
 +define('_ADD_PASTE_TT',                               'Liitä');
 +
 +
 +// edit item form
 +define('_EDIT_ITEM',                          'Muokkaa artikkelia');
 +define('_EDIT_SUBMIT',                                'Muokkaa');
 +define('_EDIT_ORIG_AUTHOR',                   'Alkuperäinen kirjoittaja');
 +define('_EDIT_BACKTODRAFTS',          'Tallenna takaisin vedokseen');
 +define('_EDIT_COMMENTSNOTE',          '(huomaa: kommenttien pois päältä kytkeminen _ei_ piilota aiemmin lisättyjä kommentteja)');
 +
 +// used on delete screens
 +define('_DELETE_CONFIRM',                     'Varmista poistaminen');
 +define('_DELETE_CONFIRM_BTN',         'Varmista poistaminen');
 +define('_CONFIRMTXT_ITEM',                    'Olet poistamassa seuraavan artikkelin:');
 +define('_CONFIRMTXT_COMMENT',         'Olet poistamassa seuraavan kommentin:');
 +define('_CONFIRMTXT_TEAM1',                   'Olet poistamassa ');
 +define('_CONFIRMTXT_TEAM2',                   ' blogin hallintaryhmässä ');
 +define('_CONFIRMTXT_BLOG',                    'Olet poistamassa blogia: ');
 +define('_WARNINGTXT_BLOGDEL',         'Varoitus! Blogin poisto tulee tuhoamaan kaikki artikkelit ja kommentit kyseisessä blogissa. Vahvista että olet AIVAN VARMA siitä mitä olet tekemässä!<br />Älä myöskään keskeytä Nucleusta sen poistaessa blogiasi.');
 +define('_CONFIRMTXT_MEMBER',          'Olet poistamassa seuraavan käyttäjän profiilin: ');
 +define('_CONFIRMTXT_TEMPLATE',                'Olet poistamassa sivuasetuksen nimeltä ');
 +define('_CONFIRMTXT_SKIN',                    'Olet poistamassa sivurungon nimeltä ');
 +define('_CONFIRMTXT_BAN',                     'Olet poistamassa eston ip-osoitteelle ');
 +define('_CONFIRMTXT_CATEGORY',                'Olet poistamassa kategorian ');
 +
 +// some status messages
 +define('_DELETED_ITEM',                               'Artikkeli poistettu');
 +define('_DELETED_MEMBER',                     'Käyttäjä poistettu');
 +define('_DELETED_COMMENT',                    'Kommentti poistettu');
 +define('_DELETED_BLOG',                               'Blogi poistettu');
 +define('_DELETED_CATEGORY',                   'Kategoria poistettu');
 +define('_ITEM_MOVED',                         'Artikkeli siirretty');
 +define('_ITEM_ADDED',                         'Artikkeli lisätty');
 +define('_COMMENT_UPDATED',                    'Kommentti päivitetty');
 +define('_SKIN_UPDATED',                               'Sivurunkodata on tallennettu');
 +define('_TEMPLATE_UPDATED',                   'Asettelu on tallennettu');
 +
 +// errors
 +define('_ERROR_COMMENT_LONGWORD',     'Älä käytä yli 60 merkkiä pitkiä sanoja kommenteissasi');
 +define('_ERROR_COMMENT_NOCOMMENT',    'Kommentti puuttuu');
 +define('_ERROR_COMMENT_NOUSERNAME',   'Nimi puuttuu');
 +define('_ERROR_COMMENT_TOOLONG',      'Kommenttisi on liian pitkä (max. 5000 merkkiä)');
 +define('_ERROR_COMMENTS_DISABLED',    'Kommentointimahdollisuus tälle blogille on pois käytöstä.');
 +define('_ERROR_COMMENTS_NONPUBLIC',   'Sinun täytyy olla kirjautunut käyttäjä lisätäksesi kommentin tähän blogiin');
 +define('_ERROR_COMMENTS_MEMBERNICK','Tunnus, jota haluat käyttää lähettääksesi kommentin on registeröityneen käyttäjän käytössä. Valitse jokin toinen tunnus.');
 +define('_ERROR_SKIN',                         'Sivurunkovirhe');
 +define('_ERROR_ITEMCLOSED',                   'Tämä artikkeli on suljettu, et voi lisätä uusia kommentteja siihen tai äänestää siinä');
 +define('_ERROR_NOSUCHITEM',                   'Kyseistä artikkelia ei ole');
 +define('_ERROR_NOSUCHBLOG',                   'Kyseistä blogia ei ole');
 +define('_ERROR_NOSUCHSKIN',                   'Kyseistä sivurunkoa ei ole');
 +define('_ERROR_NOSUCHMEMBER',         'Kyseistä käyttäjää ei ole');
 +define('_ERROR_NOTONTEAM',                    'Et ole tämän webblogin hallintaryhmässä.');
 +define('_ERROR_BADDESTBLOG',          'Kohdeblogia ei ole');
 +define('_ERROR_NOTONDESTTEAM',                'Artikkelia ei voi siirtää, sillä et ole kohdeblogin hallintaryhmässä');
 +define('_ERROR_NOEMPTYITEMS',         'Tyhjiä artikkeleita ei voi lisätä!');
 +define('_ERROR_BADMAILADDRESS',               'Sähköpostiosoite ei ole kelvollinen');
 +define('_ERROR_BADNOTIFY',                    'Yksi (tai useampi) annettu sähköposti-ilmoitusosoite on epäkelpo sähköpostiosoite');
 +define('_ERROR_BADNAME',                      'Nimi ei ole hyväksyttävä (vain a-z ja 0-9 ovat hyväksyttäviä merkkejä, ei välilyöntejä alussa eikä lopussa)');
 +define('_ERROR_NICKNAMEINUSE',                'Jo registeröitynyt käyttää käyttää jo kyseistä nimeä');
 +define('_ERROR_PASSWORDMISMATCH',     'Salasanojen täytyy olla samoja');
 +define('_ERROR_PASSWORDTOOSHORT',     'Salasanan pitäisi olla ainakin 6 merkkiä pitkä');
 +define('_ERROR_PASSWORDMISSING',      'Salasana on valittava');
 +define('_ERROR_REALNAMEMISSING',      'Sinun täytyy antaa oikea nimesi');
 +define('_ERROR_ATLEASTONEADMIN',      'Aina pitäisi olla ainakin yksi ylijärjestelmänvalvoja, joka voi kirjautua järjestelmänvalvoja alueelle.');
 +define('_ERROR_ATLEASTONEBLOGADMIN','Tämä toiminnon suorittaminen jättäisi blogisi mahdottomaksi ylläpitää. Varmista että järjestelmänvalvojia on ainakin yksi.');
 +define('_ERROR_ALREADYONTEAM',                'Et voi lisätä käyttäjää joka on jo hallintaryhmässä');
 +define('_ERROR_BADSHORTBLOGNAME',     'Blogin id-nimi saisi sisältää vain merkkejä a-z ja 0-9, ilman välilyöntejä');
 +define('_ERROR_DUPSHORTBLOGNAME',     'Toisella blogilla on jo valittu id-nimi. Näiden nimien tulisi erota toisistaan');
 +define('_ERROR_UPDATEFILE',                   'Päivitystiedostoon ei voi saada kirjoitusoikeutta. Tarkista että tiedosto-oikeudet ovat ok (kokeile chmod 666). Huomaa myös, että sijainti on suhteellinen järjestelmänvalvoja hakemistoon nähden, joten saattanet haluta käyttää absoluuttista polkua (kuten /sinun/polkusi/nucleukseen/)');
 +define('_ERROR_DELDEFBLOG',                   'Oletusblogia ei voi poistaa');
 +define('_ERROR_DELETEMEMBER',         'Käyttäjää ei voi poistaa, koska hän on kirjoittanut artikkeleita ja/tai kommentteja tietokantaan');
 +define('_ERROR_BADTEMPLATENAME',      'Sivuasetukselle antamasi nimi ei kelpaa. Käytä vain merkkejä a-z ja 0-9, ilman välilyöntejä');
 +define('_ERROR_DUPTEMPLATENAME',      'Toinen asettelu käyttää jo tätä nimeä');
 +define('_ERROR_BADSKINNAME',          'Epäkelpo nimi sivurungolle (käytä vain merkkejä a-z ja 0-9, ilman välilyöntejä)');
 +define('_ERROR_DUPSKINNAME',          'Toinen sivurunko tällä nimellä on jo olemassa');
 +define('_ERROR_DEFAULTSKIN',          'Sivurunko nimeltä "default" täytyy olla olemassa');
 +define('_ERROR_SKINDEFDELETE',                'Sivurunkoa ei voi poistaa, koska se on vakiosivurunko seuraavalle weblogille: ');
 +define('_ERROR_DISALLOWED',                   'Valitettavasti et ole oikeutettu suorittamaan tätä toimintoa');
 +define('_ERROR_DELETEBAN',                    'Virhe poistettaessa estoa (estoa ei ole olemassa)');
 +define('_ERROR_ADDBAN',                               'Virhe lisättäessä estoa. Estoa ei ehkei ole lisätty oikein kaikissa blogeissasi.');
 +define('_ERROR_BADACTION',                    'Pyydettyä toimintoa ei ole');
 +define('_ERROR_MEMBERMAILDISABLED',   'Käyttäjältä käyttäjälle -viestit ovat poissa käytöstä');
 +define('_ERROR_MEMBERCREATEDISABLED','Käyttäjien luomismahdollisuus on poissa käytöstä');
 +define('_ERROR_INCORRECTEMAIL',               'Epäkelpo osoite');
 +define('_ERROR_VOTEDBEFORE',          'Olet jo antanut äänesi tälle artikkelille');
 +define('_ERROR_BANNED1',                      'Toimintoa ei voi suorittaa johtuen siitä, että (esto ip:lle ');
 +define('_ERROR_BANNED2',                      ') olet estetty tekemästä niin. Viesti oli: \'');
 +define('_ERROR_BANNED3',                      '\'');
 +define('_ERROR_LOGINNEEDED',          'Sinun täytyy olla kirjautunut sisään suorittaaksesi tämän toiminnon');
 +define('_ERROR_CONNECT',                      'Yhdistämisvirhe');
 +define('_ERROR_FILE_TOO_BIG',         'Tiedosto on liian iso!');
 +define('_ERROR_BADFILETYPE',          'Valitettavasti tämä tiedostotyyppi ei ole sallittujen joukossa');
 +define('_ERROR_BADREQUEST',                   'Epäkelpo tiedostonsiirto-pyyntö');
 +define('_ERROR_DISALLOWEDUPLOAD',     'Et ole minkään weblogin hallintaryhmässä. Täten, et ole oikeutettu lähettämään tiedostoja blogiin');
 +define('_ERROR_BADPERMISSIONS',               'Tiedosto/hakemisto -oikeudet eivät ole oikein asetetut');
 +define('_ERROR_UPLOADMOVEP',          'Virhe tiedostoa siirrettäessä');
 +define('_ERROR_UPLOADCOPY',                   'Virhe tiedostoa kopioidessa');
 +define('_ERROR_UPLOADDUPLICATE',      'Toinen samanniminen tiedosto on jo olemassa. Kokeile sen uudelleennimeästä ennen tiedostonsiirtoa.');
 +define('_ERROR_LOGINDISALLOWED',      'Valitettavasti et ole oikeutettu kirjautumaan järjestelmänvalvoja alueelle. Toisaalta, voit kirjautua sisään toisena käyttäjänä');
 +define('_ERROR_DBCONNECT',                    'MySQL-palvelimeen ei saatu yhteyttä');
 +define('_ERROR_DBSELECT',                     'Nucleus tietokantaa ei voitu valita.');
 +define('_ERROR_NOSUCHLOCALE',         'Kyseistä kielitiedostoa ei ole olemassa');
 +define('_ERROR_NOSUCHCATEGORY',               'Kyseistä kategoriaa ei ole olemassa');
 +define('_ERROR_DELETELASTCATEGORY',   'Ainakin yksi kategoria täytyy olla olemassa');
 +define('_ERROR_DELETEDEFCATEGORY',    'Vakiokategoriaa ei voi tuhota');
 +define('_ERROR_BADCATEGORYNAME',      'Epäkelpo kategorian nimi');
 +define('_ERROR_DUPCATEGORYNAME',      'Toinen samanniminen kategoria samaisella nimellä on jo olemassa');
 +
 +// some warnings (used for mediadir setting)
 +define('_WARNING_NOTADIR',                    'Varoitus: Nykyinen arvo ei ole hakemisto!');
 +define('_WARNING_NOTREADABLE',                'Varoitus: Nykyinen arvo on ei-lukuoikeudellinen hakemisto!');
 +define('_WARNING_NOTWRITABLE',                'Varoitus: Nykyinen arvo EI ole kirjoitusoikeudellinen hakemisto!');
 +
 +// media and upload
 +define('_MEDIA_UPLOADLINK',                   'Lähetä uusi tiedosto');
 +define('_MEDIA_MODIFIED',                     'muokattu');
 +define('_MEDIA_FILENAME',                     'tiedoston nimi');
 +define('_MEDIA_DIMENSIONS',                   'mittasuhteet');
 +define('_MEDIA_INLINE',                               'Inline');
 +define('_MEDIA_POPUP',                                'Popup');
 +define('_UPLOAD_TITLE',                               'Valitse tiedosto');
 +define('_UPLOAD_MSG',                         'Valitse alta tiedosto, jonka haluat lähettää ja paina \'Lataa\' nappia.');
 +define('_UPLOAD_BUTTON',                      'Lähetä');
 +
 +// some status messages
 +define('_MSG_ACCOUNTCREATED',         'Käyttäjätili luotu, salasana lähetetään sähköpostitse');
 +define('_MSG_PASSWORDSENT',                   'Salasana on lähetettyä sähköpostitse.');
 +define('_MSG_LOGINAGAIN',                     'Sinun täytyy kirjautua sisään uudelleen, johtuen vaihtuneista tiedoista');
 +define('_MSG_SETTINGSCHANGED',                'Asetuksia muutettu');
 +define('_MSG_ADMINCHANGED',                   'Järjestelmänvalvoja muutettu');
 +define('_MSG_NEWBLOG',                                'Uusi blogi luotu');
 +define('_MSG_ACTIONLOGCLEARED',               'Toimintologi tyhjennetty');
 +
 +// actionlog in admin area
 +define('_ACTIONLOG_DISALLOWED',               'Ei hyväksyttävä toiminto: ');
 +define('_ACTIONLOG_PWDREMINDERSENT','Uusi salasana on lähetetty käyttäjälle ');
 +define('_ACTIONLOG_TITLE',                    'Toimintologi');
 +define('_ACTIONLOG_CLEAR_TITLE',      'Tyhjennä toimintologi');
 +define('_ACTIONLOG_CLEAR_TEXT',               'Tyhjennä toimintologi nyt');
 +
 +// team management
 +define('_TEAM_TITLE',                         'Käsittele blogin hallintaryhmää ');
 +define('_TEAM_CURRENT',                               'Nykyinen hallintaryhmä');
 +define('_TEAM_ADDNEW',                                'Lisää uusi käyttäjä hallintaryhmään');
 +define('_TEAM_CHOOSEMEMBER',          'Valitse käyttäjä');
 +define('_TEAM_ADMIN',                         'Ylläpitäjän oikeudet? ');
 +define('_TEAM_ADD',                                   'Lisää hallintaryhmään');
 +define('_TEAM_ADD_BTN',                               'Lisää hallintaryhmään');
 +
 +// blogsettings
 +define('_EBLOG_TITLE',                                'Säädä asetuksia blogiin');
 +define('_EBLOG_TEAM_TITLE',                   'Käsittele hallintaryhmää');
 +define('_EBLOG_TEAM_TEXT',                    'Klikkaa tästä käsitelläksesi hallintaryhmääsi.');
 +define('_EBLOG_SETTINGS_TITLE',               'Blogin asetukset');
 +define('_EBLOG_NAME',                         'Blogin nimi');
 +define('_EBLOG_SHORTNAME',                    'Blogin id-nimi');
 +define('_EBLOG_SHORTNAME_EXTRA',      '<br />(saisi sisältää vain merkkejä a-z ja 0-9, ilman välilyöntejä)');
 +define('_EBLOG_DESC',                         'Blogin kuvaus');
 +define('_EBLOG_URL',                          'URL');
 +define('_EBLOG_DEFSKIN',                      'Vakiosivurunko');
 +define('_EBLOG_DEFCAT',                               'Vakiokategoria');
 +define('_EBLOG_LINEBREAKS',                   'Konvertoi rivinvaihdot');
 +define('_EBLOG_DISABLECOMMENTS',      'Kommentit sallittuja?<br /><small>(Estämällä kommenttien kirjoittaminen, kommenttien lisääminen ei ole mahdollista.)</small>');
 +define('_EBLOG_ANONYMOUS',                    'Salli kommentit ei-käyttäjiltä?');
 +define('_EBLOG_NOTIFY',                               'Ilmoitussähköpostiosoite/-osoitteet (käytä puolipistemerkkiä ; erottajana)');
 +define('_EBLOG_NOTIFY_ON',                    'Ilmoitukset päällä');
 +define('_EBLOG_NOTIFY_COMMENT',               'Uusista kommenteista');
 +define('_EBLOG_NOTIFY_KARMA',         'Uusista karma äänestyksistä');
 +define('_EBLOG_NOTIFY_ITEM',          'Uusista weblogin artikkeleista');
 +define('_EBLOG_PING',                         'Pingaa Weblogs.com päivityksistä?');
 +define('_EBLOG_MAXCOMMENTS',          'Kommenttien maksimimäärä');
 +define('_EBLOG_UPDATE',                               'Päivitystiedosto');
 +define('_EBLOG_OFFSET',                               'Ajan muutos');
 +define('_EBLOG_STIME',                                'Nykyinen serverin aika on');
 +define('_EBLOG_BTIME',                                'Nykyinen blogin aika on');
 +define('_EBLOG_CHANGE',                               'Muuta asetuksia');
 +define('_EBLOG_CHANGE_BTN',                   'Muuta asetuksia');
 +define('_EBLOG_ADMIN',                                'Blogin ylläpito');
 +define('_EBLOG_ADMIN_MSG',                    'Sinulle asetetaan järjestelmänvalvoja oikeudet');
 +define('_EBLOG_CREATE_TITLE',         'Uusi weblogi');
 +define('_EBLOG_CREATE_TEXT',          'Täytä alla oleva kaavake luodaksesi uuden weblogin. <br /><br /> <b>Huomaa:</b> Vain tarvittavat kentät on listattu. Jos haluat säätää muita optioita, siirry blogin asetussivulle weblogin luomisen jälkeen.');
 +define('_EBLOG_CREATE',                               'Luo!');
 +define('_EBLOG_CREATE_BTN',                   'Luo weblogi');
 +define('_EBLOG_CAT_TITLE',                    'Kategoriat');
 +define('_EBLOG_CAT_NAME',                     'Kategorian nimi');
 +define('_EBLOG_CAT_DESC',                     'Kategorian kuvaus');
 +define('_EBLOG_CAT_CREATE',                   'Luo uusi kategoria');
 +define('_EBLOG_CAT_UPDATE',                   'Päivitä kategoria');
 +define('_EBLOG_CAT_UPDATE_BTN',               'Päivitä kategoria');
 +
 +// templates
 +define('_TEMPLATE_TITLE',                     'Asettelut');
 +define('_TEMPLATE_AVAILABLE_TITLE',   'Tarjolla olevat asettelut');
 +define('_TEMPLATE_NEW_TITLE',         'Uusi asettelu');
 +define('_TEMPLATE_NAME',                      'Asettelun nimi');
 +define('_TEMPLATE_DESC',                      'Asettelun kuvaus');
 +define('_TEMPLATE_CREATE',                    'Luo asettelu');
 +define('_TEMPLATE_CREATE_BTN',                'Luo asettelu');
 +define('_TEMPLATE_EDIT_TITLE',                'Asettelut');
 +define('_TEMPLATE_BACK',                      'Takaisin asettelut -sivulle');
 +define('_TEMPLATE_EDIT_MSG',          'Kaikkia asetteluja ei tarvita. Voit jättää osan tyhjäksi.');
 +define('_TEMPLATE_SETTINGS',          'Asettelun asetukset');
 +define('_TEMPLATE_ITEMS',                     'Artikkelit');
 +define('_TEMPLATE_ITEMHEADER',                'Artikkelin ylätunniste');
 +define('_TEMPLATE_ITEMBODY',          'Artikkelin sisältö');
 +define('_TEMPLATE_ITEMFOOTER',                'Artikkelin alatunniste');
 +define('_TEMPLATE_MORELINK',          'Linkki laajennettuun artikkeliin');
 +define('_TEMPLATE_NEW',                               'Uuden artikkelin merkki');
 +define('_TEMPLATE_COMMENTS_ANY',      'Kommentit (jos niitä on)');
 +define('_TEMPLATE_CHEADER',                   'Kommentin ylätunniste');
 +define('_TEMPLATE_CBODY',                     'Kommentin sisältö');
 +define('_TEMPLATE_CFOOTER',                   'Kommentin alatunniste');
 +define('_TEMPLATE_CONE',                      'Yksi kommentti');
 +define('_TEMPLATE_CMANY',                     'Kaksi (tai useampi) kommenttia');
 +define('_TEMPLATE_CMORE',                     'Kommentin lue_lisää');
 +define('_TEMPLATE_CMEXTRA',                   'Käyttäjäextrat');
 +define('_TEMPLATE_COMMENTS_NONE',     'Kommentit (jos niitä ei ole)');
 +define('_TEMPLATE_CNONE',                     'Ei kommentteja');
 +define('_TEMPLATE_COMMENTS_TOOMUCH','Kommentit (jos niitä on, mutta liikaa jotta ne voitaisiin näyttää)');
 +define('_TEMPLATE_CTOOMUCH',          'Liikaa kommentteja');
 +define('_TEMPLATE_ARCHIVELIST',               'Arkistolistaukset');
 +define('_TEMPLATE_AHEADER',                   'Arkistolistauksen ylätunniste');
 +define('_TEMPLATE_AITEM',                     'Arkistolistauksen artikkeli');
 +define('_TEMPLATE_AFOOTER',                   'Arkistolistauksen alatunniste');
 +define('_TEMPLATE_DATETIME',          'Päiväys ja kellonaika');
 +define('_TEMPLATE_DHEADER',                   'Päiväyksen ylätunniste');
 +define('_TEMPLATE_DFOOTER',                   'Päiväyksen alatunniste');
 +define('_TEMPLATE_DFORMAT',                   'Päiväyksen formaatti');
 +define('_TEMPLATE_TFORMAT',                   'Kellonajan formaatti');
 +define('_TEMPLATE_LOCALE',                    'Paikallinen päiväys');
 +define('_TEMPLATE_IMAGE',                     'Kuva popupit');
 +define('_TEMPLATE_PCODE',                     'Popupin linkkikoodi');
 +define('_TEMPLATE_ICODE',                     'Inline kuvan koodi');
 +define('_TEMPLATE_MCODE',                     'Media objektin linkkikoodi');
 +define('_TEMPLATE_SEARCH',                    'Etsi');
 +define('_TEMPLATE_SHIGHLIGHT',                'Korosta');
 +define('_TEMPLATE_SNOTFOUND',         'Haku ei palauttanut mitään');
 +define('_TEMPLATE_UPDATE',                    'Päivitä');
 +define('_TEMPLATE_UPDATE_BTN',                'Päivitä asettelu');
 +define('_TEMPLATE_RESET_BTN',         'Resetoi data');
 +define('_TEMPLATE_CATEGORYLIST',      'Kategorialistaus');
 +define('_TEMPLATE_CATHEADER',         'Kategorialistan ylätunniste');
 +define('_TEMPLATE_CATITEM',                   'Kategorialistan kategoria');
 +define('_TEMPLATE_CATFOOTER',         'Kategorialistan alatunniste');
 +
 +// skins
 +define('_SKIN_EDIT_TITLE',                    'Sivurungot');
 +define('_SKIN_AVAILABLE_TITLE',               'Tarjolla olevat sivurungot');
 +define('_SKIN_NEW_TITLE',                     'Uusi sivurunko');
 +define('_SKIN_NAME',                          'Nimi');
 +define('_SKIN_DESC',                          'Kuvaus');
 +define('_SKIN_TYPE',                          'Sisällön tyyppi');
 +define('_SKIN_CREATE',                                'Luo');
 +define('_SKIN_CREATE_BTN',                    'Luo sivurunko');
 +define('_SKIN_EDITONE_TITLE',         'Muokkaa sivurunkoa');
 +define('_SKIN_BACK',                          'Takaisin sivurunko -sivulle');
 +define('_SKIN_PARTS_TITLE',                   'Sivurungon osat');
 +define('_SKIN_PARTS_MSG',                     'Kaikkia osia ei tarvita jokaiselle sivurungolle. Jätä tyhjäksi ne joita et tarvitse. Valitse muokattava sivurunko alta:');
 +define('_SKIN_PART_MAIN',                     'Artikkelit (indeksi)');
 +define('_SKIN_PART_ITEM',                     'Yksittäiset artikkelisivut');
 +define('_SKIN_PART_ALIST',                    'Arkisto (indeksi)');
 +define('_SKIN_PART_ARCHIVE',          'Arkistolistaukset');
 +define('_SKIN_PART_SEARCH',                   'Etsi');
 +define('_SKIN_PART_ERROR',                    'Virheet');
 +define('_SKIN_PART_MEMBER',                   'Käyttäjän tiedot');
 +define('_SKIN_PART_POPUP',                    'Kuva popupit');
 +define('_SKIN_GENSETTINGS_TITLE',     'Yleiset asetukset');
 +define('_SKIN_CHANGE',                                'Muuta');
 +define('_SKIN_CHANGE_BTN',                    'Muuta näitä asetuksia');
 +define('_SKIN_UPDATE_BTN',                    'Päivitä sivurunko');
 +define('_SKIN_RESET_BTN',                     'Resetoi data');
 +define('_SKIN_EDITPART_TITLE',                'Muokkaa sivurunkoa');
 +define('_SKIN_GOBACK',                                'Palaa takaisin');
 +define('_SKIN_ALLOWEDVARS',                   'Sallitut muuttujat (klikkaa saadaksesi infoa):');
 +
 +// global settings
 +define('_SETTINGS_TITLE',                     'Yleiset asetukset');
 +define('_SETTINGS_SUB_GENERAL',               'Yleiset asetukset');
 +define('_SETTINGS_DEFBLOG',                   'Vakioblogi');
 +define('_SETTINGS_ADMINMAIL',         'Ylläpitäjän sähköpostiosoite');
 +define('_SETTINGS_SITENAME',          'Sivuston nimi');
 +define('_SETTINGS_SITEURL',                   'Sivuston URL (pitäisi loppua kauttaviivaan)');
 +define('_SETTINGS_ADMINURL',          'Järjestelmänvalvoja-alueen osoite (pitäisi loppua kauttaviivaan)');
 +define('_SETTINGS_DIRS',                      'Nucleus -hakemisto');
 +define('_SETTINGS_MEDIADIR',          'Media -hakemisto');
 +define('_SETTINGS_SEECONFIGPHP',      '(katso config.php)');
 +define('_SETTINGS_MEDIAURL',          'Media URL (pitäisi loppua kauttaviivaan)');
 +define('_SETTINGS_ALLOWUPLOAD',               'Salli tiedostojen lähetys blogiin?');
 +define('_SETTINGS_ALLOWUPLOADTYPES','Sallitut tiedostomuodot lähettäessä');
 +define('_SETTINGS_CHANGELOGIN',               'Salli käyttäjien vaihtaa tunnusta/salasanaa');
 +define('_SETTINGS_COOKIES_TITLE',     'Evästeasetukset');
 +define('_SETTINGS_COOKIELIFE',                'Kirjautumisevästeen elinaika');
 +define('_SETTINGS_COOKIESESSION',     'Istuntoeväste');
 +define('_SETTINGS_COOKIEMONTH',               'Kuukauden elinaika');
 +define('_SETTINGS_COOKIEPATH',                'Evästepolku (edistykselliset)');
 +define('_SETTINGS_COOKIEDOMAIN',      'Cookie Domain (edistykselliset)');
 +define('_SETTINGS_COOKIESECURE',      'Secure Cookie (edistykselliset)');
 +define('_SETTINGS_LASTVISIT',         'Tallenna edellisen käynnin evästeet');
 +define('_SETTINGS_ALLOWCREATE',               'Salli käyttäjien luoda käyttäjätili');
 +define('_SETTINGS_NEWLOGIN',          'Sisäänkirjautuminen sallittu käyttäjän luomilla tileillä');
 +define('_SETTINGS_NEWLOGIN2',         '(koskee vain vasta luotuja tilejä)');
 +define('_SETTINGS_MEMBERMSGS',                'Salli käyttäjältä-käyttäjälle palvelu');
 +define('_SETTINGS_LOCALE',            'Vakiokieli');
 +define('_SETTINGS_DISABLESITE',               'Sivusto pois käytöstä');
 +define('_SETTINGS_DBLOGIN',                   'MySQL -kirjautuminen &amp; -tietokanta');
 +define('_SETTINGS_UPDATE',                    'Päivitä asetukset');
 +define('_SETTINGS_UPDATE_BTN',                'Päivitä asetukset');
 +define('_SETTINGS_DISABLEJS',         'JavaScript -työkalurivi pois käytöstä');
 +define('_SETTINGS_MEDIA',                     'Media/lataus -asetukset');
 +define('_SETTINGS_MEDIAPREFIX',               'Päiväysetuliite ladatuille tiedostoille');
 +define('_SETTINGS_MEMBERS',                   'Käyttäjäasetukset');
 +
 +// bans
 +define('_BAN_TITLE',                          'Estolistasi blogissa');
 +define('_BAN_NONE',                                   'Ei estoja tälle weblogille');
 +define('_BAN_NEW_TITLE',                      'Lisää uusi esto');
 +define('_BAN_NEW_TEXT',                               'Lisää uusi esto nyt');
 +define('_BAN_REMOVE_TITLE',                   'Poista esto');
 +define('_BAN_IPRANGE',                                'IP-osoite');
 +define('_BAN_BLOGS',                          'Mitkä blogit?');
 +define('_BAN_DELETE_TITLE',                   'Poista esto');
 +define('_BAN_ALLBLOGS',                               'Kaikki blogit joihin sinulla on järjestelmänvalvojan oikeudet.');
 +define('_BAN_REMOVED_TITLE',          'Esto poistettu');
 +define('_BAN_REMOVED_TEXT',                   'Esto poistettu seuraavista blogeista:');
 +define('_BAN_ADD_TITLE',                      'Lisää esto');
 +define('_BAN_IPRANGE_TEXT',                   'Valitse ip-osoite, jonka haluat blokata. Mitä vähemmän numeroita siinä on, sitä enemmän osoitteita tullaan blokkaamaan.');
 +define('_BAN_BLOGS_TEXT',                     'Voit estää ip:n vain yhdellä blogilla tai voit estää ip:n kaikilla niillä blogeilla, joihin sinulla järjestelmänvalvojan oikeudet. Tee valintasi alla.');
 +define('_BAN_REASON_TITLE',                   'Syy');
 +define('_BAN_REASON_TEXT',                    'Voit osoittaa syyn estolle, joka näytetään kun ip:n haltija yrittää lisätä uuden kommentin tai antaa karma äänen. Maksimipituus on 256 merkkiä.');
 +define('_BAN_ADD_BTN',                                'Lisää esto');
 +
 +// LOGIN screen
 +define('_LOGIN_MESSAGE',                      'Viesti');
 +define('_LOGIN_NAME',                         'Tunnus');
 +define('_LOGIN_PASSWORD',                     'Salasana');
 +define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
 +define('_LOGIN_FORGOT',                               'Unohditko salasanasi?');
 +
 +// membermanagement
 +define('_MEMBERS_TITLE',                      'Käyttäjät');
 +define('_MEMBERS_CURRENT',                    'Nykyiset käyttäjät');
 +define('_MEMBERS_NEW',                                'Uusi käyttäjä');
 +define('_MEMBERS_DISPLAY',                    'Tunnus');
 +define('_MEMBERS_DISPLAY_INFO',               '(Tämä on tunnus jota käytät kirjautumiseen)');
 +define('_MEMBERS_REALNAME',                   'Oikea nimi');
 +define('_MEMBERS_PWD',                                'Salasana');
 +define('_MEMBERS_REPPWD',                     'Toista salasana');
 +define('_MEMBERS_EMAIL',                      'Sähköpostiosoite');
 +define('_MEMBERS_EMAIL_EDIT',         '(Kun vaihdat sähköpostiosoitetta, uusi salasana tullaan automaattisesti postittamaan siihen osoitteeseen)');
 +define('_MEMBERS_URL',                                'Sivuston osoite (URL)');
 +define('_MEMBERS_SUPERADMIN',         'Järjestelmänvalvojan oikeudet');
 +define('_MEMBERS_CANLOGIN',                   'Voi kirjautua järjestelmänvalvoja alueelle');
 +define('_MEMBERS_NOTES',                      'Tietoja');
 +define('_MEMBERS_NEW_BTN',                    'Lisää käyttäjä');
 +define('_MEMBERS_EDIT',                               'Käyttäjätietojen muokkaus');
 +define('_MEMBERS_EDIT_BTN',                   'Muuta asetuksia');
 +define('_MEMBERS_BACKTOOVERVIEW',     'Takaisin käyttäjät -sivulle');
 +define('_MEMBERS_LOCALE',                     'Kieli');
 +define('_MEMBERS_USESITELANG',                '- käytä sivuston vakioasetusta -');
 +
 +// List of blogs (TT = tooltip)
 +define('_BLOGLIST_TT_VISIT',          'Käy sivustolla');
 +define('_BLOGLIST_ADD',                               'Lisää artikkeli');
 +define('_BLOGLIST_TT_ADD',                    'Lisää artikkeli tähän weblogiin');
 +define('_BLOGLIST_EDIT',                      'Muokkaa/poista artikkeleita');
 +define('_BLOGLIST_TT_EDIT',                   '');
 +define('_BLOGLIST_BMLET',                     'Bookmarklet');
 +define('_BLOGLIST_TT_BMLET',          '');
 +define('_BLOGLIST_SETTINGS',          'Asetukset');
 +define('_BLOGLIST_TT_SETTINGS',               'Säädä asetuksia tai käsittele hallintaryhmää');
 +define('_BLOGLIST_BANS',                      'Estot');
 +define('_BLOGLIST_TT_BANS',                   'Tarkastele, lisää tai poista estettyjä ip:itä');
 +define('_BLOGLIST_DELETE',                    'Poista kaikki');
 +define('_BLOGLIST_TT_DELETE',         'Poista tämä weblogi');
 +
 +// OVERVIEW screen
 +define('_OVERVIEW_YRBLOGS',                   'Weblogisi');
 +define('_OVERVIEW_YRDRAFTS',          'Vedoksesi');
 +define('_OVERVIEW_YRSETTINGS',                'Asetuksesi');
 +define('_OVERVIEW_GSETTINGS',         'Yleiset asetukset');
 +define('_OVERVIEW_NOBLOGS',                   'Et ole minkään weblogin hallintaryhmässä');
 +define('_OVERVIEW_NODRAFTS',          'Ei vedoksia');
 +define('_OVERVIEW_EDITSETTINGS',      'Muokkaa omia tietojasi...');
 +define('_OVERVIEW_BROWSEITEMS',               'Selaa artikkeleitasi...');
 +define('_OVERVIEW_BROWSECOMM',                'Selaa kommenttejasi...');
 +define('_OVERVIEW_VIEWLOG',                   'Tarkastele toimintologia...');
 +define('_OVERVIEW_MEMBERS',                   'Hallitse käyttäjiä...');
 +define('_OVERVIEW_NEWLOG',                    'Luo uusi weblogi...');
 +define('_OVERVIEW_SETTINGS',          'Säädä yleisiä asetuksia...');
 +define('_OVERVIEW_TEMPLATES',         'Muokkaa asetteluja...');
 +define('_OVERVIEW_SKINS',                     'Muokkaa sivurunkoja...');
 +define('_OVERVIEW_BACKUP',                    'Tee varmuuskopio / palauta varmuuskopio...');
++=======
+ define('_ADD_ADDTO',                  'Ajouter un billet à');
+ define('_ADD_CREATENEW',              'Créer un nouveau billet');
+ define('_ADD_BODY',                   'Corps');
+ define('_ADD_TITLE',                  'Titre');
+ define('_ADD_MORE',                   'Développement (facultatif)');
+ define('_ADD_CATEGORY',                       'Thème');
+ define('_ADD_PREVIEW',                        'Prévisualisation');
+ define('_ADD_DISABLE_COMMENTS',               'Interdire les commentaires?');
+ define('_ADD_DRAFTNFUTURE',           'Brouillons &amp; billets à venir');
+ define('_ADD_ADDITEM',                        'Ajouter le billet');
+ define('_ADD_ADDNOW',                 'Ajouter maintenant');
+ define('_ADD_PLACE_ON',                       'Daté du');
+ define('_ADD_ADDDRAFT',                       'Ajouter aux brouillons');
+ define('_ADD_NOPASTDATES',            '(Les dates et heures passées ne sont pas valides, la date d\'aujourd\'hui sera utilisée)');
+ define('_ADD_BOLD_TT',                        'Gras');
+ define('_ADD_ITALIC_TT',              'Italiques');
+ define('_ADD_HREF_TT',                        'Faire un lien');
+ define('_ADD_MEDIA_TT',                       'Ajouter un document');
+ define('_ADD_PREVIEW_TT',             'Montrer/cacher la prévisualisation');
+ define('_ADD_CUT_TT',                 'Couper');
+ define('_ADD_COPY_TT',                        'Copier');
+ define('_ADD_PASTE_TT',                       'Coller');
+ // edit item form
+ define('_EDIT_ITEM',                  'Modifier le billet');
+ define('_EDIT_SUBMIT',                        'Valider');
+ define('_EDIT_ORIG_AUTHOR',           'Auteur');
+ define('_EDIT_BACKTODRAFTS',          'Remettre aux brouillons');
+ define('_EDIT_COMMENTSNOTE',          '(NB: Désactiver les commentaires ne cachera pas les anciens)');
+ // used on delete screens
+ define('_DELETE_CONFIRM',             'SVP, confirmez la suppression');
+ define('_DELETE_CONFIRM_BTN',         'Confirmer');
+ define('_CONFIRMTXT_ITEM',            'Vous allez effacer le billet suivant:');
+ define('_CONFIRMTXT_COMMENT',         'Vous allez effacer le commentaire suivant:');
+ define('_CONFIRMTXT_TEAM1',           'Vous allez effacer ');
+ define('_CONFIRMTXT_TEAM2',           ' de l\'équipe pour le blog ');
+ define('_CONFIRMTXT_BLOG',            'Le blog que vous allez effacer est: ');
+ define('_WARNINGTXT_BLOGDEL',         'Attention! Effacer un blog effarcera TOUS les billets de ce blog et tous les commentaires associés. Soyez certain de ne pas faire erreur. <br />Et n\'interrompez pas le processus.');
+ define('_CONFIRMTXT_MEMBER',          'Vous allez effacer le profil du participant suivant: ');
+ define('_CONFIRMTXT_TEMPLATE',                'Vous allez effacer le modèle  ');
+ define('_CONFIRMTXT_SKIN',            'Vous allez effacer l\'habillage ');
+ define('_CONFIRMTXT_BAN',             'Vous allez annuler l\'exclusion de la plage IP');
+ define('_CONFIRMTXT_CATEGORY',                'Vous allez effacer le thème ');
+ // some status messages
+ define('_DELETED_ITEM',                       'Billet supprimé');
+ define('_DELETED_MEMBER',             'Participant effacé');
+ define('_DELETED_COMMENT',            'Commentaire supprimé');
+ define('_DELETED_BLOG',                       'Blog effacé');
+ define('_DELETED_CATEGORY',           'Categorie supprimée');
+ define('_ITEM_MOVED',                 'Billet déplacé');
+ define('_ITEM_ADDED',                 'Billet ajouté');
+ define('_COMMENT_UPDATED',            'Commentaire mis à jour');
+ define('_SKIN_UPDATED',                       'Habillage modifié');
+ define('_TEMPLATE_UPDATED',           'Modèle modifié');
+ // errors
+ define('_ERROR_COMMENT_LONGWORD',     'SVP, n\'employez pas de mot de plus de 90 caractères dans votre commentaire');
+ define('_ERROR_COMMENT_NOCOMMENT',    'Tapez votre commentaire');
+ define('_ERROR_COMMENT_NOUSERNAME',   'Nom invalide');
+ define('_ERROR_COMMENT_TOOLONG',      'Votre commentaire est trop long (max. 5000 cars)');
+ define('_ERROR_COMMENTS_DISABLED',    'Les commentaires sur ce blog sont actuellement désactivés.');
+ define('_ERROR_COMMENTS_NONPUBLIC',   'Vous devez être connecté en tant que participant pour pouvoir commenter ce blog.');
+ define('_ERROR_COMMENTS_MEMBERNICK',  'Ce nom est déjà utilisé par un participant du blog. Choisissez autre chose.');
+ define('_ERROR_SKIN',                 'Erreur d\'habillage');
+ define('_ERROR_ITEMCLOSED',           'Ce billet est protégé. Il n\'est pas possible de le commenter ni de voter pour lui.');
+ define('_ERROR_NOSUCHITEM',           'Billet inexistant');
+ define('_ERROR_NOSUCHBLOG',           'Blog inexistant');
+ define('_ERROR_NOSUCHSKIN',           'Habillage inexistant');
+ define('_ERROR_NOSUCHMEMBER',         'Participant inexistant');
+ define('_ERROR_NOTONTEAM',            'Vous n\'appartenez pas à l\'équipe de ce blog.');
+ define('_ERROR_BADDESTBLOG',          'Le blog de destination n\'existe pas.');
+ define('_ERROR_NOTONDESTTEAM',                'Impossible de déplacer le billet car vous ne faites pas partie de l\'équipe du blog de destination.');
+ define('_ERROR_NOEMPTYITEMS',         'Impossible d\'ajouter un billet vide!');
+ define('_ERROR_BADMAILADDRESS',               'Adresse email incorrecte');
+ define('_ERROR_BADNOTIFY',            'Adresse(s) de notification incorrecte(s)');
+ define('_ERROR_BADNAME',              'Nom incorrect (seuls les lettres de a à z et les chiffres de 0 à 9 sont autorisés, sans espace au début ni à la fin)');
+ define('_ERROR_NICKNAMEINUSE',                'Un autre participant utilise déjà ce nom');
+ define('_ERROR_PASSWORDMISMATCH',     'Les mots de passe doivent correspondre');
+ define('_ERROR_PASSWORDTOOSHORT',     'Le mot de passe doit commprendre au moins 6 caractères');
+ define('_ERROR_PASSWORDMISSING',      'Il FAUT un mot de passe');
+ define('_ERROR_REALNAMEMISSING',      'Vous devez inscrire votre nom');
+ define('_ERROR_ATLEASTONEADMIN',      'Il doit toujours y avoir un super admin qui puisse se connecter.');
+ define('_ERROR_ATLEASTONEBLOGADMIN',  'Cela empêcherait la gestion de votre blog. Assurez-vous qu\'il y ait toujours au-moins un administrateur.');
+ define('_ERROR_ALREADYONTEAM',                'Ce participant est déjà dans l\'équipe');
+ define('_ERROR_BADSHORTBLOGNAME',     'Le diminutif du blog ne peut contenir que des lettres de a à z et des chiffres de 0 à 9, sans espace.');
+ define('_ERROR_DUPSHORTBLOGNAME',     'Un autre blog utilise déjà ce diminutif. Les diminutifs doivent être uniques.');
+ define('_ERROR_UPDATEFILE',           'Impossible de mettre à jour le fichier. Vérifiez le réglage de permissions d\'écriture (faites un chmod 666). Remarquez aussi que le chemin est relatif au répertoire de la zone admin ; vous devriez utiliser un chemin absolu (quelque chose comme /votre/chemin/vers/nucleus/)');
+ define('_ERROR_DELDEFBLOG',           'Impossible d\'effacer le blog par défaut');
+ define('_ERROR_DELETEMEMBER',         'Impossible de supprimer ce participant car il est probablement l\'auteur de billets ou de commentaires.');
+ define('_ERROR_BADTEMPLATENAME',      'Nom de modèle incorrect, n\'utilisez que des lettres de a à z et des chiffres de 0 à 9, sans espace.');
+ define('_ERROR_DUPTEMPLATENAME',      'Il existe déjà un modèle de ce nom');
+ define('_ERROR_BADSKINNAME',          'Nom d\'habillage incorrect, n\'utilisez que des lettres de a à z et des chiffres de 0 à 9, sans espace.');
+ define('_ERROR_DUPSKINNAME',          'Il existe déjà un habillage de ce nom');
+ define('_ERROR_DEFAULTSKIN',          'Il doit toujours subsister un habillage nommé "default"');
+ define('_ERROR_SKINDEFDELETE',                'Impossible de supprimer l\'habillage car il s\'agit de l\'habillage par défaut du blog: ');
+ define('_ERROR_DISALLOWED',           'Vous n\'êtes pas autorisé à faire cela');
+ define('_ERROR_DELETEBAN',            'Erreur en essayant de supprimer l\'exclusion (elle n\'existe pas)');
+ define('_ERROR_ADDBAN',                       'Erreur en essayant d\'ajouter l\'exclusion. L\'exclusion n\'a pas été ajoutée correctement dans tous vos blogs.');
+ define('_ERROR_BADACTION',            'L\'action demandée n\'existe pas');
+ define('_ERROR_MEMBERMAILDISABLED',   'Messages de participant à participant désactivés');
+ define('_ERROR_MEMBERCREATEDISABLED', 'Creation de nouveaux comptes désactivée');
+ define('_ERROR_INCORRECTEMAIL',               'Email incorrect');
+ define('_ERROR_VOTEDBEFORE',          'Vous avez déjà voté pour ce billet');
+ define('_ERROR_BANNED1',              'Action impossible car vous (plage IP ');
+ define('_ERROR_BANNED2',                      ') êtes exclu. Le message était: \'');
+ define('_ERROR_BANNED3',                      '\'');
+ define('_ERROR_LOGINNEEDED',          'Vous devez être connecté pour faire cela');
+ define('_ERROR_CONNECT',              'Erreur de connexion');
+ define('_ERROR_FILE_TOO_BIG',         'Fichier trop gros!');
+ define('_ERROR_BADFILETYPE',          'Désolé, cette extension n\'est pas autorisée');
+ define('_ERROR_BADREQUEST',           'Mauvaise demande de téléchargement');
+ define('_ERROR_DISALLOWEDUPLOAD',     'Vous ne faites partie d\'aucune équipe. Vous n\'êtes donc pas autorisé à télécharger des fichiers.');
+ define('_ERROR_BADPERMISSIONS',               'Les permissions de fichiers/répertoires ne sont pas correctement configurées');
+ define('_ERROR_UPLOADMOVEP',          'Erreur de déplacement de fichier');
+ define('_ERROR_UPLOADCOPY',           'Erreur de copie de fichier');
+ define('_ERROR_UPLOADDUPLICATE',      'Un fichier de ce nom existe déjà. Essayez de le renommer avant de le télécharger.');
+ define('_ERROR_LOGINDISALLOWED',      'Désolé, vous n\'êtes pas autorisé à vous connecter à la zone admin. Vous pouvez vous connecter sous un autre nom');
+ define('_ERROR_DBCONNECT',            'Impossible de se connecter au serveur mySQL');
+ define('_ERROR_DBSELECT',             'Impossible de sélectionner la base Nucleus.');
+ define('_ERROR_NOSUCHLOCALE',         'Fichier de langue indisponible');
+ define('_ERROR_NOSUCHCATEGORY',               'Thème indisponible');
+ define('_ERROR_DELETELASTCATEGORY',   'Il doit y avoir au moins un thème');
+ define('_ERROR_DELETEDEFCATEGORY',    'Impossible d\'effacerle thème par défaut');
+ define('_ERROR_BADCATEGORYNAME',      'Nom de thème incorrect');
+ define('_ERROR_DUPCATEGORYNAME',      'Ce thème existe déjà');
+ // some warnings (used for mediadir setting)
+ define('_WARNING_NOTADIR',            'Attention: ceci n\'est pas un répertoire!');
+ define('_WARNING_NOTREADABLE',                'Attention: ceci n\'est pas un répertoire avec droit de lecture!');
+ define('_WARNING_NOTWRITABLE',                'Attention: ceci n\'est pas un répertoire avec droit d\'écriture!');
+ // media and upload
+ define('_MEDIA_UPLOADLINK',           'Télécharger un nouveau fichier');
+ define('_MEDIA_MODIFIED',             'modifié');
+ define('_MEDIA_FILENAME',             'nom de fichier');
+ define('_MEDIA_DIMENSIONS',           'dimensions');
+ define('_MEDIA_INLINE',                       'Inséré');
+ define('_MEDIA_POPUP',                        'Popup');
+ define('_UPLOAD_TITLE',                       'Choisir le fichier');
+ define('_UPLOAD_MSG',                 'Sélectionnez le fichier à télécharger ci-dessous et pressez le bouton \'Télécharger\'.');
+ define('_UPLOAD_BUTTON',              'Télécharger');
+ // some status messages
+ //define('_MSG_ACCOUNTCREATED',               'Compte créé, le mot de passe sera envoyé par email');
+ //define('_MSG_PASSWORDSENT',         'Mot de passe envoyé par email');
+ define('_MSG_LOGINAGAIN',             'Vous devrez vous reconnecter car vos informations ont changé');
+ define('_MSG_SETTINGSCHANGED',                'Réglages modifiés');
+ define('_MSG_ADMINCHANGED',           'Admin changé');
+ define('_MSG_NEWBLOG',                        'Nouveau blog créé');
+ define('_MSG_ACTIONLOGCLEARED',               'Journal effacé');
+ // actionlog in admin area
+ define('_ACTIONLOG_DISALLOWED',               'Action interdite: ');
+ define('_ACTIONLOG_PWDREMINDERSENT',  'Nouveau mot de passe envoyé pour ');
+ define('_ACTIONLOG_TITLE',            'Journal des événements');
+ define('_ACTIONLOG_CLEAR_TITLE',      'Effacer le journal des événements');
+ define('_ACTIONLOG_CLEAR_TEXT',               'Effacer le journal des événements maintenant');
+ // team management
+ define('_TEAM_TITLE',                 'Gérer les participants ');
+ define('_TEAM_CURRENT',                       'Equipe actuelle');
+ define('_TEAM_ADDNEW',                        'Ajouter un participant');
+ define('_TEAM_CHOOSEMEMBER',          'Choisir un participant');
+ define('_TEAM_ADMIN',                 'Privilèges d\'administrateur? ');
+ define('_TEAM_ADD',                   'Ajouter à l\'équipe');
+ define('_TEAM_ADD_BTN',                       'Ajouter!');
+ // blogsettings
+ define('_EBLOG_TITLE',                        'Modifier les réglages du blog');
+ define('_EBLOG_TEAM_TITLE',           'Modifier l\'équipe');
+ define('_EBLOG_TEAM_TEXT',            'Cliquez ici pour modifier votre équipe...');
+ define('_EBLOG_SETTINGS_TITLE',               'Réglages du blog');
+ define('_EBLOG_NAME',                 'Nom du blog');
+ define('_EBLOG_SHORTNAME',            'Diminutif');
+ define('_EBLOG_SHORTNAME_EXTRA',      '<br />(seulement de a à z et sans espace)');
+ define('_EBLOG_DESC',                 'Description');
+ define('_EBLOG_URL',                  'URL');
+ define('_EBLOG_DEFSKIN',              'Habillage par défaut');
+ define('_EBLOG_DEFCAT',                       'Thème par défaut');
+ define('_EBLOG_LINEBREAKS',           'Convertir les sauts de ligne');
+ define('_EBLOG_DISABLECOMMENTS',      'Activer les commentaires?<br /><small>(Cela signifie qu\'il sera impossible d\'en ajouter.)</small>');
+ define('_EBLOG_ANONYMOUS',            'Autoriser les commentaires par des non-participants?');
+ define('_EBLOG_NOTIFY',                       'Adresse(s) de notification (séparées par des ;)');
+ define('_EBLOG_NOTIFY_ON',            'Notification activée');
+ define('_EBLOG_NOTIFY_COMMENT',               'Nouveaux commentaires');
+ define('_EBLOG_NOTIFY_KARMA',         'Nouveaux votes karma');
+ define('_EBLOG_NOTIFY_ITEM',          'Nouveau billet');
+ define('_EBLOG_PING',                 'Pinger Weblogs.com à la mise à jour?');
+ define('_EBLOG_MAXCOMMENTS',          'Nombre maximum de commentaires');
+ define('_EBLOG_UPDATE',                       'Fichier de mise-à-jour');
+ define('_EBLOG_OFFSET',                       'Décalage horaire');
+ define('_EBLOG_STIME',                        'Heure du serveur:');
+ define('_EBLOG_BTIME',                        'Heure du blog:');
+ define('_EBLOG_CHANGE',                       'Changer les réglages');
+ define('_EBLOG_CHANGE_BTN',           'Valider');
+ define('_EBLOG_ADMIN',                        'Gérer le blog');
+ define('_EBLOG_ADMIN_MSG',            'Les privilèges d\'administrateur vous seront attribués');
+ define('_EBLOG_CREATE_TITLE',         'Créer un nouveau blog');
+ define('_EBLOG_CREATE_TEXT',          'Remplissez le formulaire ci-dessous pour créer un nouveau blog. <br /><br /> <b>NB:</b> Seules les options nécessaires sont listées. Pour plus d\'options, changez les paramètres après la création.');
+ define('_EBLOG_CREATE',                       'Créer le blog');
+ define('_EBLOG_CREATE_BTN',           'Créer');
+ define('_EBLOG_CAT_TITLE',            'Thèmes');
+ define('_EBLOG_CAT_NAME',             'Thèmes');
+ define('_EBLOG_CAT_DESC',             'Description du thème');
+ define('_EBLOG_CAT_CREATE',           'Créer un nouveau thème');
+ define('_EBLOG_CAT_UPDATE',           'Mettre à jour le thème');
+ define('_EBLOG_CAT_UPDATE_BTN',               'Mettre à jour le thème');
+ // templates
+ define('_TEMPLATE_TITLE',             'Modifier les modèles');
+ define('_TEMPLATE_AVAILABLE_TITLE',   'Modèles disponibles');
+ define('_TEMPLATE_NEW_TITLE',         'Nouveau modèle');
+ define('_TEMPLATE_NAME',              'Nom du modèle');
+ define('_TEMPLATE_DESC',              'Description du modèle');
+ define('_TEMPLATE_CREATE',            'Créer le modèle');
+ define('_TEMPLATE_CREATE_BTN',                'Créer le modèle');
+ define('_TEMPLATE_EDIT_TITLE',                'Modifier le modèle');
+ define('_TEMPLATE_BACK',              'Retour au sommaire des modèles');
+ define('_TEMPLATE_EDIT_MSG',          'Tous les éléments de modèle ne sont pas nécessaires. Laissez vides ceux dont vous n\'avez pas besoin');
+ define('_TEMPLATE_SETTINGS',          'Réglages de modèle');
+ define('_TEMPLATE_ITEMS',             'Billet');
+ define('_TEMPLATE_ITEMHEADER',                'En-tête du billet');
+ define('_TEMPLATE_ITEMBODY',          'Corps du billet');
+ define('_TEMPLATE_ITEMFOOTER',                'Pied du billet');
+ define('_TEMPLATE_MORELINK',          'Lien vers le développement');
+ define('_TEMPLATE_NEW',                       'Indication de nouveau billet');
+ define('_TEMPLATE_COMMENTS_ANY',      'Commentaires (si nécessaire)');
+ define('_TEMPLATE_CHEADER',           'En-tête des commentaires');
+ define('_TEMPLATE_CBODY',             'Corps des commentaires');
+ define('_TEMPLATE_CFOOTER',           'Pied des commentaires');
+ define('_TEMPLATE_CONE',              'Un seul commentaire');
+ define('_TEMPLATE_CMANY',             'Deux (ou plus) commentaires');
+ define('_TEMPLATE_CMORE',             'Commentaires: en voir plus');
+ define('_TEMPLATE_CMEXTRA',           'Infos participant');
+ define('_TEMPLATE_COMMENTS_NONE',     'Commentaire (si aucun)');
+ define('_TEMPLATE_CNONE',             'Pas de commentaire');
+ define('_TEMPLATE_COMMENTS_TOOMUCH',  'Commentaires (s\'il y en a, mais trop pour les montrer tous)');
+ define('_TEMPLATE_CTOOMUCH',          'Trop de commentaires');
+ define('_TEMPLATE_ARCHIVELIST',               'Listes d\'archives');
+ define('_TEMPLATE_AHEADER',           'En-tête d\'archives');
+ define('_TEMPLATE_AITEM',             'Archive (billet)');
+ define('_TEMPLATE_AFOOTER',           'Pied de liste d\'archives');
+ define('_TEMPLATE_DATETIME',          'Date et heure');
+ define('_TEMPLATE_DHEADER',           'En-tête de date');
+ define('_TEMPLATE_DFOOTER',           'Pied de date');
+ define('_TEMPLATE_DFORMAT',           'Format de la date');
+ define('_TEMPLATE_TFORMAT',           'Format de l\'heure');
+ define('_TEMPLATE_LOCALE',            'Locale');
+ define('_TEMPLATE_IMAGE',             'Fenêtre popup');
+ define('_TEMPLATE_PCODE',             'Code de lien popup');
+ define('_TEMPLATE_ICODE',             'Code d\'image insérée');
+ define('_TEMPLATE_MCODE',             'Code lien objet media');
+ define('_TEMPLATE_SEARCH',            'Recherche');
+ define('_TEMPLATE_SHIGHLIGHT',                'Surbrillance');
+ define('_TEMPLATE_SNOTFOUND',         'Rien trouvé');
+ define('_TEMPLATE_UPDATE',            'Mettre à jour');
+ define('_TEMPLATE_UPDATE_BTN',                'Mettre à jour le modème');
+ define('_TEMPLATE_RESET_BTN',         'Rétablir les données');
+ define('_TEMPLATE_CATEGORYLIST',      'Listes de thèmes');
+ define('_TEMPLATE_CATHEADER',         'En-tête de liste de thèmes');
+ define('_TEMPLATE_CATITEM',           'Liste des thèmes (billet)');
+ define('_TEMPLATE_CATFOOTER',         'Pied de liste de thèmes');
+ // skins
+ define('_SKIN_EDIT_TITLE',            'Modification des habillages');
+ define('_SKIN_AVAILABLE_TITLE',               'Habillages disponibles');
+ define('_SKIN_NEW_TITLE',             'Nouvel habillage');
+ define('_SKIN_NAME',                  'Nom');
+ define('_SKIN_DESC',                  'Description');
+ define('_SKIN_TYPE',                  'Type de contenu');
+ define('_SKIN_CREATE',                        'Créer l\'habillage');
+ define('_SKIN_CREATE_BTN',            'Créer');
+ define('_SKIN_EDITONE_TITLE',         'Modifier l\'habillage');
+ define('_SKIN_BACK',                  'Retour au menu habillage');
+ define('_SKIN_PARTS_TITLE',           'Elements d\'habillage');
+ define('_SKIN_PARTS_MSG',             'Tous les éléments ne sont pas requis. Laissez vides ceux dont vous n\'avez pas esoin. Choisissez ci-dessous l\'élément d\'habillage à modifier:');
+ define('_SKIN_PART_MAIN',             'Page index');
+ define('_SKIN_PART_ITEM',             'Page billet');
+ define('_SKIN_PART_ALIST',            'Liste des archives');
+ define('_SKIN_PART_ARCHIVE',          'Archive');
+ define('_SKIN_PART_SEARCH',           'Recherche');
+ define('_SKIN_PART_ERROR',            'Erreurs');
+ define('_SKIN_PART_MEMBER',           'Fiches des participants');
+ define('_SKIN_PART_POPUP',            'Fenêtres Popups');
+ define('_SKIN_GENSETTINGS_TITLE',     'Réglages d\'ensemble');
+ define('_SKIN_CHANGE',                        'Modifier');
+ define('_SKIN_CHANGE_BTN',            'Modifier ces réglages');
+ define('_SKIN_UPDATE_BTN',            'Mettre à jour');
+ define('_SKIN_RESET_BTN',             'Rétablir');
+ define('_SKIN_EDITPART_TITLE',                'Modifier l\'habillage');
+ define('_SKIN_GOBACK',                        'Retour');
+ define('_SKIN_ALLOWEDVARS',           'Variables autorisées (cliquer pour info):');
+ // global settings
+ define('_SETTINGS_TITLE',             'Réglages d\'ensemble');
+ define('_SETTINGS_SUB_GENERAL',               'Réglages d\'ensemble');
+ define('_SETTINGS_DEFBLOG',           'Blog par défaut');
+ define('_SETTINGS_ADMINMAIL',         'Email de l\'administrateur');
+ define('_SETTINGS_SITENAME',          'Nom du site');
+ define('_SETTINGS_SITEURL',           'URL du site (terminé par un /)');
+ define('_SETTINGS_ADMINURL',          'URL de la zone admin (terminé par un /)');
+ define('_SETTINGS_DIRS',              'Répertoires Nucleus');
+ define('_SETTINGS_MEDIADIR',          'Répertoire media');
+ define('_SETTINGS_SEECONFIGPHP',      '(voir config.php)');
+ define('_SETTINGS_MEDIAURL',          'URL du repertoire media (terminé par un /)');
+ define('_SETTINGS_ALLOWUPLOAD',               'Autoriser le téléchargement ascendant de fichier?');
+ define('_SETTINGS_ALLOWUPLOADTYPES',  'Indiquer les extensions de fichier autorisées');
+ define('_SETTINGS_CHANGELOGIN',               'Autoriser les participants à changer de login/mot de passe?');
+ define('_SETTINGS_COOKIES_TITLE',     'Paramètres des cookies');
+ define('_SETTINGS_COOKIELIFE',                'Durée de vie du cookie de connexion');
+ define('_SETTINGS_COOKIESESSION',     'Cookies de session');
+ define('_SETTINGS_COOKIEMONTH',               'Durée de vie d\'un mois');
+ define('_SETTINGS_COOKIEPATH',                'Chemin du cookie (utilisateur averti)');
+ define('_SETTINGS_COOKIEDOMAIN',      'Domaine du cookie (utilisateur averti)');
+ define('_SETTINGS_COOKIESECURE',      'Cookie de sécurité (utilisateur averti)');
+ define('_SETTINGS_LASTVISIT',         'Garder les cookies de la dernière visite');
+ define('_SETTINGS_ALLOWCREATE',               'Autoriser les visiteurs à créer un compte');
+ define('_SETTINGS_NEWLOGIN',          'Connexion autorisée pour les comptes créés par des utilisateurs');
+ define('_SETTINGS_NEWLOGIN2',         '(ne vaut que pour les comptes récemment créés)');
+ define('_SETTINGS_MEMBERMSGS',                'Autoriser les services de participant à participant');
+ define('_SETTINGS_LOCALE',            'Langue par défaut');
+ define('_SETTINGS_DISABLESITE',               'Désactiver le site');
+ define('_SETTINGS_DBLOGIN',           'mySQL Login &amp; Database');
+ define('_SETTINGS_UPDATE',            'Mettre à jour les réglages');
+ define('_SETTINGS_UPDATE_BTN',                'Mettre à jour');
+ define('_SETTINGS_DISABLEJS',         'Désactiver la barre d\'outils JavaScript');
+ define('_SETTINGS_MEDIA',             'Paramètres de téléchargement de médias');
+ define('_SETTINGS_MEDIAPREFIX',               'Préfixer le nom des fichiers avec la date');
+ define('_SETTINGS_MEMBERS',           'Réglages des participants');
+ // bans
+ define('_BAN_TITLE',                  'Liste des exclusions pour');
+ define('_BAN_NONE',                   'Pas d\'exclusion pour ce blog');
+ define('_BAN_NEW_TITLE',              'Ajouter une exclusion');
+ define('_BAN_NEW_TEXT',                       'Ajouter une exclusion maintenant');
+ define('_BAN_REMOVE_TITLE',           'Retirer une exclusion');
+ define('_BAN_IPRANGE',                        'Plage IP');
+ define('_BAN_BLOGS',                  'Quels blogs?');
+ define('_BAN_DELETE_TITLE',           'Supprimer une exclusion');
+ define('_BAN_ALLBLOGS',                       'Tous les blogs dont vous êtes administrateur.');
+ define('_BAN_REMOVED_TITLE',          'Exclusion supprimée');
+ define('_BAN_REMOVED_TEXT',           'L\'exclusion a été supprimée pour les blogs suivants:');
+ define('_BAN_ADD_TITLE',              'Définir des exclusions');
+ define('_BAN_IPRANGE_TEXT',           'Choisissez la plage IP que vous voulez bloquer. Moins il y aura de nombres, plus il y aura d\'IP bloquées.');
+ define('_BAN_BLOGS_TEXT',             'Vous pouvez choisir d\'exclure une IP pour un blog seulement ou pour tous ceux dont vous êtes admin. Choisissez ici.');
+ define('_BAN_REASON_TITLE',           'Motif');
+ define('_BAN_REASON_TEXT',            'Vous pouvez motiver l\'exclusion: La raison s\'affichera quand l\'IP concernée essaiera d\'ajouter un commentaire ou un vote. Longueur max. 256 caractères.');
+ define('_BAN_ADD_BTN',                        'Exclure');
+ // LOGIN screen
+ define('_LOGIN_MESSAGE',              'Message');
+ define('_LOGIN_SHARED',                       _LOGINFORM_SHARED);
+ define('_LOGIN_FORGOT',                       'Mot de passe oublié?');
+ // membermanagement
+ define('_MEMBERS_TITLE',              'Gestion des participants');
+ define('_MEMBERS_CURRENT',            'Participants actuels');
+ define('_MEMBERS_NEW',                        'Nouveau participant');
+ define('_MEMBERS_DISPLAY',            'Nom affiché');
+ define('_MEMBERS_DISPLAY_INFO',               '(C\'est le nom que vous utilisez pour vous connecter)');
+ define('_MEMBERS_REALNAME',           'Nom');
+ define('_MEMBERS_PWD',                        'Mot de passe');
+ define('_MEMBERS_REPPWD',             'Répéter le mot de passe');
+ define('_MEMBERS_EMAIL',              'Adresse email');
+ define('_MEMBERS_EMAIL_EDIT',         '(Quand vous changez d\'adresse email, un nouveau mot de passe est envoyé à cette adresse)');
+ define('_MEMBERS_URL',                        'Adresse du site (URL)');
+ define('_MEMBERS_SUPERADMIN',         'Privilèges de super admin');
+ define('_MEMBERS_CANLOGIN',           'Peut ouvrir une session comme admin');
+ define('_MEMBERS_NOTES',              'Notes');
+ define('_MEMBERS_NEW_BTN',            'Ajouter un participant');
+ define('_MEMBERS_EDIT',                       'Modifier les participants');
+ define('_MEMBERS_EDIT_BTN',           'Modifier');
+ define('_MEMBERS_BACKTOOVERVIEW',     'Retour au sommaire des participants');
+ define('_MEMBERS_LOCALE',             'Langue');
+ define('_MEMBERS_USESITELANG',                '- utiliser les réglages du site -');
+ // List of blogs (TT = tooltip)
+ define('_BLOGLIST_TT_VISIT',          'Visiter le site');
+ define('_BLOGLIST_ADD',                       'Ajouter un billet');
+ define('_BLOGLIST_TT_ADD',            'Ajouter un billet à ce blog');
+ define('_BLOGLIST_EDIT',              'Modifier/Supprimer les billets');
+ define('_BLOGLIST_TT_EDIT',           '');
+ define('_BLOGLIST_BMLET',             'Bookmarklet');
+ define('_BLOGLIST_TT_BMLET',          '');
+ define('_BLOGLIST_SETTINGS',          'Paramètres');
+ define('_BLOGLIST_TT_SETTINGS',               'Modifier réglages ou gérer équipe');
+ define('_BLOGLIST_BANS',              'Exclusions');
+ define('_BLOGLIST_TT_BANS',           'Consulter, ajouter ou supprimer les exclusions IP');
+ define('_BLOGLIST_DELETE',            'Tout effacer');
+ define('_BLOGLIST_TT_DELETE',         'Effacer ce blog');
+ // OVERVIEW screen
+ define('_OVERVIEW_YRBLOGS',           'Vos blogs');
+ define('_OVERVIEW_YRDRAFTS',          'Vos brouillons');
+ define('_OVERVIEW_YRSETTINGS',                'Vos réglages');
+ define('_OVERVIEW_GSETTINGS',         'Réglages d\'ensemble');
+ define('_OVERVIEW_NOBLOGS',           'Vous ne faites partie d\'aucune équipe');
+ define('_OVERVIEW_NODRAFTS',          'Pas  de brouillon');
+ define('_OVERVIEW_EDITSETTINGS',      'Modifier vos réglages...');
+ define('_OVERVIEW_BROWSEITEMS',               'Consulter vos billets...');
+ define('_OVERVIEW_BROWSECOMM',                'Consulter vos commentaires...');
+ define('_OVERVIEW_VIEWLOG',           'Consulter le journal des événements...');
+ define('_OVERVIEW_MEMBERS',           'Gérer les participants...');
+ define('_OVERVIEW_NEWLOG',            'Créer un nouveau blog...');
+ define('_OVERVIEW_SETTINGS',          'Modifier les réglages...');
+ define('_OVERVIEW_TEMPLATES',         'Modifier les modèles...');
+ define('_OVERVIEW_SKINS',             'Modifier les habillages...');
+ define('_OVERVIEW_BACKUP',            'Sauvegarde/Récupération...');
++>>>>>>> skinnable-master
  
  // ITEMLIST
 -define('_ITEMLIST_BLOG',              'Billets du blog'); 
 -define('_ITEMLIST_YOUR',              'Vos billets');
 +define('_ITEMLIST_BLOG',                      'Artikkelit blogiin'); 
 +define('_ITEMLIST_YOUR',                      'Artikkelisi');
  
  // Comments
++<<<<<<< HEAD
 +define('_COMMENTS',                                   'Kommentteja');
 +define('_NOCOMMENTS',                         'Ei kommentteja tähän artikkeliin');
 +define('_COMMENTS_YOUR',                      'Kommenttisi');
 +define('_NOCOMMENTS_YOUR',                    'Et ole kirjoittanut kommentteja');
 +
 +// LISTS (general)
 +define('_LISTS_NOMORE',                               'Ei enää hakuvastauksia tai ei hakuvastauksia ollenkaan');
 +define('_LISTS_PREV',                         'Edellinen');
 +define('_LISTS_NEXT',                         'Seuraava');
 +define('_LISTS_SEARCH',                               'Etsi');
 +define('_LISTS_CHANGE',                               'Muuta');
 +define('_LISTS_PERPAGE',                      'artikkelia/sivu');
 +define('_LISTS_ACTIONS',                      'Toiminnot');
 +define('_LISTS_DELETE',                               'Poista');
 +define('_LISTS_EDIT',                         'Muokkaa');
 +define('_LISTS_MOVE',                         'Siirrä');
 +define('_LISTS_CLONE',                                'Monista');
 +define('_LISTS_TITLE',                                'Otsikko');
 +define('_LISTS_BLOG',                         'Blogi');
 +define('_LISTS_NAME',                         'Nimi');
 +define('_LISTS_DESC',                         'Kuvaus');
 +define('_LISTS_TIME',                         'Päiväys');
 +define('_LISTS_COMMENTS',                     'Kommentit');
 +define('_LISTS_TYPE',                         'Tyyppi');
 +
 +
 +// member list 
 +define('_LIST_MEMBER_NAME',                   'Tunnus');
 +define('_LIST_MEMBER_RNAME',          'Oikea nimi');
 +define('_LIST_MEMBER_ADMIN',          'Ylijärjestelmänvalvoja? ');
 +define('_LIST_MEMBER_LOGIN',          'Voi kirjautua sisään? ');
 +define('_LIST_MEMBER_URL',                    'Verkkosivut');
++=======
+ define('_COMMENTS',                   'Commentaires');
+ define('_NOCOMMENTS',                 'Pas de commentaire pour ce billet');
+ define('_COMMENTS_YOUR',              'Vos commentaires');
+ define('_NOCOMMENTS_YOUR',            'Vous n\'avez pas écrit de commentaire');
+ // LISTS (general)
+ define('_LISTS_NOMORE',                       'Rien de plus ou pas de résultat du tout');
+ define('_LISTS_PREV',                 'Précédent');
+ define('_LISTS_NEXT',                 'Suivant');
+ define('_LISTS_SEARCH',                       'Rechercher');
+ define('_LISTS_CHANGE',                       'Changer');
+ define('_LISTS_PERPAGE',              'billets/page');
+ define('_LISTS_ACTIONS',              'Actions');
+ define('_LISTS_DELETE',                       'Supprimer');
+ define('_LISTS_EDIT',                 'Modifier');
+ define('_LISTS_MOVE',                 'Déplacer');
+ define('_LISTS_CLONE',                        'Dupliquer');
+ define('_LISTS_TITLE',                        'Titre');
+ define('_LISTS_BLOG',                 'Blog');
+ define('_LISTS_NAME',                 'Nom');
+ define('_LISTS_DESC',                 'Description');
+ define('_LISTS_TIME',                 'Heure');
+ define('_LISTS_COMMENTS',             'Commentaires');
+ define('_LISTS_TYPE',                 'Type');
+ // member list
+ define('_LIST_MEMBER_NAME',           'Nom affiché');
+ define('_LIST_MEMBER_RNAME',          'Nom');
+ define('_LIST_MEMBER_ADMIN',          'Super admin? ');
+ define('_LIST_MEMBER_LOGIN',          'Peut se connecter? ');
+ define('_LIST_MEMBER_URL',            'Site');
++>>>>>>> skinnable-master
  
  // banlist
 -define('_LIST_BAN_IPRANGE',           'Plage IP');
 -define('_LIST_BAN_REASON',            'Motif');
 +define('_LIST_BAN_IPRANGE',                   'IP-osoite');
 +define('_LIST_BAN_REASON',                    'Syy');
  
  // actionlist
 -define('_LIST_ACTION_MSG',            'Message');
 +define('_LIST_ACTION_MSG',                    'Viesti');
  
  // commentlist
++<<<<<<< HEAD
 +define('_LIST_COMMENT_BANIP',         'Estä IP');
 +define('_LIST_COMMENT_WHO',                   'Kirjoittaja');
 +define('_LIST_COMMENT',                               'Kommentti');
 +define('_LIST_COMMENT_HOST',          'Isäntäkone');
++=======
+ define('_LIST_COMMENT_BANIP',         'Exclure l\'IP');
+ define('_LIST_COMMENT_WHO',           'Auteur');
+ define('_LIST_COMMENT',                       'Commentaire');
+ define('_LIST_COMMENT_HOST',          'Hôte');
++>>>>>>> skinnable-master
  
  // itemlist
 -define('_LIST_ITEM_INFO',             'Info');
 -define('_LIST_ITEM_CONTENT',          'Titre et contenu');
 +define('_LIST_ITEM_INFO',                     'Info');
 +define('_LIST_ITEM_CONTENT',          'Otsikko ja teksti');
  
  
  // teamlist
 -define('_LIST_TEAM_ADMIN',            'Admin ');
 -define('_LIST_TEAM_CHADMIN',          'Changer l\'admin');
 +define('_LIST_TEAM_ADMIN',                    'Järjestelmänvalvoja ');
 +define('_LIST_TEAM_CHADMIN',          'Vaihda järjestelmänvalvoja');
  
  // edit comments
++<<<<<<< HEAD
 +define('_EDITC_TITLE',                                'Muokkaa kommentteja');
 +define('_EDITC_WHO',                          'Kirjoittaja');
 +define('_EDITC_HOST',                         'Mistä?');
 +define('_EDITC_WHEN',                         'Milloin?');
 +define('_EDITC_TEXT',                         'Teksti');
 +define('_EDITC_EDIT',                         'Muokkaa kommenttia');
 +define('_EDITC_MEMBER',                               'käyttäjä');
 +define('_EDITC_NONMEMBER',                    'ei-käyttäjä');
 +
 +// move item
 +define('_MOVE_TITLE',                         'Siirrä mihin blogiin?');
 +define('_MOVE_BTN',                                   'Siirrä artikkeli');
++=======
+ define('_EDITC_TITLE',                        'Modifier les commentaires');
+ define('_EDITC_WHO',                  'Auteur');
+ define('_EDITC_HOST',                 'D\'où?');
+ define('_EDITC_WHEN',                 'Quand?');
+ define('_EDITC_TEXT',                 'Contenu');
+ define('_EDITC_EDIT',                 'Modifier le commentaire');
+ define('_EDITC_MEMBER',                       'participant');
+ define('_EDITC_NONMEMBER',            'non participant');
+ // move item
+ define('_MOVE_TITLE',                 'Déplacer dans quel blog?');
+ define('_MOVE_BTN',                   'Déplacer le billet');
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: fr_Latn_FR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: fr_Latn_FR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: gl_Latn_ES.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: gl_Latn_ES.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -470,9 -545,6 +549,12 @@@ define('_MEDIA_COLLECTION_LABEL', 'Cole
  define('_ADD_ALIGNLEFT_TT',                   'Alinear á esquerda');
  define('_ADD_ALIGNRIGHT_TT',          'Alinear á derieta');
  define('_ADD_ALIGNCENTER_TT',         'Alinear ó centro');
++<<<<<<< HEAD
 +
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Incluir en búsquedas');
++=======
++>>>>>>> skinnable-master
  
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Erro ó subir');
@@@ -1,4 -1,4 +1,8 @@@
++<<<<<<< HEAD
 +<?
++=======
+ <?php
++>>>>>>> skinnable-master
  /**
   * Nucleus Translation File
   * Galician in Spain (Latin script)
@@@ -8,7 -8,7 +12,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: gl_Latn_ES.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: gl_Latn_ES.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -81,15 -162,15 +169,27 @@@ define('_EDITC_EMAIL',                           'E-mail')
  
  define('_MANAGER_PLUGINFILE_NOTFOUND',                                "Plugin %s was not loaded (File not found)");
  /* changed */
++<<<<<<< HEAD
 +// plugin dependency 
 +define('_ERROR_INSREQPLUGIN',         'Plugin installation failed, requires %s');
 +define('_ERROR_DELREQPLUGIN',         'Plugin deletion failed, required by %s');
 +
 +//define('_ADD_ADDLATER',                                                             'Add Later');
 +define('_ADD_ADDLATER',                                                               'Add the dates specified');
 +
 +define('_LOGIN_NAME',                         'Name:');
 +define('_LOGIN_PASSWORD',                     'Password:');
++=======
+ // plugin dependency
+ define('_ERROR_INSREQPLUGIN',                 'Instalacija plugina nije uspjela, potrebno je ');
+ define('_ERROR_DELREQPLUGIN',                 'Nije moguće ukloniti plugin, potrebno je ');
+ //define('_ADD_ADDLATER',                                                             'Add Later');
+ define('_ADD_ADDLATER',                                       'Dodaj kasnije');
+ define('_LOGIN_NAME',                                 'Korisničko ime');
+ define('_LOGIN_PASSWORD',                             'Zaporka');
++>>>>>>> skinnable-master
  
  // changed from _BOOKMARLET_BMARKLFOLLOW
  define('_BOOKMARKLET_BMARKFOLLOW',                                    ' (Works with nearly all browsers)');
@@@ -186,13 -267,7 +286,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -350,10 -425,6 +454,13 @@@ define('_ARCHIVETYPE_MONTH',                     'mjesec'
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                            'Neodgovarajući ili već iskorišteni kupon.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',                 'Instalacija plugina nije uspjela, potrebno je ');
 +define('_ERROR_DELREQPLUGIN',                 'Nije moguće ukloniti plugin, potrebno je ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',              'Cookie prefiks');
  
@@@ -756,7 -827,6 +863,10 @@@ define('_COMMENTFORM_YOUARE',                     'Vi ste
  define('_COMMENTFORM_SUBMIT',                 'Dodajte komentar');
  define('_COMMENTFORM_COMMENT',                'Vaš komentar');
  define('_COMMENTFORM_NAME',                           'Ime');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                           'E-mail/http');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Zapamti');
  
  // loginform
@@@ -783,7 -853,6 +893,10 @@@ define('_ADD_DISABLE_COMMENTS'
  define('_ADD_DRAFTNFUTURE',                           'Draft &amp; za kasnije postove');
  define('_ADD_ADDITEM',                                        'Dodaj post');
  define('_ADD_ADDNOW',                                 'Dodaj sada');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                       'Dodaj kasnije');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                                       'Kada dodati');
  define('_ADD_ADDDRAFT',                                       'Dodaj u draftove');
  define('_ADD_NOPASTDATES',                            '(raniji datumi i vrijeme ne mogu biti prihvaćeni, u slučaju njihovog odabira bit će uneseni trenutni datum i vrijeme.)');
@@@ -1128,8 -1197,6 +1241,11 @@@ define('_BAN_ADD_BTN',                                 'Postavi blo
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                              'Obavijest');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                                 'Korisničko ime');
 +define('_LOGIN_PASSWORD',                             'Zaporka');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                                       _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                                       'Zaboravili ste zaporku?');
  
@@@ -1260,3 -1327,19 +1376,22 @@@ define('_EDITC_NONMEMBER',                            'posjetit
  // move item
  define('_MOVE_TITLE',                                 'U koji blog prenijeti ovaj post?');
  define('_MOVE_BTN',                                           'Prenesi post');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -81,15 -162,15 +169,27 @@@ define('_EDITC_EMAIL',                           'E-mail')
  
  define('_MANAGER_PLUGINFILE_NOTFOUND',                                "Plugin %s was not loaded (File not found)");
  /* changed */
++<<<<<<< HEAD
 +// plugin dependency 
 +define('_ERROR_INSREQPLUGIN',         'Plugin installation failed, requires %s');
 +define('_ERROR_DELREQPLUGIN',         'Plugin deletion failed, required by %s');
 +
 +//define('_ADD_ADDLATER',                                                             'Add Later');
 +define('_ADD_ADDLATER',                                                               'Add the dates specified');
 +
 +define('_LOGIN_NAME',                         'Name:');
 +define('_LOGIN_PASSWORD',                     'Password:');
++=======
+ // plugin dependency
+ define('_ERROR_INSREQPLUGIN',                 'Instalacija plugina nije uspjela, potrebno je ');
+ define('_ERROR_DELREQPLUGIN',                 'Nije moguæe ukloniti plugin, potrebno je ');
+ //define('_ADD_ADDLATER',                                                             'Add Later');
+ define('_ADD_ADDLATER',                                       'Dodaj kasnije');
+ define('_LOGIN_NAME',                                 'Korisnièko ime');
+ define('_LOGIN_PASSWORD',                             'Zaporka');
++>>>>>>> skinnable-master
  
  // changed from _BOOKMARLET_BMARKLFOLLOW
  define('_BOOKMARKLET_BMARKFOLLOW',                                    ' (Works with nearly all browsers)');
@@@ -186,13 -267,7 +286,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -350,10 -425,6 +454,13 @@@ define('_ARCHIVETYPE_MONTH',                     'mjesec'
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                            'Neodgovarajuæi ili veæ iskori\9ateni kupon.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',                 'Instalacija plugina nije uspjela, potrebno je ');
 +define('_ERROR_DELREQPLUGIN',                 'Nije moguæe ukloniti plugin, potrebno je ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',              'Cookie prefiks');
  
@@@ -756,7 -827,6 +863,10 @@@ define('_COMMENTFORM_YOUARE',                     'Vi ste
  define('_COMMENTFORM_SUBMIT',                 'Dodajte komentar');
  define('_COMMENTFORM_COMMENT',                'Va\9a komentar');
  define('_COMMENTFORM_NAME',                           'Ime');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                           'E-mail/http');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Zapamti');
  
  // loginform
@@@ -783,7 -853,6 +893,10 @@@ define('_ADD_DISABLE_COMMENTS'
  define('_ADD_DRAFTNFUTURE',                           'Draft &amp; za kasnije postove');
  define('_ADD_ADDITEM',                                        'Dodaj post');
  define('_ADD_ADDNOW',                                 'Dodaj sada');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                       'Dodaj kasnije');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                                       'Kada dodati');
  define('_ADD_ADDDRAFT',                                       'Dodaj u draftove');
  define('_ADD_NOPASTDATES',                            '(raniji datumi i vrijeme ne mogu biti prihvaæeni, u sluèaju njihovog odabira bit æe uneseni trenutni datum i vrijeme.)');
@@@ -1128,8 -1197,6 +1241,11 @@@ define('_BAN_ADD_BTN',                                 'Postavi blo
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                              'Obavijest');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                                 'Korisnièko ime');
 +define('_LOGIN_PASSWORD',                             'Zaporka');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                                       _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                                       'Zaboravili ste zaporku?');
  
@@@ -1260,3 -1327,19 +1376,22 @@@ define('_EDITC_NONMEMBER',                            'posjetit
  // move item
  define('_MOVE_TITLE',                                 'U koji blog prenijeti ovaj post?');
  define('_MOVE_BTN',                                           'Prenesi post');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: hu_Latn_HU.ISO-8859-2.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: hu_Latn_HU.ISO-8859-2.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -351,10 -426,6 +430,13 @@@ define('_ARCHIVETYPE_MONTH',             'hónap')
  
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Hamis vagy lejárt címke.');
++<<<<<<< HEAD
 +
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Plugin installáció sikertelen, szükséges: ');
 +define('_ERROR_DELREQPLUGIN',         'Plugin törlése sikertelen, szükséges: ');
++=======
++>>>>>>> skinnable-master
  
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Süti elõtag');
@@@ -789,7 -859,6 +870,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Megje
  define('_ADD_DRAFTNFUTURE',                   'Piszkozat &amp; Jövõbeni elemek');
  define('_ADD_ADDITEM',                                'Elem hozzáadása');
  define('_ADD_ADDNOW',                         'Hozzáadás azonnal');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Hozzáadás késõbb');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Place on');
  define('_ADD_ADDDRAFT',                               'Hozzáadás a piszkozathoz');
  define('_ADD_NOPASTDATES',                    '(A régebbi dátum és idõ NEM érvényes, így ebben az esetben a mostani idõ lesz)');
@@@ -1133,8 -1202,6 +1217,11 @@@ define('_BAN_ADD_BTN',                         'Ban hozzáadá
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Üzenet');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Név');
 +define('_LOGIN_PASSWORD',                     'Jelszó');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Elfelejetted a jelszavad?');
  
@@@ -1266,3 -1333,19 +1353,22 @@@ define('_EDITC_NONMEMBER',                    'Nem tag')
  // move item
  define('_MOVE_TITLE',                         'Melyik blogba mozgassam?');
  define('_MOVE_BTN',                                   'Elem áthelyezése');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: hu_Latn_HU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: hu_Latn_HU.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -186,13 -267,7 +274,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -352,10 -427,6 +444,13 @@@ define('_ARCHIVETYPE_MONTH',             'bulan')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Tiket tidak sah atau kadaluarsa.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Instalasi Plugingagal, harus ada ');
 +define('_ERROR_DELREQPLUGIN',         'Menghapus Plugin gagal, dibutuhkan oleh ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Awalan Cookie');
  
@@@ -758,7 -829,6 +853,10 @@@ define('_COMMENTFORM_YOUARE',             'Anda ad
  define('_COMMENTFORM_SUBMIT',         'Tambahkan komentar');
  define('_COMMENTFORM_COMMENT',                'Komentar Anda');
  define('_COMMENTFORM_NAME',                   'Nama');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Ingat Saya');
  
  // loginform
@@@ -785,7 -855,6 +883,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Tida
  define('_ADD_DRAFTNFUTURE',                   'Draft &amp; Isi untuk nanti');
  define('_ADD_ADDITEM',                                'Tambahkan Isi');
  define('_ADD_ADDNOW',                         'Tambahkan Sekarang');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Tambahkan Nanti');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Taruh di');
  define('_ADD_ADDDRAFT',                               'Tambahkan ke draft');
  define('_ADD_NOPASTDATES',                    '(tanggal dan waktu di masa lampau tidak sah, waktu yang sekarang yang akan dipakai)');
@@@ -1129,8 -1198,6 +1230,11 @@@ define('_BAN_ADD_BTN',                         'Tambah dafta
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Pesan');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Nama');
 +define('_LOGIN_PASSWORD',                     'Password');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Lupa password Anda?');
  
@@@ -1262,3 -1329,19 +1366,22 @@@ define('_EDITC_NONMEMBER',                    'bukan ang
  // move item
  define('_MOVE_TITLE',                         'Pindahkan ke blog mana?');
  define('_MOVE_BTN',                                   'Pindahkan Isi');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -186,13 -267,7 +274,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -352,10 -427,6 +444,13 @@@ define('_ARCHIVETYPE_MONTH',             'bulan')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Tiket tidak sah atau kadaluarsa.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Instalasi Plugingagal, harus ada ');
 +define('_ERROR_DELREQPLUGIN',         'Menghapus Plugin gagal, dibutuhkan oleh ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Awalan Cookie');
  
@@@ -758,7 -829,6 +853,10 @@@ define('_COMMENTFORM_YOUARE',             'Anda ad
  define('_COMMENTFORM_SUBMIT',         'Tambahkan komentar');
  define('_COMMENTFORM_COMMENT',                'Komentar Anda');
  define('_COMMENTFORM_NAME',                   'Nama');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Ingat Saya');
  
  // loginform
@@@ -785,7 -855,6 +883,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Tida
  define('_ADD_DRAFTNFUTURE',                   'Draft &amp; Isi untuk nanti');
  define('_ADD_ADDITEM',                                'Tambahkan Isi');
  define('_ADD_ADDNOW',                         'Tambahkan Sekarang');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Tambahkan Nanti');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Taruh di');
  define('_ADD_ADDDRAFT',                               'Tambahkan ke draft');
  define('_ADD_NOPASTDATES',                    '(tanggal dan waktu di masa lampau tidak sah, waktu yang sekarang yang akan dipakai)');
@@@ -1129,8 -1198,6 +1230,11 @@@ define('_BAN_ADD_BTN',                         'Tambah dafta
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Pesan');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Nama');
 +define('_LOGIN_PASSWORD',                     'Password');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Lupa password Anda?');
  
@@@ -1262,3 -1329,19 +1366,22 @@@ define('_EDITC_NONMEMBER',                    'bukan ang
  // move item
  define('_MOVE_TITLE',                         'Pindahkan ke blog mana?');
  define('_MOVE_BTN',                                   'Pindahkan Isi');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: it_Latn_IT.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: it_Latn_IT.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -354,10 -429,6 +433,13 @@@ define('_ARCHIVETYPE_MONTH',             'mese')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Biglietto non valido o scaduto.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Installazione del plugin fallita, richiede ');
 +define('_ERROR_DELREQPLUGIN',         'Cancellazione del plugin fallita, è richiesto da ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Prefisso dei Cookie');
  
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: it_Latn_IT.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: it_Latn_IT.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The NucleusCMS Japan¥Á¡¼¥à
++<<<<<<< HEAD
 + * @version $Id: ja_Jpan_JP.EUC-JP.php 1868 2012-05-22 05:10:53Z sakamocchi $
 + */
 +
 +/********************************************
 + *        Start New for 4.0                *
++=======
+  * @version $Id: ja_Jpan_JP.EUC-JP.php 1887 2012-06-17 08:30:08Z sakamocchi $
+  */
+ /********************************************
+  *        Start New for 4.0                 *
++>>>>>>> skinnable-master
   ********************************************/
- define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
- define('_LISTS_AUTHOR', 'Ãø¼Ô');
- define('_OVERVIEW_OTHER_DRAFTS', '¤½¤Î¾¤Î¥É¥é¥Õ¥È');
-  
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'jpn_jpn');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'ǯ');
+ define('_LABEL_MONTH_UNIT',           '·î');
+ define('_LABEL_DAY_UNIT',             'Æü');
+ define('_LABEL_HOUR_UNIT',            '»þ');
+ define('_LABEL_MINUTE_UNIT',  'ʬ');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   '¥×¥é¥°¥¤¥ó¤òºï½ü¤¹¤ë¤È¤­¤Ë´ÉÍý¥¨¥ê¥¢ÍÑ¥¹¥­¥ó¤Î¥Ç¡¼¥¿¤âºï½ü¤·¤Þ¤¹¤«¡©');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         '´ÉÍýÎΰè¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥¹¥­¥ó');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          '¤¢¤Ê¤¿¤¬»È¤¦´ÉÍýÎΰè¤Î¥¹¥­¥ó');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         '´ÉÍý¥¨¥ê¥¢ÍÑÀßÄê');
+ define('_SKINABLEADMIN_PAGE_STR',                                     '¥Ú¡¼¥¸');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   '¥¢¥¤¥Æ¥à¤Î¥«¥Æ¥´¥ê°ÜÆ°/¥«¥Æ¥´¥ê¤Î¥Ö¥í¥°°ÜÆ°');
+ define('_SKINABLEADMIN_BATCH',                                                '¥Ð¥Ã¥Á½èÍý');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     '´ÉÍý¥Ú¡¼¥¸¤Î¥Ø¥Ã¥À');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     '´ÉÍý¥Ú¡¼¥¸¤Î¥Õ¥Ã¥¿');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     '¥Æ¥ó¥×¥ì¡¼¥È°ìÍ÷');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[¥µ¥¤¥È¤Î³Îǧ]¥ê¥ó¥¯');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'Á´ÈÌŪ¤Ë»ÈÍÑ');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' ¤Î¥Ø¥Ã¥À');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' ¤ÎËÜÂÎ');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' ¤Î¥Õ¥Ã¥¿');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' ¤ÎËÜÂÎ');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' ¤Î¥¿¥¤¥È¥ë');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' ´ÉÍý¼ÔÀßÄêÍÑ');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' Ä̾ï»ÅÍÍ');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' ¤Ç»ÈÍѤ¹¤ë¥¢¥¤¥³¥ó¤ÎURL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' ¤Ç»ÈÍѤ¹¤ë¥Ø¥ë¥×¥Õ¥¡¥¤¥ë¤ÎURL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' ¥¹¥­¥óÊÑ¿ô');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     '´ÉÍý¥¨¥ê¥¢¤Ç»ÈÍѤ¹¤ë¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      '°ìÍ÷ɽ¼¨Íѥơ¼¥Ö¥ë');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     '¥¯¥¤¥Ã¥¯¥á¥Ë¥å¡¼¤Ëɽ¼¨¤¹¤ë¥×¥é¥°¥¤¥ó¤Î´ÉÍý¥Ú¡¼¥¸¤Ø¤Î¥ê¥ó¥¯');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                '¥ª¥×¥·¥ç¥ó¥¿¥¤¥×%s¤Î¥Æ¥ó¥×¥ì¡¼¥È');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                '¥ª¥×¥·¥ç¥ó¡¦¥á¥¿¥Ç¡¼¥¿%s¤Î¥Æ¥ó¥×¥ì¡¼¥È');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    '»ÈÍѤ¹¤ë´ÉÍýÎΰè¤Î¥¹¥­¥ó');
+ define('_LOCALE_BG_CYRL_BG',  '¥Ö¥ë¥¬¥ê¥¢¸ì¡Ê¥Ö¥ë¥¬¥ê¥¢¡Ë');
+ define('_LOCALE_CA_LATN_ES',  '¥«¥¿¥ë¡¼¥Ë¥ã¸ì¡Ê¥¹¥Ú¥¤¥ó¡Ë');
+ define('_LOCALE_CS_LATN_CZ',  '¥Á¥§¥³¸ì¡Ê¥Á¥§¥³¡Ë');
+ define('_LOCALE_DE_LATN_DE',  '¥É¥¤¥Ä¸ì¡Ê¥É¥¤¥Ä¡Ë');
+ define('_LOCALE_EL_GREK_GR',  '¥®¥ê¥·¥ã¸ì¡Ê¥®¥ê¥·¥ã¡¢¥®¥ê¥·¥ãʸ»ú¡Ë');
+ define('_LOCALE_EN_LATN_US',  '±Ñ¸ì¡Ê¥¢¥á¥ê¥«¡Ë');
+ define('_LOCALE_ES_LATN_ES',  '¥¹¥Ú¥¤¥ó¸ì¡Ê¥¹¥Ú¥¤¥ó¡Ë');
+ define('_LOCALE_FA_ARAB_IR',  '¥Ú¥ë¥·¥ã¸ì¡Ê¥¤¥é¥ó¡Ë');
+ define('_LOCALE_FI_LATN_FI',  '¥Õ¥£¥ó¥é¥ó¥É¸ì¡Ê¥Õ¥£¥ó¥é¥ó¥É¡Ë');
+ define('_LOCALE_FR_LATN_FR',  '¥Õ¥é¥ó¥¹¸ì¡Ê¥Õ¥é¥ó¥¹¡Ë');
+ define('_LOCALE_GL_LATN_ES',  '¥¬¥ê¥·¥¢¸ì¡Ê¥¹¥Ú¥¤¥ó¡Ë');
+ define('_LOCALE_HR_LATN_HR',  '¥¯¥í¥¢¥Á¥¢¸ì¡Ê¥¯¥í¥¢¥Á¥¢¡Ë');
+ define('_LOCALE_HU_LATN_HU',  '¥Ï¥ó¥¬¥ê¡¼¸ì¡Ê¥Ï¥ó¥¬¥ê¡¼¡Ë');
+ define('_LOCALE_ID_LATN_ID',  '¥¤¥ó¥É¥Í¥·¥¢¸ì¡Ê¥¤¥ó¥É¥Í¥·¥¢¡¢¥é¥Æ¥óʸ»ú¡Ë');
+ define('_LOCALE_IT_LATN_IT',  '¥¤¥¿¥ê¥¢¸ì¡Ê¥¤¥¿¥ê¥¢¡Ë');
+ define('_LOCALE_JA_JPAN_JP',  'ÆüËܸì¡ÊÆüËÜ¡Ë');
+ define('_LOCALE_KO_KORE_KR',  '´Ú¹ñ¸ì¡Ê´Ú¹ñ¡Ë');
+ define('_LOCALE_KU_ARAB_TR',  '¥¯¥ë¥É¸ì¡Ê¥È¥ë¥³¡¢¥¢¥é¥Ó¥¢Ê¸»ú¡Ë');
+ define('_LOCALE_LV_LATN_LV',  '¥é¥È¥Ó¥¢¸ì¡Ê¥é¥È¥Ó¥¢¡Ë');
+ define('_LOCALE_NL_LATN_NL',  '¥ª¥é¥ó¥À¸ì¡Ê¥ª¥é¥ó¥À¡Ë');
+ define('_LOCALE_PL_LATN_PL',  '¥Ý¡¼¥é¥ó¥É¸ì¡Ê¥Ý¡¼¥é¥ó¥É¡Ë');
+ define('_LOCALE_PT_LATN_BR',  '¥Ý¥ë¥È¥¬¥ë¸ì¡Ê¥Ö¥é¥¸¥ë¡Ë');
+ define('_LOCALE_RO_LATN_RO',  '¥ë¡¼¥Þ¥Ë¥¢¸ì¡Ê¥ë¡¼¥Þ¥Ë¥¢¡Ë');
+ define('_LOCALE_RU_CYRL_RU',  '¥í¥·¥¢¸ì¡Ê¥í¥·¥¢¡Ë');
+ define('_LOCALE_SK_LATN_SK',  '¥¹¥í¥Ð¥­¥¢¸ì¡Ê¥¹¥í¥Ð¥­¥¢¡Ë');
+ define('_LOCALE_SR_CYRL_RS',  '¥»¥ë¥Ó¥¢¸ì¡Ê¥»¥ë¥Ó¥¢¡Ë');
+ define('_LOCALE_UR_ARAB_PK',  '¥¦¥ë¥É¥¥¡¼¸ì¡Ê¥Ñ¥­¥¹¥¿¥ó¡Ë');
+ define('_LOCALE_VI_LATN_VN',  '¥Ù¥È¥Ê¥à¸ì¡Ê¥Ù¥È¥Ê¥à¡¢¥é¥Æ¥óʸ»ú¡Ë');
+ define('_LOCALE_ZH_HANS_CN',  'Ãæ¹ñ¸ì¡ÊÃæ¹ñ¡¢´ÊÂλú¡Ë');
+ define('_LOCALE_ZH_HANT_TW',  'Ãæ¹ñ¸ì¡ÊÂæÏÑ¡¢ÈËÂλú¡Ë');
+ define('_FORGOTPASSWORD_TITLE',                               '¥Ñ¥¹¥ï¡¼¥É¤ò˺¤ì¤Þ¤·¤¿¤«¡©');
+ define('_FORGOTPASSWORD_MSG',                         '°Ê²¼¤Ë¥æ¡¼¥¶¡¼Ì¾¤È¥á¡¼¥ë¥¢¥É¥ì¥¹¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤¡£¿·¤·¤¤¥Ñ¥¹¥ï¡¼¥É¤òÀßÄꤹ¤ë¥Ú¡¼¥¸¤Ø¤Î¥ê¥ó¥¯¤ÎÆþ¤Ã¤¿¥á¡¼¥ë¤¬Á÷¿®¤µ¤ì¤Þ¤¹¡£');
+ define('_FORGOTPASSWORD_SUBMIT',                      'ǧ¾ÚÍÑ¥ê¥ó¥¯¤ÎÁ÷¿®');
+ define('_FORGOTPASSWORD_CONTACT',                     '¤â¤·¥æ¡¼¥¶¡¼Ì¾¤ò¤ªËº¤ì¤Ê¤é¡¢¤¢¤Ê¤¿¤ÎNucleus¥µ¥¤¥È´ÉÍý¼Ô¤ËÏ¢Íí¤·¤Æ¤¯¤À¤µ¤¤¡£');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Ãø¼Ô');
+ define('_OVERVIEW_OTHER_DRAFTS',                      '¤½¤Î¾¤Î¥É¥é¥Õ¥È');
+ define('_ERROR_BADADMINSKINNAME',                     '´ÉÍý²èÌÌÍÑ¥¹¥­¥ó̾¤ÏÀèƬ¤¬¡Öadmin/¡×¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£');
+ define('_ERROR_BADADMINTEMPLATENAME',         '´ÉÍý²èÌÌÍÑ¥¹¥­¥ó¤Î¥Æ¥ó¥×¥ì¡¼¥È̾¤ÏÀèƬ¤¬¡Öadmin/¡×¤Ç»Ï¤Þ¤Ã¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£');
+ define('_SETTINGS_ADMINSKIN',                         '¥Ç¥Õ¥©¥ë¥È¤Î´ÉÍý²èÌÌÍÑ¥¹¥­¥ó');
+ define('_SETTINGS_BKMKLTSKIN',                                '¥Ç¥Õ¥©¥ë¥È¤Î¥Ö¥Ã¥¯¥Þ¡¼¥¯¥ì¥Ã¥ÈÍÑ¥¹¥­¥ó');
+ define('_MEMBERS_BKMKLTSKIN',                         '»ÈÍѤ¹¤ë¥Ö¥Ã¥¯¥Þ¡¼¥¯¥ì¥Ã¥ÈÍѤΥ¹¥­¥ó');
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                '»ÈÍÑÃæ¤Î¥Ð¡¼¥¸¥ç¥ó¤ÏºÇ¿·¤Ç¤¹');
  /********************************************
   *        Start New for 3.64                *
   ********************************************/
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2009 The NucleusCMS Japanチーム
++<<<<<<< HEAD
 + * @version $Id: ja_Jpan_JP.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
 + */
 +
 +/********************************************
 + *        Start New for 4.0                *
++=======
+  * @version $Id: ja_Jpan_JP.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
+  */
+ /********************************************
+  *        Start New for 4.0                 *
++>>>>>>> skinnable-master
   ********************************************/
- define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
- define('_LISTS_AUTHOR', '著者');
- define('_OVERVIEW_OTHER_DRAFTS', 'その他のドラフト');
-  
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'jpn_jpn');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            '年');
+ define('_LABEL_MONTH_UNIT',           '月');
+ define('_LABEL_DAY_UNIT',             '日');
+ define('_LABEL_HOUR_UNIT',            '時');
+ define('_LABEL_MINUTE_UNIT',  '分');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'プラグインを削除するときに管理エリア用スキンのデータも削除しますか?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         '管理領域のデフォルトのスキン');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'あなたが使う管理領域のスキン');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         '管理エリア用設定');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'ページ');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'アイテムのカテゴリ移動/カテゴリのブログ移動');
+ define('_SKINABLEADMIN_BATCH',                                                'バッチ処理');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     '管理ページのヘッダ');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     '管理ページのフッタ');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'テンプレート一覧');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[サイトの確認]リンク');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         '全般的に使用');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' のヘッダ');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' の本体');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' のフッタ');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' の本体');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' のタイトル');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' 管理者設定用');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' 通常仕様');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' で使用するアイコンのURL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' で使用するヘルプファイルのURL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' スキン変数');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     '管理エリアで使用するセレクトボックス');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      '一覧表示用テーブル');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'クイックメニューに表示するプラグインの管理ページへのリンク');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'オプションタイプ%sのテンプレート');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'オプション・メタデータ%sのテンプレート');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    '使用する管理領域のスキン');
+ define('_LOCALE_BG_CYRL_BG',  'ブルガリア語(ブルガリア)');
+ define('_LOCALE_CA_LATN_ES',  'カタルーニャ語(スペイン)');
+ define('_LOCALE_CS_LATN_CZ',  'チェコ語(チェコ)');
+ define('_LOCALE_DE_LATN_DE',  'ドイツ語(ドイツ)');
+ define('_LOCALE_EL_GREK_GR',  'ギリシャ語(ギリシャ、ギリシャ文字)');
+ define('_LOCALE_EN_LATN_US',  '英語(アメリカ)');
+ define('_LOCALE_ES_LATN_ES',  'スペイン語(スペイン)');
+ define('_LOCALE_FA_ARAB_IR',  'ペルシャ語(イラン)');
+ define('_LOCALE_FI_LATN_FI',  'フィンランド語(フィンランド)');
+ define('_LOCALE_FR_LATN_FR',  'フランス語(フランス)');
+ define('_LOCALE_GL_LATN_ES',  'ガリシア語(スペイン)');
+ define('_LOCALE_HR_LATN_HR',  'クロアチア語(クロアチア)');
+ define('_LOCALE_HU_LATN_HU',  'ハンガリー語(ハンガリー)');
+ define('_LOCALE_ID_LATN_ID',  'インドネシア語(インドネシア、ラテン文字)');
+ define('_LOCALE_IT_LATN_IT',  'イタリア語(イタリア)');
+ define('_LOCALE_JA_JPAN_JP',  '日本語(日本)');
+ define('_LOCALE_KO_KORE_KR',  '韓国語(韓国)');
+ define('_LOCALE_KU_ARAB_TR',  'クルド語(トルコ、アラビア文字)');
+ define('_LOCALE_LV_LATN_LV',  'ラトビア語(ラトビア)');
+ define('_LOCALE_NL_LATN_NL',  'オランダ語(オランダ)');
+ define('_LOCALE_PL_LATN_PL',  'ポーランド語(ポーランド)');
+ define('_LOCALE_PT_LATN_BR',  'ポルトガル語(ブラジル)');
+ define('_LOCALE_RO_LATN_RO',  'ルーマニア語(ルーマニア)');
+ define('_LOCALE_RU_CYRL_RU',  'ロシア語(ロシア)');
+ define('_LOCALE_SK_LATN_SK',  'スロバキア語(スロバキア)');
+ define('_LOCALE_SR_CYRL_RS',  'セルビア語(セルビア)');
+ define('_LOCALE_UR_ARAB_PK',  'ウルドゥー語(パキスタン)');
+ define('_LOCALE_VI_LATN_VN',  'ベトナム語(ベトナム、ラテン文字)');
+ define('_LOCALE_ZH_HANS_CN',  '中国語(中国、簡体字)');
+ define('_LOCALE_ZH_HANT_TW',  '中国語(台湾、繁体字)');
+ define('_FORGOTPASSWORD_TITLE',                               'パスワードを忘れましたか?');
+ define('_FORGOTPASSWORD_MSG',                         '以下にユーザー名とメールアドレスを入力してください。新しいパスワードを設定するページへのリンクの入ったメールが送信されます。');
+ define('_FORGOTPASSWORD_SUBMIT',                      '認証用リンクの送信');
+ define('_FORGOTPASSWORD_CONTACT',                     'もしユーザー名をお忘れなら、あなたのNucleusサイト管理者に連絡してください。');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               '著者');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'その他のドラフト');
+ define('_ERROR_BADADMINSKINNAME',                     '管理画面用スキン名は先頭が「admin/」で始まっている必要があります。');
+ define('_ERROR_BADADMINTEMPLATENAME',         '管理画面用スキンのテンプレート名は先頭が「admin/」で始まっている必要があります。');
+ define('_SETTINGS_ADMINSKIN',                         'デフォルトの管理画面用スキン');
+ define('_SETTINGS_BKMKLTSKIN',                                'デフォルトのブックマークレット用スキン');
+ define('_MEMBERS_BKMKLTSKIN',                         '使用するブックマークレット用のスキン');
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                '使用中のバージョンは最新です');
  /********************************************
   *        Start New for 3.64                *
   ********************************************/
@@@ -9,7 -9,7 +9,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ko_Kore_KR.EUC-KR.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ko_Kore_KR.EUC-KR.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -9,7 -9,7 +9,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ko_Kore_KR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ko_Kore_KR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -187,13 -268,7 +275,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -352,10 -427,6 +444,13 @@@ define('_ARCHIVETYPE_MONTH',             'مانگ
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'كارتێكی ناچالاك یان به‌سه‌رچوو');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'دامه‌زراندنی پێوه‌كراوه‌ی پێویسته‌ ');
 +define('_ERROR_DELREQPLUGIN',         'پێوه‌كراوی سڕاوه‌ جێ‌به‌جی نه‌بووه‌');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'پرێفیكسی كووكیزه‌كان');
  
@@@ -758,7 -829,6 +853,10 @@@ define('_COMMENTFORM_YOUARE',             'تۆ ه
  define('_COMMENTFORM_SUBMIT',         'زیادكردنی بۆچوون');
  define('_COMMENTFORM_COMMENT',                'بۆچوونه‌كه‌ت');
  define('_COMMENTFORM_NAME',                   'ناو');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'پۆستی ئه‌لیكترۆنی یا وێبگه‌');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'به‌بیرم بهێنه‌وه‌');
  
  // loginform
@@@ -785,7 -855,6 +883,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Ù\86اÚ
  define('_ADD_DRAFTNFUTURE',                   'هه‌ڵگیراو &amp; بابه‌تی داهاتوو');
  define('_ADD_ADDITEM',                                'زیادكردنی بابه‌ت');
  define('_ADD_ADDNOW',                         'زیادكردن ئێستا');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'پاشان زیادكردن');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'ڕووبه‌ر بۆ');
  define('_ADD_ADDDRAFT',                               'زیادكردن بۆ هه‌ڵگیراوه‌كان');
  define('_ADD_NOPASTDATES',                    '(dates and times in the past are NOT valid, the current time will be used in that case)');
@@@ -1129,8 -1198,6 +1230,11 @@@ define('_BAN_ADD_BTN',                         'زیادكر
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'په‌یام');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'ناو');
 +define('_LOGIN_PASSWORD',                     'وشه‌ی تێپه‌ڕبوون');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'وشه‌ی تێپه‌ڕبوونت له‌بیركردوه‌؟');
  
@@@ -1263,4 -1330,18 +1367,22 @@@ define('_EDITC_NONMEMBER',                    'ئه‌ن
  define('_MOVE_TITLE',                         'بۆ كوێ ئه‌یگوازنه‌وه‌؟');
  define('_MOVE_BTN',                                   'گواستنه‌وه‌ی بابه‌ت');
  
++<<<<<<< HEAD
 +?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: lv_Latn_LV.ISO-8859-13.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: lv_Latn_LV.ISO-8859-13.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -470,9 -545,6 +549,12 @@@ define('_MEDIA_COLLECTION_LABEL', 'Paðr
  define('_ADD_ALIGNLEFT_TT',                   'Kreisajâ pusç');
  define('_ADD_ALIGNRIGHT_TT',          'Labajâ pusç');
  define('_ADD_ALIGNCENTER_TT',         'Iecentrçts');
++<<<<<<< HEAD
 +
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Pievienot meklçðanas indeksam');
++=======
++>>>>>>> skinnable-master
  
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Kïûdas rezultâtâ fails netika pievienots.');
@@@ -772,7 -844,6 +854,10 @@@ define('_COMMENTFORM_YOUARE',        'T
  define('_COMMENTFORM_SUBMIT',        'Komentçt');
  define('_COMMENTFORM_COMMENT',        'Tavs komentârs');
  define('_COMMENTFORM_NAME',            'Vârds');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',            'Epasts/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',        'Atcerçties mani turpmâk');
  
  // loginform
@@@ -799,7 -870,6 +884,10 @@@ define('_ADD_DISABLE_COMMENTS',        
  define('_ADD_DRAFTNFUTURE',            'Sagataves nâkotnei');
  define('_ADD_ADDITEM',                'Pievienot');
  define('_ADD_ADDNOW',                'Pievienot tagad');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                'Pievienot vçlâk');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                'Vieta');
  define('_ADD_ADDDRAFT',                'Pievienot sagatavçm');
  define('_ADD_NOPASTDATES',            '(pagâtnes datumi un laiki nav iespçjami, ðajâ gadîjumâ tiks lietots ðâbrîþa laiks)');
@@@ -1147,8 -1217,6 +1235,11 @@@ define('_BAN_ADD_BTN',                '
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',            'Ziòojums');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                'Vârds/nosaukums');
 +define('_LOGIN_PASSWORD',            'Parole');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                'Aizmirsâs parole?');
  
@@@ -1280,3 -1348,19 +1371,22 @@@ define('_EDITC_NONMEMBER',            '
  // move item
  define('_MOVE_TITLE',                'Uz kuru blogu?');
  define('_MOVE_BTN',                    'Pârvietot...');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: lv_Latn_LV.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: lv_Latn_LV.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -1,10 -1,8 +1,14 @@@
  <?php
  /**
-  * Nucleus Language File
+  * Nucleus CMS Translation File
+  * Dutch in Netherlands (Latin script)
   *
++<<<<<<< HEAD
 + * Nucleus CMS Translation File
 + * Dutch in Netherlands (Latin script)
 + *
++=======
++>>>>>>> skinnable-master
   * Updates:
   * Oct 7, 2005 - Translation fine-tuned and spellingcorrection by Errie (http://getverd.errie.com
   * - Nucleus v2.5-3.1 Norbert (beckerswna@yahoo.com)
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: nl_Latn_NL.ISO-8859-15.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: nl_Latn_NL.ISO-8859-15.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -353,10 -426,6 +436,13 @@@ define('_ARCHIVETYPE_MONTH',             'maand')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Ongeldig ticket.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Plugin kon niet geïnstalleerd worden: vereist ');
 +define('_ERROR_DELREQPLUGIN',         'Plugin kon niet verwijderd worden: vereist door ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Cookie Prefix');
  
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: nl_Latn_NL.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: nl_Latn_NL.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'plk_pol');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'Rok');
+ define('_LABEL_MONTH_UNIT',           'Miesiąc');
+ define('_LABEL_DAY_UNIT',             'Dzień');
+ define('_LABEL_HOUR_UNIT',            'Godzina');
+ define('_LABEL_MINUTE_UNIT',  'Minuta');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -208,13 -289,7 +296,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Błąd: plik wtyczki <strong>%s.php</strong> nie został załadowany, lub jest on nieaktywny ponieważ nie obsługuje niektórych funkcji (sprawdź <a href="?action=actionlog">logi</a>, żeby uzyskać więcej informacji.)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Rok');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Miesiąc');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Dzień');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Godzina');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minuta');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'Plik install.sql powinien zostać usunięty');
@@@ -413,10 -488,6 +505,13 @@@ define('_ARCHIVETYPE_MONTH',             'miesiąc
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Niewłaściwa lub przeterminowana sesja.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Instalacja pluginu nie powiodła się, wymaga ');
 +define('_ERROR_DELREQPLUGIN',         'Nie można usunąć pluginu, wymagany przez ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'prefix Cookie');
  
@@@ -822,7 -893,6 +917,10 @@@ define('_COMMENTFORM_YOUARE',             'Jesteś
  define('_COMMENTFORM_SUBMIT',         'Dodaj komentarz');
  define('_COMMENTFORM_COMMENT',                'Twój komentarz');
  define('_COMMENTFORM_NAME',                   'Nazwa');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Zapamiętaj mnie');
  
  // loginform
@@@ -849,7 -919,6 +947,10 @@@ define('_ADD_DISABLE_COMMENTS',           'WyÅ\82Ä
  define('_ADD_DRAFTNFUTURE',                   'Wykorzystuj do późniejszej publikacji');
  define('_ADD_ADDITEM',                                'Dodaj element');
  define('_ADD_ADDNOW',                         'Dodaj teraz');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Dodaj później');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Rozpocznij wyświetlanie');
  define('_ADD_ADDDRAFT',                               'Dodaj do brudnopisu');
  define('_ADD_NOPASTDATES',                    '(minione daty lub godziny nie będą akceptowane zamiast nich wyświetlony będzie czas rzeczywisty.)');
@@@ -1193,8 -1262,6 +1294,11 @@@ define('_BAN_ADD_BTN',                         'Dodaj blkoka
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Wiadomość');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Login');
 +define('_LOGIN_PASSWORD',                     'Hasło');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Zapomniałeś hasła?');
  
@@@ -1327,4 -1394,18 +1431,22 @@@ define('_EDITC_NONMEMBER',                    'odwiedzaj
  define('_MOVE_TITLE',                         'Do którego bloga przenieść ten wpis?');
  define('_MOVE_BTN',                                   'Przenieś wpis');
  
++<<<<<<< HEAD
 +?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: pt_Latn_BR.ISO-8859-1.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: pt_Latn_BR.ISO-8859-1.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -756,7 -828,6 +832,10 @@@ define('_COMMENTFORM_YOUARE',             'Você es
  define('_COMMENTFORM_SUBMIT',         'Envia');
  define('_COMMENTFORM_COMMENT',                'Seu comentário');
  define('_COMMENTFORM_NAME',                   'Nome');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail ou site');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'auto-completar na próxima visita');
  
  // loginform
@@@ -8,7 -8,7 +8,11 @@@
   *
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: pt_Latn_BR.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: pt_Latn_BR.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -94,9 -175,6 +182,12 @@@ define('_ERROR_DELREQPLUGIN',              'Plugin 
  //define('_ADD_ADDLATER',                                                             'Add Later');
  define('_ADD_ADDLATER',                                                               'Add the dates specified');
  
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Name:');
 +define('_LOGIN_PASSWORD',                     'Password:');
 +
++=======
++>>>>>>> skinnable-master
  // changed from _BOOKMARLET_BMARKLFOLLOW
  define('_BOOKMARKLET_BMARKFOLLOW',                                    ' (Works with nearly all browsers)');
  // END changed/added after 3.33 END
@@@ -192,13 -270,7 +283,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -357,10 -429,6 +452,13 @@@ define('_ARCHIVETYPE_MONTH',             'luna')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Tichetul nu este valid sau este expirat.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Instalarea pluginului a esuat, necesita ');
 +define('_ERROR_DELREQPLUGIN',         'Stergerea pluginului a esuat, folosit de ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Prefixul Cookieului');
  
@@@ -482,9 -550,6 +580,12 @@@ define('_ADD_ALIGNLEFT_TT',               'Aliniaza 
  define('_ADD_ALIGNRIGHT_TT',          'Aliniaza la dreapta');
  define('_ADD_ALIGNCENTER_TT',         'Centreaza');
  
++<<<<<<< HEAD
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                       'Include in cautare');
 +
++=======
++>>>>>>> skinnable-master
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Descarcare esuata');
  
@@@ -767,7 -832,6 +868,10 @@@ define('_COMMENTFORM_YOUARE',             'Sunteti
  define('_COMMENTFORM_SUBMIT',         'Adaugati un comentariu');
  define('_COMMENTFORM_COMMENT',                'Comentariul Dvs');
  define('_COMMENTFORM_NAME',           'Nume');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',           'Email/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Tine minte numele');
  
  // loginform
@@@ -794,7 -858,6 +898,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Inter
  define('_ADD_DRAFTNFUTURE',           'Ciorne &amp; articole viitoare');
  define('_ADD_ADDITEM',                        'Adauga un articol');
  define('_ADD_ADDNOW',                 'Adauga acum');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                       'Adauga mai tarziu');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                       'Datat: ');
  define('_ADD_ADDDRAFT',                       'Adaugati la ciorne');
  define('_ADD_NOPASTDATES',            '(Datele si orele nu sunt valide, deci va fi utilizata data de azi)');
@@@ -1272,4 -1335,18 +1379,22 @@@ define('_EDITC_NONMEMBER',            'vizitator'
  define('_MOVE_TITLE',                 'Deplasare in care blog?');
  define('_MOVE_BTN',                   'Deplasare articol');
  
++<<<<<<< HEAD
 +?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -94,9 -175,6 +182,12 @@@ define('_ERROR_DELREQPLUGIN',              'Plugin 
  //define('_ADD_ADDLATER',                                                             'Add Later');
  define('_ADD_ADDLATER',                                                               'Add the dates specified');
  
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Name:');
 +define('_LOGIN_PASSWORD',                     'Password:');
 +
++=======
++>>>>>>> skinnable-master
  // changed from _BOOKMARLET_BMARKLFOLLOW
  define('_BOOKMARKLET_BMARKFOLLOW',                                    ' (Works with nearly all browsers)');
  // END changed/added after 3.33 END
@@@ -192,13 -270,7 +283,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -357,10 -429,6 +452,13 @@@ define('_ARCHIVETYPE_MONTH',             'luna')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Tichetul nu este valid sau este expirat.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Instalarea pluginului a esuat, necesita ');
 +define('_ERROR_DELREQPLUGIN',         'Stergerea pluginului a esuat, folosit de ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Prefixul Cookieului');
  
@@@ -482,9 -550,6 +580,12 @@@ define('_ADD_ALIGNLEFT_TT',               'Aliniaza 
  define('_ADD_ALIGNRIGHT_TT',          'Aliniaza la dreapta');
  define('_ADD_ALIGNCENTER_TT',         'Centreaza');
  
++<<<<<<< HEAD
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                       'Include in cautare');
 +
++=======
++>>>>>>> skinnable-master
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Descarcare esuata');
  
@@@ -767,7 -832,6 +868,10 @@@ define('_COMMENTFORM_YOUARE',             'Sunteti
  define('_COMMENTFORM_SUBMIT',         'Adaugati un comentariu');
  define('_COMMENTFORM_COMMENT',                'Comentariul Dvs');
  define('_COMMENTFORM_NAME',           'Nume');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',           'Email/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Tine minte numele');
  
  // loginform
@@@ -794,7 -858,6 +898,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Inter
  define('_ADD_DRAFTNFUTURE',           'Ciorne &amp; articole viitoare');
  define('_ADD_ADDITEM',                        'Adauga un articol');
  define('_ADD_ADDNOW',                 'Adauga acum');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                       'Adauga mai tarziu');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                       'Datat: ');
  define('_ADD_ADDDRAFT',                       'Adaugati la ciorne');
  define('_ADD_NOPASTDATES',            '(Datele si orele nu sunt valide, deci va fi utilizata data de azi)');
@@@ -1272,4 -1335,18 +1379,22 @@@ define('_EDITC_NONMEMBER',            'vizitator'
  define('_MOVE_TITLE',                 'Deplasare in care blog?');
  define('_MOVE_BTN',                   'Deplasare articol');
  
++<<<<<<< HEAD
 +?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ru_Cyrl_RU.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ru_Cyrl_RU.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: ru_Cyrl_RU.WINDOWS-1251.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: ru_Cyrl_RU.WINDOWS-1251.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -355,10 -430,6 +434,13 @@@ define('_ARCHIVETYPE_MONTH',             'ìåñÿö')
  
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'Íåïðàâèëüíàÿ èëè èñïîëüçóåìàÿ ïîâòîðíî ññûëêà.');
++<<<<<<< HEAD
 +
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'Îøèáêà ïðè óñòàíîâêå ïëàãèíà, òðåáóåòñÿ ');
 +define('_ERROR_DELREQPLUGIN',         'Íå óäàëîñü âûïîëíèòü óäàëåíèå ïëàãèíà, òðåáóåòñÿ ');
++=======
++>>>>>>> skinnable-master
  
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'Ïðåôèêñ Cookie');
@@@ -766,7 -837,6 +848,10 @@@ define('_COMMENTFORM_YOUARE',             'Âû')
  define('_COMMENTFORM_SUBMIT',         'Êîììåíòèðîâàòü!');
  define('_COMMENTFORM_COMMENT',                'Âàø êîììåíòàðèé');
  define('_COMMENTFORM_NAME',                   'Èìÿ');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Çàïîìíèòü ìåíÿ');
  
  // loginform
@@@ -793,7 -863,6 +878,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Âûêëþ
  define('_ADD_DRAFTNFUTURE',                   '×åðíîâèêè &amp; Áóäóùèå ñîîáøåíèÿ');
  define('_ADD_ADDITEM',                                'Äîáàâèòü ñîîáùåíèå');
  define('_ADD_ADDNOW',                         'Äîáàâèòü ñåé÷àñ');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Äîáàâèòü ïîçæå');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Âûáåðèòå äàòó');
  define('_ADD_ADDDRAFT',                               'Äîáàâèòü â ÷åðíîâèêè');
  define('_ADD_NOPASTDATES',                    '(äàòà è âðåìÿ â ïðîøëîì íåäåéñòâèòåëüíû, áóäóò èñïîëüçîâàíî òåêóùåå âðåìÿ)');
@@@ -1137,8 -1206,6 +1225,11 @@@ define('_BAN_ADD_BTN',                         'Óñòàíîâèòü á
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Ñîîáùåíèå');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Èìÿ');
 +define('_LOGIN_PASSWORD',                     'Ïàðîëü');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Âñïîìíèòü ïàðîëü');
  
@@@ -1270,3 -1337,19 +1361,22 @@@ define('_EDITC_NONMEMBER',                    'ãîñòü')
  // move item
  define('_MOVE_TITLE',                         'Âûáåðèòå ðàçäåë äëÿ ïåðåìåùåíèÿ');
  define('_MOVE_BTN',                                   'Ïåðåìåñòèòü ñîîáùåíèå');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: sk_Latn_SK.ISO-8859-2.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: sk_Latn_SK.ISO-8859-2.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -470,9 -545,6 +549,12 @@@ define('_MEDIA_COLLECTION_LABEL', 'Aktu
  define('_ADD_ALIGNLEFT_TT',                   'Zarovna» doµava');
  define('_ADD_ALIGNRIGHT_TT',          'Zarovna» doprava');
  define('_ADD_ALIGNCENTER_TT',         'Zarovna» na stred');
++<<<<<<< HEAD
 +
 +// searchable blog setting (yes/no)
 +define('_EBLOG_SEARCH',                               'Zahrnú» do hµadania');
++=======
++>>>>>>> skinnable-master
  
  // generic upload failure
  define('_ERROR_UPLOADFAILED',         'Nahrávanie zlyhalo');
@@@ -760,7 -832,6 +842,10 @@@ define('_COMMENTFORM_YOUARE',             'Ste')
  define('_COMMENTFORM_SUBMIT',         'Prida» komentár');
  define('_COMMENTFORM_COMMENT',                'Vá¹ komentár');
  define('_COMMENTFORM_NAME',                   'Meno');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                   'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Pamätaj si mna');
  
  // loginform
@@@ -787,7 -858,6 +872,10 @@@ define('_ADD_DISABLE_COMMENTS',           'Zakáz
  define('_ADD_DRAFTNFUTURE',                   'Koncepty a èlánky pre neskor¹ie publikovanie');
  define('_ADD_ADDITEM',                                'Prida» èlánok');
  define('_ADD_ADDNOW',                         'Prida» teraz');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'Prida» neskôr');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'Umiestni» na');
  define('_ADD_ADDDRAFT',                               'Prida» medzi koncepty');
  define('_ADD_NOPASTDATES',                    '(dátumy a èasy v minulosti NIE SÚ platné, v tom prípade bude pou¾itý aktuálny èas)');
@@@ -1131,8 -1201,6 +1219,11 @@@ define('_BAN_ADD_BTN',                         'Prida» obmed
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'Správa');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'Meno');
 +define('_LOGIN_PASSWORD',                     'Heslo');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'Zabudli ste heslo?');
  
@@@ -1264,3 -1332,19 +1355,22 @@@ define('_EDITC_NONMEMBER',                    'nie je èl
  // move item
  define('_MOVE_TITLE',                         'Presunú» do akého blogu?');
  define('_MOVE_BTN',                                   'Presunú» èlánok');
++<<<<<<< HEAD
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: sk_Latn_SK.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: sk_Latn_SK.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -186,13 -267,7 +274,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -350,10 -425,6 +442,13 @@@ define('_ARCHIVETYPE_MONTH',                     'mesec')
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                            'Neodgovarajući ili već iskorišćeni kupon.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',                 'Instalacija plugina nije uspela, potrebno je ');
 +define('_ERROR_DELREQPLUGIN',                 'Nije uspelo brisanje plugina, potrebno je ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',              'Cookie prefiks');
  
@@@ -756,7 -827,6 +851,10 @@@ define('_COMMENTFORM_YOUARE',                     'Vi ste
  define('_COMMENTFORM_SUBMIT',                 'Dodajte komentar');
  define('_COMMENTFORM_COMMENT',                'Vaš komentar');
  define('_COMMENTFORM_NAME',                           'Ime');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                           'E-mail/http');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',               'Zapamti me');
  
  // loginform
@@@ -783,7 -853,6 +881,10 @@@ define('_ADD_DISABLE_COMMENTS'
  define('_ADD_DRAFTNFUTURE',                   'Skica &amp; za kasnije postove');
  define('_ADD_ADDITEM',                                        'Dodaj post');
  define('_ADD_ADDNOW',                                 'Dodaj sada');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                       'Dodaj kasnije');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                                       'Postavi na');
  define('_ADD_ADDDRAFT',                                       'Dodaj u skice');
  define('_ADD_NOPASTDATES',                            '(raniji datumi i vreme NISU važeći, u slučaju njihovog odabira bit će unešeni trenutni datum i vreme.)');
@@@ -1128,8 -1197,6 +1229,11 @@@ define('_BAN_ADD_BTN',                                 'Postavi blo
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                              'Poruka');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                                 'Korisničko ime');
 +define('_LOGIN_PASSWORD',                             'Lozinka');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                                       _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                                       'Zaboravili ste lozinku?');
  
@@@ -1261,4 -1328,18 +1365,22 @@@ define('_EDITC_NONMEMBER',                            'posetila
  define('_MOVE_TITLE',                                 'U koji blog preneti ovaj post?');
  define('_MOVE_BTN',                                           'Prenesi post');
  
- ?>
++<<<<<<< HEAD
++?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -186,13 -267,7 +274,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -351,10 -426,6 +443,13 @@@ define('_ARCHIVETYPE_MONTH',             'مہین
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                    'نا موزوں یا ختم شدہ ٹکٹ.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',         'پلگ ان کی تنصیب ناکام ہوگئی، درکار ہے ');
 +define('_ERROR_DELREQPLUGIN',         'پلگ ان حذف کرنا ناکام ہوگیا، درکار از ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',      'کوکی پریفکس');
  
@@@ -783,7 -854,6 +878,10 @@@ define('_ADD_DISABLE_COMMENTS',           'تبØ
  define('_ADD_DRAFTNFUTURE',                   'مسودے &amp; مستقبل کے عناصر');
  define('_ADD_ADDITEM',                                'عنصر شامل کریں');
  define('_ADD_ADDNOW',                         'ابھی شامل کریں');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                               'بعد میں شامل کریں');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                               'لگائیں');
  define('_ADD_ADDDRAFT',                               'مسودوں میں شامل کریں');
  define('_ADD_NOPASTDATES',                    '(ماضی کی تاریخیں اور وقت موزوں نہیں، اس صورت میں حالیہ وقت استعمال کی جائے گا)');
@@@ -1127,8 -1197,6 +1225,11 @@@ define('_BAN_ADD_BTN',                         'بÛ\8cÙ\86 Ø´Ø§Ù
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                      'پیغام');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                         'نام');
 +define('_LOGIN_PASSWORD',                     'پاس ورڈ');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                               _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                               'پاس ورڈ بھول گئے؟');
  
@@@ -1261,4 -1329,18 +1362,22 @@@ define('_EDITC_NONMEMBER',                    'غیر ر
  define('_MOVE_TITLE',                         'کس بلاگ میں منتقل کیا جائے؟');
  define('_MOVE_BTN',                                   'عنصر منتقل کریں');
  
++<<<<<<< HEAD
 +?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 4.0                 *
   ********************************************/
++<<<<<<< HEAD
 +define('_SKINIE_INVALID_NAMES_DETECTED', 'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
 +define('_LISTS_AUTHOR', 'Author');
 +define('_OVERVIEW_OTHER_DRAFTS', 'Other Drafts');
 + 
++=======
+ /* argument value for setlocale() in Microsoft's windows operating system */
+ define('_LOCALE_IN_WINDOWS',  'C');
+ /* labels for date and time measurement unit */
+ define('_LABEL_YEAR_UNIT',            'year');
+ define('_LABEL_MONTH_UNIT',           'month');
+ define('_LABEL_DAY_UNIT',             'day');
+ define('_LABEL_HOUR_UNIT',            'hour');
+ define('_LABEL_MINUTE_UNIT',  'minute');
+ // SkinableAdminArea vars
+ define('_SKINABLEADMIN_DEL_UNINSTALL_DATA',                   'Delete ADMIN skin data table on uninstall?');
+ define('_SKINABLEADMIN_DEFAULT_SKIN',                         'Choose a skin of the management area of the default.');
+ define('_SKINABLEADMIN_MEMBER_DEFAULT_SKIN',          'Choose a skin of the management area of you use.');
+ define('_SKINABLEADMIN_QMENU_LAYOUT',                         'Admin layout');
+ define('_SKINABLEADMIN_PAGE_STR',                                     'page');
+ define('_SKINABLEADMIN_BATCH_MOVE',                                   'Item move other category/Category move other blog');
+ define('_SKINABLEADMIN_BATCH',                                                'batch');
+ define('_SKINABLEADMIN_PAGEHEAD',                                     'Admin page head');
+ define('_SKINABLEADMIN_PAGEFOOT',                                     'Admin page foot');
+ define('_SKINABLEADMIN_TEMPLATEOVERVIEW',                     'Template overview');
+ define('_SKINABLEADMIN_ADMINAREAHEADLINK',                    '[Your site]link');
+ define('_SKINABLEADMIN_TPLSETTING_INGENERAL',         'In general');
+ define('_SKINABLEADMIN_HEAD_STR',                                     ' head');
+ define('_SKINABLEADMIN_BODY_STR',                                     ' body');
+ define('_SKINABLEADMIN_FOOT_STR',                                     ' foot');
+ define('_SKINABLEADMIN_TEXT_STR',                                     ' text');
+ define('_SKINABLEADMIN_TITLE_STR',                                    ' title');
+ define('_SKINABLEADMIN_ADMINSETTING_STR',                     ' set editmember is \'admin\'');
+ define('_SKINABLEADMIN_NORMALSETTING_STR',                    ' normal');
+ define('_SKINABLEADMIN_HELPICONURL_STR',                      ' icon URL');
+ define('_SKINABLEADMIN_HELPFILEURL_STR',                      ' help file URL');
+ define('_SKINABLEADMIN_ADMINSKINVAR_STR',                     ' skinvars');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_SELECT',     'selectbox used in ADMIN area');
+ define('_SKINABLEADMIN_SHOWLIST_LISTPLUG_TABLE',      'Table for list indication');
+ define('_SKINABLEADMIN_PLUGIN_QUICKMENU',                     'Link to admin page of the plugin shown to the quick-menu');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTTYPE',                'Template for option-type %s');
+ define('_SKINABLEADMIN_PLUGIN_PLGOPT_OPTMETA',                'Template for option-meta-data %s');
+ define('_SKINABLEADMIN_MEMBERS_ADMINSKIN',                    "ADMIN-Area's skin");
+ define('_LOCALE_BG_CYRL_BG',  'Bulgarian in Bulgaria');
+ define('_LOCALE_CA_LATN_ES',  'Catalan in Spain');
+ define('_LOCALE_CS_LATN_CZ',  'Czech in Czech Republic');
+ define('_LOCALE_DE_LATN_DE',  'German in Germany');
+ define('_LOCALE_EL_GREK_GR',  'Greek in Greece (Greek script) (Greek script)');
+ define('_LOCALE_EN_LATN_US',  'English in United States');
+ define('_LOCALE_ES_LATN_ES',  'Spanish in Spain');
+ define('_LOCALE_FA_ARAB_IR',  'Persian in Islamic Republic of Iran');
+ define('_LOCALE_FI_LATN_FI',  'Finnish in Finland');
+ define('_LOCALE_FR_LATN_FR',  'French in France');
+ define('_LOCALE_GL_LATN_ES',  'Galician in Spain');
+ define('_LOCALE_HR_LATN_HR',  'Croatian in Croatia');
+ define('_LOCALE_HU_LATN_HU',  'Hungarian in Hungary');
+ define('_LOCALE_ID_LATN_ID',  'Indonesian in Indonesia (Latin script)');
+ define('_LOCALE_IT_LATN_IT',  'Italian in Italy');
+ define('_LOCALE_JA_JPAN_JP',  'Japanese in Japan');
+ define('_LOCALE_KO_KORE_KR',  'Korean in Korea');
+ define('_LOCALE_KU_ARAB_TR',  'Kurdish in Turkey (Arabic script)');
+ define('_LOCALE_LV_LATN_LV',  'Latvian in Latvia');
+ define('_LOCALE_NL_LATN_NL',  'Dutch in Netherlands');
+ define('_LOCALE_PL_LATN_PL',  'Polish in Poland');
+ define('_LOCALE_PT_LATN_BR',  'Portuguese in Brazil');
+ define('_LOCALE_RO_LATN_RO',  'Romainan in Romania');
+ define('_LOCALE_RU_CYRL_RU',  'Russian in Russia');
+ define('_LOCALE_SK_LATN_SK',  'Slovak in Slovakia');
+ define('_LOCALE_SR_CYRL_RS',  'Serbian in Serbia');
+ define('_LOCALE_UR_ARAB_PK',  'Urdu in Pakistan');
+ define('_LOCALE_VI_LATN_VN',  'Vietnamese in Vietnam (Latin script)');
+ define('_LOCALE_ZH_HANS_CN',  'Chinese in China (simplified script)');
+ define('_LOCALE_ZH_HANT_TW',  'Chinese in Taiwan (Traditional script)');
+ define('_FORGOTPASSWORD_TITLE',                               'Forgot your password?');
+ define('_FORGOTPASSWORD_MSG',                         'Enter your username and email address below, and you\'ll be sent an e-mail with a link where you can choose a new password.');
+ define('_FORGOTPASSWORD_SUBMIT',                      'Send Activation Link" class="transparent');
+ define('_FORGOTPASSWORD_CONTACT',                     'If you don\'t remember your exact username, contact the site administrator.');
+ define('_SKINIE_INVALID_NAMES_DETECTED',      'Invalid skin or templates names detected. Valid names consist of only a-z, A-Z, 0-9, -, and _'); 
+ define('_LISTS_AUTHOR',                                               'Author');
+ define('_OVERVIEW_OTHER_DRAFTS',                      'Other Drafts');
+ define('_ERROR_BADADMINSKINNAME',                     'the name of skin for admin area must start with \'admin/\'.');
+ define('_ERROR_BADADMINTEMPLATENAME',         'the name of template for admin area must start with \'admin/\'.');
+ define('_SETTINGS_ADMINSKIN',                         'default skin for admin area');
+ define('_SETTINGS_BKMKLTSKIN',                                'default skin for bookmarklet');
+ define('_MEMBERS_BKMKLTSKIN',                         "bookmarklet skin");
+ define('_ADMIN_SYSTEMOVERVIEW_VERSION_LATEST',                'The version which is being used is latest.');
++>>>>>>> skinnable-master
  /********************************************
   *        Start New for 3.6x                *
   ********************************************/
@@@ -186,13 -267,7 +274,17 @@@ define('_PLUGIN_OPTIONS_TITLE',                                                  '
  // Plugin file loda error
  define('_PLUGINFILE_COULDNT_BELOADED',                                'Error: plugin file <strong>%s.php</strong> could not be loaded, or it has been set inactive because it does not support some features (check the <a href="?action=actionlog">actionlog</a> for more info)');
  
++<<<<<<< HEAD
 +//ITEM add/edit template (for japanese only)
 +define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
 +define('_ITEM_ADDEDITTEMPLATE_YEAR',                          'Year');
 +define('_ITEM_ADDEDITTEMPLATE_MONTH',                         'Month');
 +define('_ITEM_ADDEDITTEMPLATE_DAY',                                   'Day');
 +define('_ITEM_ADDEDITTEMPLATE_HOUR',                          'Hour');
 +define('_ITEM_ADDEDITTEMPLATE_MINUTE',                                'Minute');
++=======
+ define('_ITEM_ADDEDITTEMPLATE_FORMAT',                                'Format :');
++>>>>>>> skinnable-master
  
  // Errors
  define('_ERRORS_INSTALLSQL',                                          'install.sql should be deleted');
@@@ -351,10 -426,6 +443,13 @@@ define('_ARCHIVETYPE_MONTH'
  // tickets (prevents malicious users to trick an admin to perform actions he doesn't want)
  define('_ERROR_BADTICKET',                        'Invalid or expired ticket.');
  
++<<<<<<< HEAD
 +// plugin dependency
 +define('_ERROR_INSREQPLUGIN',                'Lỗi cài đặt plugin, cần có:');
 +define('_ERROR_DELREQPLUGIN',                'Không thể xóa plugin, đang dùng bởi ');
 +
++=======
++>>>>>>> skinnable-master
  // cookie prefix
  define('_SETTINGS_COOKIEPREFIX',        'Tiếp đầu ngữ cookie');
  
@@@ -757,7 -828,6 +852,10 @@@ define('_COMMENTFORM_YOUARE'
  define('_COMMENTFORM_SUBMIT',                'Gởi ý kiến');
  define('_COMMENTFORM_COMMENT',                'Ý kiến của bạn');
  define('_COMMENTFORM_NAME',                        'Tên');
++<<<<<<< HEAD
 +define('_COMMENTFORM_MAIL',                        'E-mail/HTTP');
++=======
++>>>>>>> skinnable-master
  define('_COMMENTFORM_REMEMBER',                'Ghi nhớ');
  
  // loginform
@@@ -784,7 -854,6 +882,10 @@@ define('_ADD_DISABLE_COMMENTS'
  define('_ADD_DRAFTNFUTURE',                        'Nháp &amp; Các bài viết ở tương lai');
  define('_ADD_ADDITEM',                                'Thêm bài viết');
  define('_ADD_ADDNOW',                                'Thêm lúc này');
++<<<<<<< HEAD
 +define('_ADD_ADDLATER',                                'Thêm vào sau');
++=======
++>>>>>>> skinnable-master
  define('_ADD_PLACE_ON',                                'Thời điểm');
  define('_ADD_ADDDRAFT',                                'Lưu nháp');
  define('_ADD_NOPASTDATES',                        '(ngày và giờ trong quá khứ là không được chấp nhận, giờ hiện tại sẽ được thay thế vào các chỗ đó)');
@@@ -1128,8 -1197,6 +1229,11 @@@ define('_BAN_ADD_BTN'
  
  // LOGIN screen
  define('_LOGIN_MESSAGE',                        'Tin nhắn');
++<<<<<<< HEAD
 +define('_LOGIN_NAME',                                'Tên');
 +define('_LOGIN_PASSWORD',                        'Mật khẩu');
++=======
++>>>>>>> skinnable-master
  define('_LOGIN_SHARED',                                _LOGINFORM_SHARED);
  define('_LOGIN_FORGOT',                                'Quên mật khẩu?');
  
@@@ -1262,4 -1329,19 +1366,23 @@@ define('_EDITC_NONMEMBER'
  define('_MOVE_TITLE',                                'Di chuyển đến blog nào?');
  define('_MOVE_BTN',                                        'Di chuyển');
  define('_ADMINTITLE',                                        'Trang Quản Lý');
- ?>
++<<<<<<< HEAD
++?>
++=======
+ // ADMIN-template template types
+ include_once('adminskinTypes.php');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_NAVILIST',         'navibar for item/comment list');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_TADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is blog ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_BLIST_BD_SADM',  _SKINABLEADMIN_ADMINSKINVAR_STR . ' [yrbloglist] member is super ADMIN');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_GURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin URL');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGEVENTLIST',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'API entry');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGNEDUPDATE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'eventlist updates');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPEND',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency to');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGIN_DEPREQ',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'dependency by');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLISTFALSE',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'couldn\'t load file');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ACTN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin actions');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_ADMN',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin admin link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_HELP',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin help link');
+ define('_ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGOPTSETURL',  _ADM_TPLPT_SHOWLIST_LISTPLUG_TABLE_PLUGLIST_BODY . 'plugin option setting link');
++>>>>>>> skinnable-master
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: zh_Hans_CN.GB2312.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: zh_Hans_CN.GB2312.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -8,7 -8,7 +8,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: zh_Hans_CN.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: zh_Hans_CN.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -7,7 -7,7 +7,11 @@@
   * 
   * @license http://nucleuscms.org/license.txt GNU General Public License
   * @copyright Copyright (C) 2002-2012 The Nucleus Group
++<<<<<<< HEAD
 + * @version $Id: zh_Hant_TW.UTF-8.php 1868 2012-05-22 05:10:53Z sakamocchi $
++=======
+  * @version $Id: zh_Hant_TW.UTF-8.php 1887 2012-06-17 08:30:08Z sakamocchi $
++>>>>>>> skinnable-master
   */
  
  /********************************************
@@@ -14,7 -14,7 +14,11 @@@ This program is distributed in the hop
  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
  PARTICULAR PURPOSE. See the GNU General Public License for more details.
  
++<<<<<<< HEAD
 +* @version $Id: NP_SecurityEnforcer.php 1721 2012-03-31 10:18:25Z sakamocchi $
++=======
+ * @version $Id: NP_SecurityEnforcer.php 1874 2012-06-17 07:27:38Z sakamocchi $
++>>>>>>> skinnable-master
  */
  class NP_SecurityEnforcer extends NucleusPlugin
  {
                $this->createOption('login_lockout',            '_SECURITYENFORCER_OPT_LOGIN_LOCKOUT',          'text', '15');
                
                // create needed tables
++<<<<<<< HEAD
 +              DB::execute("CREATE TABLE IF NOT EXISTS ". sql_table('plug_securityenforcer').
++=======
+               DB::execute('CREATE TABLE IF NOT EXISTS '. sql_table('plug_securityenforcer').
++>>>>>>> skinnable-master
                                        " (login varchar(255),
                                           fails int(11) NOT NULL default '0',
                                           lastfail bigint NOT NULL default '0',
                global $_SERVER;
                $login = $data['login'];
                $ip = $_SERVER['REMOTE_ADDR'];
++<<<<<<< HEAD
 +              DB::execute("DELETE FROM " . sql_table('plug_securityenforcer') . " WHERE lastfail < " . (time() - ($this->login_lockout * 60)));
 +              $query = "SELECT fails as result FROM " . sql_table('plug_securityenforcer') . " ";
 +              $query .= 'WHERE login=' . DB::quoteValue($login);
 +              $flogin = DB::getValue($query); 
 +              $query = "SELECT fails as result FROM " . sql_table('plug_securityenforcer') . " ";
 +              $query .= 'WHERE login=' . DB::quoteValue($ip);
++=======
+               
+               $query = "DELETE FROM %s WHERE lastfail < %d;";
+               $query = sprintf($query, sql_table('plug_securityenforcer'), (integer) (time() - ($this->login_lockout * 60)));
+               DB::execute($query);
+               
+               $query = "SELECT fails as result FROM %s WHERE login=%s;";
+               $query = sprintf($query, sql_table('plug_securityenforcer'), DB::quoteValue($login));
+               $flogin = DB::getValue($query); 
+               
+               $query = "SELECT fails as result FROM %s WHERE login=%s;";
+               $query = sprintf($query, sql_table('plug_securityenforcer'), DB::quoteValue($ip));
++>>>>>>> skinnable-master
                $fip = DB::getValue($query); 
                
                if ( $flogin >= $this->max_failed_login || $fip >= $this->max_failed_login )
                global $_SERVER;
                $login = $data['username'];
                $ip = $_SERVER['REMOTE_ADDR'];
++<<<<<<< HEAD
 +              DB::execute("DELETE FROM " . sql_table('plug_securityenforcer') . " WHERE login=" . DB::quoteValue($login));
 +              DB::execute("DELETE FROM " . sql_table('plug_securityenforcer') . " WHERE login=" . DB::quoteValue($ip));
++=======
+               DB::execute('DELETE FROM ' . sql_table('plug_securityenforcer') . ' WHERE login=' . DB::quoteValue($login));
+               DB::execute('DELETE FROM ' . sql_table('plug_securityenforcer') . ' WHERE login=' . DB::quoteValue($ip));
++>>>>>>> skinnable-master
                return;
        }
        
                global $_SERVER;
                $login = $data['username'];
                $ip = $_SERVER['REMOTE_ADDR'];
++<<<<<<< HEAD
 +              $lres = DB::getValue("SELECT * FROM " . sql_table('plug_securityenforcer') . ' WHERE login=' . DB::quoteValue($login));
 +              if ( $lres )
 +              {
 +                      DB::execute("UPDATE " . sql_table('plug_securityenforcer') . " SET fails=fails+1, lastfail=" . time() . ' WHERE login=' . DB::quoteValue($login));
 +              }
 +              else
 +              {
 +                      DB::execute("INSERT INTO " . sql_table('plug_securityenforcer') . ' (login,fails,lastfail) VALUES (' . DB::quoteValue($login) . ',1,' . time() . ')');
 +              }
 +              $lres = DB::getValue("SELECT * FROM " . sql_table('plug_securityenforcer') . " WHERE login='" . DB::quoteValue($ip) . "'");
 +              if ( $lres )
 +              {
 +                      DB::execute("UPDATE " . sql_table('plug_securityenforcer') . ' SET fails=fails+1, lastfail=' . time() . ' WHERE login=' . DB::quoteValue($ip));
 +              }
 +              else
 +              {
 +                      DB::execute("INSERT INTO " . sql_table('plug_securityenforcer') . ' (login,fails,lastfail) VALUES (' . DB::quoteValue($ip) . ',1,' . time() . ')');
++=======
+               $lres = DB::getResult('SELECT * FROM ' . sql_table('plug_securityenforcer') . ' WHERE login=' . DB::quoteValue($login));
+               if ( $lres->rowCount() > 0 )
+               {
+                       DB::execute('UPDATE ' . sql_table('plug_securityenforcer') . ' SET fails=fails+1, lastfail=' . time() . ' WHERE login=' . DB::quoteValue($login));
+               }
+               else
+               {
+                       DB::execute('INSERT INTO ' . sql_table('plug_securityenforcer') . ' (login,fails,lastfail) VALUES (' . DB::quoteValue($login) . ',1,' . time() . ')');
+               }
+               $lres = DB::getResult('SELECT * FROM ' . sql_table('plug_securityenforcer') . ' WHERE login=' . DB::quoteValue($ip));
+               if ( $lres->rowCount() > 0 )
+               {
+                       DB::execute('UPDATE ' . sql_table('plug_securityenforcer') . ' SET fails=fails+1, lastfail=' . time() . ' WHERE login=' . DB::quoteValue($ip));
+               }
+               else
+               {
+                       DB::execute('INSERT INTO ' . sql_table('plug_securityenforcer') . ' (login,fails,lastfail) VALUES (' . DB::quoteValue($ip) . ',1,' . time() . ')');
++>>>>>>> skinnable-master
                }
                return;
        }
                        $complexity = 4;
                }
                
++<<<<<<< HEAD
 +              $ucchars        = "[A-Z]";
 +              $lcchars        = "[a-z]";
 +              $numchars       = "[0-9]";
 +              $ochars         = "[-~!@#$%^&*()_+=,.<>?:;|]";
++=======
+               $ucchars        = '[A-Z]';
+               $lcchars        = '[a-z]';
+               $numchars       = '[0-9]';
+               $ochars         = '[#-~!@\\$%^&*()_+=,.<>?:;|]';
++>>>>>>> skinnable-master
                $chartypes      = array($ucchars, $lcchars, $numchars, $ochars);
                $tot            = array(0,0,0,0);
                $i                      = 0;
@@@ -7,7 -7,7 +7,11 @@@ class NP_SkinFiles extends NucleusPlugi
        *
        * Copyright 2005-2007 by Jeff MacMichael and Niels Leenheer
        *
++<<<<<<< HEAD
 +      * @version $Id: NP_SkinFiles.php 1678 2012-02-26 07:31:36Z sakamocchi $
++=======
+       * @version $Id: NP_SkinFiles.php 1749 2012-04-13 14:06:34Z sakamocchi $
++>>>>>>> skinnable-master
        * @version $NucleusJP: NP_SkinFiles.php,v 1.3 2006/07/17 20:03:45 kimitake Exp $
        *
        * ==========================================================================================
                        break;
                }
  
++<<<<<<< HEAD
 +              $result = DB::getResult($query);
 +              $installed = ( $result !== FALSE ) && ($result->rowCount() >= $minrows);
 +
++=======
+               $result = mysql_query($query);
+               $installed = ( $result != 0 ) && (mysql_num_rows($result) >= $minrows);
+               
++>>>>>>> skinnable-master
                return $installed;
        }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -22,29 -22,160 +22,167 @@@ function upgrade_do400(
                return "already installed";
        }
        
-       /* config.Language to config.Locale  */
-       if ( !upgrade_checkIfColumnExists('config','Locale') )
+       // Give user warning if they are running old version of PHP
+       if ( phpversion() < '5' )
        {
++<<<<<<< HEAD
 +              $res = DB::getResult("SELECT * FROM " . sql_table('config') . " WHERE name='Language'");
 +              foreach ( $res as $row )
 +              {
 +                      $locale = $row['Language'];
++=======
+               echo 'WARNING: You are running NucleusCMS on a older version of PHP that is no longer supported by NucleusCMS. Please upgrade to PHP5!';
+       }
+       
+       /* config table */
+       /* change Language setting to Locale */
+       if ( upgrade_checkIfCVExists('Language') )
+       {
+               $res = sql_query("SELECT value FROM " . sql_table('config') . " WHERE name='Language'");
+               if ( $res !== FALSE )
+               {
+                       $row = sql_fetch_assoc($res);
+                       $locale = i18n_upg::convert_old_language_file_name_to_locale($row['value']);
+                       if ( $locale )
+                       {
+                               $query = 'INSERT INTO ' . sql_table('config') . " VALUES ('Locale','{$locale}')";
+                               upgrade_query('Creating Locale config value', $query);
+                               
+                               $query = 'DELETE FROM ' . sql_table('config') . " WHERE name='Language'";
+                               upgrade_query("Removing Language config value", $query);
+                       }
++>>>>>>> skinnable-master
                }
-               $query = 'INSERT INTO ' . sql_table('config') . " (name, value) VALUE('Locale', '{$locale}');";
-               upgrade_query("Renaming Language for configs to Locale", $query);
        }
        
-       if ( !upgrade_checkIfColumnExists('config','Language') )
+       /* change AdminCSS setting */
+       if ( upgrade_checkIfCVExists('AdminCSS') )
+       {
+               $query = 'UPDATE ' . sql_table('config') . " SET value='original' WHERE name='AdminCSS'";
+               upgrade_query('Changing AdminCSS config value', $query);
+       }
+       
+       /* create AdminSkin setting */
+       if ( !upgrade_checkIfCVExists('AdminSkin') )
+       {
+               $query = 'INSERT INTO ' . sql_table('config') . " VALUES ('AdminSkin','0')";
+               upgrade_query('Creating AdminSkin config value', $query);
+       }
+       
+       /* create BookmarkletSkin setting */
+       if ( !upgrade_checkIfCVExists('BookmarkletSkin') )
        {
-               $query = "DELETE * FROM " . sql_table('config') . " WHERE name='Language'";
-               upgrade_query("Renaming Language for configs to Locale", $query);
+               $query = 'INSERT INTO ' . sql_table('config') . " VALUES ('BookmarkletSkin','0')";
+               upgrade_query('Creating BookmarkletSkin config value', $query);
        }
        
-       /* member.deflang to member.mlocale   */
+       
+       /* member table */
+       /* changing the member table to rename deflang to mlocale */
        if ( !upgrade_checkIfColumnExists('member','mlocale') )
        {
-               $query =  'ALTER TABLE '.sql_table('member') . " CHANGE deflang mlocale varchar(10) NOT NULL default ''";
+               $query =  'ALTER TABLE '.sql_table('member') . " CHANGE deflang mlocale varchar(20) NOT NULL default '' AFTER mcookiekey";
                upgrade_query("Renaming deflang column for members to mlocale", $query);
        }
+       
+       /* changing the member table to add madminskin column */
+       if ( !upgrade_checkIfColumnExists('member','madminskin') )
+       {
+               $query =  'ALTER TABLE '.sql_table('member') . " ADD madminskin tinyint(2) NOT NULL default '0'";
+               upgrade_query("Adding a new row for the adminskin member option", $query);
+       }
+       
+       /* changing the member table to add mbkmklt column */
+               if ( !upgrade_checkIfColumnExists('member','mbkmklt') )
+       {
+               $query =  'ALTER TABLE '.sql_table('member') . " ADD mbkmklt tinyint(2) NOT NULL default '0'";
+               upgrade_query("Adding a new row for the bkmklt member option", $query);
+       }
+       
+       // all member default value set
+       $result = sql_query("SELECT * FROM " . sql_table('member'));
+       while ( $row = mysql_fetch_assoc($result) )
+       {
+               $locale = i18n_upg::convert_old_language_file_name_to_locale($row['mlocale']);
+               if ( $locale )
+               {
+                       $query = 'UPDATE $s SET mlocale=$s WHERE mnumber=$d';
+                       $query = sprintf($query, sql_table('member'), addslashes($locale), $row['mnumber']);
+                       upgrade_query('Changing mlocale value', $query);
+               }
+       }
+       
+       // 3.6 -> 4.0
+       // update database version
+       update_version('400');
+       
  }
  
+ class i18n_upg
+ {
+       /**
+       * i18n::convert_old_language_file_name_to_locale()
+       * NOTE: this should be obsoleted near future.
+       *
+       * @static
+       * @param        string  $target_language        old translation file name
+       * @return       string  locale name as language_script_region
+       */
+       static public function convert_old_language_file_name_to_locale($target_language)
+       {
+               $target_locale = '';
+               foreach ( self::$lang_refs as $language => $locale )
+               {
+                       if ( $target_language == $language )
+                       {
+                               if ( preg_match('#^(.+)\.(.+)$#', $locale, $match) )
+                               {
+                                       $target_locale = $match[1];
+                               }
+                               else
+                               {
+                                       $target_locale = $locale;
+                               }
+                               break;
+                       }
+               }
+               return $target_locale;
+       }
+       
+       /**
+        * i18n::$lang_refs
+        * reference table to convert old and new way to name translation files.
+        * NOTE: this should be obsoleted as soon as possible.
+        *
+        * @static
+        */
+       static private $lang_refs = array(
+                       "english"               => "en_Latn_US",
+                       "english-utf8"  => "en_Latn_US.UTF-8",
+                       "bulgarian"     => "bg_Cyrl_BG",
+                       "finnish"               => "fi_Latn_FI",
+                       "catalan"               => "ca_Latn_ES",
+                       "french"                => "fr_Latn_FR",
+                       "russian"               => "ru_Cyrl_RU",
+                       "chinese"               => "zh_Hans_CN",
+                       "simchinese"    => "zh_Hans_CN",
+                       "chineseb5"     => "zh_Hant_TW",
+                       "traditional_chinese"   =>      "zh_Hant_TW",
+                       "galego"                => "gl_Latn_ES",
+                       "german"                => "de_Latn_DE",
+                       "korean-utf"    => "ko_Kore_KR.UTF-8",
+                       "korean-euc-kr" => "ko_Kore_KR.EUC-KR",
+                       "slovak"                => "sk_Latn_SK",
+                       "czech"         => "cs_Latn_CZ",
+                       "hungarian"     => "hu_Latn_HU",
+                       "latvian"               => "lv_Latn_LV",
+                       "nederlands"    => "nl_Latn_NL",
+                       "italiano"              => "it_Latn_IT",
+                       "persian"               => "fa_Arab_IR",
+                       "spanish"               => "es_Latn_ES",
+                       "spanish-utf8"  => "es_Latn_ES.UTF-8",
+                       "japanese-euc"  => "ja_Jpan_JP.EUC-JP",
+                       "japanese-utf8" => "ja_Jpan_JP.UTF-8",
+                       "portuguese_brazil"     => "pt_Latn_BR"
+                       );
+ }
@@@ -282,7 -282,7 +282,11 @@@ function _getSkinPart($blogid, $usernam
  
        // 3. return skin part
        $blog =& $manager->getBlog($blogid);
++<<<<<<< HEAD
 +      $skin = new SKIN($blog->getDefaultSkin());
++=======
+       $skin =& $manager->getSkin($blog->getDefaultSkin());
++>>>>>>> skinnable-master
        return new xmlrpcresp(new xmlrpcval($skin->getContentFromDB($type),"string"));
  
  }
@@@ -303,7 -303,7 +307,11 @@@ function _setSkinPart($blogid, $usernam
  
        // 3. update skin part
        $blog =& $manager->getBlog($blogid);
++<<<<<<< HEAD
 +      $skin = new SKIN($blog->getDefaultSkin());
++=======
+       $skin =& $manager->getSkin($blog->getDefaultSkin());
++>>>>>>> skinnable-master
        $skin->update($type, $content);
  
        return new xmlrpcresp(new xmlrpcval(1,'boolean'));
index 0000000,f8749f1..29a7d99
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,46 +1,53 @@@
+ /*
+       This stylesheet serves to make item previews look nicer, and to markup the 
+       buttonbar
+       
+       $Id: addedit.css 757 2005-08-12 07:29:40Z dekarma $
+ */
+ .leftbox, .rightbox {
+       margin: 3px;
+       padding: 3px;
+       font-size: larger;
+       width: 20%;
+ }
+ .leftbox {
+       float: left;
+       border-right: 2px solid #888;   
+ }
+ .rightbox {
+       float: right;
+       border-left: 2px solid #888;    
+ }
+ /* markup buttons */
+ .jsbuttonbar {
++<<<<<<< HEAD:nucleus/styles/addedit.css
++      height: 30px;
++=======
+       padding: 3px;
++>>>>>>> skinnable-master:skins/admin/bookmarklet/styles/addedit.css
+       cursor: default;
+ }
+ .jsbutton {
+       float: left;
+       padding: 3px;
+       margin-right: 4px;
+       height: 16px;
+       width: 16px;
+       border: 1px solid #dddddd;
+       background-color: white;
+ }
+ .jsbuttonspacer {
+       float: left;
+       width: 10px;
++<<<<<<< HEAD:nucleus/styles/addedit.css
++=======
+ }
+ .jsbuttonend {
+       clear: both;
++>>>>>>> skinnable-master:skins/admin/bookmarklet/styles/addedit.css
+ }
@@@ -433,9 -433,9 +433,15 @@@ function moveNiceTitle(e
                X = e.pageX;
                }
        w_title = Number(CURRENT_NICE_TITLE.style.width.replace(/^(\d+).*$/, '$1'));
++<<<<<<< HEAD
 +      if (w_title + X > (window.innerWidth - 20))
 +              {
 +              X = window.innerWidth - w_title - 20;
++=======
+       if (w_title + X > (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20))
+               {
+               X = (window.innerWidth + (document.documentElement.scrollLeft || window.pageXOffset) - 20) - w_title;
++>>>>>>> skinnable-master
                }
  
        if (document.all)
                {
                Y = e.pageY;
                }
++<<<<<<< HEAD
 +      if (Y > (window.innerHeight - 60))
++=======
+       if (Y > (window.innerHeight + (document.documentElement.scrollTop || window.pageYOffset) - 60))
++>>>>>>> skinnable-master
                {
                Y = Y - 25 - 60;
                }